:root {
  color-scheme: light;
  --app-bg: #f2f4f7;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --surface-hover: #f1f5f9;
  --border: #cfd6df;
  --border-strong: #aeb8c5;
  --text: #172033;
  --muted: #5f6b7a;
  --subtle: #7a8594;
  --accent: #176b9a;
  --accent-hover: #12577d;
  --accent-soft: #eaf4fa;
  --success: #246b45;
  --success-bg: #edf7f1;
  --warning: #835d13;
  --warning-bg: #fff7e2;
  --danger: #a43f4a;
  --danger-bg: #fff0f1;
  --radius: 4px;
  --control: 34px;
  --focus: 0 0 0 3px rgba(23,107,154,.24);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  background: var(--app-bg);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; padding: 16px 20px 28px; background: var(--app-bg); color: var(--text); font-size: 14px; line-height: 1.4; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: none; box-shadow: var(--focus); }
h1 { margin: 1px 0 3px; font-size: 27px; line-height: 1.18; letter-spacing: -.02em; }
h2 { margin: 0 0 3px; font-size: 20px; line-height: 1.25; }
h3 { margin: 0 0 8px; font-size: 15px; }
p { color: var(--muted); }
.eyebrow { margin: 0; color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.admin-shell { width: min(100%, 1480px); margin-inline: auto; }
.admin-dashboard { background: transparent; }
.admin-identity { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.admin-identity strong { font-size: 15px; }
.admin-identity span { color: var(--muted); font-size: 12px; }
.page-heading { padding: 12px 0 9px; }
.page-heading p { margin: 2px 0 0; font-size: 12px; }
.admin-topbar { min-height: 52px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.admin-topbar h1 { font-size: 22px; }
.admin-topbar p:last-child { margin: 0; font-size: 12px; }
.topbar-actions { display: flex; align-items: stretch; justify-content: flex-end; gap: 8px; flex-shrink: 0; margin-left: auto; }
.topbar-actions form { display: flex; margin: 0; }
.topbar-actions .back-link, .topbar-actions .logout { height: var(--control); min-height: var(--control); margin: 0; }
.dashboard-section { padding: 18px 0; border-top: 1px solid var(--border); }
.page-heading + .dashboard-section { border-top: 0; }
.section-heading { max-width: 760px; margin-bottom: 12px; }
.section-heading .eyebrow { margin-bottom: 2px; }
.section-heading p:last-child { margin: 0; font-size: 13px; }
label { display: block; color: var(--text); font-size: 12px; font-weight: 650; }
input, select { width: 100%; height: var(--control); min-height: var(--control); margin-top: 4px; padding: 5px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; }
input:hover, select:hover { border-color: #7d8998; }
input:disabled, select:disabled { background: #edf0f3; color: var(--subtle); }
button, .button { display: inline-flex; min-height: var(--control); align-items: center; justify-content: center; margin: 0; padding: 5px 13px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
button:hover, .button:hover { border-color: var(--accent-hover); background: var(--accent-hover); color: #fff; }
.button--secondary, .back-link { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.button--secondary:hover, .back-link:hover { background: var(--surface-hover); color: var(--text); }
.logout { border-color: var(--border-strong); background: var(--surface); color: var(--text); }
.logout:hover { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.settings-form { display: grid; width: max-content; max-width: 100%; grid-template-columns: 270px 270px 270px max-content; gap: 14px; align-items: end; }
.settings-form .settings-field { display: grid; width: 270px; grid-template-rows: auto var(--control); gap: 4px; margin: 0; white-space: nowrap; }
.settings-form .settings-field > span { display: block; line-height: 1.2; }
.settings-form input[type=number] { width: 270px; margin-top: 0; }
.settings-form button { width: max-content; min-width: 0; justify-self: start; align-self: end; }
.settings-actions { display: flex; grid-column: 1 / -1; align-items: center; gap: 14px; }
.settings-actions .notice { flex: 1 1 auto; width: auto; max-width: none; margin: 0; }
.settings-actions button { flex: 0 0 auto; }
.date-range { display: grid; grid-template-columns: 190px 190px auto; gap: 10px; align-items: end; margin-bottom: 14px; }
.date-range label { margin: 0; }
.date-range button { width: max-content; min-width: 0; justify-self: start; }
.date-picker-wrap { display: block; }
.date-picker-popover { position: fixed; z-index: 1000; width: 292px; padding: 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 22px rgba(22,32,51,.16); }
.date-picker-head { display: grid; grid-template-columns: 32px minmax(0,1fr) 72px 32px; gap: 5px; align-items: center; }
.date-picker-head button { width: 32px; height: 32px; min-height: 32px; padding: 0; }
.date-picker-nav { display: grid; place-items: center; font-size: 18px; line-height: 1; }
.date-picker-head select { height: 32px; min-height: 32px; margin: 0; padding: 3px 6px; }
.date-picker-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; margin-top: 7px; }
.date-picker-grid span { padding: 3px 0; text-align: center; color: var(--subtle); font-size: 10px; font-weight: 650; text-transform: uppercase; }
.date-picker-grid button { min-height: 30px; padding: 2px; border-color: transparent; background: transparent; color: var(--text); font-weight: 500; }
.date-picker-grid button:hover, .date-picker-grid button:focus-visible { border-color: var(--border); background: var(--surface-hover); color: var(--text); }
.date-picker-grid button[aria-current=date] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); font-weight: 750; }
.date-picker-grid .outside { color: #a4adb9; opacity: .72; }
.analytics-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border-block: 1px solid var(--border); }
.analytics-summary article { padding: 12px 14px; border-right: 1px solid var(--border); background: var(--surface); }
.analytics-summary article:last-child { border-right: 0; }
.analytics-summary strong { display: block; color: var(--muted); font-size: 11px; font-weight: 650; }
.analytics-summary span { display: block; margin-top: 3px; color: var(--text); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.analytics-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.analytics-chart { margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.analytics-chart figcaption { font-size: 13px; font-weight: 700; }
.analytics-chart svg { display: block; width: 100%; height: auto; margin-top: 4px; }
.analytics-chart line { stroke: #d7dde5; stroke-width: 1; }
.analytics-chart polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; }
.analytics-chart circle { fill: var(--accent); }
.analytics-chart text { fill: var(--muted); font-size: 10px; }
.chart-no-data { min-height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); }
.chart-no-data strong { color: var(--text); font-size: 22px; }
.chart-no-data span { margin-top: 4px; font-size: 12px; }
.avatar-breakdown { margin-top: 12px; padding: 12px 0 2px; border-top: 1px solid var(--border); }
.avatar-breakdown ul { list-style: none; margin: 0; padding: 0; max-width: 780px; }
.avatar-breakdown li { display: grid; grid-template-columns: 108px 1fr 34px; gap: 10px; align-items: center; min-height: 26px; }
.avatar-breakdown strong { text-align: right; font-variant-numeric: tabular-nums; }
.avatar-bar { height: 5px; overflow: hidden; border-radius: 1px; background: #e4e8ee; }
.avatar-bar i { display: block; height: 100%; background: var(--accent); }
.analytics-note, .timezone-note { margin: 8px 0 0; color: var(--subtle); font-size: 11px; }
.filters { display: grid; grid-template-columns: repeat(4,minmax(145px,1fr)); gap: 9px 10px; align-items: end; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); }
.filters label { margin: 0; }
.filters button { width: max-content; justify-self: start; }
.check { display: flex !important; min-height: var(--control); align-items: center; gap: 7px; }
.check input { width: 16px; height: 16px; min-height: 16px; margin: 0; }
.table-wrap { overflow: auto; margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; min-width: 1050px; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 9px; border-bottom: 1px solid #e5e9ef; text-align: left; vertical-align: top; }
th { position: sticky; top: 0; z-index: 1; background: #eef1f5; color: #465365; font-size: 10px; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
tbody tr:hover { background: #f7f9fb; }
tbody tr:last-child td { border-bottom: 0; }
.detail-link { color: var(--accent); white-space: nowrap; font-weight: 650; text-decoration: none; }
.detail-link:hover { text-decoration: underline; }
.badge { display: inline-flex; align-items: center; padding: 1px 5px; border: 1px solid var(--border-strong); border-radius: 3px; background: var(--surface-muted); color: #425064; font-size: 10px; font-weight: 650; line-height: 1.5; }
.badge.warning, .warning { border-color: #dfc17d; background: var(--warning-bg); color: var(--warning); }
.error, .success, .notice { margin: 10px 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.error { border-color: #e0a5ab; background: var(--danger-bg); color: var(--danger); }
.success { border-color: #9bc9ad; background: var(--success-bg); color: var(--success); }
.notice { background: var(--surface-muted); color: var(--muted); }
.next-link, .back-link { display: inline-flex; min-height: 32px; margin-top: 10px; padding: 5px 9px; align-items: center; }
.panel, .card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.card { padding: 16px; }
.admin-shell--login { min-height: calc(100vh - 32px); display: grid; place-items: center; }
.login-card { width: min(100%, 400px); padding: 22px; }
.login-card h1 { margin-top: 4px; }
.login-card > p { margin: 5px 0; }
.login-card form { margin-top: 14px; }
.login-card label { margin-top: 10px; }
.login-card button { width: 100%; margin-top: 14px; }
.detail-shell { width: min(100%,1480px); }
.detail-topbar { margin-bottom: 12px; }
.detail-card { margin-top: 10px; }
.metadata { display: grid; grid-template-columns: repeat(4,minmax(105px,auto) minmax(130px,1fr)); gap: 5px 12px; padding: 10px 0; font-size: 12px; }
.metadata dt { color: var(--muted); font-weight: 650; }
.metadata dd { margin: 0; color: var(--text); font-variant-numeric: tabular-nums; }
.timeline { display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.turn { margin: 0; padding: 10px 12px; border-bottom: 1px solid #e5e9ef; border-left: 3px solid var(--accent); background: var(--surface); }
.turn:last-child { border-bottom: 0; }
.turn:nth-child(even) { background: var(--surface-muted); }
.turn-header { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .035em; }
.turn p { margin: 4px 0 0; color: #344054; white-space: pre-wrap; }
.metric-summary { display: grid; grid-template-columns: repeat(4,minmax(130px,1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.metric-summary span { padding: 8px 10px; border-right: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.metric-summary span:last-child { border-right: 0; }
.metric-summary strong { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.chart-legend { display: flex; gap: 16px; margin: 6px 0; color: var(--muted); font-size: 11px; }
.chart-legend span::before { content: ""; display: inline-block; width: 18px; height: 2px; margin-right: 5px; vertical-align: middle; }
.rms-key::before { background: var(--accent); }
.peak-key::before { background: #9a761d; }
.level-chart { display: block; width: 100%; height: auto; max-height: 220px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.level-chart line { stroke: #cbd2dc; stroke-width: 1; }
.level-chart .grid { stroke: #e1e5eb; stroke-dasharray: 4 5; }
.level-chart text { fill: var(--muted); font-size: 10px; }
.level-chart polyline { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: square; }
.rms-line { stroke: var(--accent); }
.peak-line { stroke: #9a761d; }
details.card { padding: 0; }
details summary { padding: 12px 16px; cursor: pointer; font-size: 14px; font-weight: 700; }
details[open] summary { border-bottom: 1px solid var(--border); }
details .metadata { padding: 12px 16px; }
@media(max-width:900px) {
  body { padding: 10px; }
  .admin-identity { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.admin-identity strong { font-size: 15px; }
.admin-identity span { color: var(--muted); font-size: 12px; }
.page-heading { padding: 12px 0 9px; }
.page-heading p { margin: 2px 0 0; font-size: 12px; }
.admin-topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .dashboard-section { padding: 16px 0; }
  .settings-form, .date-range { grid-template-columns: 1fr 1fr; }
  .settings-form .settings-field, .settings-form input[type=number] { width: 100%; }
  .settings-form .settings-field { white-space: normal; }
  .settings-form button, .date-range button { grid-column: 1 / -1; }
  .analytics-summary, .analytics-charts, .timeline { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .metadata { grid-template-columns: minmax(105px,150px) 1fr; }
  .metric-summary { grid-template-columns: 1fr 1fr; }
}
@media(max-width:600px) {
  .settings-form, .date-range, .analytics-summary, .analytics-charts, .filters, .timeline, .metric-summary { grid-template-columns: 1fr; }
  .settings-form button, .date-range button { grid-column: auto; }
  .settings-actions { align-items: stretch; flex-direction: column; }
  .analytics-summary article, .metric-summary span { border-right: 0; border-bottom: 1px solid var(--border); }
}
.settings-form .sensitivity-field { grid-column: 1 / 4; width: 838px; grid-template-rows: auto auto auto auto; }
.settings-form input[type=range] { width: 100%; margin: 0; padding-inline: 0; }
.sensitivity-field output { font-variant-numeric: tabular-nums; }
.sensitivity-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 500; }
.sensitivity-field small { max-width: 838px; color: var(--muted); font-weight: 400; }
@media(max-width:900px) {
  .admin-dashboard .settings-form { width: 100%; }
  .admin-dashboard .settings-form .sensitivity-field { grid-column: 1 / -1; width: 100%; min-width: 0; }
}

/* Cost-management tables keep identifiers readable on screen and expand naturally when printed. */
.economy-table { width: 100%; table-layout: fixed; }
.economy-table th:nth-child(1), .economy-table td:nth-child(1) { width: auto; overflow-wrap: anywhere; word-break: break-word; }
.economy-table th:nth-child(2), .economy-table td:nth-child(2) { width: 150px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.economy-table th:nth-child(3), .economy-table td:nth-child(3) { width: 180px; }
.economy-breakdown-table { min-width: 900px; }
.economy-breakdown-table th:nth-child(n+2), .economy-breakdown-table td:nth-child(n+2) { width: 170px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.economy-breakdown-table .economy-review-value { color: var(--warning); }
.economy-breakdown-table .economy-total-value { font-weight: 750; }


/* Compact financial summaries reuse the economy-table language without the full breakdown-table footprint. */
.economy-summary-table-wrap { max-width: 760px; overflow: visible; }
.economy-summary-table { min-width: 0; }
.economy-summary-table th:first-child, .economy-summary-table td:first-child { width: auto; }
.economy-summary-table th:nth-child(2), .economy-summary-table td:nth-child(2) { width: 190px; text-align: right; white-space: nowrap; }
.economy-summary-table .economy-value { font-variant-numeric: tabular-nums; }
.economy-summary-table .economy-summary-review td:first-child { color: var(--warning); font-weight: 700; }
.economy-summary-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; max-width: 760px; margin: 10px 0 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); font-size: 12px; }
.economy-summary-meta div { display: flex; gap: 6px; }
.economy-summary-meta dt { color: var(--muted); font-weight: 650; }
.economy-summary-meta dd { margin: 0; color: var(--text); font-variant-numeric: tabular-nums; }


@media print {
  @page { size: auto; margin: 12mm; }
  body { background: #fff; color: #000; }
  .admin-shell { width: 100%; max-width: none; margin: 0; padding: 0; }
  .economy-actions { display: none !important; }
  .dashboard-section { box-shadow: none; break-inside: auto; page-break-inside: auto; }
  .economy-table-wrap { max-height: none !important; overflow: visible !important; width: 100%; }
  .economy-table { width: 100% !important; table-layout: fixed; }
  .economy-table thead { display: table-header-group; }
  .economy-table tr { break-inside: avoid; page-break-inside: avoid; }
  .economy-table th, .economy-table td { overflow: visible; overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
  .economy-table th:nth-child(2), .economy-table td:nth-child(2) { width: 25%; text-align: right; white-space: nowrap; }
  .economy-table th:nth-child(3), .economy-table td:nth-child(3) { width: 28%; }
  .economy-breakdown-table { min-width: 0; font-size: 10px; }
  .economy-breakdown-table th:first-child, .economy-breakdown-table td:first-child { width: 32%; }
  .economy-breakdown-table th:nth-child(n+2), .economy-breakdown-table td:nth-child(n+2) { width: 17%; padding-inline: 5px; text-align: right; white-space: nowrap; }

  .economy-summary-section { break-inside: avoid; page-break-inside: avoid; }
  .economy-summary-table-wrap { max-width: none; overflow: visible !important; }
  .economy-summary-table { min-width: 0; }
  .economy-summary-table th:nth-child(2), .economy-summary-table td:nth-child(2) { width: 32%; text-align: right; white-space: nowrap; }
  .economy-summary-meta { break-inside: avoid; page-break-inside: avoid; }
}

.technical-details-content { padding: 12px 16px 16px; }
.technical-details .metadata { padding: 0 0 16px; }
.runtime-diagnostics h3 { margin: 0 0 10px; }
