/* ═══════════════════════════════════════════════════════════════════════════
   NEXUS — Design System v7.0
   Aesthetic: Refined Executive Light
   Theme: Clean white surfaces · Warm amber-gold accents · Editorial type
   Fonts: DM Serif Display (headings) + DM Sans (body) + DM Mono (data)
   All generic blues eliminated. Unique. Uncompromising.
═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* ══════════════════════════════════════════════════════════════════════════
   DESIGN TOKENS
══════════════════════════════════════════════════════════════════════════ */
:root {
  /* Typography */
  --ff:   'DM Sans', 'Helvetica Neue', sans-serif;
  --ff-h: 'DM Serif Display', 'Georgia', serif;
  --fm:   'DM Mono', 'Fira Code', monospace;

  /* Core palette — Clean Light */
  --bg:         #F5F6FA;
  --bg-raised:  #FFFFFF;
  --surface:    #FFFFFF;
  --surface2:   #F0F1F7;
  --surface3:   #E8EAF2;
  --surface4:   #DDE0EE;

  /* Borders */
  --border:     rgba(0,0,0,.07);
  --border-med: rgba(0,0,0,.10);
  --border-str: rgba(0,0,0,.16);

  /* Text */
  --text:       #1A1B23;
  --text-2:     #5A5C72;
  --text-3:     #9A9BAD;
  --text-inv:   #FFFFFF;

  /* Accent — Warm Amber Gold */
  --gold:       #E8A94B;
  --gold-dk:    #C78A2E;
  --gold-lt:    rgba(232,169,75,.12);
  --gold-glow:  rgba(232,169,75,.22);
  --gold-mid:   rgba(232,169,75,.55);

  /* Semantic colors (adjusted for light theme) */
  --green:       #1A9E6E;
  --green-light: rgba(26,158,110,.10);
  --green-dark:  #137A52;
  --red:         #D94040;
  --red-light:   rgba(217,64,64,.10);
  --amber:       #C47F10;
  --amber-light: rgba(196,127,16,.10);
  --teal:        #1A8FA8;
  --teal-light:  rgba(26,143,168,.10);
  --purple:      #6D4FCF;
  --purple-light:rgba(109,79,207,.10);
  --coral:       #C84F2E;
  --coral-light: rgba(200,79,46,.10);
  --pink:        #B84880;
  --pink-light:  rgba(184,72,128,.10);
  --indigo:      #4047C8;
  --indigo-light:rgba(64,71,200,.10);

  /* Spacing */
  --sp2: 0.375rem;
  --sp3: 0.625rem;
  --sp4: 1rem;
  --sp5: 1.375rem;
  --sp6: 1.75rem;

  /* Radii */
  --r:    10px;
  --r-sm: 7px;
  --r-md: 13px;
  --r-lg: 18px;
  --r-xl: 26px;

  /* Shadows */
  --shadow:    0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.14), 0 4px 16px rgba(0,0,0,.09);
  --shadow-card: 0 2px 16px rgba(0,0,0,.09), 0 1px 4px rgba(0,0,0,.06);
  --glow-gold: 0 0 24px rgba(232,169,75,.18), 0 0 8px rgba(232,169,75,.12);

  /* Transitions */
  --transition: .18s ease;

  /* Layout */
  --sidebar-w: 252px;
  --topbar-h:  60px;
  --nav-h:     0px;
  --bot-h:     68px;
  --ts-sm: 0.75rem; --ts-md: 0.92rem; --ts-lg: 1.05rem; --ts-xl: 1.3rem;

  /* Legacy aliases so existing pages still work */
  --blue:        var(--gold);
  --blue-dark:   var(--gold-dk);
  --blue-light:  var(--gold-lt);
  --blue-mid:    var(--gold-mid);
  --blue-glow:   var(--gold-glow);
  --blue-l:      var(--gold-lt);
  --blue-d:      var(--gold-dk);
  --pri:         var(--gold);
  --pri-dark:    var(--gold-dk);
  --pri-light:   var(--gold-lt);
  --pri-glow:    var(--gold-glow);
  --pri-dk:      var(--gold-dk);
  --pri-lt:      var(--gold-lt);
  --card:        var(--surface);
  --card2:       var(--surface2);
  --bd:          var(--border-med);
  --bd2:         var(--border-str);
  --ink:         var(--text);
  --ink2:        var(--text-2);
  --ink3:        var(--text-3);
  --ink-2:       var(--text-2);
  --ink-3:       var(--text-3);
  --green-bg:    var(--green-light);
  --red-bg:      var(--red-light);
  --gbg:         var(--green-light);
  --rbg:         var(--red-light);
  --abg:         var(--amber-light);
  --green-l:     var(--green-light);
  --red-l:       var(--red-light);
  --amber-l:     var(--amber-light);
  --purple-l:    var(--purple-light);
  --teal-l:      var(--teal-light);
  --border-med:  var(--border-med);
  --border-str:  var(--border-str);
  --sh-xs: var(--shadow); --sh-lg: var(--shadow-lg); --sh-xl: var(--shadow-lg);
  --shadow-xl: var(--shadow-lg);
  --r-md: var(--r-md);
}

