/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: dark;
  --zoom-blue: #2D8CFF;
  /* Theme-toggle icons: dark mode shows sun, light mode shows moon */
  --icon-sun-display:  block;
  --icon-moon-display: none;
  --zoom-blue-dark: #1a6fd4;
  --bg: #0f1117;
  --bg2: #1a1d26;
  --bg3: #22263a;
  --bg4: #2a2f45;
  --border: #2e3248;
  --text: #e2e8f0;
  --text-muted: #8892a4;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --yellow: #eab308;
  --purple: #a855f7;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 13px; }
a { color: var(--zoom-blue); }

/* ── Header ────────────────────────────────────────────────────────────────── */
.app-header {
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px; height: 52px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
}
.header-left  { flex-shrink: 0; }
.header-center{ flex: 1; overflow: hidden; }
.header-right { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }
.logo         { display: flex; align-items: center; gap: 10px; }
.logo-text    { font-size: 15px; font-weight: 700; color: var(--text); }
.logo-text em { color: var(--zoom-blue); font-style: normal; }

/* ── Tab Nav ───────────────────────────────────────────────────────────────── */
.tab-nav { display: flex; flex-wrap: wrap; gap: 2px 4px; row-gap: 4px; }
.tab-btn {
  flex-shrink: 0; padding: 5px 10px; border: none; border-radius: 6px;
  background: transparent; color: var(--text-muted);
  cursor: pointer; font-size: 12px; font-family: var(--font);
  transition: all 0.15s; white-space: nowrap;
}
.tab-btn:hover  { background: var(--bg3); color: var(--text); }
.tab-btn.active { background: var(--zoom-blue); color: #fff; }

/* ── Main layout ───────────────────────────────────────────────────────────── */
.app-main { position: fixed; top: 52px; left: 0; right: 0; bottom: 0; overflow: hidden; }
.tab-panel { display: none; height: 100%; overflow: auto; }
.tab-panel.active { display: flex; flex-direction: column; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  padding: 7px 14px; border: none; border-radius: 6px;
  cursor: pointer; font-size: 12.5px; font-family: var(--font);
  font-weight: 500; transition: all 0.15s; white-space: nowrap;
}
.btn-sm        { padding: 5px 10px; font-size: 11.5px; }
.btn-primary   { background: var(--zoom-blue); color: #fff; }
.btn-primary:hover { background: var(--zoom-blue-dark); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

/* ── Toolbar ───────────────────────────────────────────────────────────────── */
.board-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--bg2); border-bottom: 1px solid var(--border);
  flex-shrink: 0; gap: 10px; flex-wrap: wrap;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; }
.project-name { font-weight: 600; color: var(--text); font-size: 14px; }
.project-meta { color: var(--text-muted); font-size: 11.5px; }

.golive-picker {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg3); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 6px; font-size: 12px;
}
.golive-picker input { background: transparent; border: none; color: var(--text); font-family: var(--font); font-size: 12px; outline: none; }
.golive-picker label { color: var(--text-muted); }

/* ── Board container ───────────────────────────────────────────────────────── */
.board-wrap { flex: 1; overflow: hidden; padding: 0; background: var(--bg); }
#board { height: 100%; }

/* ── Tabulator dark overrides ──────────────────────────────────────────────── */
.tabulator {
  background: var(--bg); color: var(--text); border: none; font-family: var(--font); font-size: 12.5px;
}
.tabulator .tabulator-header {
  background: var(--bg2); border-bottom: 1px solid var(--border); color: var(--text-muted);
  font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px;
}
.tabulator .tabulator-header .tabulator-col {
  background: var(--bg2); border-right: 1px solid var(--border);
}
.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover { background: var(--bg3); }
.tabulator .tabulator-row { background: var(--bg); border-bottom: 1px solid var(--border); }
.tabulator .tabulator-row.tabulator-row-even { background: var(--bg2); }
.tabulator .tabulator-row:hover { background: var(--bg3) !important; }
.tabulator .tabulator-cell { border-right: 1px solid var(--border); padding: 8px 10px; color: var(--text); }
.tabulator .tabulator-tree-level-0 > .tabulator-cell { font-weight: 700; color: var(--zoom-blue); background: var(--bg2); }
.tabulator .tabulator-tree-level-1 > .tabulator-cell { font-weight: 600; color: var(--text); }
.tabulator .tabulator-tree-level-2 > .tabulator-cell { color: var(--text); }
.tabulator .tabulator-tree-level-3 > .tabulator-cell { color: var(--text-muted); }
.tabulator .tabulator-tree-control {
  background: transparent; border-color: var(--text-muted); color: var(--text-muted);
}
.tabulator .tabulator-tree-control:hover { background: var(--bg3); border-color: var(--text); }
.tabulator-popup-container { background: var(--bg2); border: 1px solid var(--border); color: var(--text); }
.tabulator-edit-list {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 4px; min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.tabulator-edit-list .tabulator-edit-list-item {
  color: var(--text); padding: 5px 8px; border-radius: 4px; cursor: pointer;
}
.tabulator-edit-list .tabulator-edit-list-item:hover,
.tabulator-edit-list .tabulator-edit-list-item.active {
  background: var(--bg3);
}
.tabulator-edit-list .tabulator-edit-list-item .pill {
  pointer-events: none; /* clicks should hit the row, not the pill */
}

/* ── Status pills (PSO/Implementation set) ────────────────────────────────── */
.pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.pill-not_started      { background: var(--bg3);                    color: var(--text-muted); }
.pill-scheduled        { background: rgba(168, 85, 247, 0.15);      color: var(--purple); }
.pill-in_progress      { background: rgba(45, 140, 255, 0.15);      color: var(--zoom-blue); }
.pill-waiting_customer { background: rgba(245, 158, 11, 0.15);      color: var(--orange); }
.pill-done             { background: rgba(34, 197, 94, 0.15);       color: var(--green); }
.pill-stuck            { background: rgba(239, 68, 68, 0.15);       color: var(--red); }
.pill-na               { background: var(--bg3);                    color: var(--text-muted); text-decoration: line-through; opacity: 0.7; }
/* Legacy alias so any rows still carrying the old "working" value render OK during migration */
.pill-working          { background: rgba(45, 140, 255, 0.15);      color: var(--zoom-blue); }

.variance-ontime  { color: var(--green); }
.variance-late    { color: var(--red); }
.variance-early   { color: var(--zoom-blue); }

/* ── Optional / not-applicable rows ───────────────────────────────────────── */
.tabulator .tabulator-row.row-optional { opacity: 0.55; }
.tabulator .tabulator-row.row-optional .tabulator-cell { font-style: italic; }

/* Critical-path highlight (Phase 2.1) — left border + subtle bg tint. */
.tabulator .tabulator-row.row-critical {
  box-shadow: inset 3px 0 0 var(--red);
}
.tabulator .tabulator-row.row-critical:hover { background: rgba(239, 68, 68, 0.06) !important; }
.title-optional { display: inline-flex; align-items: center; gap: 6px; }
.opt-tag {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 1px 6px; border-radius: 8px; background: var(--bg3); color: var(--text-muted);
  font-style: normal;
}

/* ── Status picker (custom Tabulator editor) ──────────────────────────────── */
.status-picker {
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 6px; min-width: 160px;
}
.status-picker-item {
  border: none; cursor: pointer; padding: 5px 12px;
  text-align: left; font-family: var(--font);
}
.status-picker-item:hover { filter: brightness(1.2); outline: 1px solid var(--zoom-blue); }
.status-picker-item:focus { outline: 2px solid var(--zoom-blue); outline-offset: 1px; }

/* ── Inline progress bar (% Done column) ─────────────────────────────────── */
.pct-cell {
  display: flex; align-items: center; gap: 8px; width: 100%;
}
.pct-bar {
  flex: 1; height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden;
  border: 1px solid var(--border);
}
.pct-fill {
  height: 100%; transition: width 0.2s ease; border-radius: 3px;
}
.pct-label {
  font-variant-numeric: tabular-nums; font-size: 11.5px;
  color: var(--text-muted); min-width: 32px; text-align: right;
}

/* ── Notes cell ──────────────────────────────────────────────────────────── */
.notes-cell {
  display: inline-block; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-muted); font-size: 12px;
}

