:root {
  --bg: #fbfbf9; --fg: #1c1c1a; --muted: #75756f; --line: #e4e4de; --soft: #f1f1ec;
  --accent: #26467a; --accent-fg: #fff; --danger: #a33a2e;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141413; --fg: #e8e8e3; --muted: #8e8e86; --line: #2c2c29; --soft: #1d1d1b; --accent: #8fb0e8; --accent-fg: #101418; --danger: #e0786b; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font); font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }

header { display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 52px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
header .brand { font-weight: 600; letter-spacing: -0.01em; }
nav { display: flex; gap: 4px; flex: 1; }
nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 4px; }
nav a:hover { color: var(--fg); }
nav a.on { color: var(--fg); background: var(--soft); }
.who { color: var(--muted); font-size: 13px; display: flex; gap: 12px; align-items: center; }
main { padding: 24px; max-width: 1400px; margin: 0 auto; }
.bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }

.btn { border: 1px solid var(--line); background: transparent; padding: 5px 12px; border-radius: 4px; cursor: pointer; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--danger); }
.btn.link { border: 0; padding: 0; color: var(--muted); }
.btn.link:hover { background: none; color: var(--fg); }
input, select, textarea { border: 1px solid var(--line); background: var(--bg); border-radius: 4px; padding: 6px 8px; width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; min-height: 80px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* login */
.login { max-width: 320px; margin: 18vh auto 0; padding: 0 16px; }
.login h1 { font-size: 20px; margin-bottom: 4px; }
.login form { margin-top: 24px; }
.login .btn { width: 100%; margin-top: 8px; padding: 8px; }
.err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 8px; }

/* board */
.search { width: 220px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.col { background: var(--soft); border-radius: 10px; padding: 10px 10px 6px; min-height: calc(100vh - 150px); transition: box-shadow .12s; }
.col.over { box-shadow: inset 0 0 0 2px var(--accent); }
.col h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 2px 4px 10px; display: flex; align-items: center; gap: 8px; }
.col h3 .count { margin-left: auto; font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.s-doing .dot { background: var(--accent); } .s-review .dot { background: #c98a1b; } .s-done .dot { background: #3d8b5f; }
.cards { min-height: 48px; padding-top: 2px; }
.cards:empty::before { content: "Nothing here"; display: block; text-align: center; color: var(--muted); font-size: 12px; padding: 14px 0; opacity: .7; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin-bottom: 8px; cursor: pointer; user-select: none; box-shadow: 0 1px 2px rgb(0 0 0 / .05); transition: border-color .12s, box-shadow .12s; }
.card:hover { border-color: var(--muted); box-shadow: 0 2px 6px rgb(0 0 0 / .08); }
.card:focus-visible { outline: 2px solid var(--accent); }
.card .t { overflow-wrap: anywhere; }
.card.done .t { color: var(--muted); text-decoration: line-through; }
.card.drag { opacity: .3; }
.card.ghost { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; box-shadow: 0 10px 28px rgb(0 0 0 / .25); cursor: grabbing; }
.grabbing, .grabbing * { cursor: grabbing !important; }
.ph { height: 0; position: relative; }
.ph::after { content: ""; position: absolute; left: 0; right: 0; top: -5px; height: 3px; border-radius: 2px; background: var(--accent); }
.card .meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11px; line-height: 18px; padding: 0 7px; border-radius: 9px; background: var(--soft); color: var(--muted); }
.chip.late { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.add { margin-bottom: 8px; resize: none; min-height: 0; }
.addbtn { display: block; width: 100%; text-align: left; padding: 7px 4px; margin-bottom: 4px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 6px; z-index: 100; }

/* roadmap */
.gantt { border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; position: relative; }
.g-row { display: flex; height: 30px; border-bottom: 1px solid var(--line); }
.g-row:last-child { border-bottom: 0; }
.g-lab { flex: 0 0 220px; position: sticky; left: 0; background: var(--bg); z-index: 2; padding: 5px 10px; border-right: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-trk { position: relative; flex: none; }
.g-head .g-lab, .g-head .g-trk { background: var(--soft); }
.g-head { height: 28px; }
.g-grid { background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); }
.g-month { position: absolute; top: 5px; font-size: 12px; color: var(--muted); padding-left: 6px; }
.g-grp .g-lab { font-weight: 600; background: var(--soft); }
.g-grp .g-trk { background: var(--soft); }
.g-span { position: absolute; top: 13px; height: 3px; background: var(--muted); opacity: .5; }
.g-bar { position: absolute; top: 6px; height: 18px; border-radius: 3px; background: var(--accent); cursor: pointer; min-width: 6px; }
.g-bar.s-todo { background: transparent; border: 1.5px solid var(--accent); }
.g-bar.s-done { background: var(--muted); opacity: .55; }
.g-bar.s-review { background: repeating-linear-gradient(135deg, var(--accent) 0 4px, transparent 4px 8px); border: 1.5px solid var(--accent); }
.g-today { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--danger); z-index: 1; pointer-events: none; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12px; }

/* log + comments */
.entry { border-top: 1px solid var(--line); padding: 18px 0; display: grid; grid-template-columns: 110px 1fr; gap: 16px; }
.entry .date { color: var(--muted); }
.entry h3 { margin-bottom: 4px; }
.body { white-space: pre-wrap; }
.cmts { margin-top: 12px; }
.cmt { padding: 8px 0; border-top: 1px solid var(--line); }
.cmt .who2 { font-size: 12px; color: var(--muted); display: flex; gap: 10px; }
.cmt-form { display: flex; gap: 8px; margin-top: 8px; }
.cmt-form textarea { min-height: 36px; height: 36px; }

/* paper + people */
.list { border: 1px solid var(--line); border-radius: 6px; }
.list > div { display: flex; align-items: center; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.list > div:last-child { border-bottom: 0; }
.list .grow { flex: 1; }
.list select { width: auto; }
.inv { display: grid; grid-template-columns: 1fr 1fr 140px auto; gap: 8px; margin-bottom: 18px; }

dialog { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); width: min(560px, calc(100vw - 32px)); padding: 22px; max-height: 90vh; }
dialog::backdrop { background: rgb(0 0 0 / .35); }
dialog .foot { display: flex; justify-content: space-between; margin: 16px 0; }
.empty { color: var(--muted); padding: 24px 0; }

@media (max-width: 800px) {
  header { gap: 12px; padding: 0 12px; overflow-x: auto; }
  main { padding: 16px 12px; }
  .board { grid-template-columns: 1fr; }
  .col { min-height: 0; }
  .search { width: 140px; }
  .entry { grid-template-columns: 1fr; gap: 4px; }
  .inv { grid-template-columns: 1fr; }
  .g-lab { flex-basis: 120px; }
}
