:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-alt: #f6f7fb;
  --border: #e2e4e9;
  --text: #1f2430;
  --text-muted: #6b7280;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-tint: rgba(99,102,241,.12);
  --danger: #ef4444;
  --danger-tint: rgba(239,68,68,.12);
  --warn: #f59e0b;
  --warn-tint: rgba(245,158,11,.15);
  --ok: #10b981;
  --ok-tint: rgba(16,185,129,.14);
  --todo: #94a3b8;
  --doing: #3b82f6;
  --done: #10b981;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.05);
  --sidebar-w: 250px;
  /* Gantt SVG fills — these are inline presentation attributes (fill="..."), not CSS, so
     charts.js reads these custom properties via getComputedStyle at render time rather than
     relying on a [data-theme] selector that could never reach them. */
  --gantt-weekend: #f6f7f9;
  --gantt-rowline: #f0f1f4;
  --gantt-slack: #c7d2fe;
}
[data-theme="dark"] {
  --bg: #0e1016;
  --surface: #171a24;
  --surface-alt: #1e2230;
  --border: #2b2f3d;
  --text: #e7e9f0;
  --text-muted: #9aa0b4;
  --primary: #818cf8;
  --primary-dark: #a5b4fc;
  --primary-tint: rgba(129,140,248,.18);
  --danger: #f87171;
  --danger-tint: rgba(248,113,113,.16);
  --warn: #fbbf24;
  --warn-tint: rgba(251,191,36,.16);
  --ok: #34d399;
  --ok-tint: rgba(52,211,153,.16);
  --todo: #64748b;
  --doing: #60a5fa;
  --done: #34d399;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  --gantt-weekend: #1e2230;
  --gantt-rowline: #2b2f3d;
  --gantt-slack: #3d4166;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  /* Noto Sans Thai leads, not Inter — Inter has zero Thai glyph coverage, so any string mixing
     Thai with Latin digits/letters (nearly every date and count in this app, e.g. "2 ตุลาคม")
     split across two unrelated type families mid-string: Inter drew the digit, Noto Sans Thai
     drew the Thai, and their differing proportions/weight made the pairing look inconsistent.
     Noto Sans Thai has full Latin coverage too, so leading with it renders both scripts from one
     consistent family; pure-English UI text (button labels etc.) just picks up its Latin style
     instead of Inter's. */
  font-family: 'Noto Sans Thai', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
  transition: background .15s ease, color .15s ease;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- Login ---------- */
.login-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 100; }
.login-box { background: var(--surface); padding: 36px; border-radius: 14px; box-shadow: var(--shadow); width: 320px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-box input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 16px; }

/* ---------- Layout ---------- */
.app { display: flex; height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--surface); color: var(--text);
  display: flex; flex-direction: column; flex-shrink: 0; z-index: 40;
  border-right: 1px solid var(--border);
}
.sidebar-header { padding: 20px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.logo {
  font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--text); display: flex; align-items: center; gap: 9px;
  border: none; background: transparent; padding: 2px; border-radius: 8px; cursor: pointer;
}
.logo svg { color: var(--primary); flex-shrink: 0; }
.logo:hover { color: var(--primary-dark); }
.header-actions { display: flex; align-items: center; gap: 2px; }
.sidebar-close { display: none; color: var(--text-muted); }
.sidebar-section-title { padding: 8px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; }
.sidebar-section-title .icon-btn { color: var(--text-muted); }
.project-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.project-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  cursor: pointer; color: var(--text); margin-bottom: 2px; font-size: 13.5px;
}
.project-item:hover { background: var(--bg); }
.project-item.active { background: var(--primary-tint); color: var(--primary-dark); font-weight: 600; }
.project-item .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.project-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-item .count { font-size: 11px; color: var(--text-muted); }
.project-item.archived { opacity: .55; }
.project-item.dragging { opacity: .4; }
.project-item.drag-over { box-shadow: inset 0 2px 0 var(--primary); }
.sidebar-group-header {
  display: flex; align-items: center; gap: 6px; padding: 10px 10px 4px; margin-top: 4px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
  cursor: pointer; border-radius: 6px;
}
.sidebar-group-header.drag-over { background: var(--primary-tint); outline: 1px dashed var(--primary); }
.sidebar-group-header.dragging { opacity: .4; }

/* Rows are draggable (reorder / move between folders) but also clickable (select / collapse) —
   the handle is a dedicated grab target so the two affordances don't fight over the cursor. It
   stays invisible until hover so the sidebar doesn't look cluttered at rest. */