/* ── Sticky phase headers (top-level tree rows) ───────────────────────────── */
.tabulator .tabulator-row.tabulator-tree-level-0 {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg2);
  box-shadow: 0 1px 0 var(--border);
}

/* ── Right-click context menu ─────────────────────────────────────────────── */
.row-context-menu {
  position: fixed; z-index: 1000;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  padding: 4px; min-width: 200px;
}
.row-context-item {
  display: block; width: 100%; text-align: left;
  background: transparent; border: none; color: var(--text);
  padding: 7px 12px; border-radius: 4px;
  cursor: pointer; font-size: 12.5px; font-family: var(--font);
}
.row-context-item:hover { background: var(--bg3); }

/* ── Row-detail drawer ─────────────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 200; opacity: 0; transition: opacity 0.18s ease;
}
.drawer-backdrop.open { opacity: 1; }

.row-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 92vw);
  background: var(--bg2); border-left: 1px solid var(--border);
  z-index: 201; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.22s ease;
  box-shadow: -8px 0 32px rgba(0,0,0,0.55);
}
.row-drawer.open { transform: translateX(0); }

.drawer-head {
  flex-shrink: 0; padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border); background: var(--bg2);
}
.drawer-title-row {
  display: flex; align-items: flex-start; gap: 10px;
}
.drawer-title-row .drawer-title {
  flex: 1; font-size: 15px; font-weight: 600; color: var(--text);
  line-height: 1.35; word-break: break-word;
}
.drawer-close {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 22px; line-height: 1; cursor: pointer;
  padding: 0 4px; border-radius: 4px;
}
.drawer-close:hover { color: var(--text); background: var(--bg3); }

.drawer-meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 8px; color: var(--text-muted); font-size: 11.5px;
}
.drawer-meta strong { color: var(--text); font-weight: 600; }

.drawer-tabs {
  display: flex; gap: 2px; margin-top: 12px; border-bottom: 1px solid var(--border);
  margin-left: -18px; margin-right: -18px; padding: 0 14px;
}
.drawer-tab {
  background: transparent; border: none; color: var(--text-muted);
  padding: 8px 12px; cursor: pointer; font-size: 12.5px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.drawer-tab:hover { color: var(--text); }
.drawer-tab.active { color: var(--zoom-blue); border-bottom-color: var(--zoom-blue); }
.drawer-tab .badge {
  display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 6px;
  background: var(--bg3); border-radius: 9px; font-size: 10.5px;
  color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.drawer-tab.active .badge { background: rgba(45, 140, 255, 0.18); color: var(--zoom-blue); }

.drawer-body {
  flex: 1; overflow-y: auto; padding: 14px 18px;
}
.drawer-pane { display: none; }
.drawer-pane.active { display: block; }

/* Notes editor (in-drawer) */
.drawer-notes {
  width: 100%; min-height: 64px; resize: vertical;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; color: var(--text);
  font-family: var(--font); font-size: 12.5px; outline: none;
}
.drawer-notes:focus { border-color: var(--zoom-blue); }
.drawer-section-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted); margin: 4px 0 6px;
}
.drawer-section + .drawer-section { margin-top: 16px; }
.drawer-hint { color: var(--text-muted); font-size: 11.5px; margin-top: 4px; }