/* ── Base ── */
body {
  font-family: var(--ff);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@media (max-width: 767px) {
  body { padding-bottom: calc(var(--bot-h) + env(safe-area-inset-bottom, 0px)); }
}
.app { display: flex; min-height: 100vh; }

/* Noise texture overlay for depth */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: .022;
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

/* ══════════════════════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  transition: width var(--transition), transform var(--transition);
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.sidebar.collapsed { width: 68px; }
.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .filter-group,
.sidebar.collapsed .dept-filter-list,
.sidebar.collapsed .label-list,
.sidebar.collapsed .add-label-btn,
.sidebar.collapsed .stats-mini,
.sidebar.collapsed .sidebar-footer > div { display: none; }
.sidebar.collapsed .sidebar-top  { justify-content: center; padding: 14px 0; }
.sidebar.collapsed .brand        { justify-content: center; width: 100%; }
.sidebar.collapsed .nav-item     { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }

.sidebar-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-raised); z-index: 2; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dk) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 4px 14px var(--gold-glow);
}
.brand-icon svg { fill: #0E0F13; width: 16px; height: 16px; }
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: -.3px; color: var(--text); font-family: var(--ff-h); }
.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); padding: 6px; border-radius: 8px; display: flex; flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}
.sidebar-toggle:hover { color: var(--text); background: var(--surface); }

.sidebar-nav { padding: 12px 10px 8px; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: none; background: none; border-radius: var(--r);
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2);
  width: 100%; text-align: left; white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent; font-family: var(--ff);
  text-decoration: none;
}
.nav-item:hover  { background: var(--surface); color: var(--text); }
.nav-item.active {
  background: var(--gold-lt);
  color: var(--gold);
  font-weight: 600;
  border: 1px solid rgba(232,169,75,.2);
}
.nav-item.active svg { opacity: 1; }
.nav-item svg    { flex-shrink: 0; opacity: .6; width: 15px; height: 15px; }
.nav-item .sb-badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 99px; padding: 1px 6px; font-size: 10px; font-weight: 700; }

.sidebar-section-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--text-3); padding: 16px 16px 6px; flex-shrink: 0;
  font-family: var(--fm);
}

.filter-group { padding: 0 10px; display: flex; flex-direction: column; gap: 1px; flex-shrink: 0; }
.filter-btn {
  display: flex; align-items: center; gap: 9px; padding: 7px 12px;
  border: none; background: none; border-radius: var(--r);
  cursor: pointer; font-size: 12px; font-weight: 400; color: var(--text-2);
  text-align: left; width: 100%; white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent; font-family: var(--ff);
}
.filter-btn:hover  { background: var(--surface); color: var(--text); }
.filter-btn.active { background: var(--gold-lt); color: var(--gold); font-weight: 600; }
.filter-btn .dot   { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-high    { background: var(--red); }
.dot-medium  { background: var(--amber); }
.dot-low     { background: var(--green); }
.dot-overdue { background: var(--red); }
.dot-today   { background: var(--gold); }

.label-list { padding: 0 10px; display: flex; flex-direction: column; gap: 1px; flex-shrink: 0; }
.label-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 12px; border-radius: var(--r);
  font-size: 12px; color: var(--text-2); cursor: pointer; transition: background var(--transition);
}
.label-item:hover  { background: var(--surface); }
.label-item.active { background: var(--gold-lt); color: var(--gold); font-weight: 600; }
.label-dot    { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.label-delete { background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 14px; padding: 0 3px; margin-left: auto; opacity: 0; transition: opacity var(--transition); }
.label-item:hover .label-delete { opacity: 1; }

.add-label-btn {
  margin: 4px 16px 0; background: none; border: none; cursor: pointer;
  font-size: 11.5px; color: var(--text-3); text-align: left; padding: 4px;
  transition: color var(--transition); flex-shrink: 0; font-family: var(--ff);
}
.add-label-btn:hover { color: var(--gold); }

/* Dept filter */
.dept-filter-list { display: flex; flex-direction: column; gap: 1px; }
.dept-filter-item { border-radius: var(--r); overflow: hidden; }
.dept-filter-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: var(--r);
  cursor: pointer; font-size: 12px; color: var(--text-2); font-weight: 500;
  transition: background .14s; position: relative;
}
.dept-filter-row:hover { background: var(--surface); }
.dept-filter-item.active > .dept-filter-row { background: var(--gold-lt); color: var(--gold); }
.subdept-filter-item {
  display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 28px;
  font-size: 11px; color: var(--text-3); cursor: pointer; border-radius: var(--r-sm);
  transition: background .12s;
}
.subdept-filter-item:hover { background: var(--surface); color: var(--text-2); }
.subdept-filter-item.active { background: var(--gold-lt); color: var(--gold); font-weight: 600; }
.dept-filter-row .label-delete, .subdept-filter-item .label-delete { margin-left: auto; opacity: 0; }
.dept-filter-row:hover .label-delete, .subdept-filter-item:hover .label-delete { opacity: 1; }

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto; padding: 14px 12px 18px;
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.stats-mini { font-size: 11px; color: var(--text-3); line-height: 1.9; font-family: var(--fm); margin-bottom: 8px; }
.sidebar-footer-links { display: flex; flex-direction: column; gap: 1px; margin-bottom: 10px; }
.sidebar-footer-links a {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2);
  text-decoration: none; padding: 7px 10px; border-radius: var(--r);
  transition: background .15s, color .15s; font-weight: 500;
}
.sidebar-footer-links a:hover { background: var(--surface); color: var(--text); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border);
}
.sidebar-user-av {
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #1A1B23; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold), var(--gold-dk));
}
.sb-user-info .name { font-size: 12px; font-weight: 700; color: var(--text); line-height: 1.3; }
.sb-user-info .role { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; font-family: var(--fm); }

