/* Eight16 Digital client reporting dashboard.
 * Brand chrome (ink/gold/cream) for page furniture; chart internals use the
 * validated light/dark token set from the dataviz skill's reference
 * palette (chart chrome, status colors, sequential blue) so charts stay
 * accessible regardless of brand skin.
 */

:root {
  color-scheme: light;

  /* Eight16 brand chrome */
  --brand-ink: #181510;
  --brand-gold: #c9a876;
  --brand-gold-deep: #a9803f;
  --brand-cream: #f7f2e8;
  --brand-tan: #6b6355;

  /* Validated chart tokens (light) */
  --surface-1: #fcfcfb;
  --page-plane: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --series-1: #2a78d6;
  --border-hairline: rgba(11, 11, 11, 0.10);

  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --page-plane: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --baseline: #383835;
    --series-1: #3987e5;
    --border-hairline: rgba(255, 255, 255, 0.10);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --page-plane: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --gridline: #2c2c2a;
  --baseline: #383835;
  --series-1: #3987e5;
  --border-hairline: rgba(255, 255, 255, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page-plane);
  color: var(--text-primary);
}

.header {
  background: var(--brand-ink);
  color: var(--brand-cream);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.header .brand {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--brand-gold);
  text-transform: uppercase;
}
.header .client-name {
  font-size: 22px;
  font-weight: 700;
  margin-top: 2px;
}
.header .controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  padding: 16px 18px;
}
.stat-tile .label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-tile .value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--text-primary);
  font-variant-numeric: proportional-nums;
}
.stat-tile .delta {
  font-size: 13px;
  margin-top: 4px;
  color: var(--text-secondary);
}
.stat-tile .delta.good { color: var(--status-good); }
.stat-tile .delta.bad { color: var(--status-critical); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  margin-top: 8px;
}
.status-pill.good { background: color-mix(in srgb, var(--status-good) 16%, transparent); color: var(--status-good); }
.status-pill.warning { background: color-mix(in srgb, var(--status-warning) 22%, transparent); color: #8a5a00; }
.status-pill.critical { background: color-mix(in srgb, var(--status-critical) 16%, transparent); color: var(--status-critical); }
:root[data-theme="dark"] .status-pill.warning,
@media (prefers-color-scheme: dark) {
  .status-pill.warning { color: var(--status-warning); }
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--brand-cream);
}
.switch {
  position: relative;
  width: 40px;
  height: 22px;
  display: inline-block;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--brand-tan); border-radius: 999px; transition: background 0.15s;
}
.switch .track::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.15s;
}
.switch input:checked + .track { background: var(--brand-gold); }
.switch input:checked + .track::before { transform: translateX(18px); }

.icon-btn {
  background: transparent; border: 1px solid var(--brand-tan); color: var(--brand-cream);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer;
}
.icon-btn:hover { border-color: var(--brand-gold); }

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 20px;
}
.panel h2 {
  font-size: 15px;
  margin: 0 0 4px;
  color: var(--text-primary);
}
.panel .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.chart-wrap { position: relative; }
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--brand-ink);
  color: var(--brand-cream);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  transform: translate(-50%, -120%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 5;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table th, table.data-table td {
  text-align: right;
  padding: 8px 10px;
  border-bottom: 1px solid var(--gridline);
  font-variant-numeric: tabular-nums;
}
table.data-table th:first-child, table.data-table td:first-child { text-align: left; }
table.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
}

details.table-toggle summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.footnote {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

@media (max-width: 480px) {
  .header { padding: 16px; }
  .container { padding: 18px 10px 48px; }
  .stat-tile .value { font-size: 24px; }
}