/* Comments list */
.comment-list { display: flex; flex-direction: column; gap: 10px; }
.comment-item {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.comment-head {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px;
}
.comment-author { color: var(--text); font-weight: 600; }
.comment-time { font-variant-numeric: tabular-nums; }
.comment-edited { font-style: italic; opacity: 0.7; }
.comment-body { color: var(--text); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.comment-actions { margin-top: 6px; display: flex; gap: 8px; }
.comment-action {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 11px; padding: 2px 6px; border-radius: 4px;
}
.comment-action:hover { color: var(--text); background: var(--bg2); }
.comment-action.danger:hover { color: var(--red); }

.comment-composer {
  margin-top: 12px; display: flex; flex-direction: column; gap: 6px;
}
.comment-composer textarea {
  width: 100%; min-height: 60px; resize: vertical;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; color: var(--text);
  font-family: var(--font); font-size: 12.5px; outline: none;
}
.comment-composer textarea:focus { border-color: var(--zoom-blue); }
.comment-composer .composer-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.comment-composer-hint { color: var(--text-muted); font-size: 11px; }

/* Activity feed */
.activity-list { display: flex; flex-direction: column; gap: 6px; }
.activity-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; border-left: 2px solid var(--border);
  background: var(--bg3); border-radius: 0 6px 6px 0;
  font-size: 12px;
}
.activity-item.action-comment { border-left-color: var(--zoom-blue); }
.activity-item.action-mention { border-left-color: var(--purple); }
.activity-item.action-update  { border-left-color: var(--orange); }
.activity-item.action-create  { border-left-color: var(--green); }
.activity-item.action-delete  { border-left-color: var(--red); }
.activity-item.action-watch,
.activity-item.action-unwatch { border-left-color: var(--text-muted); }
.activity-text { flex: 1; line-height: 1.5; color: var(--text); }
.activity-actor { font-weight: 600; }
.activity-field { color: var(--zoom-blue); }
.activity-value {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  background: var(--bg2); color: var(--text); font-size: 11.5px;
  font-variant-numeric: tabular-nums; max-width: 240px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: baseline;
}
.activity-arrow { color: var(--text-muted); margin: 0 4px; }
.activity-time {
  flex-shrink: 0; color: var(--text-muted); font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* Watcher list */
.watcher-list { display: flex; flex-direction: column; gap: 6px; }
.watcher-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px;
}
.watcher-name  { flex: 1; color: var(--text); font-weight: 500; }
.watcher-email { color: var(--text-muted); font-size: 11.5px; }
.watcher-remove {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 4px;
}
.watcher-remove:hover { color: var(--red); background: var(--bg2); }

.drawer-empty { color: var(--text-muted); font-size: 12px; padding: 16px 0; text-align: center; font-style: italic; }

/* Dependencies tab */
.cp-summary { margin-bottom: 12px; font-size: 11.5px; }
.cp-critical { color: var(--red); font-weight: 600; }
.cp-tight    { color: var(--orange); font-weight: 600; }
.cp-float    { color: var(--text-muted); }

.dep-list { display: flex; flex-direction: column; gap: 6px; }
.dep-item {
  display: grid; grid-template-columns: 1fr 70px 70px 1fr 28px; gap: 8px;
  align-items: center;
  padding: 6px 10px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 6px; font-size: 12px;
}
.dep-title { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-type, .dep-lag {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  border-radius: 4px; padding: 3px 6px; font-size: 11.5px; font-family: var(--font); outline: none;
}
.dep-type:focus, .dep-lag:focus { border-color: var(--zoom-blue); }
.dep-lag-label { color: var(--text-muted); font-size: 11px; }
.dep-remove {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 4px;
}
.dep-remove:hover { color: var(--red); background: var(--bg2); }

.dep-add { margin-top: 8px; padding: 10px; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; }
.dep-add input[type="search"], .dep-add input[type="number"], .dep-add select {
  width: 100%; background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  padding: 6px 10px; border-radius: 6px; font-size: 12px; font-family: var(--font); outline: none;
  margin-bottom: 6px;
}
.dep-add input:focus, .dep-add select:focus { border-color: var(--zoom-blue); }
.dep-add-results { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.dep-add-result {
  display: block; width: 100%; text-align: left;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 4px;
  padding: 6px 10px; cursor: pointer; color: var(--text); font-family: var(--font);
}
.dep-add-result:hover { background: var(--zoom-blue); border-color: var(--zoom-blue); color: #fff; }
.dep-add-title { font-size: 12px; font-weight: 500; }
.dep-add-sub { font-size: 10.5px; color: var(--text-muted); }
.dep-add-result:hover .dep-add-sub { color: rgba(255,255,255,0.85); }
.dep-add-actions { display: flex; justify-content: flex-end; }

/* ── Timeline / Gantt view (Phase 2.1) ─────────────────────────────────────── */
.timeline-zoom { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 11.5px; }
.timeline-zoom input[type="range"] { width: 120px; }

.timeline-wrap {
  flex: 1; overflow: hidden; background: var(--bg);
  position: relative;
}
.tl-shell {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: 44px 1fr;
}
/* Top-left corner over the labels column. */
.tl-corner {
  grid-row: 1; grid-column: 1;
  background: var(--bg2); border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 12px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
  font-weight: 600;
}
/* Date scale header that scrolls with bars. */
.tl-header {
  grid-row: 1; grid-column: 2;
  position: relative; overflow: hidden;
  background: var(--bg2); border-bottom: 1px solid var(--border);
}
.tl-header-inner { position: relative; height: 100%; }
.tl-month {
  position: absolute; top: 0; height: 22px; line-height: 22px;
  border-right: 1px solid var(--border);
  padding-left: 8px;
  font-size: 11.5px; color: var(--text); font-weight: 600;
  background: var(--bg2);
}
.tl-week-row { position: absolute; top: 22px; height: 22px; left: 0; right: 0; }
.tl-tick {
  position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border);
}

/* Sticky-left labels column. */
.tl-labels {
  grid-row: 2; grid-column: 1;
  position: relative; overflow: hidden;
  background: var(--bg2); border-right: 1px solid var(--border);
}
.tl-labels-inner { position: relative; }
.tl-row {
  position: absolute; left: 0; right: 0; height: 26px; line-height: 26px;
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-row-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-group { background: var(--bg2); }
.tl-depth-0 { font-weight: 700; color: var(--zoom-blue); }
.tl-depth-1 { font-weight: 600; }
.tl-leaf { background: var(--bg); }

/* Bars area (right of labels, scroll both axes). */
.tl-bars {
  grid-row: 2; grid-column: 2;
  position: relative; overflow: auto;
  background:
    linear-gradient(var(--bg) 25px, var(--border) 25px, var(--border) 26px, var(--bg) 26px) 0 0 / 100% 26px;
}
.tl-bars-inner { position: relative; }
.tl-bars-inner > .tl-tick {
  background: rgba(255,255,255,0.04);
}

.tl-bar {
  position: absolute; height: 18px;
  border-radius: 4px;
  background: var(--zoom-blue);
  cursor: pointer;
  overflow: hidden;
  display: flex; align-items: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
  transition: filter 0.15s, transform 0.05s;
}
.tl-bar:hover { filter: brightness(1.15); }
.tl-bar:active { transform: scale(0.98); }
.tl-bar-leaf  { background: var(--zoom-blue); }
.tl-bar-group { background: var(--bg4); height: 22px; opacity: 0.85; }
.tl-bar-critical { background: var(--red); }
.tl-bar-optional { opacity: 0.45; }
.tl-bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(255,255,255,0.22);
  pointer-events: none;
}
.tl-bar-label {
  font-size: 11px; color: #fff; padding: 0 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  pointer-events: none;
  position: relative; z-index: 1;
}

/* Vertical markers — today + go-live. */
.tl-today, .tl-golive {
  position: absolute; top: 0; bottom: 0; width: 2px;
  pointer-events: none;
}
.tl-today { background: var(--green); }
.tl-today::after {
  content: 'TODAY'; position: absolute; top: 2px; left: 4px;
  font-size: 9.5px; color: var(--green); font-weight: 700; letter-spacing: 0.5px;
}
.tl-golive { background: var(--orange); }
.tl-golive::after {
  content: 'GO-LIVE'; position: absolute; top: 2px; left: 4px;
  font-size: 9.5px; color: var(--orange); font-weight: 700; letter-spacing: 0.5px;
}

/* ── Login page ────────────────────────────────────────────────────────────── */
.login-wrap {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 32px; width: 360px; box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.login-card h1 { font-size: 20px; margin-bottom: 6px; }
.login-card h1 em { color: var(--zoom-blue); font-style: normal; }
.login-card p { color: var(--text-muted); font-size: 12px; margin-bottom: 20px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 6px; font-size: 13px; font-family: var(--font); outline: none;
}
.form-group input:focus { border-color: var(--zoom-blue); }
.login-error { color: var(--red); font-size: 12px; margin-top: 8px; min-height: 16px; }
.login-card .btn { width: 100%; padding: 10px; }
.login-divider { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 11px; margin: 14px 0 10px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn-core-sso { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 9px 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg2); color: var(--text); font-size: 13px; font-weight: 500; text-decoration: none; transition: background 0.15s, border-color 0.15s; cursor: pointer; }
.btn-core-sso:hover { background: var(--bg3, var(--bg)); border-color: var(--zoom-blue); }
.core-badge { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; background: var(--zoom-blue); color: #fff; font-size: 11px; font-weight: 700; border-radius: 5px; }

/* ── Phase 2.2 — Notification Bell ──────────────────────────────────────── */
.notif-bell-wrap { position: relative; }
.notif-bell {
  position: relative; background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 6px; border-radius: 6px;
  display: flex; align-items: center; transition: color 0.15s, background 0.15s;
}
.notif-bell:hover { color: var(--text); background: var(--bg3); }
.notif-bell.has-unread { color: var(--zoom-blue); }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700; line-height: 1;
  min-width: 14px; height: 14px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}
.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 340px; max-height: 420px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; z-index: 500;
  overflow: hidden;
}
.notif-dropdown-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 12.5px; flex-shrink: 0;
}
.notif-mark-all {
  background: none; border: none; color: var(--zoom-blue);
  cursor: pointer; font-size: 11px; padding: 2px 6px;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-list { overflow-y: auto; flex: 1; }
.notif-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 12px; }
.notif-item {
  display: flex; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg3); }
.notif-item.unread { background: rgba(45,140,255,0.07); }
.notif-item.unread:hover { background: rgba(45,140,255,0.13); }
.notif-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--zoom-blue); flex-shrink: 0; margin-top: 5px;
}
.notif-item:not(.unread) .notif-dot { background: transparent; }
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 12px; color: var(--text); font-weight: 500; line-height: 1.3; }
.notif-body  { font-size: 11px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-meta  { font-size: 10.5px; color: var(--text-muted); margin-top: 3px; }
.notif-type-badge {
  font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px;
  text-transform: uppercase; flex-shrink: 0; margin-top: 3px; align-self: flex-start;
}
.notif-type-mention { background: rgba(168,85,247,0.2); color: var(--purple); }
.notif-type-comment { background: rgba(45,140,255,0.2); color: var(--zoom-blue); }
.notif-type-status_change { background: rgba(34,197,94,0.2); color: var(--green); }
.notif-type-assignment { background: rgba(245,158,11,0.2); color: var(--orange); }
.notif-type-dep_updated { background: rgba(234,179,8,0.2); color: var(--yellow); }

/* ── Phase 2.2 — @mention Picker ─────────────────────────────────────────── */
.mention-picker {
  position: absolute; z-index: 600;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  width: 240px; max-height: 200px; overflow-y: auto;
}
.mention-item {
  padding: 7px 12px; cursor: pointer; transition: background 0.1s;
  display: flex; flex-direction: column; gap: 1px;
}
.mention-item:hover, .mention-item.active { background: var(--bg3); }
.mention-item-name  { font-size: 12.5px; color: var(--text); font-weight: 500; }
.mention-item-email { font-size: 11px; color: var(--text-muted); }
.mention-chip {
  display: inline-flex; align-items: center; gap: 3px;
  background: rgba(45,140,255,0.15); color: var(--zoom-blue);
  border-radius: 4px; padding: 0 5px; font-size: 12px; font-weight: 500;
}

/* ── Phase 2.2 — Filter Bar ──────────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 14px; background: var(--bg); border-bottom: 1px solid var(--border);
  flex-shrink: 0; gap: 10px; flex-wrap: wrap;
}
.filter-chips { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.filter-label { font-size: 11px; color: var(--text-muted); margin-right: 2px; }
.filter-chip {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text-muted); padding: 3px 9px; border-radius: 20px;
  font-size: 11px; cursor: pointer; transition: all 0.12s; white-space: nowrap;
}
.filter-chip:hover { border-color: var(--zoom-blue); color: var(--text); }
.filter-chip.active { background: var(--zoom-blue); border-color: var(--zoom-blue); color: #fff; }
.filter-right { display: flex; align-items: center; gap: 8px; }
.filter-select {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 4px 8px; border-radius: 6px; font-size: 11.5px; font-family: var(--font);
  cursor: pointer;
}
#filter-critical-only.active { background: var(--red); border-color: var(--red); color: #fff; }

/* ── Phase 2.2 — My Work View ────────────────────────────────────────────── */
.mywork-wrap { flex: 1; overflow-y: auto; padding: 20px; }
.mywork-group { margin-bottom: 24px; }
.mywork-group-header {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.mywork-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg2);
  margin-bottom: 6px; cursor: pointer; transition: all 0.12s;
}
.mywork-item:hover { border-color: var(--zoom-blue); background: var(--bg3); }
.mywork-item-left { flex: 1; min-width: 0; }
.mywork-item-title { font-size: 13px; font-weight: 500; color: var(--text); }
.mywork-item-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.mywork-item-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mywork-dates { font-size: 11px; color: var(--text-muted); }
.mywork-pct {
  font-size: 11px; color: var(--text-muted);
  width: 60px; text-align: right;
}
.mywork-empty { padding: 40px; text-align: center; color: var(--text-muted); }
.mywork-empty h3 { font-size: 15px; color: var(--text); margin-bottom: 8px; }
.mywork-empty p  { font-size: 12px; }

