/* ================= Tokens ================= */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e7eaef;
  --border: #dfe3e9;
  --text: #1b1f24;
  --muted: #5d6673;
  --faint: #8a93a0;
  --accent: #2f6fde;
  --accent-ink: #ffffff;
  --todo: #8a94a3;
  --doing: #2f6fde;
  --done: #1f9d63;
  --danger: #cf3f3f;
  --warn: #b97a06;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --weekend: rgba(16, 24, 40, .045);
  --hue-blue: #2f6fde;
  --hue-amber: #d27d16;
  --hue-green: #1f9d63;
  --hue-purple: #7a52cc;
  --hue-teal: #11928f;
  --hue-rose: #d0466c;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1d2229;
    --surface-3: #262c35;
    --border: #2c333d;
    --text: #e6e9ee;
    --muted: #a3acb8;
    --faint: #76808d;
    --accent: #5b92f0;
    --accent-ink: #0b1220;
    --todo: #7d8794;
    --doing: #5b92f0;
    --done: #3cc085;
    --danger: #ef6b6b;
    --warn: #e0a534;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    --weekend: rgba(255, 255, 255, .035);
    --hue-blue: #5b92f0;
    --hue-amber: #e79a3c;
    --hue-green: #3cc085;
    --hue-purple: #a283e6;
    --hue-teal: #34b8b4;
    --hue-rose: #ec6d90;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1216;
  --surface: #171b21;
  --surface-2: #1d2229;
  --surface-3: #262c35;
  --border: #2c333d;
  --text: #e6e9ee;
  --muted: #a3acb8;
  --faint: #76808d;
  --accent: #5b92f0;
  --accent-ink: #0b1220;
  --todo: #7d8794;
  --doing: #5b92f0;
  --done: #3cc085;
  --danger: #ef6b6b;
  --warn: #e0a534;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  --weekend: rgba(255, 255, 255, .035);
  --hue-blue: #5b92f0;
  --hue-amber: #e79a3c;
  --hue-green: #3cc085;
  --hue-purple: #a283e6;
  --hue-teal: #34b8b4;
  --hue-rose: #ec6d90;
  color-scheme: dark;
}

.hue-blue { --c: var(--hue-blue); }
.hue-amber { --c: var(--hue-amber); }
.hue-green { --c: var(--hue-green); }
.hue-purple { --c: var(--hue-purple); }
.hue-teal { --c: var(--hue-teal); }
.hue-rose { --c: var(--hue-rose); }

