/* =========================================================
   Pulse — Design System
   ========================================================= */

/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Vazirmatn', 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
html[dir="ltr"] body { font-family: 'Inter', 'Vazirmatn', system-ui, sans-serif; }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: content-box; }

/* ---- Theme tokens ---- */
:root {
  /* Brand */
  --brand-1: #7c5cff;
  --brand-2: #22d3ee;
  --brand-3: #f472b6;
  --brand-grad: linear-gradient(135deg, #7c5cff 0%, #22d3ee 100%);
  --brand-grad-2: linear-gradient(135deg, #f472b6 0%, #7c5cff 100%);

  /* Status palette (used in both themes; theme just shifts surface) */
  --c-red:    #ef4444;
  --c-orange: #f97316;
  --c-amber:  #f59e0b;
  --c-yellow: #eab308;
  --c-lime:   #84cc16;
  --c-green:  #22c55e;
  --c-teal:   #14b8a6;
  --c-cyan:   #06b6d4;
  --c-sky:    #0ea5e9;
  --c-blue:   #3b82f6;
  --c-indigo: #6366f1;
  --c-violet: #8b5cf6;
  --c-pink:   #ec4899;
  --c-rose:   #f43f5e;
  --c-slate:  #64748b;

  /* Layout */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 1px 1px rgba(0,0,0,.04);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .14), 0 8px 16px rgba(15, 23, 42, .06);
  --transition: 180ms cubic-bezier(.4,.2,.2,1);

  --sidebar-w: 260px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 60px;
}

/* Dark theme (default) */
:root, [data-theme="dark"] {
  --bg: #0b0f1a;
  --bg-elev: #111726;
  --bg-elev-2: #161e30;
  --bg-glass: rgba(20, 27, 45, .72);
  --panel: #131a2c;
  --panel-2: #1a223a;
  --hover: rgba(255,255,255,.04);
  --hover-strong: rgba(255,255,255,.08);
  --border: rgba(255,255,255,.07);
  --border-strong: rgba(255,255,255,.14);
  --text: #e6e9f2;
  --text-soft: #c2c7d6;
  --text-muted: #8a93a6;
  --text-faint: #5e6679;
  --accent: var(--brand-1);
  --accent-soft: rgba(124, 92, 255, .16);
  --danger: var(--c-red);
  --danger-soft: rgba(239, 68, 68, .14);
  --success: var(--c-green);
  --success-soft: rgba(34, 197, 94, .14);
  --warn: var(--c-amber);
  --warn-soft: rgba(245, 158, 11, .14);

  color-scheme: dark;
}

/* Light theme */
[data-theme="light"] {
  --bg: #f5f6fb;
  --bg-elev: #ffffff;
  --bg-elev-2: #f8f9fd;
  --bg-glass: rgba(255,255,255,.78);
  --panel: #ffffff;
  --panel-2: #f2f4fa;
  --hover: rgba(15,23,42,.04);
  --hover-strong: rgba(15,23,42,.08);
  --border: rgba(15,23,42,.08);
  --border-strong: rgba(15,23,42,.14);
  --text: #0f172a;
  --text-soft: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --accent: #6d4cff;
  --accent-soft: rgba(109, 76, 255, .12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, .10);
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, .10);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, .10);

  color-scheme: light;
}

/* ---- Boot splash ---- */
.boot-splash {
  position: fixed; inset: 0;
  display: grid; place-content: center; gap: 14px;
  text-align: center;
  background: var(--bg);
  z-index: 9999;
}
.boot-logo svg { filter: drop-shadow(0 12px 32px rgba(124,92,255,.45)); animation: bootPulse 2s ease-in-out infinite; margin: 0 auto; }
.boot-title { font-weight: 800; font-size: 22px; letter-spacing: .5px; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.boot-sub { color: var(--text-muted); font-size: 13px; }
@keyframes bootPulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.06);} }