/* ── Phase 3 — Header icon button ─────────────────────────────────────────── */
.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 6px; border-radius: 6px;
  display: flex; align-items: center; transition: color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--text); background: var(--bg3); }

/* ── Phase 3 — Board stats bar ───────────────────────────────────────────── */
.board-stats-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 5px 14px; background: var(--bg2); border-bottom: 1px solid var(--border);
  flex-shrink: 0; min-height: 30px;
}
.stat-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 12px; font-size: 11px; font-weight: 600;
  background: var(--bg3); border: 1px solid var(--border); color: var(--text-muted);
}
.stat-chip.stat-done    { background: rgba(34,197,94,0.1);   border-color: rgba(34,197,94,0.3);  color: var(--green); }
.stat-chip.stat-overdue { background: rgba(239,68,68,0.1);   border-color: rgba(239,68,68,0.3);  color: var(--red); }
.stat-chip.stat-golive  { background: rgba(245,158,11,0.1);  border-color: rgba(245,158,11,0.3); color: var(--orange); }
.stat-chip.stat-pct     { background: rgba(45,140,255,0.1);  border-color: rgba(45,140,255,0.3); color: var(--zoom-blue); }

/* ── Phase 3 — Portfolio / Dashboard ────────────────────────────────────── */
.dash-wrap {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  background: var(--bg);
}
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.proj-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column; gap: 10px;
}
.proj-card:hover {
  border-color: var(--zoom-blue);
  box-shadow: 0 4px 20px rgba(45,140,255,0.12);
}
.proj-card-name {
  font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3;
}
.proj-card-sub {
  font-size: 11px; color: var(--text-muted); margin-top: 1px;
}
.proj-card-golive {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
}
.proj-card-golive.past   { color: var(--red); }
.proj-card-golive.soon   { color: var(--orange); }
.proj-card-golive.ok     { color: var(--text-muted); }
.proj-card-golive.none   { color: var(--text-muted); }
.proj-progress-track {
  height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden;
  border: 1px solid var(--border);
}
.proj-progress-fill {
  height: 100%; border-radius: 3px; transition: width 0.3s ease;
  background: var(--zoom-blue);
}
.proj-stat-row {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.proj-stat {
  display: flex; flex-direction: column; align-items: center; flex: 1;
  background: var(--bg3); border-radius: 6px; padding: 6px 8px;
}
.proj-stat-val { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1; }
.proj-stat-lbl { font-size: 9px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-top: 2px; }
.proj-stat.s-done .proj-stat-val     { color: var(--green); }
.proj-stat.s-overdue .proj-stat-val  { color: var(--red); }
.proj-stat.s-pct .proj-stat-val      { color: var(--zoom-blue); }

/* Single-project dashboard */
.single-dash { display: flex; flex-direction: column; gap: 20px; max-width: 900px; }
.single-dash-header { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.single-dash-title { font-size: 20px; font-weight: 700; color: var(--text); flex: 1; }
.single-dash-meta  { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.dash-kpis {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px;
}
.dash-kpi {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
}
.dash-kpi-val { font-size: 26px; font-weight: 700; line-height: 1; color: var(--text); }
.dash-kpi-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.dash-kpi.kpi-done .dash-kpi-val    { color: var(--green); }
.dash-kpi.kpi-overdue .dash-kpi-val { color: var(--red); }
.dash-kpi.kpi-pct .dash-kpi-val     { color: var(--zoom-blue); }
.dash-kpi.kpi-golive .dash-kpi-val  { color: var(--orange); font-size: 18px; }

.dash-phases { display: flex; flex-direction: column; gap: 8px; }
.dash-phase-row {
  display: grid; grid-template-columns: 160px 1fr 50px;
  align-items: center; gap: 10px; font-size: 12px;
}
.dash-phase-name { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-phase-track { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.dash-phase-fill  { height: 100%; border-radius: 4px; background: var(--zoom-blue); }
.dash-phase-pct   { font-size: 11px; color: var(--text-muted); text-align: right; }

.dash-section-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text-muted);
  margin-bottom: 8px;
}
.dash-activity-list { display: flex; flex-direction: column; gap: 5px; }
.dash-activity-item {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12px; padding: 5px 8px;
  background: var(--bg3); border-radius: 6px; color: var(--text);
}
.dash-activity-actor { font-weight: 600; flex-shrink: 0; }
.dash-activity-text  { flex: 1; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-activity-time  { flex-shrink: 0; font-size: 10.5px; color: var(--text-muted); }

/* ── Phase 3 — Calendar ──────────────────────────────────────────────────── */
.cal-wrap {
  flex: 1; overflow: hidden; display: flex; flex-direction: column;
  background: var(--bg);
}
.cal-grid-head {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--bg2); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cal-day-header {
  padding: 7px 10px; font-size: 11px; font-weight: 700;
  text-align: center; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-right: 1px solid var(--border);
}
.cal-day-header:last-child { border-right: none; }
.cal-grid {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(100px, 1fr);
  border-left: 1px solid var(--border);
}
.cal-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px 6px; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px;
  transition: background 0.1s;
}
.cal-cell:hover { background: var(--bg2); }
.cal-cell.today { background: rgba(45,140,255,0.05); }
.cal-cell.today .cal-cell-num { color: var(--zoom-blue); font-weight: 700; }
.cal-cell.other-month .cal-cell-num { color: var(--bg4); }
.cal-cell.other-month .cal-chip     { opacity: 0.45; }
.cal-cell-num {
  font-size: 11px; color: var(--text-muted);
  flex-shrink: 0; line-height: 1.4;
}
.cal-chip {
  display: block; padding: 2px 6px; border-radius: 4px; font-size: 10.5px;
  font-weight: 500; cursor: pointer; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; color: #fff;
  transition: filter 0.1s;
}
.cal-chip:hover { filter: brightness(1.2); }
.cal-overflow {
  font-size: 10px; color: var(--text-muted); cursor: pointer;
  padding: 1px 4px;
}
.cal-overflow:hover { color: var(--text); }

/* ── Phase 3 — Settings panel ────────────────────────────────────────────── */
.settings-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 300; opacity: 0; transition: opacity 0.18s ease;
}
.settings-backdrop.open { opacity: 1; }
.settings-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(700px, 95vw);
  background: var(--bg2); border-left: 1px solid var(--border);
  z-index: 301; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.22s ease;
  box-shadow: -8px 0 32px rgba(0,0,0,0.55);
}
.settings-panel.open { transform: translateX(0); }
.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.settings-title { font-size: 15px; font-weight: 700; color: var(--text); }
.settings-close {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; padding: 0 4px; border-radius: 4px;
  line-height: 1;
}
.settings-close:hover { color: var(--text); background: var(--bg3); }
.settings-layout {
  display: flex; flex: 1; overflow: hidden;
}
.settings-nav {
  width: 130px; flex-shrink: 0; border-right: 1px solid var(--border);
  padding: 12px 8px; display: flex; flex-direction: column; gap: 2px;
  background: var(--bg);
}
.settings-nav-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; color: var(--text-muted);
  padding: 8px 10px; border-radius: 6px; font-size: 12.5px;
  cursor: pointer; font-family: var(--font); width: 100%;
  text-align: left; transition: all 0.12s;
}
.settings-nav-btn:hover  { color: var(--text); background: var(--bg2); }
.settings-nav-btn.active { color: var(--zoom-blue); background: rgba(45,140,255,0.1); }
.settings-content {
  flex: 1; overflow-y: auto; padding: 18px 20px;
}
.settings-section { display: none; }
.settings-section.active { display: block; }
.settings-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.settings-section-head h3 { font-size: 14px; font-weight: 700; color: var(--text); }
.settings-hint { font-size: 11px; color: var(--text-muted); }