/* ================= Base ================= */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  min-height: 100vh;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.wrap { max-width: 1400px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tnum { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ================= Buttons ================= */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

/* ================= Header ================= */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-top: 18px; }
.brand h1 { font-size: 22px; letter-spacing: -.01em; }
.subtitle { color: var(--muted); margin-top: 2px; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px 0 18px; }
.stat { background: var(--surface-2); border-radius: var(--radius); padding: 10px 14px; min-width: 0; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; background: var(--done); border-radius: 99px; }
.stat.alert .v { color: var(--danger); }

.announcement {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 10px 14px; margin: 16px 0 0;
}

/* ================= GitHub reminder & docs ================= */
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: 12px; word-break: break-all; }
.gh-reminder {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--done);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px;
}
.gh-reminder.urgent { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.gh-icon { color: var(--text); display: grid; place-items: center; flex-shrink: 0; }
.gh-text { flex: 1 1 260px; min-width: 0; }
.gh-status { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.gh-actions { display: flex; gap: 6px; flex-wrap: wrap; }
a.btn { text-decoration: none; color: inherit; }
a.btn.btn-primary { color: var(--accent-ink); }
a.badge { text-decoration: none; }
.badge svg { flex-shrink: 0; }
.docs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.docs-grid .phase-card { margin-bottom: 0; }
.docs-grid + .phase-card { margin-top: 14px; }
.docs-steps { margin: 0; padding: 4px 16px 16px 36px; }
.docs-steps li { margin: 6px 0; }
.repo-list { list-style: none; margin: 0; padding: 4px 16px 8px; display: flex; flex-direction: column; gap: 8px; }
.readme-box { margin: 4px 16px 16px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.readme-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; background: var(--surface-2); }
.readme-box pre { margin: 0; padding: 10px 12px; font-size: 12px; line-height: 1.5; overflow-x: auto; white-space: pre-wrap; }
.checklists { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 4px 16px 16px; }
.checklist { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; border-top: 3px solid var(--c); }
.checklist h4 { font-size: 13px; margin-bottom: 4px; }
.checklist .code { color: var(--c); }
.checklist ul, .doc-list { margin: 0; padding-left: 18px; font-size: 13px; }
.checklist li, .doc-list li { margin: 3px 0; }
.doc-sec { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.doc-sec h4 { display: flex; align-items: center; gap: 6px; color: var(--text); }
.doc-sec .linkbox input { background: var(--surface); }

/* ================= Admin bar ================= */
.admin-bar { background: var(--text); color: var(--bg); }
.admin-bar .wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 8px; padding-bottom: 8px; }
.admin-bar .tag { font-weight: 700; letter-spacing: .04em; font-size: 11px; text-transform: uppercase; background: var(--warn); color: #111; padding: 2px 8px; border-radius: 99px; }
.admin-bar .state { font-size: 13px; margin-right: auto; opacity: .9; }
.admin-bar .btn { background: transparent; border-color: color-mix(in srgb, var(--bg) 35%, transparent); color: var(--bg); }
.admin-bar .btn:hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }
.admin-bar .btn-primary { background: var(--bg); color: var(--text); border-color: var(--bg); }
.admin-bar .dirty { color: var(--warn); font-weight: 600; }

/* ================= Toolbar ================= */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; padding-top: 16px; padding-bottom: 12px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.tabs button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 7px; cursor: pointer;
  color: var(--muted); font-weight: 550; white-space: nowrap;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; flex: 1 1 480px; justify-content: flex-end; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); min-width: 0; }
.field.grow { flex: 1 1 200px; max-width: 280px; }
.filters .field:not(.grow) { flex: 0 1 180px; }
.field select, .field input, .form input, .form select, .form textarea {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px;
  padding: 7px 10px; font-size: 14px; color: var(--text); min-width: 0; width: 100%;
}
.field select { min-width: 0; }

main { padding-bottom: 24px; outline: none; }
.loading, .empty-state { color: var(--muted); padding: 40px 0; text-align: center; }

/* ================= Chips & badges ================= */
.chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 22px; padding: 0 6px;
  border-radius: 99px; font-size: 11px; font-weight: 650;
  background: var(--surface-3); color: var(--muted);
  white-space: nowrap;
}
.chip.me { background: var(--accent); color: var(--accent-ink); }
.chip.unassigned { background: transparent; box-shadow: inset 0 0 0 1px var(--border); color: var(--faint); font-weight: 600; font-style: italic; }
.chip.owner { box-shadow: inset 0 0 0 1.5px var(--muted); }
.chip.owner.me { box-shadow: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 99px; white-space: nowrap; }
.badge.late { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.badge.soon { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.info { background: var(--surface-3); color: var(--muted); }
.badge.ok { background: color-mix(in srgb, var(--done) 16%, transparent); color: var(--done); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: var(--surface-3); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.st-todo { --s: var(--todo); }
.st-doing { --s: var(--doing); }
.st-done { --s: var(--done); }
.dot.st-todo, .dot.st-doing, .dot.st-done { background: var(--s); }
.prio { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--danger); }

/* ================= Board ================= */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.col { background: var(--surface-2); border-radius: 12px; padding: 10px; min-width: 0; }
.col-head { display: flex; align-items: center; gap: 8px; font-weight: 650; padding: 4px 6px 10px; }
.col-head .count { margin-left: auto; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.col-body { display: flex; flex-direction: column; gap: 8px; min-height: 60px; border-radius: 8px; transition: background .15s; }
.col-body.drag-over { background: color-mix(in srgb, var(--accent) 10%, transparent); outline: 2px dashed var(--accent); outline-offset: 2px; }
.col .empty { color: var(--faint); font-size: 13px; text-align: center; padding: 18px 0; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--c, var(--border));
  border-radius: 9px; padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.card:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--border)); border-left-color: var(--c); }