/* ══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT AREA
══════════════════════════════════════════════════════════════════════════ */
#main {
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  overflow: hidden;
  transition: margin-left var(--transition);
}
#main.sidebar-collapsed { margin-left: 68px; }

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h); background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; gap: 14px; flex-shrink: 0;
  position: sticky; top: 0; z-index: 40;
}
.topbar-left  { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.menu-btn {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--text-2); padding: 8px; border-radius: var(--r);
}
.view-title {
  font-size: 16px; font-weight: 700; letter-spacing: -.4px; color: var(--text);
  font-family: var(--ff-h);
}
.search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 0 12px; height: 36px;
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap:focus-within { border-color: var(--gold-mid); box-shadow: 0 0 0 3px var(--gold-glow); }
.search-icon { color: var(--text-3); flex-shrink: 0; width: 13px; height: 13px; }
.search-input { background: none; border: none; outline: none; font-size: 13px; color: var(--text); width: 170px; font-family: var(--ff); }
.search-input::placeholder { color: var(--text-3); }

/* ── BOARD CONTENT ── */
.board-content {
  flex: 1; overflow: auto;
  padding: 22px 22px 32px;
  background: var(--bg);
}

/* ── KANBAN COLUMNS ── */
.board-cols {
  display: flex; gap: 14px;
  align-items: flex-start;
  min-height: 60vh;
}
.board-col {
  flex: 0 0 290px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.board-col-head {
  padding: 14px 16px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.col-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-2); flex: 1; font-family: var(--fm);
}
.col-count {
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 20px; background: var(--surface3); color: var(--text-3);
  font-family: var(--fm);
}
.col-cards {
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
  min-height: 80px;
}