/* Invite form */
.invite-form {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 12px;
}
.invite-form input, .invite-form select {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  padding: 6px 10px; border-radius: 6px; font-size: 12px; font-family: var(--font);
  outline: none;
}
.invite-form input[type="email"] { flex: 2; min-width: 160px; }
.invite-form input[type="text"]  { flex: 1; min-width: 120px; }
.invite-form input:focus, .invite-form select:focus { border-color: var(--zoom-blue); }
.invite-result { font-size: 12px; margin-bottom: 8px; min-height: 16px; }
.invite-result.ok  { color: var(--green); }
.invite-result.err { color: var(--red); }

/* Team list */
.team-list { display: flex; flex-direction: column; gap: 5px; }
.team-member {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px;
}
.team-member-info { flex: 1; min-width: 0; }
.team-member-name  { font-size: 12.5px; font-weight: 600; color: var(--text); }
.team-member-email { font-size: 11px; color: var(--text-muted); }
.team-member-role {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  padding: 3px 6px; border-radius: 4px; font-size: 11.5px; font-family: var(--font);
  cursor: pointer; outline: none;
}
.team-member-role:focus { border-color: var(--zoom-blue); }
.team-member-remove {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; padding: 3px 7px; border-radius: 4px; font-size: 15px;
}
.team-member-remove:hover { color: var(--red); background: var(--bg2); }