/* ---- App shell ---- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  height: 100vh;
  height: 100dvh;
}
.app.sidebar-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

.sidebar { grid-area: sidebar; background: var(--bg-elev); border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.topbar  { grid-area: topbar;  background: var(--bg-glass); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 18px; gap: 12px; position: relative; z-index: 5; }
.main    { grid-area: main; min-width: 0; overflow: hidden; display: flex; flex-direction: column; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: var(--topbar-h) 1fr; grid-template-areas: "topbar" "main"; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; max-width: 84vw; transform: translateX(-100%); transition: transform var(--transition); z-index: 50; box-shadow: var(--shadow-lg); }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.is-open { transform: translateX(0); }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; }
}

/* ---- Sidebar ---- */
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); height: var(--topbar-h); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-grad); display: grid; place-content: center; box-shadow: 0 8px 20px rgba(124,92,255,.35); }
.brand-text { font-weight: 800; font-size: 17px; letter-spacing: .3px; }
.brand-text .accent { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sidebar-collapsed .brand-text, .sidebar-collapsed .nav-label, .sidebar-collapsed .db-meta, .sidebar-collapsed .side-section-title { display: none; }
.sidebar-collapsed .brand { justify-content: center; padding: 14px 8px; }

.side-section { padding: 14px 12px; }
.side-section + .side-section { border-top: 1px solid var(--border); }
.side-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); padding: 0 8px 8px; font-weight: 700; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--text-soft);
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); }
.nav-item.is-active .nav-icon { color: var(--accent); }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; }

.db-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--panel-2);
  border: 1px solid transparent;
  transition: var(--transition);
  width: 100%;
  text-align: start;
  position: relative;
}
.db-pill:hover { border-color: var(--border-strong); }
.db-pill.is-active { background: var(--accent-soft); border-color: var(--accent); }
.db-pill .db-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.db-pill .db-name { font-weight: 600; font-size: 13px; }
.db-meta { font-size: 11px; color: var(--text-muted); }

.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); }

/* ---- Topbar ---- */
.topbar-title { font-weight: 700; font-size: 15px; }
.topbar-sub { font-size: 12px; color: var(--text-muted); margin-inline-start: 8px; }
.spacer { flex: 1; }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-md);
  display: grid; place-content: center;
  color: var(--text-soft);
  transition: var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.is-active { background: var(--accent-soft); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-radius: var(--r-md);
  font-weight: 600; font-size: 13px;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: 0 6px 16px rgba(124,92,255,.32); }
.btn-primary:hover { box-shadow: 0 10px 24px rgba(124,92,255,.45); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover { background: var(--accent); color: #fff; }
.btn-ghost { color: var(--text-soft); border-color: var(--border); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14px; }
.btn-icon { padding: 0; width: 36px; justify-content: center; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---- Inputs ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.field-hint { font-size: 11px; color: var(--text-muted); }
.input, .textarea, .select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--r-md);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  transition: var(--transition);
  outline: none;
}
.textarea { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; line-height: 1.6; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 16px, calc(100% - 13px) 16px; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 28px; }
html[dir="rtl"] .select { background-position: 13px 16px, 18px 16px; padding-inline-start: 28px; padding-inline-end: 12px; }

/* Search input */
.search-input {
  position: relative; flex: 1; max-width: 360px;
}
.search-input input {
  width: 100%; height: 36px; padding-inline: 36px 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text);
  transition: var(--transition); outline: none;
}
.search-input input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-input svg { position: absolute; top: 50%; inset-inline-start: 12px; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }

/* ---- Cards & surfaces ---- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); }
.card-pad { padding: 16px; }
.card-pad-lg { padding: 20px; }
.glass { background: var(--bg-glass); backdrop-filter: blur(20px); border: 1px solid var(--border); }

.empty-state { display: grid; place-items: center; padding: 60px 20px; text-align: center; color: var(--text-muted); gap: 12px; }
.empty-state svg { width: 56px; height: 56px; color: var(--text-faint); }
.empty-state h3 { margin: 0; color: var(--text); font-size: 16px; font-weight: 700; }
.empty-state p { margin: 0; font-size: 13px; max-width: 360px; line-height: 1.7; }

/* ---- Tags / Pills ---- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600;
  background: var(--panel-2);
  color: var(--text-soft);
  white-space: nowrap;
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; }
.tag-priority-urgent  { background: rgba(239,68,68,.14); color: #ef4444; }
.tag-priority-high    { background: rgba(249,115,22,.14); color: #f97316; }
.tag-priority-medium  { background: rgba(245,158,11,.16); color: #d97706; }
.tag-priority-low     { background: rgba(34,197,94,.14); color: #22c55e; }
.tag-priority-none    { background: var(--panel-2); color: var(--text-muted); }

.priority-bar { width: 3px; align-self: stretch; border-radius: 3px; }
.priority-bar-urgent { background: #ef4444; }
.priority-bar-high   { background: #f97316; }
.priority-bar-medium { background: #f59e0b; }
.priority-bar-low    { background: #22c55e; }
.priority-bar-none   { background: var(--border-strong); }

/* ---- Avatar ---- */
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-content: center;
  font-size: 10px; font-weight: 700;
  color: #fff;
  border: 2px solid var(--panel);
  flex-shrink: 0;
}
.avatar-sm { width: 22px; height: 22px; font-size: 9px; }
.avatar-lg { width: 36px; height: 36px; font-size: 13px; }
.avatar-stack { display: inline-flex; }
.avatar-stack > * + * { margin-inline-start: -8px; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8,12,22,.6); backdrop-filter: blur(6px);
  display: grid; place-items: center;
  z-index: 200;
  animation: fadeIn .18s ease-out;
}
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: min(92vw, 720px);
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
.modal-lg { width: min(96vw, 920px); }
.modal-header { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--bg-elev-2); }
@keyframes fadeIn { from { opacity: 0;} to { opacity: 1;} }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.98);} to { opacity: 1; transform: none;} }

/* ---- Toast ---- */
.toast-stack { position: fixed; bottom: 18px; inset-inline-end: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 500; }
.toast { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 360px; animation: toastIn .25s ease-out; }
.toast.is-success { border-color: var(--success); }
.toast.is-error { border-color: var(--danger); }
.toast.is-info { border-color: var(--accent); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0;} to { transform: none; opacity: 1;} }

/* ---- View shell ---- */
.view-header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.view-tabs { display: inline-flex; background: var(--panel-2); padding: 4px; border-radius: var(--r-md); gap: 2px; }
.view-tab { padding: 6px 14px; border-radius: 8px; color: var(--text-muted); font-weight: 600; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; transition: var(--transition); }
.view-tab svg { width: 14px; height: 14px; }
.view-tab:hover { color: var(--text); }
.view-tab.is-active { background: var(--bg-elev); color: var(--accent); box-shadow: var(--shadow-sm); }

.view-body { flex: 1; min-height: 0; overflow: auto; padding: 18px; position: relative; }
.view-body.no-pad { padding: 0; }

/* ---- Kanban ---- */
.kanban {
  display: flex;
  gap: 14px;
  height: 100%;
  padding: 18px;
  overflow-x: auto;
  align-items: flex-start;
}
.kanban-col {
  flex: 0 0 300px;
  min-width: 300px;
  max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.kanban-col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); position: relative; }
.kanban-col-dot { width: 10px; height: 10px; border-radius: 50%; }
.kanban-col-title { font-weight: 700; font-size: 13px; }
.kanban-col-count { background: var(--panel-2); color: var(--text-muted); font-size: 11px; padding: 2px 8px; border-radius: var(--r-pill); font-weight: 600; }
.kanban-col-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-col-foot { padding: 8px 10px; border-top: 1px solid var(--border); }
.kanban-col-foot .btn { width: 100%; justify-content: center; }

.task-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px;
  display: flex; gap: 8px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.task-card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.task-card.is-dragging { opacity: .5; }