/* ── TASK CARDS ── */
.task-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 13px 14px;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.task-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: transparent;
  transition: background var(--transition);
}
.task-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-str);
  box-shadow: var(--shadow-md);
}
.task-card:hover::before { background: var(--gold); }
.task-card.dragging { opacity: .35; }

.task-card-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.45; margin-bottom: 6px; }
.task-card-desc  { font-size: 12px; color: var(--text-3); line-height: 1.5; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-card-meta  { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.task-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

/* Priority badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; font-family: var(--fm); }
.badge-high    { background: rgba(240,92,92,.15); color: #C03030; border: 1px solid rgba(240,92,92,.2); }
.badge-medium  { background: rgba(240,168,50,.15); color: #A06A10; border: 1px solid rgba(240,168,50,.2); }
.badge-low     { background: rgba(52,199,146,.12); color: #34C792; border: 1px solid rgba(52,199,146,.18); }
.badge-urgent  { background: rgba(240,92,92,.2); color: #FF6060; border: 1px solid rgba(240,92,92,.28); }
.badge-done    { background: rgba(52,199,146,.12); color: #34C792; }
.badge-todo    { background: var(--surface3); color: var(--text-3); }
.badge-doing   { background: rgba(232,169,75,.12); color: var(--gold); }

/* Assignee chip */
.task-assignee-chip { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-3); }
.avatar {
  width: 20px; height: 20px; border-radius: 6px;
  background: var(--surface3);
  color: var(--text-2); font-size: 9px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-family: var(--ff);
}
.task-due { font-size: 11px; color: var(--text-3); font-family: var(--fm); }
.task-due.overdue { color: var(--red); }

/* Subtask progress bar */
.subtask-progress-bar  { height: 3px; background: var(--surface3); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.subtask-progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--green)); border-radius: 99px; transition: width .3s; }

/* Labels */
.task-labels { display: flex; gap: 4px; flex-wrap: wrap; }
.label-chip { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 20px; cursor: pointer; transition: filter .15s; }
.label-chip:hover { filter: brightness(1.15); }
.label-chip.selected { outline: 2px solid currentColor; outline-offset: 1px; }

/* ── VIEW CONTAINERS ── */
.view-container { display: none; }
.view-container.active, .view-container:not(.hidden) { display: block; }
.view-container.hidden { display: none !important; }

/* LIST VIEW */
.list-view-table { width: 100%; border-collapse: collapse; }
.list-view-table th {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); padding: 8px 14px; text-align: left;
  border-bottom: 1px solid var(--border); white-space: nowrap; font-family: var(--fm);
}
.list-view-table td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.list-view-table tr:last-child td { border-bottom: none; }
.list-view-table tr:hover td { background: var(--surface2); cursor: pointer; }
.list-title { font-weight: 600; color: var(--text); }
.list-desc  { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.list-assignee { font-size: 11px; color: var(--text-2); min-width: 80px; white-space: nowrap; }
.list-date { font-size: 11px; color: var(--text-3); white-space: nowrap; font-family: var(--fm); }

/* ── ANALYTICS ── */
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 18px 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.stat-card:hover { border-color: var(--border-str); box-shadow: var(--shadow); }
.stat-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: 6px; font-family: var(--fm); }
.stat-val   { font-size: 28px; font-weight: 800; color: var(--text); font-family: var(--ff-h); letter-spacing: -.5px; line-height: 1; }
.stat-sub   { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.chart-bar  { display: flex; align-items: flex-end; gap: 6px; height: 80px; margin-top: 10px; }
.chart-bar-item { flex: 1; background: var(--gold-lt); border-radius: 4px 4px 0 0; min-width: 0; border: 1px solid rgba(232,169,75,.15); position: relative; transition: background .2s; }
.chart-bar-item:hover { background: rgba(232,169,75,.25); }
.chart-bar-item .bar-val { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-3); white-space: nowrap; font-family: var(--fm); }