/* Status manager */
.status-manager { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.status-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; cursor: default;
  transition: border-color 0.12s;
}
.status-row.drag-over { border-color: var(--zoom-blue); }
.status-row.dragging  { opacity: 0.4; }
.status-drag-handle {
  color: var(--text-muted); font-size: 14px; cursor: grab; user-select: none;
  flex-shrink: 0;
}
.status-drag-handle:active { cursor: grabbing; }
.status-color-btn {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.2);
  cursor: pointer; flex-shrink: 0; position: relative; overflow: hidden;
}
.status-color-btn input[type="color"] {
  position: absolute; inset: -4px; opacity: 0; cursor: pointer; width: 26px; height: 26px;
}
.status-label-input {
  flex: 1; background: transparent; border: none; color: var(--text);
  font-family: var(--font); font-size: 13px; outline: none;
  border-bottom: 1px solid transparent; padding: 1px 2px;
}
.status-label-input:focus { border-bottom-color: var(--zoom-blue); }
.status-done-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 1px 6px; border-radius: 4px; color: var(--green);
  background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.25);
  flex-shrink: 0;
}
.status-done-toggle {
  display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-muted);
  cursor: pointer; flex-shrink: 0;
}
.status-done-toggle input { cursor: pointer; }
.status-delete-btn {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; padding: 3px 6px; border-radius: 4px; font-size: 15px;
  flex-shrink: 0;
}
.status-delete-btn:hover { color: var(--red); background: var(--bg2); }

/* Add-status form */
.status-add-form {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 10px 12px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 6px;
}
.status-add-form input[type="text"] {
  flex: 1; min-width: 140px;
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  padding: 6px 10px; border-radius: 6px; font-size: 12px; font-family: var(--font);
  outline: none;
}
.status-add-form input[type="text"]:focus  { border-color: var(--zoom-blue); }
.status-add-form input[type="color"] {
  width: 32px; height: 30px; border: 1px solid var(--border); border-radius: 6px;
  padding: 2px; background: var(--bg2); cursor: pointer;
}
.search-input {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 5px 10px; border-radius: 6px; font-size: 12px; font-family: var(--font);
  outline: none; width: 180px;
}
.search-input:focus { border-color: var(--zoom-blue); }

/* ── Theme toggle icon visibility ────────────────────────────────────────── */
.icon-sun  { display: var(--icon-sun-display); }
.icon-moon { display: var(--icon-moon-display); }

/* ═══════════════════════════════════════════════════════════════════════════
   LIGHT THEME
   Applied when <html data-theme="light">. Overrides :root custom properties
   AND resets Tabulator midnight-theme colours.
   ═══════════════════════════════════════════════════════════════════════════ */

