/* The stats & staff dashboard (/dashboard): Solanum Beta inspired obsidian surfaces with chartreuse
   accents and comfortable spacing. All shared color tokens come from base.css. */
main { transition: opacity .12s; }
main.loading { opacity: .45; pointer-events: none; }
.num, td.n, th.n, .kpi b, .pulse b, .facts b, .sums b { font-variant-numeric: tabular-nums; font-family: var(--mono); }

/* The shell: elevated left navigation sidebar, then the workspace. */
.shell { display: grid; grid-template-columns: var(--side-width) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; scrollbar-width: none; padding-bottom: 20px; background: var(--surface); border-right: 1px solid var(--border); }
.side .brand { padding: 0 20px; }

/* Sidebar navigation with Solanum chartreuse active indicator. */
.pages { display: flex; flex-direction: column; padding: 0 10px; gap: 2px; }
.pages .nav-group { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--idle); padding: 12px 12px 4px; }
.pages .nav-group:first-child { padding-top: 4px; }
.pages a { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 34px; padding: 0 12px; border-radius: var(--radius); text-decoration: none; color: var(--text-soft); font-size: 13.5px; transition: background-color 110ms, color 110ms; }
.pages a:hover { background: var(--hover); color: var(--text); }
.pages a[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.pages a small { font-size: 11.5px; font-weight: 600; font-family: var(--mono); font-variant-numeric: tabular-nums; padding: 1px 6px; border-radius: 999px; background: var(--control); color: var(--text-soft); }
.pages a small:empty { display: none; }
.pages a[aria-current="page"] small { background: var(--accent); color: var(--accent-ink); }
.pages hr { flex: none; border: 0; height: 1px; background: var(--border); margin: 10px 8px; }

.side-foot { margin-top: auto; flex: none; display: flex; flex-direction: column; gap: 14px; padding: 16px 14px 0; border-top: 1px solid var(--border); }
.foot-who { display: flex; flex-direction: column; gap: 6px; }
.foot-who:empty { display: none; }
.account-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-raised); border: 1px solid var(--border); }
.account-avatar { width: 32px; height: 32px; border-radius: 8px; background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--accent); font-family: var(--mono); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.account-info { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.signed-in { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signed-role { font-size: 11px; color: var(--idle); text-transform: capitalize; }
.foot-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px; }
.pulse { display: flex; gap: 18px; font-size: 12px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-raised); border: 1px solid var(--border); }
.pulse span { display: flex; flex-direction: column; color: var(--idle); }
.pulse b { font-size: 17px; font-weight: 600; line-height: 1.25; color: var(--text); }
.pulse span:first-child b { color: var(--accent); }

/* Search bar in the left rail. */
.find { position: relative; flex: none; margin: 0 12px 12px; }
.find input { width: 100%; height: 34px; background: var(--control); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 11px; font-size: 13px; transition: border-color 120ms, background-color 120ms; }
.find input:hover { background: var(--control-hover); }
.find input:focus { border-color: var(--accent); outline: none; }
.hits { position: absolute; left: 0; right: 0; top: 38px; z-index: 20; max-height: 60vh; overflow-y: auto; background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, .55); }
.hits button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; height: 34px; padding: 0 10px; background: none; border: 0; text-align: left; cursor: pointer; }
.hits button:hover, .hits button.on { background: var(--control-hover); }
.hits button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hits button small { flex: none; font-size: 11.5px; color: var(--idle); }
.hits .none { padding: 9px 10px; color: var(--idle); }

