:root {
  --bg: #f6f7f9; --panel: #fff; --text: #1c2430; --muted: #657084; --line: #e2e6ec;
  --accent: #2457d6; --accent-ink: #fff;
  --blocker: #c62828; --blocker-bg: #fde8e8; --large: #b26a00; --large-bg: #fff1dc;
  --small: #1c5fb8; --small-bg: #e5effc; --minor: #5a6577; --minor-bg: #eceff3;
  --ok: #1b7f4b; --ok-bg: #e2f5ea; --warn-bg: #fff6d6; --warn: #8a6a00;
}
/* Theme: auto follows the device; [data-theme] (set by theme.js) forces light or dark */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151b; --panel: #1a2029; --text: #e6eaf0; --muted: #94a0b4; --line: #2b3441;
      --accent: #6c9bff; --accent-ink: #0b1220;
      --blocker: #ff8a80; --blocker-bg: #3a1c1c; --large: #ffc470; --large-bg: #3a2a12;
      --small: #8fb8ff; --small-bg: #1b2a44; --minor: #aab4c5; --minor-bg: #272f3b;
      --ok: #6fd69b; --ok-bg: #163324; --warn-bg: #3a3212; --warn: #f2d36b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11151b; --panel: #1a2029; --text: #e6eaf0; --muted: #94a0b4; --line: #2b3441;
      --accent: #6c9bff; --accent-ink: #0b1220;
      --blocker: #ff8a80; --blocker-bg: #3a1c1c; --large: #ffc470; --large-bg: #3a2a12;
      --small: #8fb8ff; --small-bg: #1b2a44; --minor: #aab4c5; --minor-bg: #272f3b;
      --ok: #6fd69b; --ok-bg: #163324; --warn-bg: #3a3212; --warn: #f2d36b;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
.top { display: flex; align-items: center; gap: 16px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; color: var(--text); font-size: 16px; }
nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); } nav a.on { background: var(--bg); color: var(--text); font-weight: 600; }
.spacer { flex: 1; } .who { color: var(--muted); font-size: 13px; }
main { max-width: 1280px; margin: 0 auto; padding: 24px; }
h1 { font-size: 22px; margin: 0 0 16px; } h2 { font-size: 15px; margin: 0 0 10px; } h3 { font-size: 13px; margin: 0 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: 1fr 1fr; } .g-detail { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
@media (max-width: 900px) { .g2, .g-detail { grid-template-columns: 1fr; } main { padding: 12px; } .top { flex-wrap: wrap; padding: 8px 12px; } }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 6px 12px; border-radius: 7px; cursor: pointer; font: inherit; display: inline-block; }
.btn:hover { background: var(--bg); text-decoration: none; } .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); } .btn.danger { color: var(--blocker); } .btn.ghost { border-color: transparent; } .btn.sm { padding: 2px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); width: 100%; }
textarea { min-height: 80px; resize: vertical; } label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 3px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .row > * { width: auto; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; } .filters > * { width: auto; min-width: 120px; }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; } tr.click { cursor: pointer; } tr.click:hover td { background: var(--bg); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.i-blocker { background: var(--blocker-bg); color: var(--blocker); } .i-large_gap { background: var(--large-bg); color: var(--large); }
.i-small_prd_gap { background: var(--small-bg); color: var(--small); } .i-minor_clarification { background: var(--minor-bg); color: var(--minor); }
.s-new { background: var(--small-bg); color: var(--small); } .s-pending { background: var(--warn-bg); color: var(--warn); }
.s-closed { background: var(--ok-bg); color: var(--ok); } .s-reopened { background: var(--blocker-bg); color: var(--blocker); }
.badge { display: inline-block; padding: 0 6px; border-radius: 5px; font-size: 11px; font-weight: 700; background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--blocker-bg); color: var(--blocker); } .badge.good { background: var(--ok-bg); color: var(--ok); }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.overdue { color: var(--blocker); font-weight: 700; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; } .kpi b { font-size: 26px; display: block; }
.matrix td, .matrix th { text-align: center; } .matrix td:first-child, .matrix th:first-child { text-align: left; }
.bar { display: flex; align-items: center; gap: 8px; margin: 4px 0; } .bar span.lbl { width: 56px; color: var(--muted); font-size: 12px; }
.bar i { display: block; height: 14px; background: var(--accent); border-radius: 3px; min-width: 2px; }
.thread .msg { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
.msg.mcp { background: var(--small-bg); } .msg.draft { border-style: dashed; } .msg.accepted { border-color: var(--ok); }
.msg .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.md { overflow-wrap: anywhere; } .md pre { background: var(--bg); padding: 10px; border-radius: 6px; overflow: auto; } .md table { margin: 8px 0; } .md blockquote { border-left: 3px solid var(--line); margin: 6px 0; padding: 2px 12px; color: var(--muted); }
.md :first-child { margin-top: 0; } .md :last-child { margin-bottom: 0; }
.anchor { background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.drift { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; } @media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.tree { max-height: 75vh; overflow: auto; padding: 6px; } .tree .node { display: flex; gap: 4px; align-items: center; padding: 2px 4px; border-radius: 5px; cursor: pointer; }
.tree .node:hover, .tree .node.on { background: var(--bg); } .tree .node.on { font-weight: 600; } .tree .tg { width: 14px; color: var(--muted); flex: none; }
.tree .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; } .kind { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.modalbg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; z-index: 20; overflow: auto; }
.modal { background: var(--panel); border-radius: 12px; padding: 20px; width: 560px; max-width: 100%; border: 1px solid var(--line); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 30; }
#toast.show { opacity: 1; } #toast.err { background: var(--blocker); color: #fff; }
.empty { padding: 28px; text-align: center; color: var(--muted); } .kv { display: grid; grid-template-columns: 96px 1fr; gap: 4px 8px; font-size: 13px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.tl { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 12px; } .tl div { margin-bottom: 6px; font-size: 13px; }
