:root {
  --bg: #f6f7f9; --card: #fff; --text: #1d2330; --muted: #667085; --line: #e4e7ec;
  --accent: #2f5bea; --red: #d92d20; --green: #079455; --amber: #dc6803;
  --radius: 12px; font-size: 15px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1218; --card: #171b23; --text: #e6e8ec; --muted: #98a2b3; --line: #2a303b; --accent: #7c9bff; }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
       background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--card);
             border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
header.top h1 { font-size: 18px; margin: 0; }
header.top nav { display: flex; gap: 14px; margin-left: auto; align-items: center; flex-wrap: wrap; }
header.top form { margin: 0; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
        margin-bottom: 14px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
h3 { font-size: 14px; margin: 14px 0 6px; color: var(--muted); font-weight: 600; }

/* hero tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 12px 14px; color: var(--text); }
.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile.active { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.tile .num { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .label { color: var(--muted); font-size: 13px; }
.tile .sub { font-size: 13px; color: var(--red); font-weight: 600; }
.tile .ok { color: var(--green); font-weight: 600; }
.tile .bad { color: var(--red); font-weight: 600; }

/* task rows */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .title { font-weight: 500; }
.row .key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; margin-right: 6px; }
.row .meta { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted);
             align-items: center; }
.row .due.overdue { color: var(--red); font-weight: 600; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); }
.p-urgent { background: #fee4e2; color: #b42318; border-color: #fecdca; }
.p-high { background: #fef0c7; color: #b54708; border-color: #fedf89; }
.p-medium { background: #eff8ff; color: #175cd3; border-color: #b2ddff; }
.p-low { background: #f2f4f7; color: #475467; }
.p-none { color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .p-urgent, .p-high, .p-medium, .p-low { background: transparent; }
}
details.addc summary { cursor: pointer; color: var(--accent); list-style: none; }
details.addc form { display: flex; gap: 6px; margin-top: 6px; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=email], input[type=date], input[type=number], select, textarea {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-width: 0; }
textarea { width: 100%; min-height: 80px; }
button, .btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer; }
button.link { background: none; color: var(--accent); padding: 0; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.ok { color: var(--green); }
.err { color: var(--red); }
.alert { border-left: 4px solid var(--red); }
.notice { border-left: 4px solid var(--amber); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th a { color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.red { color: var(--red); font-weight: 600; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 16px; }
.grid2 label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.checks { display: flex; gap: 10px; flex-wrap: wrap; }
.checks label { flex-direction: row; align-items: center; gap: 4px; color: var(--text); }
pre { white-space: pre-wrap; font-size: 12px; background: var(--bg); padding: 8px; border-radius: 8px; }
.htmx-request { opacity: .6; transition: opacity .2s; }
