:root {
  --navy: #071a2f;
  --navy-soft: #102942;
  --gold: #c99a3d;
  --gold-light: #e3c47b;
  --cream: #f7f3ea;
  --paper: #ffffff;
  --ink: #17212b;
  --muted: #66717e;
  --line: #e6e9ed;
  --danger-bg: #fff1f1;
  --danger: #982d2d;
  --shadow: 0 18px 60px rgba(7, 26, 47, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--cream);
  color: var(--ink);
}

body {
  margin: 0;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.login-body {
  min-height: 100vh;
  background: var(--cream);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns:
    minmax(360px, 0.95fr)
    minmax(420px, 1.05fr);
}

.login-brand-panel {
  min-height: 100vh;
  padding: clamp(32px, 5vw, 72px);
  color: white;
  background:
    radial-gradient(
      circle at 20% 15%,
      rgba(201, 154, 61, 0.20),
      transparent 32%
    ),
    linear-gradient(
      145deg,
      #071a2f,
      #0d2944
    );
  display: flex;
  flex-direction: column;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand strong {
  display: block;
  font-family: Georgia, serif;
  font-size: 19px;
}

.login-brand small {
  color: rgba(255,255,255,.65);
}

.portal-brand-mark {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(201,154,61,.7);
  color: var(--gold-light);
  font-family: Georgia, serif;
  font-weight: 700;
  letter-spacing: .04em;
}

.portal-brand-mark.large {
  width: 48px;
  height: 48px;
}

.login-message {
  max-width: 650px;
  margin: auto 0;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .16em;
}

.eyebrow.dark {
  color: #9a7027;
}

.login-message h1 {
  max-width: 640px;
  margin: 0 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: clamp(42px, 5vw, 74px);
  line-height: .98;
  letter-spacing: -.035em;
}

.login-message p {
  max-width: 560px;
  margin: 0;
  font-size: 17px;
  line-height: 1.75;
  color: rgba(255,255,255,.76);
}

.login-footer {
  color: rgba(255,255,255,.55);
  font-size: 13px;
}

.login-form-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px;
}

.login-card {
  width: min(100%, 460px);
}

.login-card h2 {
  margin: 0 0 12px;
  font-family: Georgia, serif;
  font-size: 38px;
  font-weight: 500;
  color: var(--navy);
}

.login-intro {
  margin: 0 0 32px;
  color: var(--muted);
  line-height: 1.7;
}

.login-card label {
  display: block;
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

.login-card input {
  width: 100%;
  margin-top: 8px;
  padding: 15px 16px;
  background: white;
  border: 1px solid #ccd3da;
  border-radius: 8px;
  outline: none;
}

.login-card input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,154,61,.15);
}

.primary-button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 16px 20px;
  background: var(--navy);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.primary-button:hover {
  background: var(--navy-soft);
}

.login-error {
  margin: 0 0 22px;
  padding: 13px 15px;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 14px;
}

.login-help {
  margin: 24px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.back-link {
  color: var(--navy);
  font-size: 13px;
  text-decoration: none;
  font-weight: 700;
}

.portal-body {
  min-height: 100vh;
  background: #f5f6f7;
}

.portal-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 255px minmax(0, 1fr);
}

.portal-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px 22px;
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: white;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 26px;
  text-decoration: none;
}

.portal-brand strong {
  display: block;
  font-family: Georgia, serif;
  font-size: 17px;
}

.portal-brand small {
  color: rgba(255,255,255,.55);
}

.portal-nav {
  display: grid;
  gap: 6px;
}

.portal-nav a {
  padding: 12px 14px;
  border-radius: 7px;
  color: rgba(255,255,255,.70);
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}

.portal-nav a:hover,
.portal-nav a.active {
  background: rgba(255,255,255,.08);
  color: white;
}

.portal-nav a.active {
  box-shadow:
    inset 3px 0 0 var(--gold);
}

.portal-sidebar-footer {
  margin-top: auto;
  padding: 18px 8px 0;
  border-top: 1px solid rgba(255,255,255,.10);
}

.portal-sidebar-footer > span {
  display: block;
  margin-bottom: 10px;
  color: rgba(255,255,255,.55);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.logout-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.portal-main {
  min-width: 0;
}

.portal-topbar {
  min-height: 82px;
  padding: 16px clamp(22px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-topbar > div:first-child small,
.portal-user small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.portal-topbar > div:first-child strong {
  display: block;
  margin-top: 2px;
  color: var(--navy);
}

.portal-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.portal-avatar {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cream);
  color: var(--navy);
  font-family: Georgia, serif;
  font-weight: 700;
}

.portal-user strong {
  display: block;
  font-size: 13px;
}

.portal-content {
  padding: clamp(28px, 4vw, 50px);
}

.page-heading {
  margin-bottom: 30px;
}

.page-heading h1 {
  margin: 0 0 9px;
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 500;
}

.page-heading p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.metrics-grid {
  margin-bottom: 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metric-card,
.panel-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(7,26,47,.04);
}

.metric-card {
  padding: 22px;
}

.metric-card small {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 34px;
  font-weight: 500;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.panel-card {
  padding: 28px;
}

.panel-card.wide {
  max-width: 900px;
}

.panel-kicker {
  display: block;
  margin-bottom: 8px;
  color: #9a7027;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.panel-card h2 {
  margin: 0 0 10px;
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 500;
}

.panel-card p {
  color: var(--muted);
  line-height: 1.65;
}

.panel-link {
  display: inline-block;
  margin-top: 9px;
  color: var(--navy);
  font-weight: 800;
  text-decoration: none;
}

.foundation-badge {
  display: inline-block;
  margin-bottom: 22px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f7f1e4;
  color: #805d20;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.feature-list {
  display: grid;
  gap: 4px;
  margin-top: 26px;
}

.feature-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.feature-item span {
  color: #8e6926;
  font-weight: 900;
}

.feature-item p {
  margin: 0;
}

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    min-height: auto;
    padding: 35px 28px;
  }

  .login-message {
    margin: 70px 0;
  }

  .login-form-panel {
    min-height: auto;
    padding: 55px 28px;
  }

  .portal-layout {
    grid-template-columns: 1fr;
  }

  .portal-sidebar {
    position: relative;
    height: auto;
  }

  .portal-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .portal-sidebar-footer {
    margin-top: 25px;
  }

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

@media (max-width: 620px) {
  .login-message h1 {
    font-size: 42px;
  }

  .portal-nav {
    grid-template-columns: 1fr;
  }

  .portal-topbar {
    align-items: flex-start;
  }

  .portal-user span:last-child {
    display: none;
  }

  .metrics-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .portal-content {
    padding: 28px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