/* ══════════════════════════════════════════════════════════════════════════
   TOPBAR CONTROLS (view switch, add button, user)
══════════════════════════════════════════════════════════════════════════ */
.view-toggle { display: flex; gap: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 3px; }
.view-btn {
  padding: 5px 10px; border-radius: 7px; border: none; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--text-3); background: none; font-family: var(--ff);
  transition: background var(--transition), color var(--transition);
}
.view-btn.active { background: var(--gold); color: #1A1B23; }
.view-btn:hover:not(.active) { background: var(--surface2); color: var(--text); }

.sort-select {
  padding: 5px 10px; font-size: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); border-radius: var(--r);
  cursor: pointer; font-family: var(--ff); outline: none;
}
.sort-select:focus { border-color: var(--gold-mid); box-shadow: 0 0 0 3px var(--gold-glow); }

.btn-add-task {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: var(--r); border: none; cursor: pointer;
  font-size: 13px; font-weight: 700; color: #1A1B23;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dk) 100%);
  box-shadow: 0 4px 14px var(--gold-glow);
  transition: transform .15s, box-shadow .15s, opacity .15s; font-family: var(--ff);
  text-decoration: none;
}
.btn-add-task:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--gold-glow); opacity: .95; }
.btn-add-task:active { transform: none; }

.user-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border);
}
.user-pill-av {
  width: 26px; height: 26px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #1A1B23; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold), var(--gold-dk));
}
.user-pill-info { display: flex; flex-direction: column; }
.user-pill-info .uname { font-size: 12px; font-weight: 700; color: var(--text); line-height: 1.2; }
.user-pill-info .urole { font-size: 10px; color: var(--text-3); font-family: var(--fm); letter-spacing: .3px; }

/* WIP badge */
.wip-badge {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px;
  background: rgba(240,92,92,.2); color: var(--red); border: 1px solid rgba(240,92,92,.25);
  font-family: var(--fm);
}

/* ══════════════════════════════════════════════════════════════════════════
   MODAL SYSTEM
══════════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 600; padding: 1.5rem;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-str);
  border-radius: var(--r-xl);
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  transform: translateY(20px) scale(.96);
  transition: transform .24s cubic-bezier(.34,1.56,.64,1);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(232,169,75,.06);
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }
.modal-sm { max-width: 420px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px 0; margin-bottom: 16px;
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.3px; font-family: var(--ff-h); }
.modal-close {
  background: var(--surface2); border: none; cursor: pointer; color: var(--text-3);
  padding: 6px; border-radius: 8px; display: flex;
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--red); background: var(--red-light); }
.modal-body { padding: 0 24px; }
.modal-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 24px; border-top: 1px solid var(--border); margin-top: 4px;
}
.spacer { flex: 1; }

/* Form fields */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; font-family: var(--fm); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-med);
  border-radius: var(--r); font-size: 13px; font-family: var(--ff);
  color: var(--text); background: var(--surface2); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--gold-mid);
  background: var(--surface3);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field textarea { min-height: 80px; resize: vertical; line-height: 1.55; }
.field select option { background: var(--surface2); color: var(--text); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.req { color: var(--gold); }
.hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* Color swatches */
.color-swatches { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 24px; margin-bottom: 14px; }
.color-swatch {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: transform .15s, border-color .15s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: var(--text); transform: scale(1.15); }

/* Label picker */
.label-picker { display: flex; flex-wrap: wrap; gap: 6px; }

/* Subtask UI */
.subtask-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.subtask-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); background: var(--surface2); border-radius: var(--r); padding: 6px 10px; }
.subtask-cb { accent-color: var(--gold); width: 13px; height: 13px; cursor: pointer; }
.subtask-text { flex: 1; }
.subtask-text.done { text-decoration: line-through; color: var(--text-3); }
.subtask-del { background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 12px; padding: 2px 3px; border-radius: 4px; transition: color .15s; }
.subtask-del:hover { color: var(--red); }
.subtask-add-row { display: flex; gap: 7px; }
.subtask-add-row input { flex: 1; padding: 7px 11px; font-size: 12px; border: 1px solid var(--border-med); border-radius: var(--r); background: var(--surface2); color: var(--text); outline: none; font-family: var(--ff); }
.subtask-add-row input:focus { border-color: var(--gold-mid); background: var(--surface3); }
.btn-add-subtask { padding: 7px 12px; font-size: 12px; font-family: var(--ff); background: var(--gold-lt); border: 1px solid rgba(232,169,75,.2); border-radius: var(--r); cursor: pointer; color: var(--gold); font-weight: 600; transition: background .15s; }
.btn-add-subtask:hover { background: rgba(232,169,75,.2); }

