:root {
  --bg: #0b0b0c;
  --surface: #141416;
  --surface-2: #1c1c20;
  --line: #2a2a30;
  --text: #f2efe9;
  --muted: #a39e93;
  --orange: #ff8a1f;
  --orange-dim: #c4600a;
  --good: #7bc47f;
  --bad: #ff6b5b;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--orange); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; }

header.site {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 20px;
}
header.site .brand { color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: 0.01em; }
header.site .brand span { color: var(--orange); }
header.site nav { display: flex; gap: 16px; font-size: 15px; }
header.site nav a { color: var(--muted); text-decoration: none; }
header.site nav a.on, header.site nav a:hover { color: var(--orange); }

h1 { font-size: 28px; margin: 0 0 4px; line-height: 1.2; }
h2 { font-size: 19px; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.banner {
  border: 1px solid var(--orange-dim); background: rgba(255, 138, 31, 0.08);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 15px;
}

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.card > p.sub { margin-bottom: 12px; font-size: 14px; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .label { color: var(--muted); font-size: 13px; }
.tile .value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile .note { color: var(--muted); font-size: 13px; }

/* Live hero */
.hero { text-align: center; padding: 26px 18px 22px; }
.hero .count { font-size: clamp(72px, 22vw, 140px); font-weight: 800; line-height: 1; color: var(--orange); font-variant-numeric: tabular-nums; }
.hero .count-label { color: var(--muted); margin-top: 6px; }
.pace { font-size: 18px; margin-top: 14px; }
.pace .up { color: var(--good); }
.pace .down { color: var(--bad); }

.meter { position: relative; height: 18px; background: var(--surface-2); border-radius: 9px; margin: 20px 0 8px; overflow: hidden; }
.meter .fill { position: absolute; inset: 0 auto 0 0; background: var(--orange); border-radius: 9px; }
.meter .expected { position: absolute; top: -3px; bottom: -3px; width: 3px; background: var(--text); border-radius: 2px; }
.meter-legend { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; gap: 8px; }

.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 360px; }
@media (max-width: 600px) {
  .chart-box { height: 240px; }
  .chart-box.tall { height: 300px; }
}

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }

/* Tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
th:first-child, td:first-child { text-align: left; }
td.notes { text-align: left; white-space: normal; color: var(--muted); font-size: 14px; min-width: 200px; }

table.heat td, table.heat th { padding: 4px 2px; text-align: center; font-size: 12px; border: 0; }
table.heat td.cell { border-radius: 4px; min-width: 30px; height: 26px; }
table.heat th.year { text-align: right; padding-right: 8px; }

details summary { cursor: pointer; color: var(--muted); font-size: 14px; margin-top: 10px; }

/* Forms */
input, textarea, button, select { font: inherit; color: inherit; }
input[type=text], input[type=password], input[type=number], textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--orange); outline-offset: 0; border-color: transparent; }
button, .button {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px;
  cursor: pointer; text-decoration: none; display: inline-block; color: var(--text);
}
button.primary { background: var(--orange); color: #111; border-color: var(--orange); font-weight: 700; }
button.danger { border-color: #6b2a24; color: #ffb3aa; }
button:hover { filter: brightness(1.15); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-actions form { margin: 0; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; color: var(--muted); }
.seg button.on { background: var(--orange); color: #111; font-weight: 700; }

/* Tally rows */
.slots { width: 100%; }
.slots td { padding: 6px 8px; vertical-align: middle; }
.slots td.time { font-variant-numeric: tabular-nums; }
.slots tr.future td.time { color: var(--muted); }
.slots tr.due td { background: rgba(255, 138, 31, 0.12); }
.slots tr.due td.time { color: var(--orange); font-weight: 700; }
.slots tr.current td.time::after { content: " · now"; color: var(--muted); font-weight: 400; font-size: 13px; }
.slots tr.due td.time::after { content: " · enter this"; color: var(--orange); font-weight: 400; font-size: 13px; }
.stepper { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.stepper input { width: 84px; text-align: center; font-size: 20px; padding: 8px 4px; }
.stepper button { width: 44px; height: 44px; padding: 0; font-size: 20px; }
.sticky-save {
  position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%);
  padding: 18px 0 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}

.messages { list-style: none; padding: 0; margin: 0 0 14px; }
.messages li { padding: 8px 12px; border-radius: 8px; background: var(--surface-2); margin-bottom: 6px; font-size: 15px; }
.messages li.error { color: #ffb3aa; }

footer.site { color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); margin-top: 28px; padding-top: 14px; }

@media (max-width: 480px) {
  .slots td { padding: 6px 4px; }
  .slots tr.current td.time::after, .slots tr.due td.time::after { display: block; }
  .stepper { gap: 4px; }
  .stepper input { width: 64px; font-size: 18px; }
  .stepper button { width: 40px; height: 44px; }
}

header.site .brand .where { font-style: normal; }
@media (max-width: 480px) {
  header.site .brand .where { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
}
