/* ============================================================
   BitBang — Design System
   Enterprise SaaS · brand blue #0048FD · accent gold #F5B245
   Light sidebar · #F5F5F5 workspace · white surfaces · #121212 text
   ============================================================ */

:root {
  /* Neutrals — BitBang brand */
  --bg:        oklch(96.5% 0.001 260);  /* #F5F5F5 workspace background */
  --surface:   oklch(100% 0 0);         /* #FFFFFF cards / panels */
  --surface-2: oklch(94% 0.002 260);    /* subtle inset / hover */
  --fg:        oklch(25% 0.004 260);    /* primary text */
  --fg-strong: oklch(14% 0.004 260);    /* #121212 headings */
  --muted:     oklch(52% 0.006 260);    /* secondary text */
  --muted-2:   oklch(64% 0.005 260);    /* placeholders */
  --border:    oklch(90% 0.003 260);    /* hairline */
  --border-2:  oklch(84% 0.004 260);    /* stronger hairline */

  /* Brand — BitBang */
  --accent:        oklch(52% 0.24 264);  /* #0048FD primary blue */
  --accent-hover:  oklch(46% 0.24 264);
  --accent-soft:   oklch(94% 0.06 264);  /* light blue tint bg */
  --accent-fg:     oklch(100% 0 0);
  --spark:         oklch(82% 0.13 75);   /* #F5B245 accent gold */
  --spark-soft:    oklch(94% 0.07 75);   /* light gold tint */

  /* Sidebar (light — white with blue active) */
  --side-bg:        oklch(100% 0 0);        /* #FFFFFF */
  --side-bg-2:      oklch(96% 0.002 260);   /* hover bg */
  --side-fg:        oklch(42% 0.006 260);   /* nav text */
  --side-fg-strong: oklch(14% 0.004 260);   /* #121212 brand text */
  --side-muted:     oklch(60% 0.005 260);
  --side-border:    oklch(92% 0.003 260);
  --side-active:    oklch(94% 0.06 264);    /* active item = light blue */

  /* Semantic / status (functional UX conventions) */
  --success:   oklch(58% 0.14 152);   /* done */
  --success-s: oklch(94% 0.05 152);
  --warn:      oklch(82% 0.13 75);    /* warning = brand gold */
  --warn-s:    oklch(94% 0.07 75);
  --danger:    oklch(54% 0.20 25);    /* blocked / overdue / highest */
  --danger-s:  oklch(94% 0.05 25);
  --info:      oklch(56% 0.16 230);   /* in-review / improvement (blue-family) */
  --info-s:    oklch(93% 0.05 230);
  --purple:    oklch(52% 0.24 264);   /* alias -> brand blue (legacy refs) */
  --purple-s:  oklch(94% 0.06 264);

  /* Type */
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  /* Radii */
  --r-sm: 6px;
  --r:    9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* Shadows — soft, low, neutral black-based */
  --shadow-1: 0 1px 2px oklch(14% 0.004 260 / 0.05), 0 1px 1px oklch(14% 0.004 260 / 0.04);
  --shadow-2: 0 2px 6px oklch(14% 0.004 260 / 0.06), 0 1px 2px oklch(14% 0.004 260 / 0.04);
  --shadow-3: 0 6px 20px oklch(14% 0.004 260 / 0.09), 0 2px 6px oklch(14% 0.004 260 / 0.05);
  --shadow-pop: 0 12px 40px oklch(14% 0.004 260 / 0.16), 0 4px 12px oklch(14% 0.004 260 / 0.08);

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--side-bg);
  color: var(--side-fg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--side-border);
  overflow: hidden;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 16px;
  flex-shrink: 0;
}
.spark-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: url("../mqrx11ro-image.png") center / contain no-repeat;
  display: block;
  flex-shrink: 0;
  position: relative;
}
.spark-mark svg { display: none; }
.spark-mark::after { content: ""; }
.brand-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--side-fg-strong);
}
.brand-name b { color: var(--spark); font-weight: 600; }

