:root {
  --bg: #f4f1ec; --panel: #fffdf9; --ink: #1f1c18; --muted: #6f675d; --line: #e2dbd0;
  --accent: #b4542c; --accent-ink: #fff; --col: #ebe5db; --danger: #a33;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17150f; --panel: #221f19; --ink: #ece6dc; --muted: #a69d90; --line: #3a352c;
    --accent: #e0784a; --accent-ink: #1a120c; --col: #1d1a15; --danger: #e77;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }

header.top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .02em; }
.brand span { color: var(--accent); }
nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
nav.tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); }
nav.tabs button.on { background: var(--col); color: var(--ink); font-weight: 600; }
.who { margin-left: auto; color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; }
.link-btn { border: 0; background: none; color: var(--muted); cursor: pointer; text-decoration: underline; padding: 0; }

main { padding: 20px; max-width: 1280px; margin: 0 auto; }
.bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.bar h2 { margin: 0 auto 0 0; font-size: 20px; }
.btn { border: 1px solid var(--line); background: var(--panel); padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--danger); }
input[type=search], input[type=text], input[type=url], input[type=date], input[type=password], textarea, select {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 10px; width: 100%;
}
input[type=search] { width: 220px; }

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.col { background: var(--col); border-radius: 12px; padding: 10px; min-height: 120px; }
.col h3 { margin: 2px 4px 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; }
.col.over { outline: 2px dashed var(--accent); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: pointer; }
.card[draggable=true] { cursor: grab; }
.card h4 { margin: 0 0 4px; font-size: 15px; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.pill { background: var(--col); border-radius: 99px; padding: 1px 8px; }
.pill.late { color: var(--danger); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.grid .card { cursor: pointer; }
.card p.sum { margin: 4px 0 6px; color: var(--muted); font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.empty { color: var(--muted); padding: 30px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); padding: 0; width: min(640px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog form { padding: 18px 20px; display: grid; gap: 10px; }
dialog label { font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
dialog .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
dialog .actions .btn.danger { margin-right: auto; }
dialog textarea { min-height: 160px; resize: vertical; }
.view { padding: 18px 20px; }
.view h3 { margin-top: 0; }
.md { line-height: 1.6; }
.md pre { background: var(--col); padding: 10px; border-radius: 8px; overflow: auto; }
.md code { background: var(--col); padding: 1px 4px; border-radius: 4px; }
.foot { font-size: 12px; color: var(--muted); margin-top: 8px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: min(360px, 100%); display: grid; gap: 12px; box-shadow: var(--shadow); }
.login h1 { margin: 0 0 6px; font-size: 22px; }
.err { color: var(--danger); font-size: 14px; min-height: 1.2em; }

@media (max-width: 760px) {
  header.top { padding: 10px 16px; }
  main { padding: 16px; }
  .board { grid-template-columns: 1fr; }
  input[type=search] { width: 100%; }
  dialog .row { grid-template-columns: 1fr; }
}
