:root {
  --bg: #061016;
  --surface: #0a171e;
  --surface-2: #0e1d25;
  --text: #eef7f4;
  --muted: #83969b;
  --line: rgba(218, 240, 235, 0.13);
  --line-strong: rgba(218, 240, 235, 0.24);
  --accent: #55e6c1;
  --input: #6ea7ff;
  --cache: #55e6c1;
  --output: #f6b86f;
  --reasoning: #d9a7ff;
  --danger: #ff8a82;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: radial-gradient(circle at 74% -10%, rgba(85,230,193,.08), transparent 30rem), var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(420px, 100%); padding: 46px; background: rgba(10,23,30,.9); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.login-panel .brand-mark { display: block; margin-bottom: 28px; }
.login-panel h1 { margin: 0; font-size: 34px; letter-spacing: -.05em; }
.login-copy { margin: 16px 0 30px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.login-panel label, .rename-form label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.login-panel input, .rename-form input { height: 42px; padding: 0 2px; color: var(--text); background: transparent; border: 0; border-bottom: 1px solid var(--line-strong); outline: none; }
.login-panel input:focus, .rename-form input:focus { border-color: var(--accent); }
.login-panel .primary-button { width: 100%; margin-top: 24px; justify-content: space-between; }
.inline-error { margin: 15px 0 0; color: var(--danger); font-size: 11px; }

.app-shell { max-width: 1520px; margin: 0 auto; padding: 0 42px; }
.topbar { height: 92px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand-block, .status-block { display: flex; align-items: center; }
.brand-block { gap: 15px; }
.brand-mark { width: 32px; height: 32px; border: 1px solid var(--accent); border-radius: 50%; box-shadow: inset 0 0 0 8px var(--bg), inset 0 0 0 10px var(--accent); position: relative; }
.brand-mark::after { content: ""; position: absolute; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; top: -2px; right: 2px; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .19em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 21px; letter-spacing: -.03em; }
h2 { margin-bottom: 0; font-size: 19px; letter-spacing: -.025em; }
.status-block { gap: 10px; text-align: right; }
.status-block > div { display: grid; gap: 2px; }
.status-block b { font-size: 13px; }
.status-block small { color: var(--muted); font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px rgba(85,230,193,.7); }
.status-dot.is-loading { animation: pulse 1s infinite alternate; }
.status-dot.is-error { background: var(--danger); box-shadow: none; }

.control-strip { min-height: 90px; display: flex; align-items: center; justify-content: space-between; gap: 28px; border-bottom: 1px solid var(--line); }
.preset-group { display: flex; gap: 4px; }
.preset-group button, .text-button { background: transparent; border: 0; color: var(--muted); cursor: pointer; }
.preset-group button { padding: 9px 13px; border-radius: var(--radius); font-size: 12px; }
.preset-group button:hover, .preset-group button.is-active { color: var(--text); background: var(--surface-2); }
.date-range { display: flex; align-items: flex-end; gap: 10px; }
.date-range label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.date-range input { width: 142px; height: 36px; color: var(--text); background: transparent; border: 0; border-bottom: 1px solid var(--line-strong); color-scheme: dark; outline: none; }
.date-range input:focus { border-color: var(--accent); }
.date-arrow { color: var(--muted); line-height: 36px; }
.primary-button, .secondary-button { border: 0; border-radius: var(--radius); font-size: 12px; font-weight: 750; cursor: pointer; }
.primary-button { height: 39px; margin-left: 8px; padding: 0 15px; display: inline-flex; align-items: center; gap: 20px; color: #05110e; background: var(--accent); }
.primary-button:hover { background: #74efd0; transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.secondary-button { height: 38px; padding: 0 15px; color: var(--accent); background: rgba(85,230,193,.08); border: 1px solid rgba(85,230,193,.22); }
.text-button { padding: 6px 0; color: var(--accent); font-size: 11px; border-bottom: 1px solid rgba(85,230,193,.28); }
.text-button.is-selected { color: var(--text); }
.error-banner { margin-top: 18px; padding: 12px 14px; color: #ffd1cc; background: rgba(255,112,104,.08); border-left: 2px solid var(--danger); font-size: 13px; }

.summary-section, .people-section, .person-editor, .chart-section, .model-section, .table-section { padding: 36px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-heading.compact { align-items: center; }
.range-label, .section-note { margin: 0; color: var(--muted); font-size: 11px; }
.section-note { margin-top: 7px; }
.summary-grid { display: grid; grid-template-columns: minmax(300px, 1.35fr) minmax(320px, 1fr) minmax(280px, .85fr); gap: 42px; margin-top: 34px; }
.total-block > span, .cost-block span { color: var(--muted); font-size: 12px; }
.hero-number, .token-breakdown dd, .cost-block strong { font-variant-numeric: tabular-nums; }
.hero-number { display: block; margin-top: 8px; font-size: clamp(50px, 6vw, 84px); line-height: .95; letter-spacing: -.065em; }
.total-block p { margin: 13px 0 0; color: var(--muted); font-size: 12px; }
.token-breakdown { margin: 2px 0 0; display: grid; grid-template-columns: 1fr 1fr; }
.token-breakdown > div { padding: 8px 15px 22px 0; border-bottom: 1px solid var(--line); }
.token-breakdown > div:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--line); }
.token-breakdown dt { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 7px; }
.token-breakdown dd { margin: 9px 0 0; font-size: 23px; letter-spacing: -.035em; }
.legend { display: inline-block; width: 6px; height: 6px; border-radius: 2px; }
.legend.input { background: var(--input); }.legend.cache { background: var(--cache); }.legend.output { background: var(--output); }.legend.reasoning { background: var(--reasoning); }
.cost-block { display: grid; grid-template-columns: 1fr .7fr; gap: 24px; border-left: 1px solid var(--line); padding-left: 30px; }
.cost-block > div { display: flex; flex-direction: column; justify-content: center; }
.cost-block strong { margin: 9px 0 6px; font-size: 34px; letter-spacing: -.04em; }
.cost-block small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.cost-block .minor-stat { padding-left: 24px; border-left: 1px solid var(--line); }
.cost-block .minor-stat strong { font-size: 25px; }

.people-list { margin-top: 25px; }
.people-head, .person-row { display: grid; grid-template-columns: 44px minmax(190px, 1.4fr) minmax(130px, 2fr) 120px 105px 128px; align-items: center; gap: 16px; }
.people-head { padding: 0 12px 9px; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-align: right; }
.people-head span:nth-child(2), .person-row > div:first-of-type { text-align: left; }
.person-row { width: 100%; padding: 14px 12px; color: var(--text); background: transparent; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; text-align: right; }
.person-row:hover, .person-row.is-selected { background: rgba(85,230,193,.035); }
.person-rank { color: var(--muted); font-variant-numeric: tabular-nums; }
.person-name { display: grid; gap: 3px; }
.person-name b { font-size: 12px; }.person-name small { color: var(--muted); font-size: 9px; }
.rank-track { height: 5px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.rank-track svg, .model-track svg { display: block; width: 100%; height: 100%; }
.rank-track rect, .model-track rect { fill: var(--accent); transform-origin: left; animation: expand 500ms ease both; }
.person-metric { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.person-cost { color: var(--text); }
.sync-age.is-stale { color: var(--danger); }
.person-editor { display: flex; align-items: end; justify-content: space-between; gap: 42px; }
.rename-form { display: flex; align-items: end; gap: 14px; min-width: min(440px, 100%); }
.rename-form label { flex: 1; }

.chart-legend { display: flex; gap: 17px; color: var(--muted); font-size: 11px; }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.usage-chart { position: relative; min-height: 310px; margin-top: 28px; }
.usage-chart svg { width: 100%; height: 310px; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }.chart-label { fill: var(--muted); font-size: 10px; font-family: inherit; }
.chart-bar { cursor: crosshair; transform-box: fill-box; transform-origin: bottom; animation: rise 450ms ease both; }
.chart-tooltip { position: fixed; z-index: 20; pointer-events: none; min-width: 190px; padding: 12px; color: var(--text); background: rgba(11,25,32,.96); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.35); font-size: 11px; line-height: 1.75; }
.chart-tooltip b { display: block; margin-bottom: 3px; font-size: 12px; }

.model-list { margin-top: 28px; }
.model-list-head { display: grid; grid-template-columns: 90px 88px; justify-content: end; gap: 14px; padding-bottom: 7px; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-align: right; }
.model-row { display: grid; grid-template-columns: minmax(150px,.65fr) minmax(160px,2fr) 90px 88px; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.model-name { font-size: 12px; }.model-track { height: 5px; background: var(--surface-2); overflow: hidden; border-radius: 4px; }
.model-value, .model-cost { text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; }.model-value { color: var(--muted); }.pricing-missing { color: var(--danger); }
.empty-state { padding: 40px 0; color: var(--muted); font-size: 13px; }

.table-wrap { width: 100%; overflow-x: auto; }.table-section .table-wrap { margin-top: 24px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 13px 14px; text-align: right; border-bottom: 1px solid var(--line); font-size: 11px; white-space: nowrap; }
th { color: var(--muted); font-weight: 550; } th:first-child, td:first-child { padding-left: 0; text-align: left; } th:last-child, td:last-child { padding-right: 0; }
tbody tr:hover { background: rgba(255,255,255,.018); }.day-row { cursor: pointer; }.day-row.is-open { background: rgba(85,230,193,.035); }
.day-toggle { min-width: 126px; padding: 0; display: inline-flex; align-items: center; gap: 10px; color: var(--text); background: transparent; border: 0; cursor: pointer; }
.day-chevron { color: var(--accent); font-size: 10px; transition: transform 180ms ease; }.day-toggle[aria-expanded="true"] .day-chevron { transform: rotate(90deg); }
.day-detail-row > td { padding: 0; text-align: left; border-bottom: 1px solid var(--line-strong); }.day-detail { padding: 20px 18px 25px 32px; background: linear-gradient(90deg, rgba(85,230,193,.045), transparent 70%); animation: detail-in 180ms ease both; }
.day-detail-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 12px; }.day-detail-heading b { font-size: 12px; }.day-detail-heading span { color: var(--muted); font-size: 10px; }
.model-detail-table td:first-child { color: var(--text); font-weight: 600; }.model-detail-table td { color: #c7d3d1; }.model-detail-table tfoot td { color: var(--text); font-weight: 650; border-bottom: 0; border-top: 1px solid var(--line-strong); }
footer { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 10px; }

@keyframes pulse { from { opacity: .4; } to { opacity: 1; } } @keyframes rise { from { transform: scaleY(0); opacity: .2; } to { transform: scaleY(1); opacity: 1; } } @keyframes expand { from { transform: scaleX(0); } to { transform: scaleX(1); } } @keyframes detail-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 980px) {
  .app-shell { padding: 0 24px; }.control-strip { align-items: flex-start; flex-direction: column; padding: 22px 0; }.date-range { width: 100%; }.primary-button { margin-left: auto; }
  .summary-grid { grid-template-columns: 1fr 1fr; }.total-block { grid-column: 1/-1; }.cost-block { border-left: 0; padding-left: 0; }
  .people-head, .person-row { grid-template-columns: 36px minmax(150px,1.2fr) minmax(90px,1.5fr) 95px 90px; }.people-head span:last-child, .sync-age { display: none; }
}
@media (max-width: 680px) {
  .app-shell { padding: 0 16px; }.topbar { height: 76px; }.status-block > div { display: none; }.login-panel { padding: 32px 26px; }
  .date-range { align-items: stretch; flex-wrap: wrap; }.date-range label { flex: 1; min-width: 130px; }.date-range input { width: 100%; }.date-arrow { display: none; }.date-range .primary-button { width: 100%; margin: 7px 0 0; justify-content: space-between; }
  .summary-grid { grid-template-columns: 1fr; gap: 28px; }.hero-number { font-size: 54px; }.cost-block { border-top: 1px solid var(--line); padding-top: 24px; }
  .people-head { display: none; }.person-row { grid-template-columns: 32px minmax(110px,1fr) 90px 78px; gap: 8px; }.rank-track, .person-row .active-days { display: none; }
  .person-editor { align-items: stretch; flex-direction: column; }.rename-form { min-width: 0; width: 100%; }.chart-legend { display: none; }
  .model-list-head { display: none; }.model-row { grid-template-columns: minmax(110px,1fr) minmax(65px,1fr) 80px; }.model-cost { grid-column: 3; }.model-value { display: none; }
  .day-detail { padding-left: 12px; padding-right: 4px; } footer { align-items: flex-start; flex-direction: column; justify-content: center; }
}