.card.dragging { opacity: .45; }
.card.dim { opacity: .5; }
.card-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); min-width: 0; }
.card-top .code { font-weight: 700; color: var(--c); font-variant-numeric: tabular-nums; }
.card-top .grp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-top .prio { margin-left: auto; }
.card h3 { font-size: 14px; font-weight: 600; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.card-foot { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.card-foot select { margin-left: auto; font-size: 12px; padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }

/* ================= Gantt ================= */
.gantt-legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.gantt-legend .sw { width: 14px; height: 10px; border-radius: 3px; display: inline-block; vertical-align: -1px; margin-right: 5px; }
.gantt-legend .spacer { margin-left: auto; }
.gantt-scroll {
  overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}
.gantt { position: relative; width: max-content; min-width: 100%; }
.g-row { display: flex; align-items: stretch; position: relative; z-index: 1; }
.g-row > .g-label, .g-row > .g-track { border-bottom: 1px solid var(--border); }
.g-row:last-child > .g-label, .g-row:last-child > .g-track { border-bottom: 0; }
.g-label {
  position: sticky; left: 0; z-index: 3;
  flex: 0 0 var(--label-w); width: var(--label-w);
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 6px 10px; display: flex; align-items: center; gap: 8px; min-width: 0;
}
.g-label .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.g-label .code { font-weight: 700; color: var(--c); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.g-track { position: relative; flex: 0 0 calc(var(--days) * var(--day-w)); width: calc(var(--days) * var(--day-w)); min-height: 34px; }

.g-head .g-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.g-head, .g-head .g-label { background: var(--surface-2); }
.g-phase {
  position: absolute; top: 5px; bottom: 5px; border-radius: 6px;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c);
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  font-size: 11px; font-weight: 700; padding: 0 8px; display: flex; align-items: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.g-days .g-track { min-height: 40px; }
.g-day {
  position: absolute; top: 0; bottom: 0; width: var(--day-w);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15;
}
.g-day small { font-size: 9px; color: var(--faint); font-weight: 500; }
.g-day.we { color: var(--faint); }
.g-day.today { color: var(--danger); }
.g-day .mon { position: absolute; top: 1px; left: 3px; font-size: 9px; color: var(--accent); font-weight: 700; text-transform: uppercase; }
.g-day.first { padding-top: 8px; }
.g-ms-row .g-track { min-height: 30px; }
.g-ms {
  position: absolute; top: 5px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 11px; font-weight: 700; color: var(--text);
}
.g-ms::before {
  content: ""; width: 10px; height: 10px; transform: rotate(45deg); background: var(--danger); border-radius: 2px;
}
.g-ms span { background: var(--surface-2); padding: 0 4px; border-radius: 4px; }

.g-cat .g-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--c); background: var(--surface); }
.g-cat .g-track { min-height: 28px; }
.g-group { cursor: pointer; }
.g-group .g-label { font-weight: 650; }
.g-group .caret { width: 14px; flex-shrink: 0; color: var(--muted); transition: transform .15s; display: inline-block; text-align: center; }
.g-group.collapsed .caret { transform: rotate(-90deg); }
.g-group .pct { font-size: 12px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.g-sum {
  position: absolute; top: 12px; height: 10px; border-radius: 99px;
  background: color-mix(in srgb, var(--c) 22%, transparent); overflow: hidden;
}
.g-sum > i { display: block; height: 100%; background: var(--c); }
.g-task { cursor: pointer; }
.g-task .g-label { padding-left: 32px; font-size: 13px; }
.g-task:hover .g-label, .g-task:hover { background: var(--surface-2); }
.g-task.dim { opacity: .45; }
.g-bar {
  position: absolute; top: 7px; height: 20px; border-radius: 5px;
  font-size: 11px; font-weight: 650; line-height: 20px; padding: 0 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--s); color: #fff;
}
.g-bar.st-todo { background: color-mix(in srgb, var(--todo) 22%, var(--surface)); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--todo) 70%, transparent); }
.g-bar.late { box-shadow: inset 0 0 0 2px var(--danger); }
.g-bar.st-todo.late { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
.g-bar.me { outline: 2px solid var(--text); outline-offset: 1px; }
.g-bar.locked { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface-3) 6px 12px); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.g-future .g-label { opacity: .7; font-style: italic; }
.g-future-note { position: sticky; left: calc(var(--label-w) + 8px); display: inline-block; padding: 6px 10px; font-size: 12px; color: var(--faint); font-style: italic; }

