:root {
  --navy: #08192d;
  --navy-mid: #102d4d;
  --navy-soft: #1b4168;
  --gold: #c6a15b;
  --gold-light: #dfc78f;
  --bg: #edf2f7;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --text: #102a46;
  --muted: #60758c;
  --line: #dfe6ee;
  --green: #079669;
  --amber: #d97706;
  --red: #dc3545;
  --blue: #2563eb;
  --purple: #7c3aed;
  --radius: 16px;
  --shadow: 0 8px 28px rgba(8, 25, 45, 0.08);
  --shadow-lg: 0 24px 70px rgba(8, 25, 45, 0.18);
}

/* Entrada cinematográfica — Portal da Decisão */
.portal-splash {
  position: fixed;
  inset: 0;
  z-index: 10000;
  min-width: 320px;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  color: #fff;
  background:
    radial-gradient(circle at 50% 44%, #0d2a49 0, #071525 36%, #02070d 76%);
  transition: opacity .5s ease, visibility .5s ease;
}
.portal-splash.splash-leaving { opacity: 0; visibility: hidden; }
.portal-depth { position: absolute; inset: 0; overflow: hidden; opacity: 0; animation: portal-depth-in .8s .1s ease-out forwards; }
.portal-depth::before, .portal-depth::after { content: ""; position: absolute; left: -10%; right: -10%; height: 1px; background: linear-gradient(90deg, transparent, rgba(198,161,91,.48), transparent); }
.portal-depth::before { top: 22%; }.portal-depth::after { bottom: 20%; }
.portal-depth span { position: absolute; left: 50%; bottom: -18%; width: 1px; height: 138%; transform-origin: bottom; background: linear-gradient(transparent 8%, rgba(255,255,255,.16)); }
.portal-depth span:nth-child(1) { transform: rotate(-64deg); }.portal-depth span:nth-child(2) { transform: rotate(-47deg); }.portal-depth span:nth-child(3) { transform: rotate(-31deg); }.portal-depth span:nth-child(4) { transform: rotate(-15deg); }
.portal-depth span:nth-child(5) { transform: rotate(15deg); }.portal-depth span:nth-child(6) { transform: rotate(31deg); }.portal-depth span:nth-child(7) { transform: rotate(47deg); }.portal-depth span:nth-child(8) { transform: rotate(64deg); }
.portal-core { position: absolute; left: 50%; top: 46%; width: min(54vw, 520px); aspect-ratio: 1; transform: translate(-50%,-50%) scale(.04); opacity: 0; animation: portal-open 1.05s .2s cubic-bezier(.16,.86,.25,1) forwards; }
.portal-ring, .portal-light { position: absolute; border-radius: 50%; }
.portal-ring.ring-one { inset: 0; border: 1px solid rgba(198,161,91,.2); animation: portal-turn 6s .3s ease-out forwards; }
.portal-ring.ring-two { inset: 13%; border: 1px solid rgba(255,255,255,.16); animation: portal-turn-reverse 6s .3s ease-out forwards; }
.portal-ring.ring-three { inset: 27%; border: 1px solid var(--gold); box-shadow: 0 0 64px rgba(198,161,91,.2), inset 0 0 64px rgba(198,161,91,.16); }
.portal-light { inset: 38%; background: radial-gradient(circle, rgba(255,255,255,.16), transparent 68%); }
.portal-sequence { position: absolute; z-index: 4; top: 42%; left: 50%; width: min(820px, calc(100% - 44px)); display: grid; grid-template-columns: 1fr 70px 1fr 70px 1fr; align-items: center; transform: translate(-50%,-50%); text-align: center; letter-spacing: .18em; animation: portal-sequence-up .7s 3.35s cubic-bezier(.2,.8,.2,1) forwards; }
.portal-word { opacity: 0; filter: blur(14px); transform: scale(1.9); font-weight: 700; text-shadow: 0 0 28px rgba(198,161,91,.48); }
.portal-sequence > i { height: 1px; transform: scaleX(0); background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.portal-data { animation: portal-word-focus .58s .55s ease-out forwards, portal-word-settle .5s 1.12s ease-in-out forwards; }
.portal-sequence > i:nth-child(2) { animation: portal-line-draw .34s 1.18s ease-out forwards; }
.portal-decision { animation: portal-word-focus .58s 1.52s ease-out forwards, portal-word-settle .5s 2.08s ease-in-out forwards; }
.portal-sequence > i:nth-child(4) { animation: portal-line-draw .34s 2.14s ease-out forwards; }
.portal-result { animation: portal-word-focus .58s 2.48s ease-out forwards, portal-word-settle .5s 3.05s ease-in-out forwards; }
.portal-brand-copy { position: relative; z-index: 5; width: min(820px, calc(100% - 42px)); display: grid; justify-items: center; padding: 102px 20px 74px; text-align: center; }
.portal-brand-copy > * { opacity: 0; transform: translateY(20px); }
.portal-brand-copy h1 { margin: 0; color: #fff; font: 800 clamp(2.9rem, 8vw, 6.8rem)/.9 Sora, sans-serif; letter-spacing: -.065em; text-shadow: 0 18px 60px rgba(0,0,0,.42); animation: portal-brand-arrive .75s 3.82s cubic-bezier(.18,.88,.25,1) forwards; }
.portal-brand-line { width: min(360px,72%); height: 1px; margin: 24px 0; transform: scaleX(0); background: linear-gradient(90deg, transparent, var(--gold), transparent); animation: portal-line-reveal .6s 4.24s ease-out forwards; }
.portal-brand-copy h2 { margin: 0 0 18px; font: 600 clamp(1.3rem,3vw,2.25rem) Sora,sans-serif; letter-spacing: -.04em; animation: portal-rise .55s 4.44s forwards; }
.portal-author { margin: 0 0 4px; color: var(--gold-light); font-size: 1.05rem; letter-spacing: .05em; animation: portal-rise .48s 4.68s forwards; }
.portal-program { margin: 0 0 24px; color: rgba(255,255,255,.74); animation: portal-rise .48s 4.82s forwards; }
.portal-enter { min-height: 46px; padding: 12px 24px; border: 0; border-radius: 10px; color: #06101b; background: linear-gradient(135deg,var(--gold-light),var(--gold)); box-shadow: 0 14px 42px rgba(198,161,91,.2); font-weight: 800; opacity: 0; transform: translateY(20px); pointer-events: none; animation: portal-rise .5s 5.04s forwards; }
.portal-splash.ready .portal-enter { pointer-events: auto; }
.portal-footer { position: absolute; z-index: 6; left: 28px; right: 28px; bottom: 24px; display: flex; align-items: center; justify-content: space-between; gap: 18px; opacity: 0; transform: translateY(10px); animation: portal-rise .55s 5.3s forwards; }
.portal-footer > span { color: var(--gold-light); font-family: Georgia,serif; letter-spacing: .08em; }
.portal-footer p { display: flex; align-items: center; gap: 12px; margin: 0; color: rgba(255,255,255,.74); font-size: .75rem; font-weight: 700; letter-spacing: .12em; }
.portal-footer i { width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }
@keyframes portal-depth-in { from { opacity: 0; transform: scale(1.15); } to { opacity: .55; transform: scale(1); } }
@keyframes portal-open { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.04) rotate(-42deg); } 70% { opacity: 1; transform: translate(-50%,-50%) scale(1.08) rotate(4deg); } 100% { opacity: 1; transform: translate(-50%,-50%) scale(1); } }
@keyframes portal-turn { to { transform: rotate(68deg); } } @keyframes portal-turn-reverse { to { transform: rotate(-54deg); } }
@keyframes portal-word-focus { 0% { opacity: 0; filter: blur(14px); transform: scale(1.9); } 65% { opacity: 1; filter: blur(0); transform: scale(.94); } 100% { opacity: 1; filter: blur(0); transform: scale(1); } }
@keyframes portal-word-settle { to { color: var(--gold-light); text-shadow: none; transform: scale(.9); } }
@keyframes portal-line-draw { to { transform: scaleX(1); } } @keyframes portal-sequence-up { to { top: 8%; transform: translate(-50%,0); } }
@keyframes portal-rise { to { opacity: 1; transform: translateY(0); } }
@keyframes portal-brand-arrive { 0% { opacity: 0; filter: blur(16px); transform: translateY(28px) scale(.9); } 70% { opacity: 1; filter: blur(0); transform: translateY(-3px) scale(1.02); } 100% { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); } }
@keyframes portal-line-reveal { to { opacity: 1; transform: scaleX(1); } }

/* Gráficos executivos */
.chart-card { min-height: 390px; display: flex; flex-direction: column; }
.chart-card.compact { min-height: 350px; }
.chart-card.tall { min-height: 470px; }
.chart-card .card-heading { align-items: flex-start; }
.chart-canvas { position: relative; flex: 1; min-height: 280px; }
.chart-card.tall .chart-canvas { min-height: 360px; }
.chart-legend-note { color: var(--muted); font-size: .72rem; }
.chart-card canvas { width: 100% !important; height: 100% !important; }

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 12000; left: 12px; top: 12px; transform: translateY(-180%); padding: 10px 14px; border-radius: 8px; background: #fff; color: var(--navy); font-weight: 800; }
.skip-link:focus { transform: translateY(0); }
.hidden { display: none !important; }
.mobile-only { display: none; }
.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-light);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .16em;
}
.eyebrow.navy { color: var(--gold); }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  background: var(--navy);
}
.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(42px, 8vw, 120px);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 12% 12%, rgba(198, 161, 91, .20), transparent 26%),
    radial-gradient(circle at 88% 84%, rgba(54, 116, 167, .24), transparent 30%),
    linear-gradient(145deg, #071525, #0d2a49);
}
.login-brand::after {
  content: "";
  position: absolute;
  inset: 24px;
  border: 1px solid rgba(198, 161, 91, .22);
  border-radius: 24px;
  pointer-events: none;
}
.login-brand h1 {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0;
  font: 800 clamp(2.6rem, 6vw, 5.8rem)/.98 Sora, sans-serif;
  letter-spacing: -.06em;
}
.brand-signature { position: relative; z-index: 1; margin: 18px 0 0; color: var(--gold-light); font: 600 1.05rem Sora,sans-serif; }
.brand-rule { position: relative; z-index: 1; width: min(580px,80%); height: 1px; margin-top: 42px; background: linear-gradient(90deg,var(--gold),rgba(198,161,91,.08)); }
.login-lead {
  position: relative;
  z-index: 1;
  max-width: 580px;
  color: rgba(255, 255, 255, .68);
  font-size: 1.05rem;
  line-height: 1.7;
}
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid var(--gold);
  border-radius: 12px;
  color: var(--gold-light);
  font: 700 1.25rem Georgia, serif;
}
.brand-mark.large { width: 74px; height: 74px; margin-bottom: 32px; font-size: 2rem; }
.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: clamp(38px, 7vw, 110px);
  background: #fff;
}
.login-card h2 { margin: 0; font: 800 2rem Sora, sans-serif; letter-spacing: -.04em; }
label { display: grid; gap: 8px; color: var(--text); font-size: .88rem; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #ccd6e1;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(198,161,91,.16); }
.button {
  min-height: 42px;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 800;
  transition: transform .15s, filter .15s, background .15s;
}
.button:hover { transform: translateY(-1px); filter: brightness(1.04); }
.button.primary { background: linear-gradient(135deg, var(--gold), #9d793a); color: #101821; box-shadow: 0 8px 20px rgba(157,121,58,.2); }
.button.secondary { background: var(--navy); color: #fff; }
.button.ghost { background: #e9eef4; color: var(--text); }
.button.danger { background: #fee9ec; color: var(--red); }
.button.small { min-height: 34px; padding: 7px 11px; font-size: .78rem; }
.button.full { width: 100%; }
.form-error { min-height: 20px; margin: 0; color: var(--red); font-size: .85rem; font-weight: 700; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  color: #fff;
  background: linear-gradient(180deg, #071727, #0c2947);
  box-shadow: 16px 0 40px rgba(8,25,45,.10);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand strong { display: block; font: 700 .94rem Sora, sans-serif; }
.sidebar-brand small { display: block; margin-top: 4px; color: var(--gold-light); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; }
#main-nav { padding: 14px 10px; flex: 1; }
.nav-group { margin-bottom: 10px; }
.nav-group-title { padding: 10px 10px 6px; color: rgba(255,255,255,.38); font-size: .68rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255,255,255,.72);
  text-align: left;
  font-size: .82rem;
  font-weight: 600;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: linear-gradient(90deg, rgba(198,161,91,.24), rgba(198,161,91,.08)); color: var(--gold-light); box-shadow: inset 3px 0 var(--gold); }
.nav-icon { width: 20px; color: currentColor; text-align: center; }
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.user-badge { margin-bottom: 10px; font-size: .78rem; color: rgba(255,255,255,.68); }
.user-badge strong { display: block; color: #fff; }

.main-shell { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
}
.topbar > div { display: flex; align-items: center; gap: 10px; }
.company-code { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 9px; background: var(--navy); color: var(--gold-light); font-weight: 900; font-size: .76rem; }
.topbar-actions select { min-width: 190px; min-height: 38px; padding: 7px 10px; font-size: .8rem; }
.alert-button { min-height: 38px; padding: 7px 11px; border: 1px solid #f2cf93; border-radius: 10px; background: #fff7e8; color: #9a5a00; font-size: .78rem; font-weight: 800; }
.alert-button span { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 5px; border-radius: 999px; background: var(--amber); color: #fff; }

.page { max-width: 1460px; margin: 0 auto; padding: 28px; outline: none; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.page-header h1 { margin: 0; font: 800 clamp(1.65rem, 3vw, 2.2rem) Sora, sans-serif; letter-spacing: -.045em; }
.page-header p { max-width: 760px; margin: 7px 0 0; color: var(--muted); line-height: 1.55; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi, .card {
  border: 1px solid rgba(16,42,70,.08);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.kpi { position: relative; overflow: hidden; min-height: 132px; padding: 18px; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent, var(--gold)); }
.kpi-label { color: var(--muted); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { margin-top: 15px; font: 800 clamp(1.55rem, 3vw, 2.05rem) Sora, sans-serif; letter-spacing: -.045em; }
.kpi-sub { margin-top: 6px; color: var(--muted); font-size: .76rem; }
.content-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-4 { grid-column: span 4; }.span-5 { grid-column: span 5; }.span-6 { grid-column: span 6; }.span-7 { grid-column: span 7; }.span-8 { grid-column: span 8; }.span-12 { grid-column: 1 / -1; }
.card { padding: 20px; min-width: 0; }
.card h2, .card h3 { margin: 0; font-family: Sora, sans-serif; letter-spacing: -.03em; }
.card h2 { font-size: 1.08rem; }.card h3 { font-size: .96rem; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-sub { margin: 5px 0 0; color: var(--muted); font-size: .78rem; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; font-size: .79rem; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--navy); color: rgba(255,255,255,.82); font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:hover { background: #f6f9fc; }
tbody tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 6px; }
.status { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: .7rem; font-weight: 800; }
.status.green { color: #087453; background: #ddf8ed; }.status.amber { color: #995b05; background: #fff2d8; }.status.red { color: #ad2432; background: #fee7ea; }.status.blue { color: #2455a8; background: #e4edff; }.status.gray { color: #596879; background: #e9eef3; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 180px; min-height: 40px; font-size: .82rem; }
.toolbar .spacer { flex: 1; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 8px; color: var(--text); }
.bar-list { display: grid; gap: 13px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr auto; gap: 12px; align-items: center; font-size: .78rem; }
.bar-track { height: 10px; overflow: hidden; border-radius: 999px; background: #e9eef4; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), #e1c785); }
.bar-fill.blue { background: linear-gradient(90deg, #245a94, #4f8fc5); }
.bar-fill.green { background: linear-gradient(90deg, #07815d, #27b989); }
.mini-list { display: grid; gap: 8px; }
.mini-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .8rem; }
.mini-row:last-child { border-bottom: 0; }
.notice { padding: 14px 16px; border: 1px solid #f0d196; border-radius: 12px; background: #fff8e8; color: #85531c; font-size: .82rem; line-height: 1.55; }
.notice.danger { border-color: #f2b8bf; background: #fff0f2; color: #982c38; }
.score { width: 150px; aspect-ratio: 1; display: grid; place-items: center; margin: 8px auto; border-radius: 50%; background: conic-gradient(var(--score-color, var(--gold)) calc(var(--score) * 1%), #e7edf3 0); }
.score::after { content: attr(data-score); width: 116px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: #fff; font: 800 1.8rem Sora, sans-serif; }

.dialog { width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 18px; box-shadow: var(--shadow-lg); }
.dialog.wide { width: min(940px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(5,16,28,.68); backdrop-filter: blur(3px); }
.dialog form, .dialog > div { padding: 22px; }
.dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.dialog h2 { margin: 0; font: 800 1.35rem Sora, sans-serif; }
.dialog footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 10px; background: #e9eef4; color: var(--text); font-size: 1.15rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid label.wide { grid-column: 1 / -1; }
.check-row { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.check-row input { width: 18px; min-height: 18px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 9999; max-width: min(420px, calc(100vw - 36px)); transform: translateY(24px); opacity: 0; pointer-events: none; padding: 13px 16px; border-radius: 11px; background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); transition: .2s; font-size: .84rem; font-weight: 700; }
.toast.show { transform: translateY(0); opacity: 1; }
.sidebar-backdrop { display: none; }

@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .actions { display: none !important; }
  .app-shell { display: block; }
  .page { max-width: none; padding: 0; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
}

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; }
}

@media (max-width: 820px) {
  .portal-core { width: 88vw; }
  .portal-sequence { top: 39%; width: calc(100% - 24px); grid-template-columns: 1fr 18px 1fr 18px 1fr; letter-spacing: .04em; }
  .portal-brand-copy { width: 100%; max-width: 100vw; padding: 112px 16px 96px; overflow: hidden; }
  .portal-brand-copy h1 {
    width: 100%;
    max-width: 100%;
    font-size: clamp(2rem, 9.5vw, 3.2rem);
    line-height: .94;
    letter-spacing: -.07em;
    overflow-wrap: anywhere;
  }
  .portal-brand-copy h2 { max-width: 330px; font-size: clamp(1.05rem, 5vw, 1.38rem); line-height: 1.25; text-wrap: balance; }
  .portal-program { max-width: 310px; line-height: 1.4; }
  .portal-enter { width: min(100%, 370px); }
  .portal-footer { left: 16px; right: 16px; flex-direction: column; gap: 8px; }
  .portal-footer p { gap: 7px; letter-spacing: .05em; }
  .mobile-only { display: grid; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 34vh; padding: 52px 34px; }
  .login-brand::after { inset: 14px; }
  .login-brand h1 { font-size: 2.5rem; }
  .brand-mark.large { display: none; }
  .login-card { min-height: 66vh; padding: 38px 28px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: 272px; transition: transform .22s; }
  body.menu-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; background: rgba(5,16,28,.55); }
  body.menu-open .sidebar-backdrop { display: block; }
  #mobile-close { position: absolute; right: 8px; top: 8px; }
  .topbar { padding: 10px 14px; }
  .topbar > div:first-of-type { flex: 1; min-width: 0; }
  .topbar > div:first-of-type strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions select { width: 130px; min-width: 0; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  #period-select { width: 82px; }
  .alert-button { font-size: 0; }
  .alert-button span { margin: 0; font-size: .75rem; }
  .page { padding: 20px 14px; }
  .page-header { flex-direction: column; }
  .page-actions { justify-content: flex-start; width: 100%; }
  .kpi-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.wide { grid-column: auto; }
  .bar-row { grid-template-columns: minmax(100px, 1fr) 1.5fr auto; }
  .chart-card, .chart-card.compact { min-height: 390px; }
  .chart-card.tall { min-height: 520px; }
}

@media (max-width: 380px) {
  .portal-sequence { font-size: .82rem; }
  .portal-brand-copy { padding-inline: 12px; }
  .portal-brand-copy h1 { font-size: clamp(1.85rem, 9.25vw, 2.45rem); }
  .portal-footer p { font-size: .64rem; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-splash * { animation-duration: .01ms !important; animation-delay: 0ms !important; }
  .portal-splash { scroll-behavior: auto; }
}
