:root {
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --grid: #ebe9e4;
  --bg: #f6f5f2; --card: #ffffff; --text: #1f2328; --muted: #6a6f76; --line: #dedbd4;
  --accent: #2f6f4f; --accent-text: #ffffff; --warn: #9a5b00; --danger: #b42318;
  --ok-bg: #e9f5ee; --err-bg: #fdecea; --flash: #fff6d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191c; --card: #212428; --text: #e6e6e3; --muted: #9aa0a6; --line: #34383d;
    --accent: #5fb88a; --accent-text: #0f1a14; --warn: #e3a34a; --danger: #f07167;
    --ok-bg: #1d3027; --err-bg: #3a1f1f; --flash: #3a3420;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --grid: #2c3035;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
main.narrow { max-width: 460px; padding-top: 10vh; }
h1 { font-size: 1.4rem; margin: .2em 0 .6em; }
h2 { font-size: 1.05rem; margin: .3em 0; }
code { background: var(--bg); padding: 0 .3em; border-radius: 3px; }
.top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); }
.top .brand { font-weight: 700; color: var(--text); text-decoration: none; }
.todo-badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: var(--accent-text); font-size: .8em; font-weight: 700; line-height: 22px; text-align: center; text-decoration: none; margin-left: -8px; }
.menu-toggle { display: none; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a.on { color: var(--text); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 0 0 14px; }
.card.ok { background: var(--ok-bg); } .card.err { background: var(--err-bg); }
.flash { background: var(--flash); border: 1px solid var(--line); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.flash.err { background: var(--err-bg); }
.bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs a { padding: 6px 12px; border-radius: 6px; text-decoration: none; color: var(--muted); border: 1px solid var(--line); background: var(--card); }
.tabs a.on { color: var(--text); border-color: var(--accent); font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.grow { flex: 1 1 260px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
label { display: block; margin-bottom: 10px; }
label.check { display: flex; gap: 6px; align-items: center; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; margin-top: 3px; }
input[type=checkbox] { width: auto; margin: 0; }
textarea { resize: vertical; }
.reply-text { margin-top: 8px; }
button, .btn { font: inherit; display: inline-block; text-decoration: none; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); border-radius: 6px; padding: 7px 14px; }
button.secondary, .btn.secondary { background: transparent; color: var(--accent); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; }
button.link.danger { color: var(--danger); }
form.inline { display: inline; }
.hidden { display: none; }
.hint { display: block; font-size: .85em; color: var(--muted); margin-top: 3px; }
.muted { color: var(--muted); } .small { font-size: .88em; }
.meta { font-size: .85em; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { display: inline-block; font-size: .8em; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.post h2 a { color: var(--text); text-decoration: none; }
.post h2 a:hover { text-decoration: underline; }
.body { white-space: normal; background: var(--bg); padding: 8px 10px; border-radius: 6px; margin-top: 4px; max-height: 300px; overflow: auto; overflow-wrap: anywhere; }
/* Queue: what was written (left) next to what you'll write (right) */
.post-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.post-read { min-width: 0; }
.post-read .body { max-height: 16em; font-size: .95em; }
.post-write { min-width: 0; border-left: 1px solid var(--line); padding-left: 20px; }
.col-label { font-size: .75em; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.post-write .reply-text { margin-top: 6px; }
.row.tight { margin-top: 0; }
.claude-note { background: var(--bg); padding: 6px 10px; border-radius: 6px; }
@media (max-width: 760px) {
  .post-cols { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .post-write { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; }
}
.suggestions div { margin-top: 4px; }
table.list { width: 100%; border-collapse: collapse; background: var(--card); margin-bottom: 14px; }
table.list th, table.list td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: .85em; color: var(--muted); font-weight: 600; }
table.list .num { text-align: right; width: 1%; white-space: nowrap; }
table.list tr.off td { opacity: .55; }
table.list input[name$="[notes]"] { margin: 0; padding: 4px 6px; }
.cloud { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; }
.pager a { padding: 3px 9px; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; }
.pager a.on { border-color: var(--accent); font-weight: 600; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  table.list { display: block; overflow-x: auto; }
}

/* Claude worklog chart */
.wl-wrap { position: relative; overflow-x: auto; }
.worklog { display: block; width: 100%; min-width: 520px; height: auto; font: 12px system-ui, sans-serif; }
.wl-grid { stroke: var(--grid); stroke-width: 1; }
.wl-base { stroke: var(--line); stroke-width: 1; }
.wl-axis { fill: var(--muted); font-size: 11px; }
.wl-label { fill: var(--text); font-size: 12px; font-weight: 600; }
.wl-arrived { fill: var(--s1); }
.wl-handled { fill: var(--s2); }
.wl-waiting { fill: none; stroke: var(--s3); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.wl-waiting-dot { fill: var(--s3); stroke: var(--card); stroke-width: 2; }
.wl-run { fill: var(--muted); }
.wl-hit { fill: transparent; cursor: crosshair; }
.wl-hit:hover { fill: color-mix(in srgb, var(--text) 6%, transparent); }
.wl-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 4px; color: var(--muted); }
.wl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.key.line { height: 2px; width: 14px; border-radius: 1px; }
.key.run { width: 0; height: 0; border-radius: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid var(--muted); }
.wl-k-arrived { background: var(--s1); } .wl-k-handled { background: var(--s2); } .wl-k-waiting { background: var(--s3); }
.wl-tip { position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.12); white-space: nowrap; z-index: 2; }
.wl-tip b { display: block; margin-bottom: 2px; }
.wl-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* Phone menu (kept last so it overrides the desktop nav) */
@media (max-width: 760px) {
  .menu-toggle { display: inline-block; margin-left: auto; background: transparent; color: var(--text); border-color: var(--line); padding: 5px 12px; }
  .top nav { display: none; flex-basis: 100%; flex-direction: column; gap: 0; }
  .top.menu-open nav { display: flex; }
  .top nav a { padding: 10px 2px; border-top: 1px solid var(--line); font-size: 1.05em; }
}
