/* Akaio brand tokens — docs/brand/README.md (brandbook) + docs.json.
   Copper orange #C15F3C is the principal colour; links step down to #AC5435
   in light mode for 4.5:1 text contrast (#E79C88 in dark). Sand neutrals
   instead of pure white. Chart series = #C15F3C in both modes (validated
   with the dataviz palette checker against both card surfaces). */
:root {
  color-scheme: light;
  --bg: #F6F4EC;
  --surface: #FCFBF7;
  --surface-sunken: #F1ECE0;
  --border: #E4DCCB;
  --grid: #ECE6D8;
  --text: #1E1C1B;
  --text-2: #4C4844;
  --text-3: #69635D;
  --link: #AC5435;
  --brand: #C15F3C;
  --brand-tint: rgb(193 95 60 / 0.10);
  --logo: #C15F3C;
  --series: #C15F3C;
  --track: #F0EADC;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --tip-bg: #1E1C1B;
  --tip-fg: #F6F4EC;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121214;
    --surface: #1E1C1B;
    --surface-sunken: #282523;
    --border: #322F2C;
    --grid: #2B2826;
    --text: #F6F4EC;
    --text-2: #CEBBA5;
    --text-3: #A29990;
    --link: #E79C88;
    --brand: #C15F3C;
    --brand-tint: rgb(222 115 86 / 0.14);
    --logo: #DE7356;
    --series: #C15F3C;
    --track: #2B2826;
    --tip-bg: #F6F4EC;
    --tip-fg: #1E1C1B;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121214; --surface: #1E1C1B; --surface-sunken: #282523; --border: #322F2C; --grid: #2B2826;
  --text: #F6F4EC; --text-2: #CEBBA5; --text-3: #A29990; --link: #E79C88; --brand: #C15F3C;
  --brand-tint: rgb(222 115 86 / 0.14); --logo: #DE7356; --series: #C15F3C; --track: #2B2826;
  --tip-bg: #F6F4EC; --tip-fg: #1E1C1B;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.3; margin: 0 0 4px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 13px; margin: 18px 0 8px; font-weight: 600; color: var(--text-2); }
p { margin: 0; }
.muted { color: var(--text-2); font-weight: 400; }
.small { font-size: 12px; }
.strong { font-weight: 600; color: var(--text); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 48px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); min-width: 0; }
.brand:hover { text-decoration: none; }
.logo { height: 20px; width: auto; color: var(--logo); flex: none; display: block; }
.brand-divider { width: 1px; height: 20px; background: var(--border); flex: none; }
.brand-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.fresh { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.fresh-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgb(12 163 12 / 0.15); }
.fresh.stale .fresh-dot { background: var(--warning); box-shadow: 0 0 0 3px rgb(250 178 25 / 0.2); }
.fresh.stale .fresh-text { color: var(--text); font-weight: 600; }
.link-btn { background: none; border: 0; color: var(--text-2); font: inherit; cursor: pointer; padding: 6px 0; }
.link-btn:hover { color: var(--text); }

.crumbs { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.page-head { margin-bottom: 14px; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 16px; }
.filters .spacer { flex: 1; }
.seg { display: inline-flex; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg a { padding: 4px 10px; border-radius: 6px; color: var(--text-2); font-size: 13px; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a[aria-current="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.toggle:hover { text-decoration: none; color: var(--text); }
.toggle .box { width: 14px; height: 14px; border: 1.5px solid var(--text-3); border-radius: 3px; display: inline-grid; place-items: center; }
.toggle[aria-pressed="true"] .box { background: var(--brand); border-color: var(--brand); }
.toggle[aria-pressed="true"] .box::after { content: ""; width: 6px; height: 3px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); }

.btn { display: inline-block; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.btn:hover { text-decoration: none; background: var(--surface-sunken); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.05); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.kpi-label { font-size: 12px; color: var(--text-2); }
.kpi-value { font-size: 26px; font-weight: 700; line-height: 1.2; margin-top: 2px; letter-spacing: -0.01em; }
.kpi-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 12px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; }
.grid-2 > .card { margin-bottom: 12px; }
.empty { color: var(--text-3); padding: 8px 0; }

.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--text-3); stroke-width: 1; }
.chart .tick { fill: var(--text-3); font-size: 11px; }
.chart .bar { fill: var(--series); pointer-events: none; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover { fill: var(--surface-sunken); }

.table-toggle { margin-top: 8px; font-size: 12px; color: var(--text-2); }
.table-toggle summary { cursor: pointer; }
.table-toggle table { margin-top: 8px; max-height: 260px; }

.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hbars li { display: grid; grid-template-columns: 170px minmax(0, 1fr) 64px; align-items: center; gap: 10px; }
.hbar-label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; background: var(--track); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--series); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar-value { font-size: 12px; color: var(--text-2); text-align: right; }

.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-weight: 600; color: var(--text-2); font-size: 12px; }
th.num, td.num { text-align: right; }
tbody tr:hover { background: var(--surface-sunken); }
tr.idle td { color: var(--text-3); }
tr.idle td a.strong { color: var(--text-2); }
table.sortable th { cursor: pointer; user-select: none; }
table.sortable th[aria-sort="ascending"]::after { content: " ▲"; font-size: 9px; }
table.sortable th[aria-sort="descending"]::after { content: " ▼"; font-size: 9px; }
td.wrap-cell { white-space: normal; min-width: 220px; }
table.compact td, table.compact th { padding: 4px 8px; }
.table-wrap + p { margin-top: 8px; }

