:root {
  color-scheme: dark;
  --bg: #07101c;
  --bg-soft: #0b1625;
  --panel: rgba(13, 27, 45, 0.88);
  --panel-strong: #101f32;
  --line: rgba(153, 180, 208, 0.14);
  --text: #eef6ff;
  --muted: #8da3bb;
  --dim: #60758c;
  --atc: #ff9d45;
  --atc-soft: rgba(255, 157, 69, 0.16);
  --telxius: #31d7c7;
  --telxius-soft: rgba(49, 215, 199, 0.14);
  --consolidated: #8aa7ff;
  --danger: #ff6174;
  --success: #54dfa0;
  --warning: #ffd166;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 17% -10%, rgba(49, 215, 199, 0.1), transparent 30%),
    radial-gradient(circle at 95% 10%, rgba(255, 157, 69, 0.08), transparent 27%),
    var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

a { color: inherit; }
button { font: inherit; }
.shell { max-width: 1560px; margin: 0 auto; padding: 0 28px 28px; position: relative; }
.topbar { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 15px; }
.brand-mark { width: 42px; height: 42px; border: 1px solid rgba(255,157,69,.32); border-radius: 12px; display: flex; align-items: flex-end; justify-content: center; gap: 4px; padding: 9px; background: var(--atc-soft); }
.brand-mark span { display: block; width: 5px; border-radius: 8px; background: var(--atc); }
.brand-mark span:nth-child(1) { height: 12px; }
.brand-mark span:nth-child(2) { height: 23px; }
.brand-mark span:nth-child(3) { height: 17px; }
.eyebrow, .panel-kicker { margin: 0 0 4px; color: var(--muted); letter-spacing: .13em; font-size: .74rem; font-weight: 800; }
h1 { margin: 0; font-size: 1.45rem; letter-spacing: -.02em; }
h1 span { color: var(--muted); font-weight: 500; }
h2 { margin: 2px 0 0; font-size: 1.22rem; line-height: 1.25; letter-spacing: -.025em; }
.top-actions, .sync-state { display: flex; align-items: center; gap: 14px; }
.sync-state { color: var(--muted); font-size: .85rem; }
.sync-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 14px currentColor; }
.sync-state.online i { background: var(--success); }
.sync-state.error i { background: var(--danger); }
.refresh-button { color: var(--text); background: #12243a; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.refresh-button:hover { border-color: rgba(49,215,199,.45); }
.refresh-button:disabled { opacity: .55; cursor: wait; }
.refresh-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
main { padding-top: 26px; display: grid; gap: 18px; }
.panel { min-width: 0; background: linear-gradient(145deg, rgba(16,31,50,.95), rgba(9,21,36,.92)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 20px 65px rgba(0,0,0,.18); }
.hero-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 14px; }
.verdict-card, .metric-card { min-height: 190px; padding: 21px 22px; }
.verdict-card { overflow: hidden; position: relative; border-color: rgba(255,157,69,.25); }
.verdict-card.saves { border-color: rgba(84,223,160,.3); }
.verdict-main { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.verdict-label { color: var(--muted); margin: 0 0 2px; font-size: .88rem; }
.verdict-value { display: block; font-size: clamp(2rem, 3vw, 3.05rem); line-height: 1; letter-spacing: -.05em; color: var(--atc); }
.verdict-card.saves .verdict-value { color: var(--success); }
.verdict-detail { margin: 10px 0 0; color: var(--muted); max-width: 430px; font-size: .86rem; }
.verdict-orbit { width: 100px; height: 100px; border-radius: 50%; border: 1px solid rgba(255,157,69,.24); position: relative; flex: 0 0 auto; margin-left: 12px; }
.verdict-orbit::before, .verdict-orbit::after { content: ""; position: absolute; border-radius: 50%; inset: 17px; border: 1px solid rgba(255,157,69,.22); }
.verdict-orbit::after { inset: 37px; background: var(--atc); box-shadow: 0 0 34px rgba(255,157,69,.6); border: 0; }
.verdict-orbit span { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--telxius); top: 7px; left: 45px; box-shadow: 0 0 14px var(--telxius); }
.verdict-orbit i { position: absolute; inset: -1px; border-radius: 50%; border-top: 2px solid var(--atc); transform: rotate(34deg); }
.confidence-row { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.confidence-row span, .source-pill { background: rgba(138,167,255,.1); color: #adc0ff; border: 1px solid rgba(138,167,255,.22); border-radius: 999px; padding: 4px 8px; font-size: .67rem; font-weight: 800; letter-spacing: .08em; }
.confidence-row small { color: var(--dim); font-size: .75rem; }
.metric-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 650; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.atc { background: var(--atc); box-shadow: 0 0 12px rgba(255,157,69,.65); }
.dot.telxius { background: var(--telxius); box-shadow: 0 0 12px rgba(49,215,199,.6); }
.dot.consolidated { background: var(--consolidated); }
.dot.warning { background: var(--warning); }
.metric-card > strong { display: block; font-size: clamp(2rem, 2.4vw, 2.65rem); margin-top: 26px; line-height: 1; letter-spacing: -.055em; }
.metric-card p { color: var(--muted); margin: 10px 0 13px; font-size: .79rem; }
.metric-card a, .text-button { color: #a8bdd2; font-size: .76rem; text-decoration: none; }
.metric-card a:hover { color: var(--text); }
.text-button { border: 0; background: transparent; padding: 0; cursor: pointer; }
.traffic-panel, .incidents-panel, .history-panel { padding: 22px; }
.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.section-heading.compact { margin-bottom: 25px; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: .78rem; }
.legend span { display: flex; align-items: center; gap: 7px; }
.chart-wrap { height: 330px; margin-top: 16px; position: relative; }
.line-chart { width: 100%; height: 100%; overflow: visible; }
.chart-footer { display: flex; justify-content: space-between; gap: 20px; color: var(--dim); font-size: .72rem; border-top: 1px solid var(--line); padding-top: 12px; }
.finance-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; }
.finance-card, .breakeven-card { padding: 22px; min-height: 290px; }
.cost-bars { display: grid; gap: 19px; }
.cost-row { display: grid; grid-template-columns: 142px 1fr 116px; gap: 14px; align-items: center; }
.cost-row > span { color: var(--muted); font-size: .82rem; }
.cost-track { height: 26px; border-radius: 8px; background: rgba(255,255,255,.045); overflow: hidden; }
.cost-track svg { width: 100%; height: 100%; display: block; }
.cost-fill { fill: var(--atc); }
.cost-row.only .cost-fill { fill: var(--telxius); }
.cost-row strong { text-align: right; font-size: .88rem; }
.cost-notes { margin-top: 27px; padding-top: 17px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cost-notes div { display: grid; gap: 4px; }
.cost-notes span { color: var(--dim); font-size: .72rem; }
.cost-notes strong { font-size: .84rem; }
.gauge { margin: 38px 0 23px; }
.gauge-track { height: 10px; background: rgba(255,255,255,.07); border-radius: 10px; position: relative; }
.gauge-track > svg { width: 100%; height: 100%; display: block; overflow: hidden; border-radius: inherit; }
.gauge-track rect { fill: var(--atc); }
.gauge-track i { position: absolute; top: -8px; left: 74.44%; height: 26px; width: 2px; background: var(--text); box-shadow: 0 0 10px rgba(255,255,255,.55); }
.gauge-labels { display: flex; justify-content: space-between; color: var(--dim); margin-top: 10px; font-size: .69rem; }
.gauge-labels strong { color: var(--text); }
.breakeven-value { display: flex; align-items: baseline; gap: 10px; }
.breakeven-value strong { font-size: 2rem; letter-spacing: -.04em; }
.breakeven-value span { color: var(--muted); font-size: .77rem; }
.method-note { color: var(--dim); font-size: .72rem; margin: 18px 0 0; }
.incident-summary { text-align: right; }
.incident-summary strong { display: block; font-size: 1.5rem; }
.incident-summary span { color: var(--dim); font-size: .72rem; }
.correlation-note { margin: 14px 0 0; max-width: 920px; color: var(--dim); font-size: .72rem; }
.table-wrap { overflow-x: auto; margin-top: 20px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { text-align: left; color: var(--dim); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; padding: 0 12px 10px; font-weight: 750; }
td { border-top: 1px solid var(--line); padding: 14px 12px; color: #c9d7e5; font-size: .8rem; }
td strong { color: var(--text); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 8px; font-size: .7rem; font-weight: 750; }
.status-pill.yes { color: var(--success); background: rgba(84,223,160,.1); }
.status-pill.no { color: var(--muted); background: rgba(141,163,187,.1); }
.status-pill.wait { color: var(--warning); background: rgba(255,209,102,.1); }
.correlation-detail { display: block; color: var(--dim); font-size: .67rem; margin-top: 5px; }
.negative { color: var(--danger) !important; }
.positive { color: var(--success) !important; }
.reference-block { border-top: 1px solid var(--line); margin-top: 15px; padding-top: 18px; display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.reference-block > div:first-child { display: grid; gap: 3px; }
.reference-block span { color: var(--dim); font-size: .72rem; }
.reference-rows { display: flex; gap: 8px; }
.reference-chip { padding: 8px 11px; background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 9px; font-size: .74rem; }
.reference-chip strong { color: var(--telxius); margin-left: 6px; }
.empty-state { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); background: rgba(7,16,28,.35); border: 1px dashed var(--line); border-radius: 12px; padding: 30px; }
.table-wrap .empty-state { position: static; min-height: 110px; }
.hidden { display: none !important; }
.data-note { border: 1px solid rgba(255,209,102,.18); background: rgba(255,209,102,.055); border-radius: 13px; padding: 14px 17px; display: flex; gap: 15px; align-items: baseline; }
.data-note strong { color: var(--warning); font-size: .8rem; white-space: nowrap; }
.data-note p { margin: 0; color: var(--muted); font-size: .77rem; }
footer { display: flex; justify-content: space-between; gap: 18px; color: var(--dim); font-size: .72rem; padding: 26px 4px 4px; }
footer a { text-decoration: none; }
.toast { position: fixed; right: 22px; bottom: 22px; background: #14263c; border: 1px solid var(--line); border-radius: 11px; padding: 12px 15px; box-shadow: 0 14px 50px rgba(0,0,0,.35); color: var(--text); font-size: .82rem; z-index: 10; }

.login-page { min-height: 100vh; display: grid; place-items: center; }
.login-shell { width: 100%; max-width: 520px; padding: 24px; position: relative; }
.login-card { background: linear-gradient(145deg, rgba(16,31,50,.98), rgba(9,21,36,.96)); border: 1px solid rgba(153,180,208,.16); border-radius: 24px; padding: 38px; box-shadow: 0 34px 100px rgba(0,0,0,.38); }
.login-brand { display: flex; align-items: center; gap: 15px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.login-copy { padding: 30px 0 24px; }
.login-copy h2 { font-size: 1.65rem; max-width: 390px; }
.login-copy > p:last-child { color: var(--muted); margin: 12px 0 0; font-size: .88rem; }
.login-form { display: grid; gap: 11px; }
.login-form label { color: #c9d7e5; font-size: .79rem; font-weight: 700; }
.password-field { position: relative; }
.password-field input { width: 100%; color: var(--text); background: rgba(5,13,23,.72); border: 1px solid rgba(153,180,208,.22); border-radius: 12px; padding: 14px 44px 14px 15px; outline: none; font: inherit; }
.password-field input:focus { border-color: var(--telxius); box-shadow: 0 0 0 3px rgba(49,215,199,.1); }
.password-field input[aria-invalid="true"] { border-color: var(--danger); }
.password-field span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--telxius); font-size: 1.15rem; }
.login-form button { margin-top: 5px; border: 0; border-radius: 12px; padding: 14px 18px; color: #041611; background: linear-gradient(120deg, var(--telxius), #72f1df); font-weight: 850; cursor: pointer; box-shadow: 0 12px 30px rgba(49,215,199,.13); }
.login-form button:hover { filter: brightness(1.06); }
.login-error { color: #ff8291; background: rgba(255,97,116,.08); border: 1px solid rgba(255,97,116,.18); border-radius: 9px; padding: 9px 11px; margin: 0; font-size: .78rem; }
.login-foot { margin: 27px 0 0; color: var(--dim); font-size: .72rem; display: flex; align-items: center; gap: 8px; }
.login-foot i { width: 7px; height: 7px; background: var(--success); border-radius: 50%; box-shadow: 0 0 10px rgba(84,223,160,.7); }

@media (max-width: 1180px) {
  .hero-grid { grid-template-columns: repeat(3, 1fr); }
  .verdict-card { grid-column: 1 / -1; }
}
@media (max-width: 800px) {
  .shell { padding: 0 16px 20px; }
  .topbar { align-items: flex-start; padding: 20px 0; }
  .sync-state span { display: none; }
  .hero-grid { grid-template-columns: 1fr; }
  .verdict-card { grid-column: auto; }
  .finance-grid { grid-template-columns: 1fr; }
  .section-heading, .reference-block { align-items: flex-start; flex-direction: column; }
  .legend { margin-top: 6px; }
  .chart-wrap { height: 280px; }
  .chart-footer { flex-direction: column; gap: 4px; }
  .cost-notes { grid-template-columns: 1fr; }
  footer { flex-direction: column; gap: 5px; }
}
@media (max-width: 520px) {
  .brand-mark { display: none; }
  .refresh-button { padding: 9px; }
  .refresh-button { font-size: 0; }
  .verdict-orbit { display: none; }
  .verdict-card, .metric-card, .traffic-panel, .incidents-panel, .history-panel, .finance-card, .breakeven-card { padding: 18px; }
  .cost-row { grid-template-columns: 1fr 82px; }
  .cost-row > span { grid-column: 1 / -1; }
  .data-note { align-items: flex-start; flex-direction: column; gap: 5px; }
  .confidence-row { flex-wrap: wrap; }
  .login-shell { padding: 14px; }
  .login-card { padding: 26px 22px; border-radius: 18px; }
  .login-brand .brand-mark { display: flex; }
  .login-copy h2 { font-size: 1.38rem; }
}

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