:root {
  --sidebar: #1c1d21;
  --sidebar-text: #f4f5f7;
  --sidebar-muted: #9aa0ab;
  --sidebar-hover: #2a2c32;
  --bg: #f3f4f7;
  --surface: #ffffff;
  --text: #1e2128;
  --mute: #646a75;
  --line: #e6e8ee;
  --accent: #5b4dff;
  --accent-soft: #ecebff;
  --ink: #ffffff;
  --ink-2: #f3f4f7;
  --panel: #ecebff;
  --rule: #e6e8ee;
  --paper: #1e2128;
  --copper: #5b4dff;
  --copper-2: #7a6dff;
  --sage: #00c875;
  --wine: #e2445c;
  --gold: #fdab3d;
  --sky: #579bfc;
  --shadow: 0 10px 30px rgba(28, 29, 33, 0.08);
  --sans: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --serif: var(--sans);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

#app {
  display: grid;
  grid-template-columns: var(--rail-width, 248px) 1fr;
  height: 100%;
  min-height: 0;
}

.rail {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
  min-width: 0;
}
.rail-resize {
  position: absolute; top: 0; right: -3px; width: 8px; height: 100%;
  cursor: col-resize; z-index: 6;
}
.rail-resize:hover, body.is-resizing-rail .rail-resize { background: rgba(91, 77, 255, 0.35); }
body.is-resizing-rail { cursor: col-resize; user-select: none; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px; flex: 0 0 auto; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; overflow: hidden;
  background: #5b4dff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.brand-mark img, .brand-mark svg { width: 32px; height: 32px; display: block; }
.brand-name { font-size: 18px; font-weight: 700; line-height: 1; color: var(--sidebar-text); white-space: nowrap; letter-spacing: -0.02em; }
.brand-sub { color: var(--sidebar-muted); font-size: 11px; margin-top: 3px; }

.views { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; }
.nav-btn {
  appearance: none; border: 0; background: transparent; color: var(--sidebar-text);
  text-align: left; padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font: inherit; font-size: 13px;
}
.nav-btn.is-active { background: var(--sidebar-hover); }
.nav-btn:hover { background: var(--sidebar-hover); }
.nav-btn[data-view="space"] { margin-top: 6px; }

.rail-label {
  color: var(--sidebar-muted); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0 10px; flex: 0 0 auto;
}
.space-progress { display: flex; align-items: center; gap: 6px; min-width: 0; }
.progress-bar {
  display: flex; height: 5px; width: 52px; flex: 0 0 52px;
  background: #3a3d45; border-radius: 99px; overflow: hidden;
}
.group-head .progress-bar { background: #e6e8ee; width: 64px; flex-basis: 64px; }
.progress-done { background: #00c875; }
.progress-active { background: #fdab3d; }
.progress-rest { background: transparent; }
.progress-pct { font-size: 11px; color: var(--sidebar-muted); font-variant-numeric: tabular-nums; font-weight: 650; }
.group-head .progress-pct { color: var(--mute); }
.status-pick {
  appearance: none; border: 0; border-radius: 999px; font: inherit;
  font-size: 11px; font-weight: 650; cursor: pointer; width: auto; max-width: 168px;
  padding: 4px 22px 4px 10px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path fill='%23555' d='M0 0l5 6 5-6z'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center;
}
.drawer .status-pick { width: auto; display: inline-block; }
.assign-wrap { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.assign-pick {
  appearance: none; border: 0; border-radius: 999px; font: inherit;
  font-size: 11px; font-weight: 650; width: 112px; max-width: 148px;
  padding: 4px 10px; background: #e6e8ee; color: var(--text);
}
.assign-pick.is-filled { background: #d6e8ff; color: #163a5f; }
.assign-me {
  appearance: none; border: 0; background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; font: inherit; font-size: 11px; font-weight: 650;
  padding: 4px 8px; cursor: pointer;
}
.assign-me:hover { background: var(--accent); color: #fff; }
.drawer .assign-drawer { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.drawer .assign-drawer input { margin-top: 0; flex: 1; }
#ticket-assign-me { width: auto; margin-top: 8px; }
.swatch { width: 8px; height: 8px; border-radius: 99px; flex: 0 0 auto; }

.rail-foot { flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.rail-foot .btn { color: var(--sidebar-text); border-color: #3a3d45; }
.rail-foot .btn.ghost:hover { background: var(--sidebar-hover); }
.hint { color: var(--mute); font-size: 12px; line-height: 1.45; margin: 8px 0 0; }

.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 8px 12px; cursor: pointer; font: inherit; font-size: 13px;
}
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 650; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--wine); border-color: rgba(226, 68, 92, 0.35); }

.stage { padding: 22px 28px 40px; min-width: 0; min-height: 0; background: var(--bg); height: 100%; overflow: auto; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; }
.topbar h1 { font-weight: 700; font-size: 28px; margin: 0; letter-spacing: -0.03em; }
.caption { color: var(--mute); margin: 6px 0 0; font-size: 13px; }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
#search {
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 12px; width: 240px; font: inherit;
}
.toggle { color: var(--mute); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.user-menu { display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--line);
  background: var(--surface); border-radius: 999px; padding: 4px 10px 4px 4px;
  font: inherit; color: var(--text); cursor: pointer;
}
.user-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 99px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  overflow: hidden; flex: 0 0 auto;
}
.user-avatar.has-photo, .account-avatar.has-photo { background: #dfe2ea; }
.user-avatar img, .account-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.account-photo {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin: 4px 0 8px; text-align: center;
}
.account-avatar {
  width: 96px; height: 96px; border-radius: 99px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: 36px; font-weight: 700;
  overflow: hidden;
}
.account-meta { min-width: 0; }
#account-name { font-weight: 700; font-size: 16px; }
#account-username { margin: 4px 0 0; }
.account-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#account-file { display: none; }

.stats { display: flex; gap: 8px; margin: 18px 0 16px; flex-wrap: wrap; }
.space-dash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
  margin: 0 0 16px;
  box-shadow: var(--shadow);
}
.space-dash[hidden] { display: none; }
.space-dash-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.space-dash-head { display: flex; gap: 10px; align-items: center; min-width: 0; }
.space-dash-edit { flex: 0 0 auto; }
.space-dash-head > div { min-width: 0; flex: 1; }
.space-dash-head .swatch { width: 12px; height: 12px; flex: 0 0 auto; }
.space-dash-label {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute);
}
.space-dash-name { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-dash-priority { color: var(--mute); font-size: 12px; margin-top: 3px; }
.space-dash-priority-fact b { color: var(--accent); }
.space-dash-meter { display: flex; align-items: center; gap: 12px; min-width: 0; }
.space-dash-pct {
  font-size: 18px; font-weight: 750; letter-spacing: -0.02em; line-height: 1;
  flex: 0 0 auto; font-variant-numeric: tabular-nums; color: var(--text);
}
.space-dash-bar { flex: 1; min-width: 0; height: 10px; width: auto; background: #e6e8ee; }
.space-dash-facts { display: flex; gap: 20px; flex-wrap: wrap; }
.space-dash-facts div { min-width: 72px; }
.space-dash-facts b { display: block; font-size: 18px; }
.space-dash-facts span {
  color: var(--mute); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
}
.space-ranks {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  min-width: 0;
}
.space-ranks-label {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute);
  margin-bottom: 8px;
}
.space-ranks-list {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.space-rank-chip {
  appearance: none; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  display: flex; align-items: center; gap: 8px; max-width: 100%;
  border-radius: 999px; padding: 6px 10px 6px 8px; cursor: pointer; font: inherit;
}
.space-rank-chip:hover, .space-rank-chip.is-active {
  border-color: var(--accent); background: var(--accent-soft);
}
.space-rank-n {
  min-width: 18px; font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--accent);
}
.space-rank-name { font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.space-rank-chip .swatch { width: 8px; height: 8px; flex: 0 0 auto; }
.space-ranks-hint { color: var(--mute); font-size: 12px; margin: 8px 0 0; }
.task-ranks-list {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
}
.task-rank-chip { cursor: grab; }
.task-rank-chip.is-dragging { opacity: 0.45; }
.task-rank-chip .space-rank-name { max-width: 140px; }
@media (max-width: 900px) {
  .space-dash { grid-template-columns: 1fr; }
}
.stat {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-width: 88px;
  background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.stat:hover, .stat.is-active { border-color: var(--accent); background: var(--accent-soft); }
.stat b { display: block; font-size: 18px; }
.stat span { color: var(--mute); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }

.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.cal-toolbar .btn { padding: 8px 12px; min-width: 40px; }
.cal-toolbar .btn.is-active, .btn.ghost.is-active {
  background: var(--accent-soft); border-color: var(--accent);
}
.cal-title { font-size: 18px; font-weight: 650; margin: 0 10px 0 4px; flex: 1; min-width: 160px; }
.cal-toolbar .stat { margin-left: auto; }

.calendar {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface);
}
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekdays div {
  padding: 8px 6px; text-align: center; color: var(--mute);
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
.cal-day {
  min-height: 108px; padding: 6px; border-top: 1px solid var(--line);
  border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px;
}
.cal-grid .cal-day:nth-child(7n+1) { border-left: 0; }
.calendar.is-week .cal-day { min-height: 280px; }
.cal-day.is-outside { opacity: 0.42; }
.cal-day.is-today { background: var(--accent-soft); }
.cal-day.is-selected { box-shadow: inset 0 0 0 1px var(--accent); }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cal-num {
  appearance: none; border: 0; background: transparent; color: inherit;
  font: inherit; font-size: 12px; width: 26px; height: 26px; border-radius: 99px; cursor: pointer;
}
.cal-day.is-today .cal-num { background: var(--accent); color: #fff; font-weight: 700; }
.cal-add {
  appearance: none; border: 0; background: transparent; color: var(--mute);
  cursor: pointer; border-radius: 6px; width: 22px; height: 22px; font-size: 14px; line-height: 1;
}
.cal-add:hover { background: var(--bg); color: var(--text); }
.cal-events { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-event {
  display: block; width: 100%; text-align: left; border: 0; cursor: pointer; font: inherit;
  font-size: 11px; line-height: 1.3; padding: 3px 7px 3px 8px; border-radius: 6px;
  color: var(--text); background: color-mix(in srgb, var(--event, var(--accent)) 18%, #fff);
  box-shadow: inset 3px 0 0 var(--event, var(--accent));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-event.is-due { box-shadow: inset 3px 0 0 var(--gold); }
.cal-event.is-selected { outline: 1px solid var(--accent); }
.cal-event.status-done { opacity: 0.55; text-decoration: line-through; }
.cal-event.status-abandoned { opacity: 0.55; text-decoration: line-through; }
.cal-more {
  appearance: none; border: 0; background: transparent; color: var(--mute);
  font: inherit; font-size: 11px; text-align: left; cursor: pointer; padding: 2px 4px;
}
.queued-chip { color: #163a5f; background: #d6e8ff; }
.cal-day.is-project-plan { background: rgba(0, 200, 117, 0.08); }
.queue-banner {
  border: 1px solid #ffe0a3; background: #fff6e5;
  border-radius: 10px; padding: 10px 12px; color: #8a5a00; font-size: 13px;
}
.dep-picker { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 12px; }
.dep-search { width: 100%; margin: 0; }
.dep-group { display: flex; flex-direction: column; gap: 6px; }
.dep-group-label {
  color: var(--accent); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
}
.dep-pick { display: flex; flex-direction: column; gap: 6px; margin: 0; max-height: none; overflow: visible; }
.dep-option { display: flex; gap: 8px; align-items: flex-start; color: var(--text); font-size: 13px; }
.dep-option input { width: auto; margin-top: 3px; flex: 0 0 auto; }
.dep-option-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.dep-option-title { color: var(--text); line-height: 1.3; }
.dep-option-meta { color: var(--mute); font-size: 11px; line-height: 1.3; }
.dep-option[data-depth="1"] { padding-left: 16px; }
.dep-option[data-depth="2"] { padding-left: 32px; }
.dep-option[data-depth="3"] { padding-left: 48px; }
.dep-option[data-depth="4"] { padding-left: 64px; }
.dep-browse, .dep-cluster {
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: var(--bg);
}
.dep-browse > summary, .dep-cluster > summary {
  cursor: pointer; color: var(--text); font-size: 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.dep-browse > summary { color: var(--mute); font-size: 12px; letter-spacing: 0.06em; }
.dep-branch-count { color: var(--mute); font-size: 11px; }
.dep-browse-body, .dep-cluster-body {
  display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 260px; overflow: auto;
}
.dep-section { margin: 14px 0 8px; }
.dep-section h3 { margin: 0 0 4px; }
.dep-xblock {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0 12px;
  background: var(--bg);
}
.dep-xhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.dep-xhead strong { color: var(--text); font-size: 13px; }
.dep-xadd { margin: 4px 0 12px; }
.queue-block { margin: 8px 0 36px; }
.queue-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.queue-head h3 { font-size: 22px; margin: 0; font-weight: 700; }
.dep-panel { margin: 0 0 18px; }
.dep-empty {
  border: 1px dashed #cdcfe4; border-radius: 14px;
  padding: 18px 16px; color: var(--mute); background: var(--surface);
}
.dep-empty strong { display: block; color: var(--accent); font-size: 15px; margin-bottom: 6px; }
.dep-empty p { margin: 0; font-size: 13px; line-height: 1.45; }
.queue-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 8px; }
.queue-lists .list { max-height: 240px; overflow: auto; padding-right: 4px; }
.queue-lists h4, .queue-block h4 { margin: 0 0 8px; color: var(--mute); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.dep-graph {
  position: relative; overflow: auto; min-height: 180px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 10px 12px;
}
.dep-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.dep-edges path { fill: none; stroke: rgba(91, 77, 255, 0.55); stroke-width: 1.6; }
.dep-cols { display: flex; gap: 28px; align-items: flex-start; position: relative; z-index: 1; padding: 8px 4px 16px; }
.dep-col { min-width: 210px; display: flex; flex-direction: column; gap: 10px; }
.dep-col-label { color: var(--mute); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
.dep-node {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; color: inherit; font: inherit; cursor: pointer; width: 210px;
}
.dep-node strong { font-size: 13px; }
.dep-node span, .dep-node em { color: var(--mute); font-size: 11px; font-style: normal; }
.dep-node.is-queued { border-color: var(--sky); }
.dep-node.status-done { opacity: 0.6; }
.dep-node.status-abandoned { opacity: 0.6; }
.dep-node.is-selected, .dep-node:hover { border-color: var(--accent); }

.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(180px, 1fr));
  gap: 12px;
  align-items: start;
}
.column {
  background: #eceef3;
  border: 0;
  border-radius: 12px;
  min-height: 52vh;
  padding: 10px;
}
.column h3 {
  margin: 0 0 12px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute);
  font-weight: 700;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.card:hover { border-color: var(--accent); }
.card h4 { margin: 0 0 8px; font-size: 14px; font-weight: 600; line-height: 1.35; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 11px; border-radius: 999px; padding: 2px 8px;
  background: #eef0f4; color: var(--mute); font-weight: 650;
}
.chip-backlog { color: #3d4148; background-color: #e6e8ee; }
.chip-doing { color: #7a4b00; background-color: #ffe3b0; }
.chip-deferred { color: #3b2d86; background-color: #e3dcff; }
.chip-blocked { color: #7a1028; background-color: #ffd2d9; }
.chip-done { color: #0b5c38; background-color: #c9f5e4; }
.chip-abandoned { color: #3a3144; background-color: #e4dce8; }
.prio-0 { color: #7a1028; background: #ffd2d9; }
.prio-1 { color: #7a4b00; background: #ffe3b0; }
.prio-2 { color: #163a5f; background: #d6e8ff; }
.prio-3 { color: #3d4148; background: #e6e8ee; }
.status-done { outline: 1px solid rgba(0, 200, 117, 0.35); }
.status-abandoned { outline: 1px solid rgba(90, 70, 110, 0.28); }
.card.status-abandoned { opacity: 0.78; }
.status-blocked { outline: 1px solid rgba(226, 68, 92, 0.35); }

.home-dash {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.home-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px 10px;
  min-width: 0;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.home-panel.is-alert { border-color: rgba(226, 68, 92, 0.28); }
.home-panel-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex: 0 0 auto;
}
.home-panel-head h3 {
  margin: 0; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--mute); font-weight: 700; flex: 1; min-width: 0;
}
.home-panel-head h3 span {
  color: var(--text); margin-left: 6px; font-variant-numeric: tabular-nums; letter-spacing: 0;
  text-transform: none; font-size: 16px;
}
.home-panel.is-alert h3 span { color: var(--wine); }
.home-panel-head .btn { padding: 4px 10px; font-size: 12px; }
.home-panel-list {
  max-height: 240px; overflow-y: auto; min-height: 0;
  scrollbar-width: thin;
}
.home-item {
  display: grid; grid-template-columns: 8px minmax(0, 1fr) auto auto; gap: 8px; align-items: center;
  padding: 8px 2px 8px 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.home-item:last-child { border-bottom: 0; }
.home-item-title { font-weight: 650; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-item-meta { color: var(--mute); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-pager {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  padding-top: 8px; flex: 0 0 auto;
}
.home-range { color: var(--mute); font-size: 12px; font-variant-numeric: tabular-nums; }
.home-page {
  appearance: none; width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit;
}
.home-page:hover:not(:disabled) { background: var(--bg); }
.home-page:disabled { opacity: 0.35; cursor: default; }
.home-assignee {
  position: sticky; top: 0; z-index: 1;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--mute); background: var(--surface);
  padding: 8px 0 4px; border-bottom: 1px solid var(--line);
}
.home-assignee:first-child { padding-top: 2px; }
@media (max-width: 900px) {
  .home-dash { grid-template-columns: 1fr; }
}
.space-catalog { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.space-catalog-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.space-catalog-toolbar input[type="search"] {
  flex: 1; min-width: 200px; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 10px 12px; font: inherit;
}
.space-catalog-count { color: var(--mute); font-size: 13px; font-variant-numeric: tabular-nums; }
.space-catalog-hint { color: var(--mute); font-size: 12px; margin: 0; }
.space-hub {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.space-hub-card {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: inherit;
  text-align: left; border-radius: 16px; padding: 18px 18px 16px; cursor: grab; font: inherit;
  display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); min-height: 220px;
}
.space-hub-card:hover { border-color: var(--accent); }
.space-hub-card.is-dragging { opacity: 0.45; }
.space-hub-card-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.space-hub-card-head .swatch { width: 12px; height: 12px; }
.space-hub-rank {
  color: var(--accent); font-weight: 750; font-variant-numeric: tabular-nums; font-size: 14px;
  min-width: 22px;
}
.space-hub-name { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-hub-desc {
  margin: 0; color: var(--mute); font-size: 13px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 3.2em; flex: 1;
}
.space-hub-desc.is-empty { font-style: italic; }
.space-hub-card .progress-bar { width: auto; flex: 1; height: 8px; background: #e6e8ee; }
.space-hub-card .progress-pct { color: var(--text); font-size: 13px; }
.space-hub-facts {
  display: flex; gap: 14px; flex-wrap: wrap; color: var(--mute); font-size: 12px;
}
.space-hub-facts b { color: var(--text); font-variant-numeric: tabular-nums; }
.space-hub-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.space-hub-actions .btn { padding: 6px 10px; font-size: 12px; }
.space-view-jumps {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 0 0 14px; color: var(--mute); font-size: 12px;
}
.space-view-jumps .btn { padding: 4px 10px; font-size: 12px; }
.space-view-jumps .btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.list { display: flex; flex-direction: column; gap: 6px; }
.row {
  display: grid; grid-template-columns: 22px 8px 1fr auto auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); cursor: pointer;
}
.row[draggable="true"] { cursor: grab; }
.row.is-dragging, .task-row.is-dragging { opacity: 0.45; }
.task-rank {
  min-width: 18px; text-align: center; color: var(--accent);
  font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums;
}
.row .task-rank { cursor: grab; }
.row.is-child .task-rank { cursor: default; }
.row-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row .title { font-weight: 600; }
.row .desc { color: var(--mute); font-size: 13px; margin-top: 3px; }
.row.is-selected, .card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 4px 0 0 var(--accent);
}
.row.is-selected .title, .card.is-selected h4 { color: var(--text); }
.selected-chip { color: #fff; background: var(--accent); font-weight: 650; }

.group-toolbar { display: flex; gap: 8px; margin: 0 0 14px; }
.group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin: 0 0 10px;
}
.group-head {
  font-size: 14px; font-weight: 700; margin: 0; display: flex; gap: 8px; align-items: center;
  background: #f7f8fb; border: 0; border-bottom: 1px solid var(--line); color: inherit;
  padding: 4px 8px 4px 4px; width: 100%; text-align: left;
  box-shadow: inset 4px 0 0 var(--group, var(--accent));
}
.group.is-collapsed .group-head { border-bottom: 0; }
.group-toggle {
  appearance: none; border: 0; background: transparent; color: inherit; font: inherit;
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  padding: 8px 6px; cursor: pointer; text-align: left; font-weight: 700;
}
.group-toggle .group-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { width: 14px; color: var(--mute); flex: 0 0 auto; }
.group-open, .group-edit { flex: 0 0 auto; padding: 4px 10px; font-size: 12px; }
.group-head.project-head { align-items: center; }
.group-head.project-head .swatch { width: 10px; height: 10px; }
.group-head span { color: var(--mute); font-size: 12px; font-weight: 600; }
.group-title { color: var(--text); font-size: 14px; font-weight: 700; }
.group .list, .group .work-table { border-radius: 0; }

.work-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.work-table th, .work-table td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line);
  font-size: 13px; vertical-align: middle;
}
.work-table th { color: var(--mute); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; background: #f7f8fb; }
.work-table tr.task-row { cursor: pointer; }
.work-table tr.task-row[draggable="true"] { cursor: grab; }
.work-table td.task-rank { width: 36px; color: var(--accent); font-weight: 750; font-variant-numeric: tabular-nums; }
.work-table tr.task-row:hover td { background: #f7f8fb; }
.work-table tr.is-selected td { background: var(--accent-soft); }
.work-table .title { font-weight: 650; }
.row.is-child { padding-left: calc(12px + (var(--nest, 1) * 22px)); }
.row.is-child .title { font-weight: 500; }
.row.is-child .title::before { content: "↳ "; color: var(--mute); }
.work-table tr.is-child td.title {
  padding-left: calc(12px + (var(--nest, 1) * 18px));
  font-weight: 500;
}
.work-table tr.is-child td.title::before { content: "↳ "; color: var(--mute); }
.work-table tr.is-child { opacity: 0.96; }

.stat.is-overdue { border-color: var(--wine); }
.due-chip { color: #7a4b00; background: #ffe3b0; }
.plan-chip { color: #163a5f; background: #d6e8ff; }
.group-head.date-head.is-overdue { color: var(--wine); }
.group-head.date-head.is-today { color: var(--accent); }

.drawer {
  position: fixed; top: 0; right: 0; width: min(480px, 100%); height: 100%;
  background: var(--surface); border-left: 1px solid var(--line); padding: 28px;
  overflow: auto; z-index: 20; box-shadow: var(--shadow);
}
.drawer-close {
  position: absolute; top: 16px; right: 16px; background: transparent; border: 0;
  color: var(--text); font-size: 28px; cursor: pointer;
}
.drawer h2 { font-weight: 700; margin: 0 80px 12px 0; font-size: 22px; }
.drawer label { display: block; margin: 12px 0; font-size: 13px; color: var(--mute); }
.drawer label select, .drawer label input, .drawer label textarea { margin-top: 6px; }
.move-banner {
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; color: var(--text); line-height: 1.45; margin: 0 0 12px;
}
.move-bar {
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 12px;
  padding: 12px; margin: 0 0 16px;
}
.move-bar strong { display: block; color: var(--text); font-size: 15px; }
.move-bar .hint { margin: 6px 0 8px; }
.move-bar .btn { margin-top: 4px; }
.row-move { cursor: pointer; white-space: nowrap; }
.card .row-move { margin-top: 10px; }
#move-task { width: min(480px, 94vw); }
.drawer textarea, .drawer select, .drawer input[type="text"], .drawer input[type="date"], .drawer input[type="search"] {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px; font: inherit;
}
.drawer .actions { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.activity { list-style: none; padding: 0; margin: 18px 0; }
.activity li { border-top: 1px solid var(--line); padding: 10px 0; color: var(--mute); font-size: 13px; }
.activity-body { white-space: pre-wrap; margin: 0 0 8px; }
.activity time { display: block; color: var(--accent); font-size: 11px; margin-bottom: 4px; }
.note-del { padding: 4px 8px; font-size: 12px; }
.children { margin: 12px 0 12px; }
.child {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.child.is-done { opacity: 0.72; }
.subtask-add { display: flex; gap: 8px; align-items: center; margin: 0 0 20px; }
.subtask-add input { flex: 1; }

dialog {
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text);
  width: min(480px, 92vw); padding: 24px; box-shadow: var(--shadow);
}
#project-plan { width: min(560px, 92vw); max-height: 86vh; overflow: auto; }
#project-plan-delete { margin-right: auto; }
.empty-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.empty-actions .btn { margin-top: 4px; }
#paste-plan { width: min(720px, 94vw); max-height: 90vh; overflow: auto; }
#paste-plan .marks { font-size: 12px; color: var(--mute); line-height: 1.55; margin: 0 0 4px; }
#paste-plan textarea {
  min-height: 280px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
}
#paste-plan menu { flex-wrap: wrap; }
dialog::backdrop { background: rgba(28, 29, 33, 0.45); }
dialog h2 { margin-top: 0; font-size: 22px; }
dialog label { display: block; margin: 12px 0; font-size: 13px; color: var(--mute); }
dialog input, dialog select, dialog textarea {
  display: block; width: 100%; margin-top: 6px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: inherit;
}
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 18px 0 0; }
dialog .dep-option { display: flex; margin: 4px 0; color: var(--text); font-size: 13px; }
dialog .dep-option input,
dialog input.dep-ticket,
dialog input.dep-project {
  display: inline-block; width: auto; margin: 0; padding: 0;
  background: transparent; border: 0;
}
dialog .dep-section h3 { color: var(--text); font-size: 15px; }
dialog .dep-xadd { margin-top: 8px; }

.empty { color: var(--mute); padding: 40px 8px; font-size: 18px; }

.auth-shell {
  min-height: 100%; display: grid; place-items: center;
  background:
    radial-gradient(900px 400px at 10% -10%, rgba(91, 77, 255, 0.16), transparent 50%),
    var(--bg);
}
.auth-card {
  width: min(420px, 92vw); background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; box-shadow: var(--shadow);
}
.auth-brand { margin-bottom: 18px; }
.auth-card h1 { margin: 0 0 6px; font-size: 26px; }
.auth-card .btn.primary { width: 100%; margin-top: 8px; }
.auth-card .btn.ghost { width: 100%; margin-top: 8px; }
@media (display-mode: standalone) {
  #btn-install { display: none !important; }
}
.auth-error { color: var(--wine); font-size: 13px; margin: 8px 0 0; }
.auth-card label { display: block; margin: 12px 0; font-size: 13px; color: var(--mute); }
.auth-card [hidden],
.auth-card label[hidden] { display: none !important; }
.auth-card input {
  display: block; width: 100%; margin-top: 6px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: inherit;
}

@media (max-width: 980px) {
  #app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .rail-resize { display: none; }
  .board { grid-template-columns: 1fr; }
  .queue-lists { grid-template-columns: 1fr; }
  .cal-day { min-height: 84px; }
  .calendar.is-week .cal-day { min-height: 160px; }
}