.workspace-switch {
  margin: 0 14px 8px;
  padding: 9px 11px;
  border-radius: var(--r);
  display: flex; align-items: center; gap: 9px;
  background: var(--side-bg-2);
  border: 1px solid var(--side-border);
  cursor: pointer;
  transition: border-color .15s;
}
.workspace-switch:hover { border-color: oklch(75% 0.05 264); }
.workspace-switch .ws-ico {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), oklch(46% 0.24 264));
  flex-shrink: 0;
}
.workspace-switch .ws-name { font-size: 13px; font-weight: 500; color: var(--side-fg-strong); }
.workspace-switch .ws-chev { margin-left: auto; color: var(--side-muted); }

.nav-scroll { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.nav-scroll::-webkit-scrollbar { width: 6px; }
.nav-scroll::-webkit-scrollbar-thumb { background: var(--side-border); border-radius: 3px; }

.nav-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--side-muted);
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border-radius: var(--r);
  color: var(--side-fg);
  font-size: 13.5px;
  font-weight: 450;
  margin: 1px 0;
  cursor: pointer;
  position: relative;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--side-bg-2); color: var(--side-fg-strong); }
.nav-item.active {
  background: var(--side-active);
  color: var(--accent);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.nav-item.active svg { opacity: 1; color: var(--accent); }
.nav-item .nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--side-muted);
  font-variant-numeric: tabular-nums;
}

.sidebar-foot {
  flex-shrink: 0;
  padding: 12px;
  border-top: 1px solid var(--side-border);
}
.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r);
  cursor: pointer;
}
.side-user:hover { background: var(--side-bg-2); }

/* ---------- Topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  border-bottom: 1px solid var(--border);
  background: oklch(100% 0 0);
  backdrop-filter: blur(8px);
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg-strong);
}
.crumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
}
.crumb .sep { color: var(--muted-2); }
.crumb b { color: var(--fg-strong); font-weight: 550; }

.search {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  width: 280px;
  padding: 7px 12px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color .15s, background .15s;
}
.search:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.search input { border: 0; background: none; outline: none; flex: 1; font-size: 13px; }
.search input::placeholder { color: var(--muted-2); }
.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--r);
  display: grid; place-items: center;
  color: var(--muted);
  position: relative;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--spark);
  border: 2px solid oklch(100% 0 0);
}

/* ---------- Content ---------- */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 40px;
}
.content::-webkit-scrollbar { width: 10px; }
.content::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 5px; border: 3px solid var(--bg); }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.page-head h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg-strong);
  line-height: 1.2;
}
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.page-head-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -0.003em;
  border: 1px solid transparent;
  transition: background .13s, border-color .13s, box-shadow .13s, transform .08s;
  white-space: nowrap;
}
.btn:active { transform: translateY(0.5px); }
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: 0 1px 2px oklch(52% 0.24 264 / 0.30), inset 0 1px 0 oklch(100% 0 0 / 0.12);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 2px 8px oklch(52% 0.24 264 / 0.40); }
.btn-secondary {
  background: var(--surface);
  border-color: var(--border-2);
  color: var(--fg);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--fg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-icon { width: 34px; padding: 0; justify-content: center; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg-strong);
}
.card-head .link { font-size: 12.5px; color: var(--accent); font-weight: 500; }
.card-head .link:hover { text-decoration: underline; }