html[data-theme="light"] {
  color-scheme: light;

  /* Palette */
  --bg:           #f4f6fb;
  --bg2:          #ffffff;
  --bg3:          #edf0f8;
  --bg4:          #dde2f0;
  --border:       #d3d8ec;
  --text:         #1a1d2e;
  --text-muted:   #6b748a;
  --green:        #15803d;
  --red:          #b91c1c;
  --orange:       #b45309;
  --yellow:       #a16207;
  --purple:       #7e22ce;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* Theme toggle: show moon, hide sun */
  --icon-sun-display:  none;
  --icon-moon-display: block;
}

/* Base */
html[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}

/* ── Tabulator midnight override ─────────────────────────────────────────── */
/* Reset every dark rule from tabulator_midnight.min.css */
html[data-theme="light"] .tabulator {
  background: var(--bg) !important;
  color: var(--text) !important;
  border: none !important;
}
html[data-theme="light"] .tabulator .tabulator-header {
  background: var(--bg2) !important;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
}
html[data-theme="light"] .tabulator .tabulator-header .tabulator-col {
  background: var(--bg2) !important;
  border-right: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
}
html[data-theme="light"] .tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover {
  background: var(--bg3) !important;
}
html[data-theme="light"] .tabulator .tabulator-header .tabulator-col .tabulator-col-content {
  color: var(--text-muted) !important;
}
html[data-theme="light"] .tabulator .tabulator-row {
  background: var(--bg) !important;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text) !important;
}
html[data-theme="light"] .tabulator .tabulator-row.tabulator-row-even {
  background: var(--bg2) !important;
}
html[data-theme="light"] .tabulator .tabulator-row:hover {
  background: var(--bg3) !important;
}
html[data-theme="light"] .tabulator .tabulator-cell {
  border-right: 1px solid var(--border) !important;
  color: var(--text) !important;
}
/* Phase / group rows */
html[data-theme="light"] .tabulator .tabulator-tree-level-0 > .tabulator-cell {
  background: var(--bg2) !important;
  color: var(--zoom-blue) !important;
}
html[data-theme="light"] .tabulator .tabulator-row.tabulator-tree-level-0 {
  background: var(--bg2) !important;
  box-shadow: 0 1px 0 var(--border) !important;
}
html[data-theme="light"] .tabulator .tabulator-tree-level-1 > .tabulator-cell { color: var(--text) !important; }
html[data-theme="light"] .tabulator .tabulator-tree-level-2 > .tabulator-cell { color: var(--text) !important; }
html[data-theme="light"] .tabulator .tabulator-tree-level-3 > .tabulator-cell { color: var(--text-muted) !important; }
/* Tree control (expand/collapse arrows) */
html[data-theme="light"] .tabulator .tabulator-tree-control {
  background: transparent !important;
  border-color: var(--text-muted) !important;
  color: var(--text-muted) !important;
}
html[data-theme="light"] .tabulator .tabulator-tree-control:hover {
  background: var(--bg3) !important;
  border-color: var(--text) !important;
}
/* Status list editor popup */
html[data-theme="light"] .tabulator-popup-container {
  background: var(--bg2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}
html[data-theme="light"] .tabulator-edit-list {
  background: var(--bg2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}
html[data-theme="light"] .tabulator-edit-list .tabulator-edit-list-item {
  color: var(--text) !important;
}
html[data-theme="light"] .tabulator-edit-list .tabulator-edit-list-item:hover,
html[data-theme="light"] .tabulator-edit-list .tabulator-edit-list-item.active {
  background: var(--bg3) !important;
}
/* Inline editors (number/date/text inputs inside cells) */
html[data-theme="light"] .tabulator-cell input,
html[data-theme="light"] .tabulator-cell select {
  background: var(--bg2) !important;
  color: var(--text) !important;
  border: 1px solid var(--zoom-blue) !important;
}
/* Critical-path rows */
html[data-theme="light"] .tabulator .tabulator-row.row-critical:hover {
  background: rgba(185,28,28,0.05) !important;
}
/* Optional rows — slightly dimmed */
html[data-theme="light"] .tabulator .tabulator-row.row-optional {
  opacity: 0.6;
}

/* ── App chrome in light mode ────────────────────────────────────────────── */
html[data-theme="light"] .app-header {
  background: var(--bg2);
  border-bottom-color: var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
html[data-theme="light"] .board-toolbar   { background: var(--bg2); border-bottom-color: var(--border); }
html[data-theme="light"] .board-stats-bar { background: var(--bg2); border-bottom-color: var(--border); }
html[data-theme="light"] .filter-bar      { background: var(--bg2); border-bottom-color: var(--border); }

html[data-theme="light"] .btn-secondary {
  background: var(--bg3);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="light"] .btn-secondary:hover { background: var(--bg4); }

html[data-theme="light"] .golive-picker {
  background: var(--bg3);
  border-color: var(--border);
}

html[data-theme="light"] .filter-chip {
  background: var(--bg3);
  border-color: var(--border);
  color: var(--text-muted);
}
html[data-theme="light"] .filter-chip:hover { border-color: var(--zoom-blue); color: var(--text); }
html[data-theme="light"] .filter-chip.active { background: var(--zoom-blue); border-color: var(--zoom-blue); color: #fff; }

html[data-theme="light"] .filter-select,
html[data-theme="light"] .search-input {
  background: var(--bg3);
  border-color: var(--border);
  color: var(--text);
}

/* Row-detail drawer */
html[data-theme="light"] .drawer-backdrop { background: rgba(0,0,0,0.25); }
html[data-theme="light"] .row-drawer      { background: var(--bg2); border-left-color: var(--border); box-shadow: -8px 0 32px rgba(0,0,0,0.12); }
html[data-theme="light"] .drawer-head     { background: var(--bg2); border-bottom-color: var(--border); }
html[data-theme="light"] .drawer-notes,
html[data-theme="light"] .comment-composer textarea {
  background: var(--bg3);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="light"] .comment-item  { background: var(--bg3); border-color: var(--border); }
html[data-theme="light"] .activity-item { background: var(--bg3); }
html[data-theme="light"] .watcher-item  { background: var(--bg3); border-color: var(--border); }
html[data-theme="light"] .dep-item      { background: var(--bg3); border-color: var(--border); }
html[data-theme="light"] .dep-add       { background: var(--bg3); border-color: var(--border); }
html[data-theme="light"] .dep-type, html[data-theme="light"] .dep-lag { background: var(--bg2); border-color: var(--border); color: var(--text); }
html[data-theme="light"] .dep-add input, html[data-theme="light"] .dep-add select {
  background: var(--bg2); border-color: var(--border); color: var(--text);
}
html[data-theme="light"] .dep-add-result { background: var(--bg2); border-color: var(--border); color: var(--text); }

/* Context menu */
html[data-theme="light"] .row-context-menu { background: var(--bg2); border-color: var(--border); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
html[data-theme="light"] .row-context-item { color: var(--text); }
html[data-theme="light"] .row-context-item:hover { background: var(--bg3); }

/* Notification dropdown */
html[data-theme="light"] .notif-dropdown  { background: var(--bg2); border-color: var(--border); box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
html[data-theme="light"] .notif-item      { border-bottom-color: var(--border); }
html[data-theme="light"] .notif-item:hover { background: var(--bg3); }
html[data-theme="light"] .notif-item.unread { background: rgba(45,140,255,0.06); }
html[data-theme="light"] .notif-item.unread:hover { background: rgba(45,140,255,0.1); }
html[data-theme="light"] .notif-dropdown-head { border-bottom-color: var(--border); }

/* @mention picker */
html[data-theme="light"] .mention-picker { background: var(--bg2); border-color: var(--border); box-shadow: 0 6px 24px rgba(0,0,0,0.15); }
html[data-theme="light"] .mention-item:hover, html[data-theme="light"] .mention-item.active { background: var(--bg3); }

/* My Work */
html[data-theme="light"] .mywork-item { background: var(--bg2); border-color: var(--border); }
html[data-theme="light"] .mywork-item:hover { background: var(--bg3); border-color: var(--zoom-blue); }
html[data-theme="light"] .mywork-group-header { border-bottom-color: var(--border); }

/* Dashboard / portfolio */
html[data-theme="light"] .dash-wrap     { background: var(--bg); }
html[data-theme="light"] .proj-card     { background: var(--bg2); border-color: var(--border); }
html[data-theme="light"] .proj-stat     { background: var(--bg3); }
html[data-theme="light"] .proj-progress-track { background: var(--bg3); border-color: var(--border); }
html[data-theme="light"] .dash-kpi      { background: var(--bg2); border-color: var(--border); }
html[data-theme="light"] .dash-phase-track { background: var(--bg3); border-color: var(--border); }
html[data-theme="light"] .dash-activity-item { background: var(--bg3); }

/* Calendar */
html[data-theme="light"] .cal-wrap     { background: var(--bg); }
html[data-theme="light"] .cal-grid-head { background: var(--bg2); border-bottom-color: var(--border); }
html[data-theme="light"] .cal-cell     { border-color: var(--border); }
html[data-theme="light"] .cal-cell:hover { background: var(--bg2); }
html[data-theme="light"] .cal-cell.today { background: rgba(45,140,255,0.06); }
html[data-theme="light"] .cal-grid     { border-left-color: var(--border); }
html[data-theme="light"] .cal-day-header { border-right-color: var(--border); }

/* Settings panel */
html[data-theme="light"] .settings-backdrop { background: rgba(0,0,0,0.2); }
html[data-theme="light"] .settings-panel { background: var(--bg2); border-left-color: var(--border); box-shadow: -8px 0 32px rgba(0,0,0,0.1); }
html[data-theme="light"] .settings-head  { border-bottom-color: var(--border); }
html[data-theme="light"] .settings-nav   { background: var(--bg); border-right-color: var(--border); }
html[data-theme="light"] .settings-nav-btn:hover  { background: var(--bg2); }
html[data-theme="light"] .settings-nav-btn.active { background: rgba(45,140,255,0.08); }
html[data-theme="light"] .invite-form    { background: var(--bg3); border-color: var(--border); }
html[data-theme="light"] .invite-form input, html[data-theme="light"] .invite-form select {
  background: var(--bg2); border-color: var(--border); color: var(--text);
}
html[data-theme="light"] .team-member   { background: var(--bg3); border-color: var(--border); }
html[data-theme="light"] .team-member-role { background: var(--bg2); border-color: var(--border); color: var(--text); }
html[data-theme="light"] .status-row    { background: var(--bg3); border-color: var(--border); }
html[data-theme="light"] .status-add-form { background: var(--bg3); border-color: var(--border); }
html[data-theme="light"] .status-add-form input[type="text"] { background: var(--bg2); border-color: var(--border); color: var(--text); }
html[data-theme="light"] .status-label-input { color: var(--text); }

/* Timeline / Gantt */
html[data-theme="light"] .tl-corner  { background: var(--bg2); border-color: var(--border); }
html[data-theme="light"] .tl-header  { background: var(--bg2); border-bottom-color: var(--border); }
html[data-theme="light"] .tl-month   { background: var(--bg2); border-right-color: var(--border); color: var(--text); }
html[data-theme="light"] .tl-labels  { background: var(--bg2); border-right-color: var(--border); }
html[data-theme="light"] .tl-row     { border-bottom-color: var(--border); color: var(--text); }
html[data-theme="light"] .tl-group   { background: var(--bg2); }
html[data-theme="light"] .tl-leaf    { background: var(--bg); }
html[data-theme="light"] .tl-bars    {
  background: linear-gradient(var(--bg) 25px, var(--border) 25px, var(--border) 26px, var(--bg) 26px) 0 0 / 100% 26px;
}
html[data-theme="light"] .tl-bar-group { background: var(--bg4); }

/* Login card */
html[data-theme="light"] .login-wrap { background: var(--bg); }
html[data-theme="light"] .login-card { background: var(--bg2); border-color: var(--border); box-shadow: 0 8px 40px rgba(0,0,0,0.1); }
html[data-theme="light"] .form-group input { background: var(--bg3); border-color: var(--border); color: var(--text); }
html[data-theme="light"] .form-group input:focus { border-color: var(--zoom-blue); }

/* Pct bars — lighter track in light mode */
html[data-theme="light"] .pct-bar { background: var(--bg3); border-color: var(--border); }
