:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #0b0b0b;
  --line: #282828;
  --muted: #9b9b9b;
  --white: #fff;
  --green: #63c174;
  --yellow: #efd65a;
  --orange: #e99a45;
  --red: #dd5d5d;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--white); font-family: Arial, Helvetica, sans-serif; }
body { overflow-x: hidden; }
.dashboard-shell { min-height: 100vh; padding: 1.1vw 1.4vw 1.3vw; display: flex; flex-direction: column; gap: .8vw; }
.dashboard-header { display: grid; grid-template-columns: minmax(280px, 31vw) 1fr auto; align-items: center; gap: 1.3vw; min-height: 76px; }
.logo { width: 100%; max-height: 74px; object-fit: contain; object-position: left center; display: block; }
.title-block { border-left: 1px solid #333; padding-left: 1.4vw; }
.eyebrow { font-size: clamp(10px, .75vw, 16px); letter-spacing: .18em; color: #bbb; font-weight: 700; }
h1 { margin: .18em 0 0; font-size: clamp(22px, 2vw, 44px); line-height: 1; }
.status-block { text-align: right; }
.status-pill { display: inline-block; font-size: clamp(10px, .7vw, 14px); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: .42em .75em; border: 1px solid #3a3a3a; border-radius: 999px; }
.status-pill.ok { border-color: #246f33; color: #9be8a7; }
.status-pill.error { border-color: #7d2e2e; color: #ffaaaa; }
.updated { color: var(--muted); font-size: clamp(9px, .65vw, 13px); margin-top: .45em; }
.legend { display: flex; align-items: center; gap: 1.15vw; min-height: 28px; font-size: clamp(9px, .68vw, 13px); color: #ddd; }
.legend span { display: inline-flex; align-items: center; gap: .4em; white-space: nowrap; }
.legend-note { margin-left: auto; color: var(--muted); }
.swatch { width: .95em; height: .95em; border-radius: 2px; display: inline-block; }
.age-0 { background: var(--green); }
.age-1 { background: var(--yellow); }
.age-2 { background: var(--orange); }
.age-3 { background: var(--red); }
.table-wrap { flex: 1; min-height: 0; border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.aging-table { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; }
.aging-table th, .aging-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; padding: .32vw .18vw; }
.aging-table th:last-child, .aging-table td:last-child { border-right: 0; }
.aging-table thead tr:first-child th { height: 6vh; min-height: 48px; background: #0d0d0d; }
.aging-table thead tr:nth-child(2) th { height: 3.4vh; min-height: 27px; background: #141414; color: #bbb; }
.date-head { width: clamp(104px, 8.2vw, 165px); text-align: left !important; padding-left: .8vw !important; }
.client-head { font-size: clamp(9px, .72vw, 15px); line-height: 1.05; font-weight: 800; }
.total-head { background: #161616 !important; }
.subhead { font-size: clamp(7px, .55vw, 11px); text-transform: uppercase; letter-spacing: .05em; font-weight: 800; }
.aging-table tbody tr { height: 8.9vh; }
.date-cell { background: #080808; text-align: left !important; padding-left: .8vw !important; }
.date-main { font-size: clamp(13px, 1.15vw, 24px); font-weight: 800; }
.date-sub { margin-top: .25em; font-size: clamp(8px, .58vw, 12px); color: #aaa; }
.metric { color: #0b0b0b; font-size: clamp(11px, 1.12vw, 23px); font-weight: 900; font-variant-numeric: tabular-nums; }
.metric.zero { opacity: .46; }
.metric.clickable { cursor: pointer; text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .16em; }
.metric.clickable:hover { filter: brightness(1.08); }
.total-cell { box-shadow: inset 2px 0 0 rgba(0,0,0,.14); }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.52); z-index: 9; }
.drawer { position: fixed; z-index: 10; top: 0; right: 0; height: 100vh; width: min(520px, 92vw); background: #111; border-left: 1px solid #333; transform: translateX(101%); transition: transform .18s ease; padding: 28px; overflow: auto; }
.drawer.open { transform: translateX(0); }
.drawer-close { position: absolute; top: 12px; right: 16px; background: transparent; color: white; border: 0; font-size: 34px; cursor: pointer; }
.drawer h2 { margin: 12px 36px 3px 0; font-size: 22px; }
.drawer .drawer-meta { color: #aaa; margin-bottom: 20px; }
.order-list { width: 100%; border-collapse: collapse; }
.order-list td, .order-list th { padding: 9px 6px; border-bottom: 1px solid #292929; text-align: left; }
.order-list th:last-child, .order-list td:last-child { text-align: right; }
.error-panel { padding: 28px; color: #ffb0b0; font-size: 16px; }
@media (max-width: 1100px) {
  .dashboard-header { grid-template-columns: 260px 1fr auto; }
  .client-head { font-size: 9px; }
  .metric { font-size: 11px; }
  .aging-table th, .aging-table td { padding-left: 1px; padding-right: 1px; }
}