.task-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.task-card-title { font-weight: 600; font-size: 13px; line-height: 1.4; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.task-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-card-foot .due { font-size: 11px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }
.task-card-foot .due.overdue { color: var(--danger); }
.task-card-foot .due svg { width: 12px; height: 12px; }
.task-card-progress { height: 4px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.task-card-progress > span { display: block; height: 100%; background: var(--brand-grad); border-radius: 4px; transition: width .3s; }
.task-card-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.label-chip { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }

/* ---- Gantt ---- */
.gantt { display: grid; grid-template-rows: auto 1fr; height: 100%; background: var(--panel); direction: ltr; }
html[dir="rtl"] .gantt .gantt-row-left { direction: rtl; }
html[dir="rtl"] .gantt .gantt-left-head { direction: rtl; }
html[dir="rtl"] .gantt-toolbar { direction: rtl; }
.gantt-toolbar { padding: 12px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gantt-zoom { display: inline-flex; background: var(--panel-2); padding: 3px; border-radius: var(--r-md); gap: 2px; }
.gantt-zoom button { padding: 5px 12px; border-radius: 6px; color: var(--text-muted); font-size: 12px; font-weight: 600; transition: var(--transition); }
.gantt-zoom button.is-active { background: var(--bg-elev); color: var(--accent); box-shadow: var(--shadow-sm); }

.gantt-scroll { overflow: auto; position: relative; }
.gantt-grid { display: grid; grid-template-columns: 280px 1fr; min-width: 100%; position: relative; }
.gantt-left { background: var(--panel); border-inline-end: 1px solid var(--border); position: sticky; inset-inline-start: 0; z-index: 4; }
.gantt-left-head, .gantt-right-head { height: 56px; border-bottom: 1px solid var(--border); display: flex; align-items: stretch; }
.gantt-left-head { padding: 0 14px; align-items: center; font-weight: 700; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px; background: var(--bg-elev-2); }
.gantt-row-left { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 44px; border-bottom: 1px solid var(--border); font-size: 13px; }
.gantt-row-left:hover { background: var(--hover); }
.gantt-row-left .gantt-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

.gantt-right { position: relative; }
.gantt-right-head { background: var(--bg-elev-2); position: sticky; top: 0; z-index: 3; flex-direction: column; }
.gantt-axis-1, .gantt-axis-2 { display: flex; height: 28px; }
.gantt-axis-1 { border-bottom: 1px solid var(--border); }
.gantt-axis-1 .cell, .gantt-axis-2 .cell { border-inline-end: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--text-muted); flex-shrink: 0; }
.gantt-axis-2 .cell.today { color: var(--accent); }
.gantt-axis-2 .cell.weekend { background: var(--hover); }

.gantt-canvas { position: relative; }
.gantt-row-right { height: 44px; border-bottom: 1px solid var(--border); position: relative; }
.gantt-row-right.even { background: var(--bg-elev-2); }
.gantt-row-right .col-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); }
.gantt-row-right .col-line.weekend { background: var(--hover-strong); width: 1px; }
.gantt-bar {
  position: absolute; top: 8px; height: 28px;
  border-radius: 8px;
  background: var(--brand-grad);
  color: #fff;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center;
  padding: 0 10px;
  box-shadow: 0 4px 10px rgba(124,92,255,.25);
  cursor: grab;
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
}
.gantt-bar:hover { filter: brightness(1.08); }
.gantt-bar.is-dragging { opacity: .8; cursor: grabbing; box-shadow: var(--shadow-lg); }
.gantt-bar .progress { position: absolute; top: 0; left: 0; bottom: 0; background: rgba(255,255,255,.22); border-radius: 8px 0 0 8px; }
html[dir="rtl"] .gantt-bar .progress { left: auto; right: 0; border-radius: 0 8px 8px 0; }
.gantt-bar .handle { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; opacity: 0; }
.gantt-bar:hover .handle { opacity: 1; background: rgba(255,255,255,.3); }
.gantt-bar .handle.start { inset-inline-start: 0; border-radius: 8px 0 0 8px; }
.gantt-bar .handle.end   { inset-inline-end: 0;   border-radius: 0 8px 8px 0; }
.gantt-bar.priority-urgent { background: linear-gradient(135deg, #ef4444 0%, #f97316 100%); box-shadow: 0 4px 10px rgba(239,68,68,.3); }
.gantt-bar.priority-high   { background: linear-gradient(135deg, #f97316 0%, #f59e0b 100%); box-shadow: 0 4px 10px rgba(249,115,22,.3); }
.gantt-bar.priority-medium { background: linear-gradient(135deg, #f59e0b 0%, #eab308 100%); box-shadow: 0 4px 10px rgba(245,158,11,.3); }
.gantt-bar.priority-low    { background: linear-gradient(135deg, #14b8a6 0%, #22c55e 100%); box-shadow: 0 4px 10px rgba(20,184,166,.3); }
.gantt-bar.done { opacity: .65; text-decoration: line-through; }

.gantt-today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); pointer-events: none; z-index: 2; }
.gantt-today-line::after { content: ""; position: absolute; top: -5px; inset-inline-start: -5px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }

/* ---- Checklist / List view ---- */
.list-view { padding: 14px 18px 30px; }
.list-group { margin-bottom: 18px; }
.list-group-head { display: flex; align-items: center; gap: 10px; padding: 8px 6px; font-weight: 700; }
.list-group-head .chev { transition: transform .2s; }
.list-group-head.collapsed .chev { transform: rotate(-90deg); }
html[dir="rtl"] .list-group-head.collapsed .chev { transform: rotate(90deg); }
.list-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.list-row { display: grid; grid-template-columns: 28px 1fr 100px 140px 110px 90px 70px 38px; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); transition: var(--transition); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--hover); }
.list-row.is-done .list-title { color: var(--text-muted); text-decoration: line-through; }
.list-title { font-size: 13px; font-weight: 500; cursor: pointer; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { font-size: 11px; color: var(--text-muted); }

.checkbox { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--border-strong); display: grid; place-content: center; cursor: pointer; transition: var(--transition); flex-shrink: 0; }
.checkbox.checked { background: var(--success); border-color: var(--success); }
.checkbox.checked svg { width: 11px; height: 11px; color: #fff; }
.checkbox:not(.checked) svg { display: none; }

@media (max-width: 720px) {
  .list-row { grid-template-columns: 28px 1fr auto 38px; }
  .list-row .col-status, .list-row .col-priority, .list-row .col-due, .list-row .col-people { display: none; }
}

/* ---- Detail / Editor ---- */
.editor { display: grid; grid-template-columns: 1fr 280px; gap: 18px; }
@media (max-width: 740px) { .editor { grid-template-columns: 1fr; } }
.editor-main { display: flex; flex-direction: column; gap: 14px; }
.editor-side { display: flex; flex-direction: column; gap: 12px; }
.editor-title-input { width: 100%; font-size: 22px; font-weight: 800; background: transparent; border: 0; outline: none; color: var(--text); padding: 6px 2px; border-radius: 6px; }
.editor-title-input:focus { background: var(--panel-2); }
.markdown-body { font-size: 13.5px; line-height: 1.75; color: var(--text-soft); }
.markdown-body h1,.markdown-body h2,.markdown-body h3 { color: var(--text); margin: .8em 0 .4em; }
.markdown-body code { background: var(--panel-2); padding: 2px 5px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.markdown-body pre { background: var(--panel-2); padding: 12px; border-radius: var(--r-md); overflow: auto; }
.markdown-body ul,.markdown-body ol { padding-inline-start: 22px; }
.markdown-body blockquote { border-inline-start: 3px solid var(--accent); padding-inline-start: 12px; color: var(--text-muted); }

.side-block { background: var(--panel-2); border-radius: var(--r-md); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.side-block .label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); font-weight: 700; }

/* ---- Dropdown / Popover ---- */
.popover {
  position: absolute; z-index: 100;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px; padding: 6px;
  animation: popIn .15s ease-out;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-4px);} to { opacity: 1; transform: none;} }
.popover-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; transition: var(--transition); }
.popover-item:hover { background: var(--hover); }
.popover-item.is-active { background: var(--accent-soft); color: var(--accent); }
.popover-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.popover-sep { height: 1px; background: var(--border); margin: 4px 2px; }

/* ---- Tooltip ---- */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg-elev); font-size: 11px; padding: 4px 8px; border-radius: 6px;
  white-space: nowrap; pointer-events: none; z-index: 200;
}

/* ---- Utils ---- */
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.text-muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 16px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Drag ghost */
.sortable-ghost { opacity: .4; }
.sortable-drag { transform: rotate(2deg); }

/* ---- Loading spinner ---- */
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg);} }

/* Bottom mobile nav (optional) */
.mobile-only { display: none; }
@media (max-width: 900px) { .mobile-only { display: inline-flex; } .desktop-only { display: none !important; } }