.g-overlay { position: absolute; top: 0; bottom: 0; left: var(--label-w); width: calc(var(--days) * var(--day-w)); z-index: 0; pointer-events: none; }
.g-overlay .we { position: absolute; top: 0; bottom: 0; width: var(--day-w); background: var(--weekend); }
.g-overlay .ms-line { position: absolute; top: 0; bottom: 0; border-left: 1.5px dashed color-mix(in srgb, var(--danger) 55%, transparent); }
.g-overlay .phase-line { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border); }
.g-overlay .today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); }
.g-overlay .today-line::before { content: "Today"; position: absolute; top: 2px; left: 4px; font-size: 10px; font-weight: 700; color: var(--danger); }

/* ================= Schedule ================= */
.phase-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.phase-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; padding: 14px 16px 10px; border-left: 4px solid var(--c); }
.phase-head .wk { font-size: 12px; font-weight: 700; color: var(--c); text-transform: uppercase; letter-spacing: .04em; }
.phase-head h2 { font-size: 17px; }
.phase-head .range { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.phase-goals { margin: 0; padding: 0 16px 12px 36px; color: var(--muted); }
.gate-note { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 16px 10px; font-size: 13px; color: var(--muted); }
.phase-goals li { margin: 2px 0; }
.ms-note { margin: 0 16px 12px; display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 13px; }
.ms-note::before { content: ""; width: 9px; height: 9px; transform: rotate(45deg); background: var(--danger); border-radius: 2px; flex-shrink: 0; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
table.sched { width: 100%; border-collapse: collapse; font-size: 13px; }
.sched th, .sched td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.sched th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.sched tr:last-child td { border-bottom: 0; }
.sched tbody tr { cursor: pointer; }
.sched tbody tr:hover { background: var(--surface-2); }
.sched .code { font-weight: 700; color: var(--c); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sched .date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sched .deadline { font-weight: 650; }
.sched .who { display: flex; flex-wrap: wrap; gap: 3px; }

/* ================= Team ================= */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.member { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.member.me { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.member-head { display: flex; gap: 10px; align-items: center; min-width: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; color: var(--muted); flex-shrink: 0; font-size: 13px; }
.member.me .avatar { background: var(--accent); color: var(--accent-ink); }
.member-head .who { min-width: 0; }
.member-head h3 { font-size: 15px; }
.member-head .role { font-size: 12px; color: var(--muted); }
.member-stats { display: flex; gap: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.member-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.member ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.member li { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 4px 6px; border-radius: 6px; cursor: pointer; min-width: 0; }
.member li:hover { background: var(--surface-2); }
.member li .code { font-weight: 700; color: var(--c); width: 28px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.member li .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member li .d { color: var(--muted); font-size: 12px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.member-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.member-edit { display: grid; grid-template-columns: 1fr; gap: 6px; }
.member-edit input, .member-edit select { border: 1px solid var(--border); background: var(--surface-2); border-radius: 7px; padding: 5px 8px; font-size: 13px; width: 100%; }

/* ================= Modal ================= */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 20, .5); }
.modal-card {
  position: relative; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px;
}
.modal-x { position: absolute; top: 12px; right: 12px; border: 0; }
.modal-card.wide { width: min(1180px, 100%); }
.assign-wrap { overflow: auto; max-height: calc(100vh - 260px); border: 1px solid var(--border); border-radius: 10px; margin-top: 12px; }
table.assign { border-collapse: separate; border-spacing: 0; font-size: 13px; width: 100%; }
.assign th, .assign td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: center; background: var(--surface); }
.assign thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-size: 12px; white-space: nowrap; }
.assign tfoot th, .assign tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.assign .t { text-align: left; position: sticky; left: 0; z-index: 1; min-width: 240px; max-width: 320px; border-right: 1px solid var(--border); }
.assign thead .t, .assign tfoot .t { z-index: 3; }
.assign .t .code { color: var(--c); margin-right: 4px; }
.assign .grp-row th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--c); background: var(--surface-2); position: sticky; left: 0; }
.assign input[type=checkbox] { width: 17px; height: 17px; cursor: pointer; accent-color: var(--accent); }
.assign td.is-owner { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.assign select { font-size: 12px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); max-width: 110px; }
.assign tbody tr:hover td { background: var(--surface-2); }
.assign td.need { white-space: nowrap; }
.assign td.need input { width: 46px; padding: 3px 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); text-align: center; }
.assign .gap { display: inline-block; min-width: 44px; margin-left: 6px; font-size: 11px; font-weight: 700; text-align: left; }
.assign .gap.ok { color: var(--done); }
.assign .gap.off { color: var(--warn); }
.assign .gap.muted { color: var(--faint); font-weight: 500; }
.assign .plan-warn { margin-left: 10px; color: var(--warn); text-transform: none; letter-spacing: 0; font-weight: 600; }
.assign td.date-cell { white-space: nowrap; }
.assign td.date-cell input { font-size: 12px; padding: 3px 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); }
.assign [data-dur].bad { color: var(--danger); font-weight: 700; }
.assign tbody tr:hover td.is-owner { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.modal h2 { font-size: 19px; padding-right: 36px; }
.detail-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.detail-top .code { font-weight: 700; color: var(--c); }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.detail-grid > div { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.detail-grid .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.detail-grid .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-sec { margin-top: 14px; }
.detail-sec h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.people { display: flex; flex-direction: column; gap: 6px; }
.person { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.person .role { color: var(--muted); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
.modal-actions .left { margin-right: auto; }

.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.form .full { grid-column: 1 / -1; }
.form textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
.assignee-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.assignee-picker label { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; color: var(--text); background: var(--surface-2); border-radius: 7px; padding: 5px 8px; cursor: pointer; font-size: 12px; }
.assignee-picker input { width: auto; }
.form-error { color: var(--danger); font-size: 13px; grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.hint code, .modal code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.linkbox { display: flex; gap: 8px; margin-top: 12px; }
.linkbox input { flex: 1; border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 7px 10px; min-width: 0; }

/* ================= Toast / footer ================= */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 9px; box-shadow: var(--shadow-lg); font-weight: 550;
  max-width: calc(100vw - 32px);
}
.site-footer { color: var(--muted); font-size: 12px; padding-top: 8px; padding-bottom: 28px; display: flex; flex-wrap: wrap; gap: 6px; }

/* ================= Responsive ================= */
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .board { grid-template-columns: 1fr; }
  .docs-grid { grid-template-columns: 1fr; }
  .filters { justify-content: flex-start; }
  .field.grow { flex: 1 1 100%; max-width: none; }
  .field select { min-width: 0; }
  .filters .field:not(.grow) { flex: 1 1 140px; }
}
@media (max-width: 560px) {
  .brand h1 { font-size: 19px; }
  .header-row { padding-top: 14px; }
  #adminBtn { padding: 6px 10px; font-size: 13px; }
  .stats { gap: 8px; }
  .stat { padding: 8px 10px; }
  .stat .v { font-size: 17px; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form { grid-template-columns: 1fr; }
  .assignee-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .modal-card { padding: 18px; }
  .team-grid { grid-template-columns: 1fr; }
  .phase-head .range { margin-left: 0; width: 100%; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 7px 8px; font-size: 13px; }
  .hide-sm { display: none; }
}

@media print {
  .site-header .header-actions, .admin-bar, .toolbar, .site-footer, .modal, .toast { display: none !important; }
  body { background: #fff; }
  .phase-card { break-inside: avoid; }
}