/* Team members */
.subdept-manage-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.subdept-manage-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); background: var(--surface2); border-radius: var(--r); padding: 6px 10px; }
.subdept-manage-del { background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 12px; margin-left: auto; border-radius: 4px; padding: 2px 4px; transition: color .15s; }
.subdept-manage-del:hover { color: var(--red); }

/* Dept modal pipeline section */
.dept-color-current { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); }

/* ══════════════════════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════════════════════ */
.btn-primary {
  padding: 9px 20px; border-radius: var(--r); border: none; cursor: pointer;
  font-size: 13px; font-weight: 700; color: #1A1B23;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dk) 100%);
  font-family: var(--ff); transition: transform .15s, box-shadow .15s, opacity .15s;
  box-shadow: 0 3px 12px var(--gold-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 5px 18px var(--gold-glow); }
.btn-primary:active { transform: none; }
.btn-ghost {
  padding: 9px 16px; border-radius: var(--r); border: 1px solid var(--border-str);
  font-size: 13px; font-weight: 600; color: var(--text-2); background: none;
  cursor: pointer; font-family: var(--ff); transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--border-str); }
.btn-icon {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface2); color: var(--text-3); cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn-icon:hover { background: var(--surface3); color: var(--text); border-color: var(--border-str); }

/* ══════════════════════════════════════════════════════════════════════════
   DRAG AND DROP
══════════════════════════════════════════════════════════════════════════ */
.col-cards.drag-over {
  outline: 2px dashed var(--gold-mid);
  outline-offset: 3px;
  background: var(--gold-lt);
  border-radius: var(--r);
}
.col-cards.drag-over * { pointer-events: none; }

/* ══════════════════════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════════════════════ */
.toast-stack {
  position: fixed; bottom: 22px; right: 22px;
  display: flex; flex-direction: column; gap: 8px; z-index: 9999;
}
.toast {
  background: var(--surface2); border: 1px solid var(--border-str);
  border-radius: var(--r-md); padding: 12px 18px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg); color: var(--text);
  animation: toastSlide .22s cubic-bezier(.34,1.2,.64,1);
  max-width: 320px;
}
.toast.success { background: rgba(52,199,146,.12); border-color: rgba(52,199,146,.3); color: var(--green); }
.toast.error   { background: var(--red-light); border-color: rgba(240,92,92,.3); color: var(--red); }
@keyframes toastSlide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE NAVIGATION
══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: none; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 49; backdrop-filter: blur(3px); }
  .sidebar-overlay.visible { display: block; }
  #main { margin-left: 0 !important; }
  .menu-btn { display: flex; }
  .topbar { padding: 0 16px; }
  .search-wrap { display: none; }
  .user-pill-info { display: none; }
  .board-content { padding: 14px; }
  .board-cols { gap: 10px; }
  .board-col { flex: 0 0 260px; }
  .modal-backdrop { align-items: flex-end; padding: 0; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
  .modal { border-radius: 22px 22px 0 0 !important; max-height: 92vh; max-width: 100%; transform: translateY(100%) !important; transition: transform .28s cubic-bezier(.32,1,.23,1) !important; }
  .modal-backdrop.open .modal { transform: translateY(0) !important; }
  .modal-sm { max-width: 100%; border-radius: 22px 22px 0 0 !important; }
  .modal-header { padding: 18px 20px 0; }
  .modal-footer { padding: 12px 20px; }
  .field-row { grid-template-columns: 1fr; }
  .list-view-table th:nth-child(4), .list-view-table th:nth-child(5), .list-view-table td:nth-child(4), .list-view-table td:nth-child(5) { display: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   SCROLLBARS — custom dark style
══════════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface4); }

/* ══════════════════════════════════════════════════════════════════════════
   PIPELINE DRAG DROP (override for pipeline view)
══════════════════════════════════════════════════════════════════════════ */
.pipeline-col-head { background: var(--surface2) !important; }
.pipeline-cards.drag-over { outline: 2px dashed var(--gold-mid) !important; background: var(--gold-lt) !important; }
