/* Tokens follow trade-review/DESIGN-LANGUAGE.md (dark default, light option). */
:root, html[data-theme="dark"] {
  --bg: #15191f; --surface: #1d232b; --surface-2: #29313c; --border: #353e4a;
  --text: #ecf0f5; --text-2: #aeb8c5;
  --accent: #89b5ff; --accent-text: #89b5ff; --accent-ink: #132947; --accent-soft: #263c58;
  --warn: #e9bf75; --info: #8fbaff; --success: #80d8b0; --danger: #ff9aab;
  --r-sm: 4px; --r-md: 8px; --r-lg: 16px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --font-code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f3f5f7; --surface: #fcfdfd; --surface-2: #edf1f6; --border: #dce2e9;
  --text: #202a36; --text-2: #606c7b;
  --accent: #215bb8; --accent-text: #215bb8; --accent-ink: #fcfdfd; --accent-soft: #e5edfa;
  --warn: #795913; --info: #2166bb; --success: #24694d; --danger: #b72c40;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.55;
  font-variant-numeric: tabular-nums lining-nums; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .small { font-size: 12px; }
.muted { color: var(--text-2); }
.grow { flex: 1; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); padding: 6px 12px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; }
select, input[type=password], input.link { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px 10px; }

.top { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.top form { margin: 0; }
.brand { font-weight: 700; color: var(--text); font-size: 16px; }
.banner { font-size: 12px; color: var(--warn); border: 1px solid var(--warn); border-radius: var(--r-sm); padding: 0 8px; }

.board-wrap { padding: 12px 16px 24px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.seg label { padding: 6px 12px; cursor: pointer; background: var(--surface); }
.seg label.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.seg input { display: none; }
.seg small { color: var(--text-2); }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); }

.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; scroll-snap-type: x proximity; }
.col { flex: 0 0 280px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px; max-height: calc(100vh - 140px); display: flex; flex-direction: column; scroll-snap-align: start; }
.col h2 { font-size: 14px; margin: 2px 4px 10px; display: flex; align-items: center; gap: 6px; }
.count { color: var(--text-2); font-weight: 500; font-size: 12px; background: var(--surface-2); border-radius: 999px; padding: 0 8px; }
.cards { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-2); display: inline-block; flex: none; }
.t-started .dot { background: var(--accent); }
.t-completed .dot { background: var(--success); }
.t-canceled .dot, .t-duplicate .dot { background: var(--border); }
.t-unstarted .dot { background: var(--warn); }
.tile { display: block; background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-md); padding: 8px 10px; color: var(--text); }
.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile-top { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.tile-title { margin: 4px 0 6px; font-size: 14px; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
.tile-meta { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12px; }
.ident { font-family: var(--font-code); font-size: 12px; color: var(--text-2); }
.ident.big { font-size: 14px; }
.prio { font-size: 12px; padding: 0 6px; border-radius: var(--r-sm); background: var(--surface); }
.prio.p1 { color: var(--danger); font-weight: 600; }
.prio.p2 { color: var(--warn); }
.due { font-size: 12px; color: var(--text-2); }
.label { font-size: 12px; padding: 0 6px; border-radius: var(--r-sm); border: 1px solid var(--border); color: var(--text-2); }
.who { font-size: 12px; padding: 0 6px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-text); }
.who.stale { background: transparent; color: var(--warn); border: 1px solid var(--warn); }
.kids { font-size: 12px; color: var(--text-2); }
.empty { color: var(--text-2); font-size: 12px; margin: 4px; }

.card-wrap { max-width: 1120px; margin: 0 auto; padding: 16px; }
.crumbs { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.card-ids { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.status { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
h1 { font-size: 24px; line-height: 1.35; margin: 8px 0 12px; word-break: keep-all; overflow-wrap: anywhere; }
h3 { font-size: 14px; margin: 20px 0 8px; color: var(--text-2); }
.linkrow { display: flex; gap: 8px; margin-bottom: 12px; }
.linkrow .link { flex: 1; min-width: 0; font-family: var(--font-code); font-size: 13px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 16px; margin: 0 0 8px; }
.facts div { display: flex; gap: 8px; }
.facts dt { color: var(--text-2); min-width: 56px; }
.facts dd { margin: 0; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.card-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }
.body, .side { min-width: 0; }
.side { border-left: 1px solid var(--border); padding-left: 16px; }
.md { overflow-wrap: anywhere; }
.md pre { background: var(--surface-2); padding: 10px; border-radius: var(--r-md); overflow-x: auto; }
.md code { font-family: var(--font-code); font-size: 13px; background: var(--surface-2); padding: 0 4px; border-radius: var(--r-sm); }
.md pre code { padding: 0; background: none; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 4px 8px; }
.md img { max-width: 100%; }
.md blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--border); color: var(--text-2); }
.comment { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px 12px; margin-bottom: 8px; }
.comment.reply { margin-left: 24px; }
.comment-head { font-size: 13px; }
.comment:target { border-color: var(--accent); }
ul.rel, ul.plain, ol.hist { padding-left: 18px; margin: 0; font-size: 13px; }
ul.rel li, ol.hist li { margin-bottom: 4px; }

body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px; }
.box label { display: flex; flex-direction: column; gap: 6px; }
.box input[type=password], .box select { font-size: 16px; }
.box .row { display: flex; gap: 8px; justify-content: flex-end; }
.error { color: var(--danger); margin: 0; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border); padding: 8px 14px; border-radius: var(--r-md); }

@media (max-width: 820px) {
  .card-grid { grid-template-columns: 1fr; }
  .side { border-left: none; padding-left: 0; border-top: 1px solid var(--border); }
  .col { flex-basis: 84vw; }
  .linkrow { flex-direction: column; }
}
