:root {
  --bg: #f6f7f9;
  --paper: #ffffff;
  --ink: #1b1f24;
  --muted: #646c76;
  --line: #dde1e6;
  --accent: #1f5fae;
  --red: #c62828;
  --red-dark: #8e1b1b;
  --yellow: #e0a400;
  --green: #2e7d32;
  --gray: #8a939e;
  --mast: #16202c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151a;
    --paper: #181d23;
    --ink: #e7eaee;
    --muted: #98a1ab;
    --line: #2b323b;
    --accent: #6ea8f0;
    --red: #e05252;
    --red-dark: #b83a3a;
    --yellow: #e8b524;
    --green: #4caf50;
    --gray: #78818c;
    --mast: #0b0f14;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
a.plain { text-decoration: none; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
h3 { font-size: 15px; margin: 22px 0 8px; }
small, .muted { color: var(--muted); }
.note { color: var(--muted); font-size: 13px; margin-top: 18px; }
.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; margin: 0; }
.error { color: var(--red); }
.ok { color: var(--green); }
.nowrap { white-space: nowrap; }

/* Masthead */
.masthead {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 8px 16px; padding: 10px 16px; background: var(--mast); color: #fff;
}
.mark { display: flex; gap: 10px; align-items: baseline; color: #fff; text-decoration: none; }
.mark-code { font-weight: 700; letter-spacing: .08em; }
.mark-name { opacity: .8; }
.masthead nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.masthead nav a, .linkish { color: #fff; opacity: .85; text-decoration: none; font: inherit; }
.masthead nav a:hover, .linkish:hover { opacity: 1; }
.masthead form { margin: 0; }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; }

/* Layout */
main.sheet { max-width: 1280px; margin: 0 auto; padding: 20px 16px 48px; }
main.narrow { max-width: 420px; margin: 0 auto; padding: 48px 16px; }
.app-title { margin: 6px 0 22px; }
.title-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.freshness { color: var(--muted); font-size: 13px; text-align: right; margin: 0 0 16px; }
.freshness.stale b { color: var(--red); }
.banner { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 12px 14px; border-radius: 6px; }

/* Forms */
form.stack { display: flex; flex-direction: column; gap: 6px; }
form.stack label { font-size: 13px; color: var(--muted); margin-top: 8px; }
form.stack button { margin-top: 16px; }
form.inline { display: inline; margin: 0; }
.row-form { display: flex; flex-wrap: wrap; gap: 8px; }
.row-form input { flex: 1 1 180px; }
input, select {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
}
button, .button {
  font: inherit; cursor: pointer; border-radius: 6px; padding: 8px 14px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); text-decoration: none; display: inline-block;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { background: transparent; }
button[disabled] { opacity: .6; cursor: default; }
.small { padding: 5px 10px; font-size: 13px; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; border-top: 4px solid var(--accent); }
.tile.red { border-top-color: var(--red); }
.tile.yellow { border-top-color: var(--yellow); }
.tile.gray { border-top-color: var(--gray); }
.tile .n { display: block; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 13px; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.group-by { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
details.pick { position: relative; }
details.pick summary {
  list-style: none; cursor: pointer; background: var(--paper); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px; font-size: 13px;
}
details.pick summary::-webkit-details-marker { display: none; }
.pick-body {
  position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; min-width: 220px; max-height: 320px; overflow: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.15);
}
label.check { display: flex; gap: 6px; align-items: center; padding: 3px 2px; font-size: 13px; white-space: nowrap; }
label.check .muted { margin-left: auto; padding-left: 10px; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--paper); position: sticky; top: 0; }
tr.inactive td { opacity: .55; }

table.heat td, table.heat thead th { text-align: center; }
table.heat .rowhead { text-align: left; white-space: nowrap; font-weight: 500; }
table.heat .rowhead a { color: var(--ink); text-decoration: none; }
table.heat .rowhead a:hover { text-decoration: underline; }
table.heat thead th.col-red { border-bottom: 3px solid var(--red); }
table.heat thead th.col-yellow { border-bottom: 3px solid var(--yellow); }
table.heat thead th.col-green { border-bottom: 3px solid var(--green); }
table.heat thead th.col-gray { border-bottom: 3px solid var(--gray); }
td.cell { min-width: 84px; font-variant-numeric: tabular-nums; font-weight: 600; --a: 0; }
td.cell a { display: block; color: inherit; text-decoration: none; }
td.cell.red    { background: color-mix(in srgb, var(--red) calc(var(--a) * 100%), transparent); }
td.cell.yellow { background: color-mix(in srgb, var(--yellow) calc(var(--a) * 100%), transparent); }
td.cell.green  { background: color-mix(in srgb, var(--green) calc(var(--a) * 70%), transparent); }
td.cell.gray   { background: color-mix(in srgb, var(--gray) calc(var(--a) * 60%), transparent); }
td.total, tfoot td { font-variant-numeric: tabular-nums; color: var(--muted); }
tfoot th, tfoot td { border-bottom: 0; }

table.list td.desc { min-width: 260px; max-width: 520px; }
.due { padding: 2px 6px; border-radius: 4px; display: inline-block; border-left: 4px solid transparent; }
.due.red { border-left-color: var(--red); }
.due.yellow { border-left-color: var(--yellow); }
.due.green { border-left-color: var(--green); }
.due.gray { border-left-color: var(--gray); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.chip.red { border-color: var(--red); }
.chip.yellow { border-color: var(--yellow); }
.chip.green { border-color: var(--green); }

.link-box p { margin: 0 0 8px; }
.copy-row { display: flex; gap: 6px; }
.copy-row input { flex: 1; font-family: ui-monospace, monospace; font-size: 12px; }