.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--brand-tint); color: var(--link); vertical-align: middle; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.chip:hover { text-decoration: none; background: var(--surface-sunken); }

.live, .plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.live li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; align-self: center; }

.sessions { list-style: none; margin: 0; padding: 0; }
.sessions li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.sessions li:last-child { border-bottom: 0; }
.session-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.steps { margin-top: 4px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; }
.arrow { color: var(--text-3); }

.login { min-height: 80vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 360px; display: grid; gap: 12px; padding: 24px; }
.login-card label { display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.login-card input { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.login-card input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.login-logo .logo { height: 26px; margin-bottom: 8px; }
.login-card h1 { font-size: 20px; margin: 0; }
.error { color: var(--critical); font-size: 13px; }

#tip { position: fixed; z-index: 10; pointer-events: none; background: var(--tip-bg); color: var(--tip-fg); font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .chart .tick { font-size: 20px; }
}
@media (max-width: 480px) {
  .brand-divider, .fresh-text { display: none; }
  .logo { height: 16px; }
  .hbars li { grid-template-columns: 110px minmax(0, 1fr) 56px; }
  .kpi-value { font-size: 22px; }
}

/* Navbar clock + timezone picker */
.clock { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.clock-time { font-weight: 700; color: var(--text); font-size: 13px; }
.clock select { font: inherit; font-size: 12px; color: var(--text-2); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 3px 2px; cursor: pointer; max-width: 170px; }
.clock select:hover, .clock select:focus { border-color: var(--border); color: var(--text); outline: none; }
.clock select option { color: var(--text); background: var(--surface); }

/* Clickable chart columns */
.chart.linked .hit { cursor: pointer; }
.chart.linked .hit:hover { fill: var(--brand-tint); }
.chart-hint { margin-top: 4px; }

/* Day view */
.day-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.day-nav { display: flex; gap: 8px; }
.btn.disabled { color: var(--text-3); cursor: default; }
.btn.disabled:hover { background: var(--surface); }
.toggle-link { font-size: 13px; }
.day-groups { display: grid; gap: 18px; }
.day-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 4px; }
.day-group table { margin-top: 2px; }
.seg { flex-wrap: wrap; }

@media (max-width: 600px) {
  .brand-title { display: none; }
  .clock select { max-width: 120px; }
  .topbar-right { gap: 10px; }
}

/* Chart bar panels: who was active, as initials (hover for the name). */
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font: 700 11px/1 Manrope, system-ui, sans-serif; letter-spacing: 0.02em;
  background: var(--surface-sunken); color: var(--text-2);
  border: 1.5px solid transparent; text-decoration: none;
}
.avatar:hover, .avatar:focus-visible { text-decoration: none; border-color: var(--brand); color: var(--text); }
.avatar.staff { background: var(--brand-tint); color: var(--link); }
.bar-pop {
  position: fixed; z-index: 20; width: max-content; max-width: min(340px, calc(100vw - 16px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 28px rgb(0 0 0 / 0.16); padding: 10px 12px; font-size: 13px;
}
.bar-pop-head { margin-bottom: 8px; white-space: nowrap; }
.bar-pop-people { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.bar-pop-more { font-size: 12px; color: var(--text-2); margin-left: 4px; }
.bar-pop-link { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 600; }
#tip { z-index: 30; }