.drag-handle {
  flex-shrink: 0; opacity: 0; cursor: grab; color: var(--text-muted); font-size: 12px;
  line-height: 1; padding: 2px; margin: -2px 0; border-radius: 4px; transition: opacity .12s ease;
}
.project-item:hover .drag-handle, .sidebar-group-header:hover .drag-handle { opacity: .55; }
.drag-handle:hover { opacity: 1 !important; background: var(--bg); }
.drag-handle:active { cursor: grabbing; }
.folder-toggle { width: 12px; flex-shrink: 0; font-size: 9px; text-align: center; }
.sidebar-group-header .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-group-header .count { font-size: 10.5px; }
/* Eye (on/off) button on project rows and folder headers. Off items stay listed but dimmed so they can be switched back on. */
.sidebar-title-link { cursor: pointer; border-radius: 4px; padding: 1px 4px; margin-left: -4px; }
.sidebar-title-link:hover, .sidebar-title-link.active { color: var(--primary); background: var(--primary-tint); }

/* Folders page (click "Projects" in the sidebar) */
.fv-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.fv-summary { font-size: 13px; color: var(--text-muted); }
.fv-new-input { padding: 7px 12px; border: 1px solid var(--primary); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; width: 240px; max-width: 100%; outline: none; box-shadow: 0 0 0 3px var(--primary-tint); }
.fv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; align-items: start; }
.fv-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 18px 12px; min-width: 0; transition: box-shadow .2s, transform .2s; }
.fv-card:hover { box-shadow: 0 6px 22px rgba(0,0,0,.10); transform: translateY(-2px); }
.fv-card.is-off { opacity: .5; }
.fv-head { display: flex; align-items: center; gap: 10px; }
.fv-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-tint); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.fv-icon svg { margin: 0 !important; width: 17px; height: 17px; }
.fv-title { flex: 1; font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fv-badge { font-size: 11.5px; font-weight: 600; color: var(--text-muted); background: var(--surface-alt); border-radius: 999px; padding: 2px 9px; }
.fv-stats { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin: 14px 0 6px; }
.fv-bar { height: 6px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; }
.fv-bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--ok)); }
.fv-list { margin-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.fv-project { display: grid; grid-template-columns: 10px 1fr auto; grid-template-areas: "dot name count" "bar bar bar"; column-gap: 10px; row-gap: 6px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 9px 10px; cursor: pointer; color: var(--text); font: inherit; }
.fv-project:hover { background: var(--surface-alt); }
.fv-project.is-off { opacity: .45; }
.fv-project.is-off .fv-pname { text-decoration: line-through; text-decoration-thickness: 1px; }
.fv-dot { grid-area: dot; width: 10px; height: 10px; border-radius: 50%; }
.fv-pname { grid-area: name; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fv-pname em { font-style: normal; color: var(--text-muted); font-size: 11.5px; }
.fv-pcount { grid-area: count; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.fv-mini { grid-area: bar; height: 3px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; }
.fv-mini > span { display: block; height: 100%; border-radius: 999px; }
.fv-none { font-size: 12.5px; color: var(--text-muted); padding: 10px; }
.fv-empty { text-align: center; color: var(--text-muted); padding: 60px 20px; }
.eye-btn { background: none; border: 0; padding: 2px 4px; border-radius: 4px; cursor: pointer; color: var(--text-muted); line-height: 0; flex-shrink: 0; opacity: .45; }
.project-item:hover .eye-btn, .sidebar-group-header:hover .eye-btn, .eye-btn.off { opacity: 1; }
.eye-btn:hover { background: var(--bg); color: var(--text); }
.project-item.is-off, .sidebar-group-header.is-off { opacity: .45; }
.project-item.is-off .name, .sidebar-group-header.is-off .name { text-decoration: line-through; text-decoration-thickness: 1px; }
.project-item.is-off:hover, .sidebar-group-header.is-off:hover { opacity: .8; }
.group-actions { display: flex; gap: 2px; flex-shrink: 0; }
.group-actions .icon-btn { font-size: 10px; padding: 2px 4px; color: var(--text-muted); }
.group-actions .icon-btn:hover { color: var(--text); }
.add-group-row { padding: 4px 10px 8px; }
.add-group-row input[type=text] { width: 100%; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 13px; }
.sidebar-footer { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.sidebar-footer .btn { color: var(--text-muted); flex: 1; }
.sidebar-backdrop { display: none; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px 18px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.menu-btn { display: none; font-size: 18px; }
.project-title-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.project-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.project-title { font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-tabs { display: flex; gap: 2px; margin-left: auto; background: var(--bg); padding: 3px; border-radius: 9px; overflow-x: auto; }
.view-tab {
  border: none; background: transparent; padding: 7px 12px; border-radius: 7px;
  font-size: 13px; color: var(--text-muted); white-space: nowrap;
}
.view-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); font-weight: 600; }
.view-container { flex: 1; overflow: auto; padding: 18px; }

/* ---------- Buttons / inputs ---------- */
.btn { border: none; border-radius: 8px; padding: 8px 14px; font-size: 13.5px; font-weight: 500; background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); filter: none; }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.icon-btn { border: none; background: transparent; font-size: 15px; padding: 4px 7px; border-radius: 6px; color: var(--text-muted); }
.icon-btn:hover { background: rgba(0,0,0,.06); }
input[type=text], input[type=date], input[type=number], input[type=password], select, textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; width: 100%;
}
textarea { resize: vertical; min-height: 70px; }
label.field-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; display: block; margin-bottom: 4px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge.status-todo { background: #f1f5f9; color: #64748b; }
.badge.status-doing { background: #dbeafe; color: #1d4ed8; }
.badge.status-done { background: #d1fae5; color: #047857; }
.badge.prio-low { background: #f1f5f9; color: #64748b; }
.badge.prio-medium { background: #e0e7ff; color: #4338ca; }
.badge.prio-high { background: #ffedd5; color: #c2410c; }
.badge.prio-urgent { background: #fee2e2; color: #b91c1c; }
.tag-chip { display: inline-block; padding: 2px 8px; border-radius: 12px; background: #eef2ff; color: #4f46e5; font-size: 11px; margin: 1px 2px 1px 0; }
.overdue-text { color: var(--danger); font-weight: 600; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=text] { width: 200px; }
.toolbar select { width: auto; }
.toolbar .spacer { flex: 1; }

/* ---------- List view ---------- */
.task-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.task-table th { text-align: left; padding: 10px 12px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--border); background: #fafbfc; cursor: pointer; user-select: none; white-space: nowrap; }
.task-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.task-table tr:last-child td { border-bottom: none; }
.task-table tr.task-row:hover { background: #f8f9ff; cursor: pointer; }
.task-title-cell { display: flex; align-items: center; gap: 6px; min-width: 220px; }
.expander { width: 18px; height: 18px; border: none; background: transparent; color: var(--text-muted); font-size: 10px; flex-shrink: 0; }
.subtask-indent { display: inline-block; }
.task-title-text { font-weight: 500; }
.task-title-text.done { text-decoration: line-through; color: var(--text-muted); }
.meta-icons { color: var(--text-muted); font-size: 11px; margin-left: 6px; white-space: nowrap; }
.inline-select { border: 1px solid transparent; background: transparent; padding: 3px 5px; border-radius: 6px; font-size: 12.5px; }
.inline-select:hover { border-color: var(--border); background: #fff; }
.add-task-row td { padding: 6px 12px; }
.task-table th.sorted { color: var(--text); }
.list-group-header { cursor: pointer; user-select: none; }
.list-group-header:hover td { background: #f0f1f7; }
.list-group-header td {
  background: #f6f7fb; font-weight: 600; font-size: 12.5px;
  padding: 8px 12px; display: flex; align-items: center; gap: 6px;
}
.list-group-header .expander { pointer-events: none; }
.list-group-header .count { background: rgba(0,0,0,.08); border-radius: 10px; padding: 1px 8px; font-size: 11px; color: var(--text-muted); margin-left: 2px; }
.add-task-input { border: none !important; background: transparent; padding: 6px 4px; }
.add-task-input:focus { outline: none; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 14px; align-items: flex-start; min-height: 70vh; }
.kanban-col { background: #eceef2; border-radius: 12px; padding: 10px; width: 300px; flex-shrink: 0; }
.kanban-col-header { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 600; font-size: 13px; }
.kanban-col-header .count { background: rgba(0,0,0,.08); border-radius: 10px; padding: 1px 8px; font-size: 11.5px; }
.kanban-cards { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-col.drag-over .kanban-cards { outline: 2px dashed var(--primary); outline-offset: 4px; border-radius: 8px; }
.kanban-card { background: var(--surface); border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.08); cursor: grab; border-left: 3px solid transparent; }
.kanban-card:active { cursor: grabbing; }
.kanban-card.prio-urgent { border-left-color: var(--danger); }
.kanban-card.prio-high { border-left-color: var(--warn); }
.kanban-card .kc-title { font-weight: 600; margin-bottom: 6px; }
.kanban-card .kc-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 11.5px; color: var(--text-muted); }
.kanban-card.dragging { opacity: .4; }
.kc-parent { font-size: 10.5px; color: var(--text-muted); margin-bottom: 3px; }

/* ---------- Calendar ---------- */
.calendar-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.calendar-header h2 { font-size: 16px; min-width: 160px; text-align: center; }
.calendar-header .spacer { flex: 1; }
.gcal-picker { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.gcal-picker-row { display: flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.cal-event.gcal-event { background: #0ea5e9; cursor: default; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-dow { background: #fafbfc; padding: 8px; text-align: center; font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.cal-cell { background: var(--surface); min-height: 96px; padding: 6px; font-size: 12px; cursor: pointer; }
.cal-cell:hover { background: #f5f6fa; }
.cal-cell.other-month { background: #fafafa; color: #c0c4cc; }
.cal-cell.other-month:hover { background: #f0f0f0; }
.cal-cell .day-num { font-weight: 600; margin-bottom: 4px; }
.cal-cell.today .day-num { background: var(--primary); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.cal-event { border-radius: 5px; padding: 2px 6px; margin-bottom: 3px; font-size: 11px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.cal-event.done { opacity: .5; text-decoration: line-through; }
.cal-event.overdue { outline: 1.5px solid var(--danger); }

/* ---------- Gantt / Network ---------- */
.chart-wrap { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; overflow: auto; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); margin-bottom: 10px; flex-wrap: wrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.network-svg text, .gantt-svg text { font-family: inherit; }

/* ---------- Gantt (frozen header + frozen task column) ----------
   Both freezes — the task column (left) and the date header (top) — work the same way: the
   frozen piece sits structurally OUTSIDE the one element that actually scrolls, rather than
   being a `position:sticky` layer painted over shared scroll content. That ruled out the
   horizontal bleed-through bug entirely (see .gantt-labelcol below); .gantt-headrow uses the
   same approach for the vertical axis — it's a plain sibling before .gantt-bodywrap (the only
   vertical scroller, height set in JS from renderGanttView), never a sticky element layered
   on top of scrolled rows, so there's no coordinate space in which row content could paint over
   it regardless of browser/GPU compositing behavior. */
.gantt-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; }
.gantt-controls { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.gantt-zoom-group { display: flex; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; }
.gantt-zoom-btn { border: none; background: transparent; border-radius: 6px; padding: 5px 11px; font-size: 12.5px; font-weight: 500; color: var(--text-muted); }
.gantt-zoom-btn:hover { color: var(--text); }
.gantt-zoom-btn.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.gantt-range { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.gantt-grid { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }

.gantt-headrow { display: flex; height: 44px; background: var(--surface); border-bottom: 1px solid var(--border); }
.gantt-bodywrap { overflow-y: auto; } /* max-height set in JS (renderGanttView's sizeBodyWrap) */
.gantt-corner {
  flex-shrink: 0; display: flex; align-items: center;
  padding: 0 12px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); background: var(--surface); border-right: 1px solid var(--border);
}
.gantt-headscroll { flex: 1; min-width: 0; overflow: hidden; }
/* height:100% is load-bearing, not decorative: .gantt-tick children are position:absolute with
   height:100%, which (per spec) resolves against this element's own height — and since its own
   children are all absolutely positioned (nothing in normal flow), it has no natural height of
   its own without this. Without it, ticks collapsed to 0-height boxes, their vertically-centered
   text extending half above this element's top edge, clipped away by .gantt-headscroll's
   overflow:hidden (showed up as the week/month date labels looking cut off at the top). */
.gantt-dateheader { position: relative; height: 100%; }
.gantt-tick { position: absolute; top: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gantt-tick-day .tick-dow { font-size: 8.5px; color: #9aa0ab; text-transform: uppercase; line-height: 1.3; }
.gantt-tick-day .tick-num { font-size: 11px; color: var(--text-muted); }
.gantt-tick-day .tick-num.tick-strong, .gantt-tick-week .tick-num.tick-strong, .gantt-tick-month .tick-num.tick-strong { color: var(--text); font-weight: 700; }
.gantt-tick-week, .gantt-tick-month { align-items: flex-start; border-left: 1px solid var(--border); padding-left: 5px; }
.gantt-tick-week .tick-num, .gantt-tick-month .tick-num { font-size: 11px; color: var(--text-muted); }
.gantt-today-flag {
  position: absolute; top: 4px; transform: translateX(-50%); background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: .03em; padding: 2px 6px; border-radius: 4px; white-space: nowrap;
}

.gantt-bodyrow { display: flex; align-items: flex-start; }
.gantt-labelcol { flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); }
.gantt-bodyscroll { flex: 1; min-width: 0; overflow-x: auto; }
.gantt-label-row { display: flex; align-items: center; padding: 0 10px 0 12px; border-bottom: 1px solid #f0f1f4; cursor: pointer; gap: 2px; }
.gantt-label-row:hover, .gantt-label-row.row-hover { background: #f5f6fb; }
.gantt-label-row.gantt-group-row { cursor: default; gap: 8px; font-weight: 700; background: #fafbfd; }
.gantt-label-row.gantt-group-row:hover { background: #fafbfd; }
.gantt-label-row .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.gantt-indent { flex-shrink: 0; }
.gantt-label-text { font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-label-text.done { color: var(--text-muted); text-decoration: line-through; }
.gantt-crit-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); flex-shrink: 0; margin-left: 4px; }
.gantt-timelinecol { position: relative; }
.gantt-svg { display: block; }
.gantt-bar { cursor: pointer; }
.gantt-bar.row-hover rect:first-child { stroke: #1f2430; stroke-width: 1.5; filter: brightness(1.05); }
.network-node { cursor: pointer; }
.cpm-note { font-size: 12.5px; color: var(--text-muted); margin: 8px 2px; }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 14px; }
.dash-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.dash-card h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 12px; }
.stat-row { display: flex; align-items: baseline; gap: 8px; }
.stat-big { font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat-sub { font-size: 12.5px; color: var(--text-muted); }
.dash-wide { grid-column: 1 / -1; }
.progress-track { background: #eef0f4; height: 10px; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: var(--ok); border-radius: 6px; transition: width .4s; }
.mini-list { list-style: none; }
.mini-list li { padding: 7px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; font-size: 13px; cursor: pointer; }
.mini-list li:last-child { border-bottom: none; }
.mini-list .date { color: var(--text-muted); white-space: nowrap; font-size: 12px; }
.activity-item { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.activity-item:last-child { border-bottom: none; }
.activity-item .when { color: var(--text-muted); font-size: 11px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; }
.bar-row .bar-label { width: 70px; color: var(--text-muted); }
.bar-row .bar-track { flex: 1; background: #eef0f4; border-radius: 5px; height: 14px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; border-radius: 5px; }
.bar-row .bar-val { width: 30px; text-align: right; font-weight: 600; }
.workload-day { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 12.5px; }
.workload-day .wl-date { width: 90px; color: var(--text-muted); }
.wl-over { color: var(--danger); font-weight: 700; }
table.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.report-table th { text-align: left; color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; padding: 6px 8px; border-bottom: 1px solid var(--border); }
table.report-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
table.report-table tr:last-child td { border-bottom: none; }

/* ---------- Overview (all-projects dashboard) ---------- */
.ov-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 14px; }
.ov-progress-card { margin-bottom: 14px; }
.ov-progress-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.ov-progress-head h3 { margin-bottom: 0; }
.ov-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 12px; margin: 18px 0 6px; }
.ov-breakdown-item .stat-big { display: block; font-size: 24px; }
.ov-breakdown-item .stat-sub { display: block; margin-top: 2px; }
.ov-subhead { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 16px 0 8px; }
.ov-priority-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.ov-bottom-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; align-items: start; }
.ov-bottom-grid > .dash-card { min-width: 0; }
.ov-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.ov-card-head h3 { margin-bottom: 0; }
/* overflow:hidden, not auto — .gantt-bodywrap inside now owns all scrolling (both axes end up
   contained within it), so this box no longer needs its own scrollbar. */
.ov-gantt-box { overflow: hidden; max-height: 480px; margin: 0 -20px -20px; padding: 0 20px 20px; }
.ov-gantt-box .gantt-toolbar { padding-top: 2px; }
.ov-clear-filter {
  flex-shrink: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: #eef0f4;
  border: none;
  border-radius: 20px;
  padding: 4px 10px;
}
.ov-clear-filter:hover { background: #e3e6ec; color: var(--text); }
.ov-project-list { display: flex; flex-direction: column; gap: 6px; }
.ov-project-row {
  cursor: pointer;
  padding: 8px;
  margin: -8px;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease;
}
.ov-project-row:hover { background: #f8f9fb; }
.ov-project-row.active { background: #eef0ff; border-color: var(--primary); }
.ov-project-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; margin-bottom: 6px; }
.ov-project-name { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ov-project-name .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ov-project-pct { color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.ov-project-open {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 5px;
  font-size: 12px;
  line-height: 20px;
  opacity: 0;
  transition: opacity .12s ease, background .12s ease, color .12s ease;
}
.ov-project-row:hover .ov-project-open,
.ov-project-row.active .ov-project-open { opacity: 1; }
.ov-project-open:hover { background: var(--primary); color: #fff; }
@media (max-width: 860px) { .ov-bottom-grid { grid-template-columns: 1fr; } }

/* ---------- Modals ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,18,32,.5); z-index: 50; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: var(--surface); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  z-index: 51; max-height: 90vh; overflow-y: auto; width: 720px; max-width: calc(100vw - 24px);
}
.project-modal { width: 480px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 20px 0; gap: 10px; }
.modal-body { padding: 14px 20px 20px; }
.modal-title-input { font-size: 18px; font-weight: 600; border: 1px solid transparent !important; padding: 6px 8px; width: 100%; border-radius: 8px; }
.modal-title-input:hover, .modal-title-input:focus { border-color: var(--border) !important; }
.attr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }
.rich-editor {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; min-height: 90px;
  background: #fff; font-size: 13.5px; line-height: 1.55;
}
.rich-editor:focus { outline: 2px solid #c7d2fe; }
.rich-editor img { max-width: 100%; border-radius: 6px; }
.rich-editor ul, .rich-editor ol { padding-left: 22px; }
.rich-toolbar { display: flex; gap: 3px; margin-bottom: 5px; flex-wrap: wrap; }
.rich-toolbar button { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 3px 9px; font-size: 12.5px; }
.rich-toolbar button:hover { background: #f4f5f7; }
.modal-section { margin-top: 18px; }
.modal-section > h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.dep-row, .subtask-row, .attach-row, .time-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.dep-row:last-child, .subtask-row:last-child, .attach-row:last-child, .time-row:last-child { border-bottom: none; }
.dep-add, .time-add { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.dep-add select, .time-add input { width: auto; flex: 1; min-width: 110px; }
.comment-item { padding: 10px 12px; background: #f8f9fb; border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.comment-item .when { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: flex; justify-content: space-between; }
.comment-form { display: flex; gap: 8px; margin-bottom: 10px; }
.comment-form textarea { flex: 1; min-height: 44px; }
.activity-log { max-height: 220px; overflow-y: auto; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-top: 16px; }
.tabs button { border: none; background: transparent; padding: 8px 14px; font-size: 13px; color: var(--text-muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-panel { padding-top: 12px; }
.form-row { margin-bottom: 12px; }
.modal-footer { display: flex; justify-content: space-between; gap: 8px; padding: 0 20px 20px; }
.modal-footer .right { display: flex; gap: 8px; margin-left: auto; }
.color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.color-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.color-swatch.selected { border-color: var(--text); }
.color-custom { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.color-custom input[type="color"] { width: 34px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: none; }
.color-custom label { cursor: pointer; }
.cf-def-row { display: flex; gap: 6px; align-items: center; padding: 5px 0; font-size: 13px; }
.meeting-modal { width: 640px; }

/* ---------- Meetings ---------- */
.meetings-view { padding: 20px 24px; max-width: 900px; margin: 0 auto; }
.meetings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.meeting-list { display: flex; flex-direction: column; gap: 6px; }
.meeting-item { height: auto; flex-direction: column; align-items: stretch; padding: 10px 12px; gap: 3px; cursor: pointer; }
.meeting-item-head { display: flex; align-items: center; gap: 10px; }
.meeting-item-head .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.meeting-item-head .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meeting-item-head .stat-sub { flex: 0 0 auto; }
.meeting-item-snippet { margin: 0; padding-left: 20px; font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-item-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.action-item-row:last-child { border-bottom: none; }
.action-item-row .ai-item-text { flex: 1; min-width: 160px; }
.action-item-row .ai-item-text-static { flex: 1; min-width: 160px; }
.action-item-row .ai-item-project { flex: 0 0 170px; }
.action-item-row.status-approved, .action-item-row.status-discarded { opacity: .75; }
.action-item-row.status-discarded .ai-item-text-static { text-decoration: line-through; }
.mm-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.mm-section-head h4 { margin: 0; }
.ai-topic-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-secondary, #6b7280); }
.ai-topic-list li { margin-bottom: 4px; }
.ai-update-list { display: flex; flex-direction: column; gap: 6px; }
.ai-update-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ai-update-row:last-child { border-bottom: none; }
.ai-update-row .badge { flex: 0 0 auto; }
.mm-tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { background: none; border: 1.5px solid var(--border); border-radius: 20px; padding: 3px 11px; font-size: 12px; font-weight: 600; cursor: pointer; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-chip.selected { color: #fff; }
.badge.project-tag { color: #fff; }
.mm-row-2col { display: flex; gap: 12px; }
.mm-row-2col .form-row { flex: 1; min-width: 0; }
.mm-date-field { flex: 0 0 170px; }
.mm-tags-block { margin: -4px 0 14px; }
.mm-tags-toggle { background: none; border: none; color: var(--text-muted); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 2px 0; display: inline-flex; align-items: center; gap: 5px; }
.mm-tags-toggle:hover { color: var(--primary); }
.mm-tags-caret { font-size: 10px; }
.mm-tags-block .mm-tag-picker { margin-top: 8px; }
.tm-meeting-link { display: flex; align-items: center; gap: 6px; }
.mm-ai-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.mm-inline-error { color: var(--danger); font-size: 12.5px; font-weight: 600; }
.mm-ai-panel { background: var(--primary-tint); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 12px; }
.mm-ai-panel-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 13px; }
.mm-draft-badge { background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; }
.mm-ai-block h4 { margin: 0 0 6px; font-size: 12.5px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #1e2235; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13.5px;
  z-index: 90; box-shadow: var(--shadow);
}

/* ---------- Chat assistant widget ---------- */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 95;
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--primary); color: #fff; font-size: 22px; box-shadow: var(--shadow);
}
.chat-fab:hover { background: var(--primary-dark); }
.chat-panel {
  position: fixed; right: 22px; bottom: 86px; z-index: 95;
  width: 360px; max-width: calc(100vw - 44px); height: 480px; max-height: calc(100vh - 140px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
.chat-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 13.5px;
}
.chat-messages { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-empty-hint { text-align: center; margin-top: 20px; }
.chat-bubble { max-width: 88%; }
.chat-bubble-user { align-self: flex-end; }
.chat-bubble-model { align-self: flex-start; }
.chat-bubble-text { padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.chat-bubble-user .chat-bubble-text { background: var(--primary); color: #fff; border-bottom-right-radius: 3px; }
.chat-bubble-model .chat-bubble-text { background: var(--surface-alt); border: 1px solid var(--border); border-bottom-left-radius: 3px; }
.chat-action-chip {
  margin-top: 6px; padding: 5px 10px; border-radius: 8px; font-size: 12px; cursor: pointer;
  background: var(--primary-tint); color: var(--primary-dark);
}
.chat-action-chip.chat-action-error { background: var(--danger-tint); color: var(--danger); cursor: default; }
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--border); }
.chat-input-row textarea { flex: 1; resize: none; min-height: 36px; max-height: 100px; }
.chat-input-row p.stat-sub { padding: 4px 0; }

/* ---------- Empty ---------- */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.empty-icon { font-size: 44px; margin-bottom: 12px; }
.empty-state h2 { color: var(--text); margin-bottom: 6px; }
.empty-state p { margin-bottom: 16px; }

/* ---------- Portfolio (cross-project) ---------- */
.portfolio-nav { flex: 0 0 auto; padding: 8px 8px 0; }
.portfolio-icon { display: flex; align-items: center; justify-content: center; width: 18px; flex-shrink: 0; color: var(--text-muted); }
.project-item.active .portfolio-icon { color: var(--primary-dark); }
.kc-project, .project-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 4px;
}
.project-chip { margin: 0 6px 0 0; flex-shrink: 0; }
.kc-project .dot, .project-chip .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.portfolio-filter { position: relative; }
.portfolio-filter-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 8px;
  min-width: 200px; max-height: 260px; overflow-y: auto;
}
.portfolio-filter-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.portfolio-filter-row:hover { background: var(--bg); }
.portfolio-filter-row .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.portfolio-filter-group + .portfolio-filter-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }
.portfolio-filter-group-header { font-weight: 600; font-size: 12px; }
.portfolio-filter-all-row { font-weight: 600; margin-bottom: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.portfolio-filter-group .portfolio-filter-row:not(.portfolio-filter-group-header) { padding-left: 22px; }
.portfolio-filter-empty { padding: 6px; font-size: 12.5px; color: var(--text-muted); }
.portfolio-task-project { display: flex; align-items: center; gap: 6px; font-size: 13.5px; padding: 6px 0; }
.portfolio-task-project .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .22s; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
  .sidebar-close { display: block; }
  .menu-btn { display: block; }
  .view-tabs { width: 100%; margin-left: 0; }
  .view-container { padding: 12px; }
  .kanban-col { width: 260px; }
  .cal-cell { min-height: 64px; font-size: 11px; }
  .modal { width: 100vw; max-width: 100vw; top: auto; bottom: 0; left: 0; transform: none; border-radius: 14px 14px 0 0; max-height: 92vh; }
}

/* ---------- Dark mode overrides ---------- */
/* Most rules already read CSS custom properties and re-theme automatically;
   this block only patches the spots that used hardcoded light-mode hex values. */
[data-theme="dark"] .task-table th,
[data-theme="dark"] .task-table tr.task-row:hover,
[data-theme="dark"] .inline-select:hover,
[data-theme="dark"] .list-group-header:hover td,
[data-theme="dark"] .list-group-header td,
[data-theme="dark"] .cal-dow,
[data-theme="dark"] .cal-cell:hover,
[data-theme="dark"] .cal-cell.other-month:hover,
[data-theme="dark"] .rich-editor,
[data-theme="dark"] .rich-toolbar button,
[data-theme="dark"] .comment-item,
[data-theme="dark"] .ov-clear-filter,
[data-theme="dark"] .ov-project-row:hover,
[data-theme="dark"] .gantt-label-row:hover,
[data-theme="dark"] .gantt-label-row.row-hover,
[data-theme="dark"] .gantt-label-row.gantt-group-row {
  background: var(--surface-alt);
}
[data-theme="dark"] .rich-toolbar button:hover { background: var(--bg); }
[data-theme="dark"] .kanban-col { background: var(--surface-alt); }
[data-theme="dark"] .cal-cell.other-month { background: var(--bg); color: #565c70; }
[data-theme="dark"] .ov-clear-filter:hover { background: var(--border); }
[data-theme="dark"] .ov-project-row.active { background: var(--primary-tint); border-color: var(--primary); }
[data-theme="dark"] input[type=text], [data-theme="dark"] input[type=date],
[data-theme="dark"] input[type=number], [data-theme="dark"] input[type=password],
[data-theme="dark"] select, [data-theme="dark"] textarea {
  background: var(--surface-alt); color: var(--text); border-color: var(--border);
}
[data-theme="dark"] .rich-editor:focus { outline-color: rgba(129,140,248,.4); }
[data-theme="dark"] .progress-track,
[data-theme="dark"] .bar-row .bar-track,
[data-theme="dark"] .tw-bar {
  background: var(--surface-alt);
}
[data-theme="dark"] .icon-btn:hover { background: rgba(255,255,255,.08); }
[data-theme="dark"] .gantt-label-row { border-bottom-color: var(--border); }
[data-theme="dark"] .gantt-bar.row-hover rect:first-child { stroke: var(--text); }
[data-theme="dark"] .btn-danger { background: var(--surface-alt); border-color: rgba(248,113,113,.35); }
[data-theme="dark"] .toast { background: #262b3a; border: 1px solid var(--border); }
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,.6); }

/* Badges / chips: translucent tints instead of flat pastel fills */
[data-theme="dark"] .badge.status-todo,
[data-theme="dark"] .badge.prio-low,
[data-theme="dark"] .tw-prio.p-low { background: rgba(148,163,184,.18); color: #b7bfd1; }
[data-theme="dark"] .badge.status-doing { background: var(--primary-tint); color: #93c5fd; }
[data-theme="dark"] .badge.status-done { background: var(--ok-tint); color: #6ee7b7; }
[data-theme="dark"] .badge.prio-medium,
[data-theme="dark"] .tag-chip { background: var(--primary-tint); color: #c7d2fe; }
[data-theme="dark"] .badge.prio-high,
[data-theme="dark"] .tw-prio.p-high { background: var(--warn-tint); color: #fcd34d; }
[data-theme="dark"] .badge.prio-urgent,
[data-theme="dark"] .tw-prio.p-urgent,
[data-theme="dark"] .tw-projrow-alert { background: var(--danger-tint); color: #fca5a5; }

/* Today view specifics */
[data-theme="dark"] .tw-row:hover,
[data-theme="dark"] .tw-add-project { background: var(--surface-alt); }
[data-theme="dark"] .tw-row { border-bottom-color: var(--border); }
[data-theme="dark"] .tw-check { border-color: #454b5e; }
[data-theme="dark"] .tw-add-hint b { color: #b7bfd1; }
[data-theme="dark"] .tw-more:hover { background: var(--primary-tint); }
[data-theme="dark"] .tw-clear-mark { background: var(--ok-tint); }
[data-theme="dark"] .tw-projrow:hover { border-color: #454b5e; }

/* Scrollbars */
[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: transparent; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #363c4e; border-radius: 6px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #454c63; }
