:root {
  --bg: #f9f9f5;
  --card: #ffffff;
  --text: #111111;
  --muted: #666666;
  --line: #111111;
  --yellow: #ffc107;
  --yellow-dark: #e6ac00;
  --black: #111111;
  --hero-dark: #1a1a1a;
  --hero-gold: #8b6914;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.portal-shell {
  min-height: 100vh;
}

.portal-topbar,
.login-topbar {
  background: var(--bg);
  color: var(--text);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--line);
}

.portal-topbar-left {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.portal-brand-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.portal-brand-text {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
}

.portal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.portal-nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid transparent;
}

.portal-nav a:hover {
  border-color: var(--line);
  background: #fff;
}

.portal-user {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.portal-user-meta {
  text-align: right;
}

.portal-user-name {
  font-weight: 700;
}

.portal-user small {
  color: var(--muted);
  font-size: 12px;
}

.portal-logout {
  font-weight: 800;
  font-size: 15px;
  padding: 8px 4px;
}

.portal-logout:hover {
  color: var(--hero-gold);
}

.portal-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.portal-hero,
.login-hero {
  background: linear-gradient(180deg, var(--hero-dark) 0%, #3d3208 55%, var(--hero-gold) 100%);
  color: #fff;
  border-radius: 28px;
  padding: 34px 28px;
  margin-bottom: 28px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
}

.portal-hero-kicker {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}

.portal-hero h1,
.login-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.portal-hero-desc {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  max-width: 640px;
  line-height: 1.65;
  font-size: 15px;
}

.section-block {
  margin-bottom: 34px;
}

.section-title {
  margin: 0 0 18px;
  text-align: center;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.app-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.app-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.1);
}

.app-card-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 22px 24px;
  height: 100%;
  color: inherit;
}

.app-icon-wrap {
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.app-icon-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.app-card h3 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 900;
}

.app-card p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
  flex: 1;
}

.app-card-btn {
  width: 100%;
  max-width: 220px;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.icon-item {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 20px;
  padding: 18px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.icon-item img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.icon-item span {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--yellow);
  color: var(--black);
}

.btn-primary:hover {
  background: var(--yellow-dark);
  color: var(--black);
}

.btn-dark {
  background: var(--black);
  color: #fff;
}

.btn-dark:hover {
  background: #000;
  color: #fff;
}

.btn-light {
  background: #fff;
  color: var(--text);
}

.btn-light:hover {
  background: #fffdf5;
}

.btn-block {
  width: 100%;
}

.login-page {
  min-height: 100vh;
  background: var(--bg);
}

.login-wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.login-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.form-group input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  background: #fff;
}

.form-group input::placeholder {
  color: #999;
}

.form-group input:focus {
  outline: none;
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.25);
}

.form-group input:disabled {
  background: #f3f3ef;
  color: var(--muted);
}

.field-help {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.alert {
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
  border: 2px solid transparent;
}

.alert-error {
  background: #fff5f5;
  border-color: #fecaca;
  color: #991b1b;
}

.alert-ok {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #854d0e;
}

.page-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
}

.page-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 900;
}

.page-desc {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.portal-form {
  max-width: 480px;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 24px;
}

.panel-block h2 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 900;
}

.panel-wide {
  min-width: 0;
}

.table-wrap {
  overflow: auto;
}

.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.portal-table th,
.portal-table td {
  border-bottom: 2px solid #ecece6;
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

.portal-table th {
  background: #fffdf5;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text);
  font-weight: 800;
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-form {
  display: inline;
  margin: 0;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 12px;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.role-badge.admin {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--line);
}

.role-badge.user {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-badge.active {
  background: #fffbeb;
  color: #854d0e;
  border: 1px solid #fcd34d;
}

.status-badge.inactive {
  background: #fff5f5;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.muted {
  color: var(--muted);
}

.portal-site-footer {
  text-align: center;
  padding: 24px 20px 32px;
  font-size: 14px;
  color: var(--muted);
}

.portal-site-footer a {
  color: var(--text);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.portal-site-footer a:hover {
  color: var(--hero-gold);
}

@media (max-width: 900px) {
  .icon-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .app-grid,
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .portal-topbar,
  .login-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .portal-topbar-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .portal-user {
    width: 100%;
    justify-content: space-between;
  }

  .portal-user-meta {
    text-align: left;
  }

  .icon-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-brand-text {
    font-size: 24px;
  }
}
