:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #1b2430; --muted: #667085; --line: #e3e7ee;
  --accent: #1f3a5f; --accent-text: #ffffff; --bar: #3b6ea8; --warn: #b54708; --warn-bg: #fff4e5;
  --bad: #b42318; --ok: #1a7f4b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c; --card: #1a2029; --text: #e6e9ee; --muted: #98a2b3; --line: #2b3441;
    --accent: #5b8fd0; --accent-text: #0e141b; --bar: #5b8fd0; --warn: #f5a84b; --warn-bg: #2d2412;
    --bad: #f97066; --ok: #5bd197;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; padding: 10px 16px;
  background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top .brand { font-weight: 700; letter-spacing: .02em; margin-right: 8px; }
header.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
header.top nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); }
header.top nav a.on { background: var(--bg); color: var(--text); font-weight: 600; text-decoration: none; }
header.top .right { margin-left: auto; display: flex; gap: 8px; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.35rem; margin: 4px 0 14px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat .l { color: var(--muted); font-size: .85rem; }
.stat .v { font-size: 1.4rem; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { color: var(--muted); font-size: .85rem; }
.stat.bad .v { color: var(--bad); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.row .grow { flex: 1; min-width: 140px; }
.spacer { flex: 1; }
.row select { width: auto; }
button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 7px 12px; border-radius: 8px; }
button:hover, .btn:hover { border-color: var(--muted); text-decoration: none; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--bad); }
button.small { padding: 3px 8px; font-size: .85rem; }
button:disabled { opacity: .6; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--bg); }
.tablewrap { overflow-x: auto; }
.empty { color: var(--muted); padding: 10px 2px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8rem; border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--ok); } .pill.bad { color: var(--bad); } .pill.warn { color: var(--warn); background: var(--warn-bg); }
.muted { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 14px; }
label.f { display: block; font-size: .85rem; color: var(--muted); }
label.f > :last-child { margin-top: 3px; color: var(--text); }
label.f.wide { grid-column: 1 / -1; }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text);
  width: min(640px, calc(100vw - 24px)); padding: 16px; max-height: calc(100vh - 24px); overflow: auto; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.err { color: var(--bad); margin: 8px 0 0; min-height: 1.2em; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 8px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bars .fill { width: 100%; background: var(--bar); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .lab { font-size: .72rem; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.login { max-width: 360px; margin: 14vh auto 0; padding: 0 16px; }
.login h1 { text-align: center; }
.login button { width: 100%; margin-top: 12px; }
footer { color: var(--muted); font-size: .85rem; margin-top: 24px; }
@media (max-width: 600px) { main { padding: 12px; } th, td { padding: 7px 6px; } }
dialog.wide { width: min(860px, calc(100vw - 24px)); }
header.top form.gs { flex: 1; min-width: 150px; max-width: 320px; }
header.top input.gsearch { padding: 5px 10px; }
.entry { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--card); }
.entry.hit { outline: 2px solid var(--accent); }
.eh { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.et { font-weight: 600; margin-top: 6px; }
.txt { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 6px; }
.txt.full { max-height: 70vh; overflow: auto; border-top: 1px dashed var(--line); padding-top: 6px; }
.entry > button.small { margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .85rem; }
.chip.new { border-style: dashed; }
.chip .x { border: 0; background: none; padding: 0 2px; color: var(--bad); font-size: 1rem; line-height: 1; }
.task { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .grow { flex: 1; min-width: 0; }
.task.done .grow > span { text-decoration: line-through; color: var(--muted); }
input.cb { width: 18px; height: 18px; flex: none; padding: 0; }
label.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
label.inline input { width: auto; }
.hitrow { padding: 8px 0; border-bottom: 1px solid var(--line); }
.hitrow:last-child { border-bottom: 0; }
mark { background: var(--warn-bg); color: var(--warn); border-radius: 3px; padding: 0 2px; }
.pill.art { color: var(--accent); border-color: var(--accent); }
a.stat:hover { border-color: var(--muted); }