/* ---------- Stat tiles ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
}
.stat .label {
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0.01em;
  color: var(--muted);
  display: flex; align-items: center; gap: 7px;
}
.stat .label svg { width: 14px; height: 14px; opacity: .7; }
.stat .val {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--fg-strong);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat .delta {
  font-size: 12px;
  margin-top: 8px;
  display: flex; align-items: center; gap: 5px;
  font-weight: 500;
}
.stat .delta.up { color: var(--success); }
.stat .delta.down { color: var(--danger); }
.stat .delta svg { width: 12px; height: 12px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge svg { width: 11px; height: 11px; }
.badge-sm { height: 18px; font-size: 11px; padding: 0 7px; }

.b-accent  { background: var(--accent-soft); color: oklch(40% 0.18 264); }
.b-success { background: var(--success-s); color: oklch(40% 0.13 152); }
.b-warn    { background: var(--warn-s);    color: oklch(50% 0.13 75); }
.b-danger  { background: var(--danger-s);  color: oklch(48% 0.20 25); }
.b-info    { background: var(--info-s);    color: oklch(42% 0.16 230); }
.b-purple  { background: var(--accent-soft);  color: oklch(40% 0.18 264); }
.b-neutral { background: var(--surface-2); color: var(--muted); }
.b-spark   { background: var(--spark-soft); color: oklch(50% 0.12 75); }

.dot-tag {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}

/* Priority — pill with distinct icon per level */
.prio { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 600; padding: 2px 5px 2px 4px; border-radius: var(--r-sm); letter-spacing: 0.01em; line-height: 1; }
.prio svg { width: 12px; height: 12px; stroke-width: 2.5; }
.prio-highest { color: oklch(48% 0.20 25); background: var(--danger-s); }
.prio-high    { color: oklch(50% 0.13 75); background: var(--warn-s); }
.prio-medium  { color: oklch(42% 0.16 230); background: var(--info-s); }
.prio-low     { color: var(--muted); background: var(--surface-2); }

/* Task type */
.type-ico {
  width: 18px; height: 18px; border-radius: 5px;
  display: grid; place-items: center; flex-shrink: 0;
}
.type-ico svg { width: 11px; height: 11px; }
.t-bug    { background: var(--danger-s);  color: oklch(50% 0.20 25); }
.t-feature{ background: var(--accent-soft); color: oklch(40% 0.18 264); }
.t-task   { background: var(--surface-2);  color: var(--muted); }
.t-improve{ background: var(--spark-soft); color: oklch(50% 0.12 75); }

/* ---------- Avatars ---------- */
.avatar {
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  color: white;
  flex-shrink: 0;
  letter-spacing: 0.01em;
  font-family: var(--font-display);
}
.av-sm { width: 24px; height: 24px; font-size: 10px; }
.av-md { width: 30px; height: 30px; font-size: 11px; }
.av-lg { width: 38px; height: 38px; font-size: 13px; }
.av-stack { display: flex; }
.av-stack .avatar { margin-left: -7px; border: 2px solid var(--surface); }
.av-stack .avatar:first-child { margin-left: 0; }
.av-stack .av-more {
  background: var(--surface-2); color: var(--muted);
  border: 2px solid var(--surface);
}
.av-1 { background: oklch(52% 0.24 264); }
.av-2 { background: oklch(62% 0.15 75); }
.av-3 { background: oklch(55% 0.16 200); }
.av-4 { background: oklch(46% 0.22 264); }
.av-5 { background: oklch(56% 0.18 25); }
.av-6 { background: oklch(50% 0.14 230); }
.av-7 { background: oklch(45% 0.10 260); }

/* ---------- Progress ---------- */
.progress {
  height: 6px; border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
}
.progress > i {
  display: block; height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.progress.success > i { background: var(--success); }
.progress.warn > i { background: var(--warn); }

/* ---------- Kanban ---------- */
.board {
  display: flex;
  gap: 14px;
  height: 100%;
  padding-bottom: 8px;
}
.col {
  flex: 0 0 290px;
  display: flex; flex-direction: column;
  min-height: 0;
}
.col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px 12px;
  flex-shrink: 0;
}
.col-head .ctitle {
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em;
  color: var(--fg-strong);
  display: flex; align-items: center; gap: 7px;
}
.col-head .ccount {
  font-size: 11.5px; font-weight: 550; color: var(--muted);
  background: var(--surface-2); padding: 1px 7px; border-radius: var(--r-pill);
  font-variant-numeric: tabular-nums;
}
.col-head .col-ico { width: 9px; height: 9px; border-radius: 50%; }
.col-add { margin-left: auto; color: var(--muted-2); width: 22px; height: 22px; border-radius: var(--r-sm); display: grid; place-items: center; }
.col-add:hover { background: var(--surface-2); color: var(--fg); }
.col-add svg { width: 14px; height: 14px; }
.col-body {
  flex: 1; overflow-y: auto;
  padding: 10px 4px 4px;
  display: flex; flex-direction: column; gap: 10px;
}
.col-body::-webkit-scrollbar { width: 6px; }
.col-body::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

.tcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 13px 11px;
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: box-shadow .14s, border-color .14s, transform .08s;
}
.tcard:hover { box-shadow: var(--shadow-2); border-color: var(--border-2); transform: translateY(-1px); }
.tcard-top { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.tcard .tt { font-size: 13px; font-weight: 500; color: var(--fg-strong); line-height: 1.4; letter-spacing: -0.003em; }
.tcard-meta { display: flex; align-items: center; gap: 11px; margin-top: 10px; color: var(--muted); font-size: 11.5px; }
.tcard-meta .m { display: flex; align-items: center; gap: 4px; }
.tcard-meta svg { width: 12px; height: 12px; }
.tcard-meta .sp {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  background: var(--surface-2); padding: 1px 7px; border-radius: var(--r-sm);
  color: var(--fg-strong); font-variant-numeric: tabular-nums;
  border: 1px solid var(--border); margin-left: auto;
}
.tcard-foot { display: flex; align-items: center; gap: 8px; margin-top: 11px; }
.tcard-foot .avatar { margin-left: auto; }
.due-overdue { color: var(--danger); font-weight: 500; }
.due-soon { color: var(--warn); }

/* ---------- Lists / rows ---------- */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row .rmain { flex: 1; min-width: 0; }
.row .rtitle { font-size: 13.5px; font-weight: 500; color: var(--fg-strong); letter-spacing: -0.003em; }
.row .rmeta { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; gap: 12px; }

/* ---------- Activity feed ---------- */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: 0; }
.feed-item .avatar { margin-top: 1px; }
.feed-item .ftext { font-size: 13px; line-height: 1.45; color: var(--fg); }
.feed-item .ftext b { font-weight: 600; color: var(--fg-strong); }
.feed-item .ftime { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }

/* ---------- Donut chart ---------- */
.donut { display: flex; align-items: center; gap: 22px; }
.donut svg { flex-shrink: 0; }
.donut-leg { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.donut-leg .li { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.donut-leg .li .ld { width: 9px; height: 9px; border-radius: 2px; }
.donut-leg .li .ln { color: var(--fg); }
.donut-leg .li .lv { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--fg-strong); font-size: 12.5px; }

/* ---------- Bars chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bar-col .bar {
  width: 100%; max-width: 34px;
  border-radius: 5px 5px 0 0;
  background: var(--accent);
  position: relative;
  transition: filter .15s;
}
.bar-col:hover .bar { filter: brightness(1.08); }
.bar-col .bl { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Drawer (task details) ---------- */
.drawer-scrim {
  position: fixed; inset: 0;
  background: oklch(14% 0.004 260 / 0.28);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0; pointer-events: none;
  transition: opacity .22s;
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 620px; max-width: 92vw;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  z-index: 41;
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.32,.72,0,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }
.drawer-body::-webkit-scrollbar { width: 8px; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

/* ---------- Ticket modal (shared board + backlog) ---------- */
.ticket-scrim {
  position: fixed; inset: 0;
  background: oklch(14% 0.004 260 / 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 60;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
  display: grid; place-items: center;
  padding: 28px;
}
.ticket-scrim.open { opacity: 1; pointer-events: auto; }
.ticket-modal {
  width: min(920px, 100%);
  max-height: 90vh;
  background: var(--bg);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: 0 24px 70px oklch(14% 0.004 260 / 0.28), 0 4px 12px oklch(14% 0.004 260 / 0.08);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(8px);
  opacity: 0;
  transition: transform .22s cubic-bezier(.32,.72,0,1), opacity .18s;
}
.ticket-scrim.open .ticket-modal { transform: scale(1) translateY(0); opacity: 1; }
.ticket-modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.ticket-modal-head .type-ico { width: 20px; height: 20px; border-radius: 6px; }
.ticket-modal-head .type-ico svg { width: 12px; height: 12px; }
.ticket-modal-head .mono { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ticket-modal-body {
  flex: 1; overflow-y: auto; padding: 22px 24px 26px;
  container-type: inline-size;
}
.ticket-modal-body::-webkit-scrollbar { width: 8px; }
.ticket-modal-body::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }
/* Collapse the 2-col grid when the modal body is narrow (not the viewport) */
@container (max-width: 720px) {
  .task-grid { grid-template-columns: 1fr !important; gap: 22px !important; }
  .meta-side { order: -1; }
  .ticket-modal-body { padding: 18px 18px 22px; }
}
@media (max-width: 760px) {
  .ticket-scrim { padding: 0; }
  .ticket-modal { max-height: 100vh; border-radius: 0; height: 100vh; }
  .task-grid { grid-template-columns: 1fr !important; gap: 20px !important; }
  .meta-side { order: -1; }
}

/* ---------- Task detail layout ---------- */
.task-grid { display: grid; grid-template-columns: 1fr 220px; gap: 26px; }
.task-main h2 {
  font-family: var(--font-display);
  font-size: 21px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--fg-strong); line-height: 1.3; margin-bottom: 14px;
}
.desc { font-size: 13.5px; line-height: 1.6; color: var(--fg); }
.desc p { margin-bottom: 10px; }
.desc code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
/* Modal-scoped density overrides — tighter section spacing inside the modal */
.ticket-modal-body .section-label { margin: 20px 0 10px; }
.ticket-modal-body .task-main h2 { margin-bottom: 12px; }

.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  margin: 26px 0 12px;
}
.subtask { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.subtask:last-child { border-bottom: 0; }
.checkbox {
  width: 17px; height: 17px; border-radius: 5px;
  border: 1.5px solid var(--border-2);
  display: grid; place-items: center; flex-shrink: 0;
  cursor: pointer; transition: background .12s, border-color .12s;
}
.checkbox.done { background: var(--success); border-color: var(--success); }
.checkbox.done svg { width: 11px; height: 11px; color: white; }
.checkbox:not(.done) svg { display: none; }
.subtask.done .st-text { color: var(--muted); text-decoration: line-through; }

.comment { display: flex; gap: 12px; padding: 12px 0; }
.comment .c-body { flex: 1; }
.comment .c-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.comment .c-name { font-size: 13px; font-weight: 600; color: var(--fg-strong); }
.comment .c-time { font-size: 11.5px; color: var(--muted-2); }
.comment .c-text { font-size: 13px; line-height: 1.55; color: var(--fg); }
.comment-box {
  margin-top: 14px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: var(--surface);
}
.comment-box textarea {
  width: 100%; border: 0; outline: none; resize: none;
  min-height: 44px; background: none; font-size: 13px;
}
.comment-box .cb-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.comment-box .cb-foot .btn { margin-left: auto; }

/* metadata sidebar */
.meta-side { display: flex; flex-direction: column; gap: 2px; }
.meta-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px solid var(--border); gap: 10px;
}
.meta-row:last-child { border-bottom: 0; }
.meta-row .mk { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.meta-row .mk svg { width: 14px; height: 14px; opacity: .7; }
.meta-row .mv { font-size: 12.5px; font-weight: 500; color: var(--fg-strong); display: flex; align-items: center; gap: 7px; text-align: right; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.tbl td {
  padding: 12px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }

/* ---------- Misc helpers ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 11px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border-2);
  color: var(--fg); cursor: pointer;
  transition: background .12s, border-color .12s;
}
.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--accent-soft); border-color: oklch(80% 0.06 264); color: oklch(40% 0.18 264); }
.chip svg { width: 13px; height: 13px; }

/* Spark flourish — single decorative moment */
.spark-glow {
  position: relative;
}
.spark-glow::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 0% 0%, oklch(82% 0.13 75 / 0.10), transparent 60%);
  pointer-events: none;
}

/* ---------- Drawer enhancements: tabs, activity, editable fields, deps ---------- */
.tab-bar { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 4px 0 16px; }
.tab-bar .tb { padding: 9px 14px; font-size: 12.5px; font-weight: 550; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .12s, border-color .12s; }
.tab-bar .tb:hover { color: var(--fg); }
.tab-bar .tb.active { color: var(--fg-strong); border-color: var(--accent); }
.tab-bar .tb .tb-count { color: var(--muted-2); font-weight: 500; margin-left: 4px; }

.activity { display: flex; flex-direction: column; }
.act-item { display: flex; gap: 12px; padding: 9px 0; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--border); line-height: 1.5; }
.act-item:last-child { border-bottom: 0; }
.act-item .at-ico { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted-2); margin-top: 1px; }
.act-item .at-ico svg { width: 16px; height: 16px; }
.act-item b { color: var(--fg-strong); font-weight: 600; }
.act-time { color: var(--muted-2); font-size: 11px; }