/* Controls: segmented bars, pickers, filters, action buttons. */
.seg { height: 34px; display: inline-flex; background: var(--control); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px; gap: 2px; }
.seg button { background: none; border: 0; border-radius: 6px; padding: 0 11px; cursor: pointer; white-space: nowrap; color: var(--text-soft); font-size: 13px; transition: background-color 110ms, color 110ms; }
.seg button:hover { background: var(--control-hover); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pick, .filter { height: 34px; background: var(--control); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 11px; font-size: 13.5px; transition: border-color 120ms, background-color 120ms; }
.pick { max-width: 210px; cursor: pointer; }
.pick:hover, .filter:hover { background: var(--control-hover); }
.pick:focus, .filter:focus { border-color: var(--accent); outline: none; }
.pick[data-on] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.pick option { background: var(--surface-raised); color: var(--text); font-weight: 400; }
.filter { width: 100%; }
.filter.cap { width: 90px; text-align: right; }

.act { height: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; background: var(--control); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 13px; white-space: nowrap; color: var(--text); text-decoration: none; transition: background-color 110ms, border-color 110ms; }
.act:hover { background: var(--control-hover); border-color: var(--border-strong); }
.act:disabled { color: var(--idle); cursor: default; opacity: .6; }
.act:disabled:hover { background: var(--control); border-color: var(--border); }
.act.main { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.act.main:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.act.danger { color: var(--down); border-color: rgba(255, 99, 105, .28); }
.act.danger:hover { background: rgba(255, 99, 105, .12); border-color: rgba(255, 99, 105, .5); }
.acts { display: inline-flex; align-items: center; gap: 6px; }
.acts .tag { margin-left: 4px; }

/* Content sections and grids. */
.shell > .main { min-width: 0; max-width: 1640px; }
.part { min-width: 0; margin-top: 36px; }
.content > .part:first-child { margin-top: 0; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.part > header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-height: 34px; margin-bottom: 12px; }
.part > header .tools { margin-left: auto; }
.part > header .filter { width: 240px; }
.empty { padding: 14px 0; color: var(--idle); }
.tag { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--idle); }
h2 .tag { font-size: 13px; }
.sums b { font-weight: 600; }
.flag, td.flag { color: var(--down); }
.code { font-family: var(--mono); font-size: 12.5px; }

/* Headline KPI cards. */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 14px; padding: 4px 0 8px; }
.kpis.eight { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { min-width: 0; padding: 16px 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.kpi .label { display: block; cursor: default; font-size: 12.5px; color: var(--idle); }
.kpi b { display: block; margin: 6px 0 0; font-size: 26px; font-weight: 600; line-height: 1.2; color: var(--text); }
#live-running b { color: var(--accent); }
.kpi .change { display: block; margin-top: 4px; font-size: 12px; color: var(--idle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.delta { margin-right: 5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }

/* Charts. */
.chart { position: relative; padding: 16px 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart text { fill: var(--text-soft); font-size: 11px; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.chart .grid { stroke: var(--line); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: var(--accent); fill-opacity: .08; }
.chart .cross { stroke: var(--rule); }
.chart .mark { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .line.s2, .chart .mark.s2 { stroke: var(--idle); }
.chart .line.s3, .chart .mark.s3 { stroke: #6CA6FF; }
.chart .line.s4, .chart .mark.s4 { stroke: #F2994A; }
.chart .mark.s2, .chart .mark.s3, .chart .mark.s4 { fill: var(--surface); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 10px; font-size: 12.5px; color: var(--text-soft); }
.legend i { display: inline-block; width: 12px; height: 2px; margin-right: 8px; vertical-align: 4px; background: var(--accent); }
.legend i.s2 { background: var(--idle); }
.legend i.s3 { background: #6CA6FF; }
.legend i.s4 { background: #F2994A; }
#tip { position: fixed; z-index: 30; pointer-events: none; display: none; min-width: 170px; background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; box-shadow: 0 10px 28px rgba(0, 0, 0, .5); }
#tip .r { display: flex; justify-content: space-between; gap: 16px; }
#tip .r b { font-weight: 600; font-variant-numeric: tabular-nums; font-family: var(--mono); }
#tip .t { margin-bottom: 6px; font-weight: 600; }

/* Tables inside clean bordered containers. */
.scroll { overflow-x: auto; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th { height: 36px; padding: 0 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 12px; font-weight: 500; color: var(--idle); white-space: nowrap; cursor: pointer; user-select: none; background: var(--surface-raised); }
td { height: 42px; padding: 0 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.wrap { min-width: 200px; max-width: 380px; padding-top: 8px; padding-bottom: 8px; white-space: normal; line-height: 1.4; }
td:first-child { font-weight: 600; }
th.n, td.n { text-align: right; }
th:hover { color: var(--text); }
th.on { font-weight: 600; color: var(--text); }
th .arrow { margin-left: 4px; color: var(--accent); }
td.zero, span.zero { color: var(--idle); }
tbody tr[data-open] { cursor: pointer; }
tbody tr[data-open]:hover td { background: var(--hover); }
tbody tr.picked td, tbody tr.picked:hover td { background: var(--control); }
tbody tr.picked td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
tbody tr.hidden td { color: var(--idle); }
tbody tr.group td { font-weight: 600; }
.partial { color: var(--idle); }
.rate.low { color: var(--down); }
.share { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; }
.share i { display: inline-block; width: 56px; height: 4px; border-radius: 999px; background: var(--control); overflow: hidden; }
.share i b { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.waves { display: block; width: 160px; height: 22px; }
.waves rect { fill: var(--accent); }
td details.history { display: inline-block; margin-left: 8px; vertical-align: middle; }
td details.history summary { cursor: pointer; font-size: 13px; color: var(--text-soft); }
td details.history summary:hover, td details.history[open] summary { color: var(--accent); text-decoration: underline; }
td details.history .rlist { white-space: nowrap; }
td .line { display: flex; align-items: center; gap: 8px; padding: 4px 0; }

/* The player panel, over the page's right side. */
.drawer { position: fixed; top: 0; right: 0; z-index: 25; width: 440px; max-width: 100%; height: 100vh; overflow-y: auto; scrollbar-width: none; background: var(--surface); border-left: 1px solid var(--border);
  padding: 22px 28px 40px; transform: translateX(100%); transition: transform .18s; visibility: hidden; box-shadow: -16px 0 48px rgba(0, 0, 0, .5); }
.drawer.open { transform: none; visibility: visible; }
@media (min-width: 1400px) {
  body:has(.drawer.open) .shell > .main { margin-right: 440px; }
}
.drawer .head { display: flex; align-items: center; gap: 10px; }
.drawer h2 { font-size: 20px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.drawer h2 .id { font-size: 14px; }
.drawer .meta { margin: 4px 0 18px; color: var(--idle); }
.drawer .acts { display: flex; flex-wrap: wrap; margin-bottom: 28px; }
.drawer h3 { font-size: 14px; font-weight: 600; margin: 32px 0 8px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 12px; }
.facts span { display: block; font-size: 12.5px; color: var(--idle); }
.facts b { font-size: 18px; font-weight: 600; color: var(--text); }
dl.ident { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 0; }
dl.ident dt { color: var(--idle); }
dl.ident dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.rlist .r { display: flex; align-items: center; gap: 10px; min-height: 40px; border-bottom: 1px solid var(--line); }
.rlist .r span:first-child { width: 110px; color: var(--idle); }
.rlist .r .got { flex: 1; font-family: var(--mono); font-size: 13px; }
.drawer .own-interval { display: flex; }
.drawer .own-interval button { flex: 1; padding: 0 6px; }
.drawer .own-interval button:disabled { color: var(--idle); cursor: default; }

/* Fixes. */
.fix { padding: 16px 18px 20px; margin-bottom: 12px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.fix-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.fix-head b { font-size: 15px; font-weight: 600; }
.fix-head .act { margin-left: auto; }
.fix.ended .fix-head b { color: var(--idle); }
.fix-changes { margin: 8px 0; padding: 0; list-style: none; }
.fix-counts { margin-bottom: 6px; font-size: 13px; color: var(--text-soft); }
.fix-form { display: flex; flex-direction: column; gap: 12px; max-width: 820px; padding: 18px 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); margin-bottom: 16px; }
.fix-form label, .fix-form .row { display: grid; grid-template-columns: 140px minmax(0, 1fr); align-items: center; gap: 12px; }
.fix-form .days { width: 90px; }
.fix-form .seg { justify-self: start; }
.change { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 0; }
.change .kind { width: 60px; }
.change .filter { width: auto; flex: 1 1 140px; }
.change .pick { max-width: 240px; }
.change textarea.filter { flex-basis: 100%; height: 140px; padding: 10px 12px; font: 12px/1.4 var(--mono); resize: vertical; }
.act.file { display: inline-flex; align-items: center; }

/* Units. */
.unit-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.breakdown { margin-top: 32px; }
.breakdown > header { display: flex; align-items: center; gap: 12px; }
.breakdown h3 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; min-width: 0; }
.breakdown h4 { margin: 24px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-soft); }

@media (max-width: 1100px) {
  .two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; overflow: visible; padding: 12px 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .side .brand { display: none; }
  .find { margin: 0 var(--pad) 10px; }
  .pages { flex-direction: row; flex-wrap: wrap; padding: 0 calc(var(--pad) - 6px); gap: 4px; }
  .pages .nav-group, .pages hr { display: none; }
  .pages a { padding: 0 10px; }
  .pages a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
  .side-foot { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-top: 8px; padding: 12px var(--pad) 0; }
  .kpis, .kpis.eight { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi b { font-size: 22px; }
  .part { margin-top: 28px; }
  .part > header .filter { width: 100%; }
  .fix-form label, .fix-form .row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
