:root {
  --bg: #f5f6f8; --panel: #fff; --text: #1c2230; --muted: #6b7385; --line: #e3e6ec;
  --brand: #0b5fff; --brand-ink: #fff; --ok: #137a3f; --ok-bg: #e5f6ec; --err: #b3261e; --err-bg: #fdecea;
  --warn: #b25e00; --radius: 10px;
  --st-0: #e8edff; --st-1: #fff1d6; --st-2: #e0f4f7; --st-3: #efe6ff; --st-4: #dff5e6; --st-5: #fde4e4; --st-6: #eef0f3; --st-7: #ffe9f3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151c; --panel: #1a1f29; --text: #e8ebf2; --muted: #98a1b3; --line: #2b3240;
    --brand: #5b8cff; --brand-ink: #0b1020; --ok: #6fd69a; --ok-bg: #16301f; --err: #ff8a80; --err-bg: #3a1c1a; --warn: #ffb866;
    --st-0: #1f2b4d; --st-1: #3a2f14; --st-2: #14343a; --st-3: #2d2250; --st-4: #153322; --st-5: #3d1d1d; --st-6: #262b36; --st-7: #3d1a2c;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: .5rem 0 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.right { text-align: right; }
.break { word-break: break-all; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }

.top { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { color: var(--text); font-weight: 500; }
.brand b { color: var(--brand); }
.brand.big { font-size: 1.4rem; margin-bottom: 1rem; text-align: center; }
.top nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.top nav a { color: var(--muted); padding: .35rem .7rem; border-radius: 8px; }
.top nav a:hover { background: var(--bg); text-decoration: none; }
.top nav a.on { color: var(--text); background: var(--bg); font-weight: 600; }
.who { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.imp-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .5rem 1rem; background: #ffe58a; color: #3b2f00; font-size: .9rem; }
main { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

.btn { display: inline-block; font: inherit; padding: .5rem .95rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.wa { background: #1faa59; border-color: #1faa59; color: #fff; font-weight: 600; }
.btn.sm { padding: .25rem .65rem; font-size: .85rem; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; }
button.link.danger { color: var(--err); }

input, select, textarea { width: 100%; font: inherit; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
textarea { resize: vertical; }
label { display: block; font-size: .85rem; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: .25rem; color: var(--text); }
input[type="number"].pos { width: 5rem; }

.row { display: flex; gap: .6rem; align-items: center; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 12rem; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.stack > .row { margin: 0; }
.narrow { max-width: 520px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }
.grid2.wide-left { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; color: var(--text); display: flex; flex-direction: column; }
.card:hover { text-decoration: none; border-color: var(--muted); }
.card .n { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.card.warn .n { color: var(--warn); }

.flash { padding: .65rem .9rem; border-radius: 8px; margin-bottom: 1rem; word-break: break-word; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); }
.panel .tbl { background: none; }
.tbl th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.tbl th, .tbl td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.filters { display: flex; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 14rem; width: auto; }
.filters select { width: auto; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { display: flex; justify-content: space-between; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--line); }

.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--st-6); }
.st-0 { background: var(--st-0); } .st-1 { background: var(--st-1); } .st-2 { background: var(--st-2); } .st-3 { background: var(--st-3); }
.st-4 { background: var(--st-4); } .st-5 { background: var(--st-5); } .st-6 { background: var(--st-6); } .st-7 { background: var(--st-7); }

.board { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.col { flex: 0 0 260px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; }
.col.over { outline: 2px dashed var(--brand); }
.col > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.drop { min-height: 60px; display: flex; flex-direction: column; gap: .5rem; }
.kcard { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .65rem; cursor: grab; }
.kcard.dragging { opacity: .4; }
.kcard a { font-weight: 600; color: var(--text); }

.task { display: flex; gap: .6rem; align-items: flex-start; padding: .4rem 0; }
.task .check { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 6px; border: 2px solid var(--muted); background: none; color: var(--ok); cursor: pointer; line-height: 1; padding: 0; font-weight: 700; }
.task.done > span { text-decoration: line-through; color: var(--muted); }
.late { color: var(--err); font-weight: 600; }

.timeline { list-style: none; padding: 0; margin: 1rem 0 0; }
.timeline li { border-left: 3px solid var(--line); padding: .15rem 0 .8rem .8rem; }
.timeline .meta { font-size: .8rem; color: var(--muted); }
.timeline .t-stage { border-color: #8e6bff; } .timeline .t-lead { border-color: #1faa59; } .timeline .t-note { border-color: var(--brand); }
.quote { border-left: 3px solid var(--line); margin: 0 0 .75rem; padding-left: .75rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .9rem; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

body.guest { display: grid; place-items: center; min-height: 100vh; }
.guest-box { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.75rem; margin: 1rem; }

@media (max-width: 640px) {
  .top { gap: .5rem; }
  .who { width: 100%; justify-content: flex-end; }
  .col { flex-basis: 78vw; }
}