/* Editable status/priority controls in metadata sidebar */
.meta-select {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-size: 11.5px; font-weight: 550;
  height: 24px; padding: 0 22px 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  cursor: pointer; outline: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23994' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: box-shadow .12s, border-color .12s;
}
.meta-select:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.meta-select.s-warn { background-color: var(--warn-s); color: oklch(50% 0.13 75); }
.meta-select.s-info { background-color: var(--info-s); color: oklch(42% 0.16 230); }
.meta-select.s-neutral { background-color: var(--surface-2); color: var(--muted); }
.meta-select.s-danger { background-color: var(--danger-s); color: oklch(48% 0.20 25); }
.meta-select.s-success { background-color: var(--success-s); color: oklch(40% 0.13 152); }
.meta-select.s-prio-highest { background-color: var(--danger-s); color: oklch(48% 0.20 25); }
.meta-select.s-prio-high { background-color: var(--warn-s); color: oklch(50% 0.13 75); }
.meta-select.s-prio-medium { background-color: var(--info-s); color: oklch(42% 0.16 230); }
.meta-select.s-prio-low { background-color: var(--surface-2); color: var(--muted); }
.meta-select.s-prio-lowest { background-color: var(--surface-2); color: var(--muted-2); }
.meta-editable .mk { cursor: pointer; }
.meta-editable:hover .mk { color: var(--accent); }

/* Dependencies */
.dep-list { display: flex; flex-direction: column; gap: 7px; }
.dep-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r); cursor: pointer; transition: background .12s, border-color .12s; }
.dep-row:hover { background: var(--surface-2); border-color: var(--border-2); }
.dep-row .dk { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--muted); flex-shrink: 0; }
.dep-row .dt { font-size: 12.5px; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.dep-row .dr { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 7px; border-radius: var(--r-pill); flex-shrink: 0; }
.dep-row .dr.blocks { background: var(--danger-s); color: oklch(48% 0.20 25); }
.dep-row .dr.blocked-by { background: var(--warn-s); color: oklch(50% 0.13 75); }
.dep-row .dr.relates { background: var(--surface-2); color: var(--muted); }
.dep-add { display: flex; align-items: center; gap: 6px; padding: 7px 10px; font-size: 12px; font-weight: 600; color: var(--accent); cursor: pointer; border-radius: var(--r); }
.dep-add:hover { background: var(--accent-soft); }
.dep-add svg { width: 14px; height: 14px; }

/* Attach button */
.attach-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px; border: 1.5px dashed var(--border-2); border-radius: var(--r); color: var(--muted); font-size: 12px; font-weight: 550; cursor: pointer; transition: border-color .14s, color .14s, background .14s; }
.attach-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.attach-btn svg { width: 15px; height: 15px; }

/* responsive guard */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .task-grid { grid-template-columns: 1fr; }
}
