:root {
  --navy: #132a36;
  --navy-soft: #21404d;
  --teal: #007d78;
  --teal-bright: #00a59d;
  --mint: #cdebe5;
  --sand: #f4f1e9;
  --paper: #fbfaf6;
  --ink: #18313b;
  --muted: #6b7d82;
  --line: #d9dfdc;
  --white: #fff;
  --orange: #e87945;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --font-body: "Avenir Next", Avenir, "Gill Sans", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--font-body); font-size: 15px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.noise { position: fixed; inset: 0; pointer-events: none; opacity: .025; z-index: 20; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E"); }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 34px; color: var(--white); background: var(--navy); border-bottom: 1px solid #38515b; position: sticky; top: 0; z-index: 15; }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #64808a; color: var(--mint); font: italic 24px var(--font-display); transform: rotate(-3deg); }
.brand strong, .brand small, .source-state strong, .source-state small { display: block; }
.brand strong { letter-spacing: .02em; font-size: 15px; }
.brand small, .source-state small { margin-top: 2px; color: #a9b9bd; font-size: 10px; letter-spacing: .09em; text-transform: uppercase; }
.source-state { display: flex; align-items: center; gap: 11px; text-align: right; }
.logout-link { color: #a9b9bd; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; text-underline-offset: 4px; }
.source-state strong { margin-top: 3px; font-size: 12px; font-weight: 500; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: #68d6a6; box-shadow: 0 0 0 5px rgba(104,214,166,.11); }
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: calc(100vh - 76px); }
.filters { background: var(--sand); border-right: 1px solid var(--line); padding: 42px 26px; position: sticky; top: 76px; height: calc(100vh - 76px); overflow-y: auto; z-index: 10; }
.filters-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.filters h2, .panel h2 { margin: 4px 0 0; font: 400 24px var(--font-display); }
.eyebrow { color: var(--teal); text-transform: uppercase; letter-spacing: .14em; font-weight: 700; font-size: 9px; }
fieldset { border: 0; padding: 0; margin: 0 0 25px; }
legend { margin-bottom: 11px; color: var(--ink); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
label { display: block; color: var(--muted); font-size: 11px; }
label + label { margin-top: 10px; }
input, select { width: 100%; height: 39px; margin-top: 5px; border: 1px solid #cad2cf; border-radius: 0; color: var(--ink); background: rgba(255,255,255,.58); padding: 0 10px; outline: none; transition: border-color .2s, background .2s; }
input:focus, select:focus { border-color: var(--teal); background: var(--white); }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-right: 28px; }
.select-wrap::after { content: "⌄"; position: absolute; right: 11px; top: 14px; color: var(--teal); pointer-events: none; }
.search-field { position: relative; }
.search-field svg { position: absolute; left: 10px; top: 16px; width: 15px; fill: none; stroke: var(--muted); stroke-width: 1.7; }
.search-field input { padding-left: 32px; }
.primary, .secondary { min-height: 42px; border: 1px solid var(--teal); display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 17px; text-decoration: none; cursor: pointer; transition: transform .2s, background .2s, color .2s; }
.primary { color: white; background: var(--teal); }
.secondary { color: var(--teal); background: transparent; }
.primary:hover, .secondary:hover { transform: translateY(-2px); }
.primary:hover { background: #006d69; }
.secondary:hover { background: var(--mint); }
.primary svg, .secondary svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.full { width: 100%; }
.text-button { width: 100%; border: 0; background: none; color: var(--muted); margin-top: 12px; padding: 8px; cursor: pointer; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.aside-note { border-top: 1px solid var(--line); margin-top: 34px; padding-top: 22px; display: flex; gap: 10px; color: var(--muted); }
.aside-note svg { width: 18px; flex: none; fill: none; stroke: var(--teal); stroke-width: 1.3; }
.aside-note p { margin: 0; font-size: 10px; line-height: 1.55; }
.aside-note strong { color: var(--ink); }
main { min-width: 0; padding: 58px clamp(28px, 5vw, 76px) 28px; overflow: hidden; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 35px; }
.hero h1 { margin: 9px 0 16px; max-width: 700px; font: 400 clamp(42px, 5.3vw, 73px)/.96 var(--font-display); letter-spacing: -.045em; }
.hero h1 em { color: var(--teal); font-weight: 400; }
.hero p { max-width: 610px; margin: 0; color: var(--muted); line-height: 1.65; font-size: 14px; }
.hero-actions { display: flex; flex: none; gap: 10px; }
.status-line { min-height: 42px; margin-bottom: 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.status-line span:last-child { color: var(--teal); font-weight: 700; }
.metrics { display: grid; grid-template-columns: 1.15fr repeat(3, 1fr); border: 1px solid var(--line); margin-bottom: 20px; }
.metric { min-height: 147px; padding: 25px; border-right: 1px solid var(--line); background: rgba(255,255,255,.45); position: relative; }
.metric:last-child { border-right: 0; }
.metric > span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
.metric strong { display: block; margin: 14px 0 8px; font: 400 clamp(27px, 3vw, 38px) var(--font-display); letter-spacing: -.025em; }
.metric small { color: var(--muted); font-size: 10px; }
.metric-main { background: var(--navy); color: white; overflow: hidden; }
.metric-main > span, .metric-main small { color: #a9b9bd; }
.metric-main strong { color: var(--mint); }
.metric-main i { position: absolute; width: 110px; height: 110px; border: 1px solid #3d5964; border-radius: 50%; right: -43px; bottom: -45px; }
.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, .75fr); gap: 20px; margin-bottom: 20px; }
.analysis-grid.lower { grid-template-columns: minmax(0, 1.5fr) minmax(270px, .7fr); }
.panel { border: 1px solid var(--line); background: rgba(255,255,255,.58); padding: 25px; min-width: 0; }
.panel > header { min-height: 52px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel-total { color: var(--teal); font: 400 20px var(--font-display); }
.quiet { color: var(--muted); font-size: 10px; }
.chart { height: 275px; margin-top: 14px; position: relative; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .grid { stroke: #dde3e0; stroke-width: 1; stroke-dasharray: 2 5; }
.chart .area { fill: url(#areaGradient); }
.chart .line { fill: none; stroke: var(--teal); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart .point { fill: var(--paper); stroke: var(--teal); stroke-width: 2; }
.chart text { fill: var(--muted); font: 9px var(--font-body); }
.empty { height: 100%; display: grid; place-items: center; color: var(--muted); font: italic 16px var(--font-display); }
.donut-wrap { min-height: 288px; display: grid; align-content: center; justify-items: center; gap: 25px; }
.donut { --segments: conic-gradient(var(--teal) 0 100%); width: 172px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: var(--segments); position: relative; }
.donut::after { content: ""; position: absolute; inset: 20px; border-radius: 50%; background: var(--paper); }
.donut span { position: relative; z-index: 1; text-align: center; }
.donut strong, .donut small { display: block; }
.donut strong { font: 400 24px var(--font-display); }
.donut small { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.legend { width: 100%; }
.legend-item { display: grid; grid-template-columns: 9px 1fr auto; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid #e7ebe8; font-size: 10px; }
.legend-item i { width: 7px; height: 7px; }
.legend-item span { text-transform: capitalize; color: var(--muted); }
.bar-list { margin-top: 18px; }
.bar-row { display: grid; grid-template-columns: minmax(230px, 1.35fr) minmax(90px, 1.65fr) 76px; gap: 14px; align-items: center; min-height: 52px; padding: 10px 0; border-bottom: 1px solid #e5e9e7; }
.bar-label { font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.bar-track { height: 6px; background: #e4e9e6; }
.bar-track i { display: block; height: 100%; background: var(--teal); transform-origin: left; animation: grow .8s ease both; }
.bar-value { text-align: right; color: var(--muted); font-size: 10px; }
.format-list { margin-top: 20px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.format-card { min-height: 82px; border: 1px solid var(--line); padding: 14px; position: relative; overflow: hidden; }
.format-card strong, .format-card span { display: block; }
.format-card strong { color: var(--teal); font: 400 20px var(--font-display); }
.format-card span { margin-top: 9px; color: var(--muted); font-size: 9px; }
.format-card i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--orange); }
.ranking { margin-bottom: 20px; }
.matrix-panel { margin-bottom: 20px; }
.panel-description { margin: 4px 0 20px; color: var(--muted); font-size: 11px; }
.matrix-wrap { overflow: auto; margin: 0 -25px -25px; max-height: 650px; }
.matrix-table { min-width: max-content; }
.matrix-table th:first-child, .matrix-table td:first-child { position: sticky; left: 0; z-index: 2; width: 310px; min-width: 310px; max-width: 310px; white-space: normal; background: var(--paper); }
.matrix-table thead th { position: sticky; top: 0; z-index: 3; }
.matrix-table thead th:first-child { z-index: 4; background: #f4f6f3; }
.matrix-table td:not(:first-child) { min-width: 118px; text-align: right; }
.matrix-table td strong, .matrix-table td small { display: block; }
.matrix-table td strong { font-size: 10px; }
.matrix-table td small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.matrix-table .matrix-total { background: var(--mint); }
.matrix-table .matrix-empty { color: #b7c0bd; text-align: center !important; }
.table-wrap { overflow-x: auto; margin: 8px -25px -25px; }
table { border-collapse: collapse; width: 100%; min-width: 850px; }
th, td { padding: 14px 18px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; background: #f4f6f3; }
td { font-size: 11px; }
td:first-child { color: var(--teal); font-weight: 700; }
td:last-child { font: 400 15px var(--font-display); }
.tag { display: inline-block; padding: 4px 7px; background: var(--mint); color: #17615f; font-size: 9px; text-transform: uppercase; letter-spacing: .05em; }
footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding: 25px 0 5px; color: var(--muted); font-size: 10px; }
footer > span { color: var(--navy); font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.icon-button { border: 0; background: transparent; cursor: pointer; color: inherit; }
.icon-button svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.mobile-filter, .close-filter { display: none; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 390px; z-index: 30; padding: 15px 18px; background: var(--navy); color: white; border-left: 4px solid var(--teal-bright); transform: translateY(130%); opacity: 0; transition: .25s; font-size: 12px; box-shadow: 0 15px 45px rgba(19,42,54,.25); }
.toast.visible { transform: translateY(0); opacity: 1; }
.toast.error { border-color: var(--orange); }
.login-page { min-height: 100vh; background: var(--navy); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.2fr .8fr; padding: 0; }
.login-intro { padding: clamp(48px, 8vw, 120px); display: flex; flex-direction: column; justify-content: center; color: white; position: relative; overflow: hidden; }
.login-intro::after { content: ""; position: absolute; width: 520px; height: 520px; border: 1px solid #36515d; border-radius: 50%; left: -210px; bottom: -290px; }
.login-intro .brand-mark { margin-bottom: 70px; }
.login-intro h1 { margin: 12px 0 22px; font: 400 clamp(48px, 6vw, 78px)/.98 var(--font-display); letter-spacing: -.045em; }
.login-intro h1 em { color: var(--mint); font-weight: 400; }
.login-intro p { max-width: 500px; color: #a9b9bd; line-height: 1.7; }
.login-card { align-self: center; width: min(430px, calc(100% - 40px)); margin: 40px auto; padding: 44px; background: var(--paper); border-top: 5px solid var(--teal); }
.login-card h2 { margin: 8px 0 10px; font: 400 32px var(--font-display); }
.login-card > p { color: var(--muted); line-height: 1.6; font-size: 12px; }
.login-card form { margin: 30px 0 18px; }
.login-card input { margin-bottom: 18px; }
.login-card > small { color: var(--muted); font-size: 9px; }
.login-error { margin-top: 18px; padding: 10px 12px; color: #853b27; background: #fae5dc; font-size: 11px; }
.reveal { animation: reveal .65s cubic-bezier(.2,.75,.2,1) both; }
.delay-1 { animation-delay: .08s; }.delay-2 { animation-delay: .14s; }.delay-3 { animation-delay: .2s; }.delay-4 { animation-delay: .26s; }
@keyframes reveal { from { opacity: 0; transform: translateY(12px); } }
@keyframes grow { from { transform: scaleX(0); } }

@media (max-width: 1120px) {
  .shell { grid-template-columns: 230px minmax(0, 1fr); }
  .filters { padding-inline: 21px; }
  main { padding-inline: 32px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 850px) {
  .topbar { height: 66px; padding: 0 19px; }
  .source-state { display: none; }
  .logout-link { margin-left: auto; margin-right: 12px; }
  .mobile-filter, .close-filter { display: block; }
  .shell { display: block; min-height: calc(100vh - 66px); }
  .filters { position: fixed; inset: 66px 0 0 auto; width: min(88vw, 340px); height: calc(100vh - 66px); transform: translateX(105%); transition: transform .25s; box-shadow: -15px 0 35px rgba(19,42,54,.12); }
  .filters.open { transform: translateX(0); }
  main { padding: 38px 18px 24px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero h1 { font-size: clamp(42px, 13vw, 62px); }
  .hero-actions { width: 100%; }
  .hero-actions > * { flex: 1; }
  .analysis-grid, .analysis-grid.lower { grid-template-columns: 1fr; }
  .status-line { align-items: flex-start; flex-direction: column; justify-content: center; gap: 5px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { min-height: 38vh; padding: 45px 28px; }
  .login-intro .brand-mark { margin-bottom: 35px; }
  .login-intro p { display: none; }
}
@media (max-width: 560px) {
  .brand small { display: none; }
  .hero-actions { flex-direction: column; }
  .metrics { grid-template-columns: 1fr; }
  .metric, .metric:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .panel { padding: 19px; }
  .bar-row { grid-template-columns: minmax(110px, 1fr) 72px; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .format-list { grid-template-columns: 1fr 1fr; }
  footer { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
