/* ADN AI Usage — monthly report. Light, print-first. */
:root {
  color-scheme: light;
  --plane: #e9ecef;
  --sheet: #ffffff;
  --ink: #14171c;
  --ink-2: #4a505a;
  --muted: #7c828c;
  --rule: #e3e6ea;
  --rule-strong: #c8cdd4;
  --wash: #f5f7f9;
  --navy: #1c2a47;
  --navy-2: #2d3f66;
  --claude: #6250d6;
  --codex: #eb6834;
  --up: #106b2d;
  --down: #b42318;
  --warn: #9a4a06;
  --warn-wash: #fff6eb;
  --focus: #2d5bd7;
  --serif: "Iowan Old Style", "Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.bar {
  background: var(--navy);
  color: #fff;
}
.bar-in {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: .01em;
  color: #fff;
  text-decoration: none;
  margin-right: auto;
}
.brand b { font-weight: 600; }
.brand span { opacity: .72; }
.controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.controls label { font-size: 13px; opacity: .8; }
.controls select {
  background: var(--navy-2);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px;
  padding: 6px 10px;
  min-width: 150px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  padding: 6px 12px;
  border: 1px solid var(--rule-strong);
  background: var(--sheet);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  line-height: 20px;
}
.btn:hover { background: var(--wash); }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-2); }
.bar .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.bar .btn:hover { background: rgba(255,255,255,.1); }
.bar .btn.primary { background: #fff; color: var(--navy); border-color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- the report sheet ---------- */
.sheet {
  max-width: 1240px;
  margin: 24px auto 48px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 40px 48px 32px;
}
.cover { border-bottom: 2px solid var(--ink); padding-bottom: 20px; margin-bottom: 28px; }
.cover .kicker { color: var(--ink-2); font-size: 14px; margin: 0 0 4px; }
.cover h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 46px;
  line-height: 1.05;
  letter-spacing: -.01em;
  margin: 0 0 10px;
}
.cover .lede { margin: 0; color: var(--ink-2); max-width: 70ch; font-size: 15px; }

section.block { margin: 0 0 40px; break-inside: avoid; }
.block-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.2;
  margin: 0;
}
.sub { margin: 4px 0 0; color: var(--ink-2); max-width: 75ch; }
.note { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }

/* ---------- KPI strip ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(0, 1.7fr);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 40px;
}
.kpi { padding: 16px 18px 16px 0; }
.kpi + .kpi { padding-left: 18px; border-left: 1px solid var(--rule); }
.kpi .label { color: var(--ink-2); font-size: 13px; }
.kpi .value {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.15;
  margin: 2px 0 4px;
}
.kpi .value small { font-size: 15px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; margin-left: 2px; }
.delta { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta .vs { color: var(--muted); }
.split-bar { display: flex; height: 10px; gap: 2px; margin: 10px 0 8px; }
.split-bar i { display: block; height: 100%; min-width: 0; }
.split-bar i:first-child { border-radius: 3px 0 0 3px; }
.split-bar i:last-child { border-radius: 0 3px 3px 0; }
.split-bar i:only-child { border-radius: 3px; }
.split-bar .empty { background: var(--rule); flex: 1; border-radius: 3px; }
.split-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.split-legend b { color: var(--ink); font-weight: 600; }

.key { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.sw.claude { background: var(--claude); }
.sw.codex { background: var(--codex); }

/* ---------- segmented toggle ---------- */
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 6px; overflow: hidden; }
.seg button {
  border: 0;
  background: var(--sheet);
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink-2);
}
.seg button + button { border-left: 1px solid var(--rule-strong); }
.seg button[aria-pressed="true"] { background: var(--navy); color: #fff; }

/* ---------- heat grid ---------- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
.heat { border-collapse: separate; border-spacing: 2px; width: auto; min-width: 100%; }
.heat th { font-weight: 500; font-size: 12.5px; color: var(--ink-2); }
.heat thead th {
  vertical-align: bottom;
  text-align: center;
  padding: 0 4px 6px;
  min-width: 66px;
  max-width: 110px;
  line-height: 1.25;
}
.heat thead th button, .heat tbody th button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: inherit;
}
.heat thead th button {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.heat thead th button:hover, .heat tbody th button:hover { color: var(--ink); text-decoration: underline; }
.heat tbody th {
  text-align: left;
  padding: 0 14px 0 0;
  white-space: nowrap;
  color: var(--ink);
  font-size: 13.5px;
  position: sticky;
  left: 0;
  background: var(--sheet);
  z-index: 1;
}
.heat td {
  height: 38px;
  min-width: 66px;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  border-radius: 3px;
  cursor: pointer;
  background: var(--wash);
  color: var(--ink);
}
.heat td.none { background: transparent; color: var(--rule-strong); cursor: default; }
.heat td.dark { color: #fff; }
.heat td:not(.none):hover, .heat td.sel { box-shadow: inset 0 0 0 2px var(--ink); }
.heat-scale { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.heat-scale .ramp { width: 120px; height: 8px; border-radius: 2px; }

.tip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: var(--sheet);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(20, 23, 28, .12);
  padding: 8px 10px;
  font-size: 12.5px;
  max-width: 280px;
}
.tip .t { font-weight: 600; margin-bottom: 4px; }
.tip .r { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-2); }
.tip .r b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- drill-down ---------- */
.drill {
  border: 1px solid var(--rule-strong);
  border-left: 4px solid var(--navy);
  border-radius: 4px;
  padding: 20px 22px;
  background: #fbfcfd;
}
.drill h2 { font-size: 21px; }
.drill .stats { color: var(--ink-2); margin: 4px 0 14px; }

/* ---------- data tables ---------- */
.tbl th, .tbl td { padding: 9px 12px 9px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.tbl thead th { font-weight: 500; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.nowrap { white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .dim { color: var(--muted); }
.tbl .summary { min-width: 260px; max-width: 460px; color: var(--ink-2); }
.tbl .summary b { color: var(--ink); font-weight: 600; }
.tbl tr.shared td { background: var(--warn-wash); }
.flag { color: var(--warn); font-weight: 600; white-space: nowrap; }
.tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; border: 1px solid var(--rule);
  border-radius: 4px; color: var(--ink-2); font-size: 11px; line-height: 18px;
}
#automated-stats { color: var(--ink-2); margin: 0 0 10px; }
.status { white-space: nowrap; }
.status.ok::before, .status.missing::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: 1px;
}
.status.ok::before { background: var(--up); }
.status.missing { color: var(--down); font-weight: 600; }
.status.missing::before { border: 2px solid var(--down); width: 8px; height: 8px; }

/* ---------- charts ---------- */
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; }
.chart-legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); }
.chart-box { position: relative; width: 100%; }
.chart-box canvas { display: block; max-width: 100%; }
.empty-msg { color: var(--muted); padding: 24px 0; }

footer.foot {
  border-top: 1px solid var(--rule);
  padding-top: 14px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.loading { color: var(--muted); padding: 60px 0; text-align: center; }
.error-box { border: 1px solid var(--down); color: var(--down); background: #fff4f3; padding: 12px 14px; border-radius: 4px; margin-bottom: 20px; }

/* ---------- admin ---------- */
.admin-input {
  width: 100%;
  min-width: 160px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  padding: 5px 8px;
  background: var(--sheet);
}
.row-actions { display: flex; gap: 6px 12px; flex-wrap: wrap; white-space: nowrap; align-items: center; }
.saved { color: var(--up); font-size: 12.5px; }
.err { color: var(--down); font-size: 12.5px; }
textarea.roster {
  width: 100%;
  min-height: 200px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  padding: 10px 12px;
  line-height: 1.6;
  resize: vertical;
}
.key-cell { overflow-wrap: anywhere; max-width: 360px; }
.admin-tbl td { vertical-align: middle; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login {
  width: 100%;
  max-width: 380px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--navy);
  border-radius: 4px;
  padding: 32px 32px 28px;
}
.login h1 { font-family: var(--serif); font-weight: 500; font-size: 28px; margin: 0 0 4px; }
.login p { color: var(--ink-2); margin: 0 0 22px; }
.login label { display: block; font-size: 13px; color: var(--ink-2); margin: 0 0 4px; }
.login input {
  width: 100%;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  padding: 9px 10px;
  margin-bottom: 14px;
  background: var(--sheet);
}
.login .btn { width: 100%; justify-content: center; padding: 9px 12px; font-size: 14px; }
.login .error-box { margin-bottom: 16px; }

/* ---------- small screens ---------- */
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { border-left: 0; padding-left: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--rule); }
  .kpi.split { grid-column: span 3; border-left: 0; padding-left: 0; }
  .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .bar-in { padding: 10px 16px; }
  .sheet { margin: 0; border: 0; border-radius: 0; padding: 24px 16px; }
  .cover h1 { font-size: 34px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(n) { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); }
  .kpi:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--rule); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi.split { grid-column: span 2; border-left: 0; padding-left: 0; }
  .kpi .value { font-size: 26px; }
  .tbl-wrap { overflow-x: auto; }
}

/* ---------- print ---------- */
@page { size: A4 landscape; margin: 12mm; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; font-size: 11.5px; }
  .bar { background: #fff; color: var(--ink); border-bottom: 1px solid var(--rule-strong); }
  .bar-in { padding: 0 0 6px; max-width: none; }
  .brand { color: var(--ink); }
  .no-print, .controls, .seg, .tip { display: none !important; }
  .sheet { max-width: none; margin: 0; border: 0; padding: 12px 0 0; }
  .cover h1 { font-size: 34px; }
  .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(0, 1.7fr); }
  .kpi .value { font-size: 24px; }
  section.block { margin-bottom: 22px; break-inside: auto; }
  .block-head { break-after: avoid; }
  .cols section.block, .chart-box { break-inside: avoid; }
  .cover { padding-bottom: 12px; margin-bottom: 16px; }
  .cover .lede { font-size: 12.5px; }
  .kpis { margin-bottom: 24px; }
  .kpi { padding-top: 10px; padding-bottom: 10px; }
  .split-bar { margin: 6px 0; }
  .scroll { overflow: visible; }
  .heat tbody th { position: static; }
  .heat td { height: 26px; min-width: 0; font-size: 11px; }
  .heat thead th { min-width: 0; font-size: 10.5px; }
  .heat td:not(.none):hover, .heat td.sel { box-shadow: none; }
  .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  .drill { break-inside: auto; background: #fff; }
  .tbl tr { break-inside: avoid; }
  .tbl th, .tbl td { padding: 5px 10px 5px 0; }
  a { color: inherit; text-decoration: none; }
}
