@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Brand */
  --brand:       #7c3aed;
  --brand-light: #a78bfa;
  --brand-glow:  rgba(124, 58, 237, 0.18);
  --brand-subtle:rgba(124, 58, 237, 0.08);

  /* Dark surface palette */
  --bg:        #0a0a0f;
  --surface-1: #111118;  /* sidebar */
  --surface-2: #16161e;  /* card */
  --surface-3: #1c1c26;  /* hover state */
  --surface-4: #21212d;  /* input bg */

  /* Text */
  --text-1: #f0f0f5;   /* primary */
  --text-2: #9898b0;   /* secondary */
  --text-3: #555568;   /* disabled/placeholder */

  /* Borders */
  --border-1: rgba(255,255,255,0.06);
  --border-2: rgba(255,255,255,0.10);
  --border-focus: var(--brand);

  /* Semantic */
  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #3b82f6;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.4);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.6), 0 4px 12px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 0 3px var(--brand-glow);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Transition */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --t-fast:   0.12s var(--ease);
  --t-normal: 0.22s var(--ease);
  --t-slow:   0.35s var(--ease);

  /* Legacy Compatibility */
  --bg-color:      var(--bg);
  --text-color:    var(--text-1);
  --text-muted:    var(--text-2);
  --primary-color: var(--brand);
  --sidebar-bg:    var(--surface-1);
  --card-bg:       var(--surface-2);
  --border-color:  var(--border-1);
  --accent-color:  var(--brand-light);

  --sidebar-w: 240px;
  --header-h:  62px;
}

/* Light theme overrides */
[data-theme="light"] {
  --bg:        #fcfcfd;
  --surface-1: #ffffff;
  --surface-2: #ffffff;
  --surface-3: #f5f5f9;
  --surface-4: #f0f0f5;

  --text-1: #0f0f13;
  --text-2: #4b4b5e;
  --text-3: #8a8a9e;

  /* Darker brand for light mode to maintain contrast */
  --brand-light: #6d28d9; 
  --brand-subtle: rgba(124, 58, 237, 0.08);
  --brand-glow:   rgba(124, 58, 237, 0.12);

  --border-1: rgba(0,0,0,0.08);
  --border-2: rgba(0,0,0,0.12);

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.04);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.06);
  --shadow-lg:  0 20px 60px rgba(0,0,0,0.08);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  letter-spacing: -0.011em;
  min-height: 100vh;
}

a { color: var(--brand-light); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--text-1); }

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.025em; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

p { color: var(--text-2); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface-1);
  border-right: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  padding: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 16px;
  text-decoration: none;
  color: var(--text-1) !important;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.03em;
  border-bottom: 1px solid var(--border-1);
  margin-bottom: 8px;
  transition: opacity var(--t-fast);
}

.sidebar-logo:hover { opacity: 0.8; color: var(--text-1) !important; }

.sidebar-logo-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--brand) 0%, #a855f7 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: white;
  box-shadow: 0 2px 8px rgba(124,58,237,0.4);
  flex-shrink: 0;
}

.nav-section {
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  padding: 10px 10px 4px;
}

.nav-menu { list-style: none; padding: 0 8px; }

.nav-item { margin: 1px 0; }

.nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--text-2);
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--t-fast);
  position: relative;
}

.nav-item a .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 0.875rem;
  opacity: 0.7;
  transition: opacity var(--t-fast);
}

.nav-item a:hover {
  color: var(--text-1);
  background: var(--surface-3);
}

.nav-item a:hover .nav-icon { opacity: 1; }

.nav-item.active a {
  color: var(--text-1) !important;
  background: var(--brand-subtle);
  font-weight: 600;
}

.nav-item.active a .nav-icon {
  opacity: 1;
  color: var(--brand-light);
}

.nav-item.active a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
  left: -8px;
}

.nav-divider {
  height: 1px;
  background: var(--border-1);
  margin: 10px 10px;
}

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

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  height: var(--header-h);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.header-brand {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
  color: var(--text-1) !important;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-brand i { color: var(--brand); }

/* Search */
.neo-search-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-4);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 0 12px;
  min-height: 36px;
  width: 260px;
  transition: all var(--t-normal);
}

.neo-search-bar:focus-within {
  border-color: var(--brand);
  background: var(--surface-3);
  box-shadow: var(--shadow-glow);
  width: 350px;
}

.neo-search-icon {
  color: var(--text-3);
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: color var(--t-fast);
}

.neo-search-bar:focus-within .neo-search-icon { color: var(--brand-light); }

[data-theme] .neo-search-bar input.neo-search-input {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  width: 100%;
  color: var(--text-1);
  font-size: 0.875rem;
  font-family: var(--font);
}

.neo-search-input::placeholder { color: var(--text-3); }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-2);
  font-size: 0.9rem;
  transition: all var(--t-fast);
  position: relative;
}

.header-icon-btn:hover {
  background: var(--surface-3);
  color: var(--text-1);
  border-color: var(--border-2);
}

/* Keep old ID working */
.header-icon-box {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-2);
  font-size: 0.9rem;
  transition: all var(--t-fast);
  position: relative;
}

.header-icon-box:hover {
  background: var(--surface-3);
  color: var(--text-1);
  border-color: var(--border-2);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--brand);
  color: white;
  border-radius: 99px;
  min-width: 16px;
  height: 16px;
  font-size: 0.58rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface-1);
  padding: 0 3px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-3);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  transition: all var(--t-fast);
}

.user-chip:hover { border-color: var(--border-2); background: var(--surface-4); }

.user-chip img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--brand-glow);
}

.user-chip span {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content-padding {
  padding: 28px 32px;
  flex: 1;
  overflow-y: auto;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  margin-bottom: 20px;
}

.card:hover {
  border-color: var(--border-2);
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 20px !important;
  border-bottom: 2px solid transparent;
  transition: all var(--t-normal) !important;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-title {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-icon {
  position: absolute;
  right: -8px;
  bottom: -8px;
  font-size: 4rem;
  opacity: 0.04;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  height: 36px;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid var(--border-2);
  background: var(--surface-3);
  color: var(--text-1);
  cursor: pointer;
  transition: all var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  background: var(--surface-4);
  border-color: var(--border-2);
  color: var(--text-1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--brand) !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: 0 0 0 0 var(--brand-glow);
}

.btn-primary:hover {
  background: #8b5cf6 !important;
  box-shadow: 0 4px 16px rgba(124,58,237,0.4) !important;
  color: #fff !important;
}

.btn-danger {
  background: rgba(239,68,68,0.1) !important;
  border-color: rgba(239,68,68,0.2) !important;
  color: #f87171 !important;
}

.btn-danger:hover {
  background: rgba(239,68,68,0.2) !important;
}

.btn-outline {
  background: transparent !important;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
}

.btn-icon:hover { background: var(--surface-3); border-color: var(--border-1); }

[data-theme="light"] .btn {
  background: #fff;
  border-color: rgba(0,0,0,0.12);
  color: #1a1a2e;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

[data-theme="light"] .btn:hover {
  background: #f8f8fc;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input, select, textarea {
  width: 100%;
  background: var(--surface-4);
  border: 1px solid var(--border-1);
  color: var(--text-1);
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  line-height: 1.2;
  display: block;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  background: var(--surface-3);
  box-shadow: var(--shadow-glow);
}

input::placeholder, textarea::placeholder { color: var(--text-3); }

option { background: var(--surface-4); color: var(--text-1); }

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: #fff !important;
  border-color: rgba(0,0,0,0.12) !important;
  color: #111 !important;
}

[data-theme="light"] option { background: #fff; color: #111; }

select { appearance: none; cursor: pointer; }

.filter-select { height: 36px !important; padding: 0 12px !important; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Semantic - Dark Mode Defaults */
.status-backlog        { background: rgba(100,116,139,0.1); color: #94a3b8; border-color: rgba(100,116,139,0.2); }
.status-ready          { background: rgba(245,158,11,0.1);  color: #fbbf24; border-color: rgba(245,158,11,0.2); }
.status-inprogress     { background: rgba(59,130,246,0.1);  color: #60a5fa; border-color: rgba(59,130,246,0.2); }
.status-dev            { background: rgba(124,58,237,0.1);  color: #a78bfa; border-color: rgba(124,58,237,0.2); }
.status-review         { background: rgba(219,39,119,0.1);  color: #f472b6; border-color: rgba(219,39,119,0.2); }
.status-ready-release  { background: rgba(8,145,178,0.1);   color: #22d3ee; border-color: rgba(8,145,178,0.2); }
.status-deployed       { background: rgba(5,150,105,0.1);   color: #34d399; border-color: rgba(5,150,105,0.2); }
.status-done           { background: rgba(16,185,129,0.1);  color: #6ee7b7; border-color: rgba(16,185,129,0.2); }

.priority-critical { background: rgba(239,68,68,0.12);  color: #f87171; border-color: rgba(239,68,68,0.25); }
.priority-high     { background: rgba(249,115,22,0.12); color: #fb923c; border-color: rgba(249,115,22,0.25); }
.priority-medium   { background: rgba(59,130,246,0.12); color: #60a5fa; border-color: rgba(59,130,246,0.25); }
.priority-low      { background: rgba(100,116,139,0.1); color: #94a3b8; border-color: rgba(100,116,139,0.2); }

/* Light Mode Badge Overrides (Better contrast) */
[data-theme="light"] .status-backlog { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
[data-theme="light"] .status-ready   { background: #fef3c7; color: #b45309; border-color: #fcd34d; }
[data-theme="light"] .status-inprogress { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
[data-theme="light"] .status-dev     { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
[data-theme="light"] .status-review  { background: #fce7f3; color: #be185d; border-color: #f9a8d4; }
[data-theme="light"] .status-ready-release { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
[data-theme="light"] .status-deployed { background: #dcfce7; color: #15803d; border-color: #86efac; }
[data-theme="light"] .status-done     { background: #dcfce7; color: #15803d; border-color: #86efac; }

[data-theme="light"] .priority-critical { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
[data-theme="light"] .priority-high     { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
[data-theme="light"] .priority-medium   { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
[data-theme="light"] .priority-low      { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }

/* ============================================================
   TABLES
   ============================================================ */
.premium-table-container { overflow-x: auto; }

.premium-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
}

.premium-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-1);
}

.task-row td {
  padding: 14px 16px;
  background: var(--surface-2);
  border-top: 1px solid var(--border-1);
  border-bottom: 1px solid var(--border-1);
  font-size: 0.875rem;
  transition: background var(--t-fast);
}

.task-row td:first-child {
  border-left: 1px solid var(--border-1);
  border-radius: var(--r-md) 0 0 var(--r-md);
}

.task-row td:last-child {
  border-right: 1px solid var(--border-1);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

.task-row {
  animation: rowIn 0.3s var(--ease) forwards;
  transition: transform var(--t-fast);
}

.task-row:hover td {
  background: var(--surface-3);
}

.task-row:hover {
  transform: translateY(-1px);
}

.task-title {
  font-weight: 600;
  color: var(--text-1);
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}

.task-title:hover { color: var(--brand-light); }

/* Subtask rows */
.subtask-row td {
  padding: 10px 16px;
  background: rgba(255,255,255,0.015);
  border-top: 1px solid var(--border-1);
  border-bottom: 1px solid var(--border-1);
  font-size: 0.835rem;
  transition: background var(--t-fast);
}

.subtask-row td:first-child {
  border-left: 1px solid var(--border-1);
  padding-left: 52px;
  border-radius: var(--r-md) 0 0 var(--r-md);
  position: relative;
}

.subtask-row td:first-child::before {
  content: '';
  position: absolute;
  left: 32px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--brand-glow);
}

.subtask-row td:last-child {
  border-right: 1px solid var(--border-1);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

.subtask-row:hover td { background: var(--surface-3); }

.subtask-title { font-size: 0.85rem; font-weight: 500; color: var(--text-2); }
.subtask-row:hover .subtask-title { color: var(--text-1); }

/* Global Badge Helpers - ensuring these work everywhere */
.badge.status-backlog, .badge.status-ready, .badge.status-inprogress, 
.badge.status-dev, .badge.status-review, .badge.status-ready-release, 
.badge.status-deployed, .badge.status-done,
.kb-badge.kb-priority-critical, .kb-badge.kb-priority-high,
.kb-badge.kb-priority-medium, .kb-badge.kb-priority-low {
    transition: transform var(--t-fast);
}

.badge:hover { transform: scale(1.05); }

/* Ensuring the old .status-* classes work with the new .badge class */
.badge.status-backlog { background: rgba(148, 163, 184, 0.1); color: #94a3b8; border-color: rgba(148, 163, 184, 0.2); }
[data-theme="light"] .badge.status-backlog { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
/* ... other statuses already defined ... */

/* ============================================================
   KANBAN BOARD — styles are in the page file
   ============================================================ */
.kanban-board { display: flex; gap: 14px; padding: 20px; overflow-x: auto; height: calc(100vh - 120px); }
.kanban-column {
  background: var(--surface-2);
  width: 280px; min-width: 280px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-1);
  display: flex; flex-direction: column; padding: 14px;
}
.column-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 8px 14px;
  font-weight: 700; font-size: 0.8rem; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-2);
  border-bottom: 1px solid var(--border-1); margin-bottom: 12px;
}
.task-card {
  background: var(--surface-3);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 14px; margin-bottom: 10px;
  cursor: grab; transition: all var(--t-fast);
  border-left: 3px solid var(--brand);
}
.task-card:hover { background: var(--surface-4); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.task-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }

/* ============================================================
   MODALS
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  display: none;
  overflow-y: auto;
  padding: 40px 20px;
}

.modal-content {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s var(--ease);
}

.modal-content h3 {
  margin-bottom: 22px;
  font-size: 1.1rem;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============================================================
   GRADIENT TEXT
   ============================================================ */
.gradient-text {
  background: linear-gradient(135deg, var(--text-1) 0%, var(--brand-light) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .gradient-text {
  background: none !important;
  -webkit-text-fill-color: var(--text-1) !important;
}

/* ============================================================
   GRID HELPERS
   ============================================================ */
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.grid-3-1 { display: grid; grid-template-columns: 3fr 1fr; gap: 24px; }
.grid-2-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.grid-2-1 > div, .grid-3-1 > div, .grid-2-col > div { min-width: 0; }

/* ============================================================
   STATUS FILTER BUTTONS (tasks.php)
   ============================================================ */
.status-filter-container {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.status-btn-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 24px;
  min-height: 48px;
  border: 1px solid var(--border-1);
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  flex: 1 0 auto;
  text-align: center;
  user-select: none;
  font-family: var(--font);
  letter-spacing: -0.01em;
  white-space: nowrap;
  box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

@media (max-width: 768px) {
  .status-filter-container {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    padding: 4px 0 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; 
  }
  .status-filter-container::-webkit-scrollbar {
    display: none;
  }
  .status-btn-filter {
    flex: 0 0 auto;
    font-size: 0.9rem;
    padding: 10px 20px;
  }
}

.status-btn-filter.active {
  background: linear-gradient(135deg, var(--brand) 0%, #8b5cf6 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 25px rgba(124, 58, 237, 0.4);
  transform: translateY(-2px);
}

.status-btn-filter:hover:not(.active) {
  border-color: var(--brand-light);
  color: var(--text-1);
  background: var(--surface-3);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.status-btn-filter .chk-icon { 
  font-size: 0.85rem; 
  opacity: 0; 
  transform: scale(0.5);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

.status-btn-filter.active .chk-icon { 
  opacity: 1; 
  transform: scale(1);
}

/* ============================================================
   MOBILE MENU
   ============================================================ */
.mobile-menu-btn {
  display: none;
  padding: 0 10px;
  min-height: 36px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  border: 1px solid var(--border-1);
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-1);
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
}

.sidebar-overlay.active { display: block; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.fade-in { animation: fadeIn 0.4s var(--ease); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-w));
    top: 0; bottom: 0;
    z-index: 1001;
    transition: left var(--t-normal);
  }

  .sidebar.active {
    left: 0;
    box-shadow: 20px 0 60px rgba(0,0,0,0.5);
  }

  .mobile-menu-btn { display: flex; }

  .neo-search-bar { width: 200px; }
  .neo-search-bar:focus-within { width: 260px; }
}

@media (max-width: 992px) {
  .grid-2-1, .grid-3-1, .grid-2-col,
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 3fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  .stats-grid { grid-template-columns: repeat(3,1fr); gap: 10px; }
}

@media (max-width: 768px) {
  .content-padding { padding: 20px 16px !important; }

  .neo-search-bar { width: 150px; }
  .neo-search-bar:focus-within { width: 200px; }

  .header { padding: 0 16px; gap: 10px; }

  .user-chip span { display: none; }
  .user-chip { padding: 4px; }

  .stats-grid { gap: 8px; }

  .stat-title { font-size: 0.62rem !important; }
  .stat-number { font-size: 1.5rem !important; }

  .premium-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .premium-table { min-width: 520px; }

  .flex-mobile-col { flex-direction: column !important; align-items: flex-start !important; }
  .flex-wrap-mobile { flex-wrap: wrap !important; }
  .hidden-mobile { display: none !important; }

  .modal { padding: 20px 12px; }
  .modal-content { padding: 20px; border-radius: var(--r-lg); }
}

@media (max-width: 480px) {
  .neo-search-bar { display: none; }
  .header { height: 56px; }
  h1 { font-size: 1.3rem; }
}

/* ============================================================
   LIGHT THEME — task card tweaks
   ============================================================ */
[data-theme="light"] .task-card {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

[data-theme="light"] .task-row td { background: #fff; }
[data-theme="light"] .task-row:hover td { background: #f8f8fc; }

[data-theme="light"] .stat-card { background: #fff; }

/* ============================================================
   SCROLLBAR FOR KANBAN
   ============================================================ */
.kanban-scroll, .kb-tasks {
  scrollbar-width: thin;
  scrollbar-color: rgba(124,58,237,0.3) transparent;
}

/* ============================================================
   ISSUE VIEW SPECIFIC
   ============================================================ */
:root {
    --issue-bg: var(--bg);
    --issue-surface: var(--surface-2);
    --issue-text: var(--text-1);
    --issue-muted: var(--text-2);
    --issue-border: var(--border-1);
    --issue-primary: var(--brand);
    --issue-primary-light: var(--brand-subtle);
    --issue-accent: var(--brand-light);
    --issue-danger: var(--danger);
}

.modern-issue-layout {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    color: var(--issue-text);
    background: var(--issue-bg);
}

.modern-issue-layout * { font-family: 'Inter', sans-serif; }
.modern-issue-layout i { font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", sans-serif !important; }

.issue-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--issue-muted);
    margin-bottom: 2rem;
}
.issue-breadcrumb a { text-decoration: none; color: inherit; transition: 0.2s; display: flex; align-items: center; gap: 0.5rem; }
.issue-breadcrumb a:hover { color: var(--issue-primary); }
.issue-breadcrumb .sep { opacity: 0.3; }
.issue-breadcrumb .active { color: var(--issue-text); font-weight: 600; }

.issue-main-card {
    position: relative;
    background: var(--issue-surface);
    border: 1px solid var(--issue-border);
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}
.issue-header { margin-bottom: 2rem; }
.project-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--issue-primary-light);
    color: var(--issue-primary);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
}
.title-row { display: flex; justify-content: flex-start; align-items: flex-start; gap: 2rem; margin-bottom: 1.5rem; padding-right: 380px; min-height: 48px; }
.title-row h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.04em; margin: 0; line-height: 1.2; color: var(--issue-text); }

.action-toolbar {
    position: absolute;
    top: 2rem;
    right: 2.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-1);
    padding: 6px;
    border-radius: 16px;
    border: 1px solid var(--issue-border);
    box-shadow: var(--shadow-sm);
}

.premium-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 110px;
    gap: 8px;
    padding: 10px 0;
    border-radius: 14px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--issue-muted);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.premium-tool-btn i { 
    font-size: 1rem;
}

.premium-tool-btn.edit {
    background: var(--brand-subtle);
    color: var(--brand-light);
    border: 1px solid var(--border-2);
}
.premium-tool-btn.edit:hover {
    background: var(--brand);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
}

.premium-tool-btn.attach {
    background: var(--brand-subtle);
    color: var(--brand-light);
    border: 1px solid var(--border-2);
}
.premium-tool-btn.attach:hover {
    background: var(--brand-light);
    color: #fff;
    transform: translateY(-2px);
}

.premium-tool-btn.delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--issue-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.premium-tool-btn.delete:hover {
    background: var(--issue-danger);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.tool-sep {
    width: 1px;
    height: 24px;
    background: var(--issue-border);
    margin: 0 4px;
}

.author-meta { display: flex; align-items: center; gap: 1rem; }
.author-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--issue-primary), var(--issue-accent));
    color: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.author-info { display: flex; flex-direction: column; }
.author-info .name { font-weight: 600; font-size: 0.9rem; }
.author-info .date { font-size: 0.75rem; color: var(--issue-muted); }

.section-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--issue-muted);
    margin-bottom: 1rem;
    display: block;
}
.description-body { font-size: 1.05rem; line-height: 1.7; color: var(--issue-text); }

.ql-toolbar.ql-snow { border-top-left-radius: 12px; border-top-right-radius: 12px; background: var(--surface-1); border-color: var(--border-1); }
.ql-container.ql-snow { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; background: var(--surface-2); border-color: var(--border-1); font-family: 'Inter', sans-serif; }

[data-theme="dark"] .ql-toolbar.ql-snow { border-color: var(--border-2); background: var(--surface-3); }
[data-theme="dark"] .ql-container.ql-snow { border-color: var(--border-2); background: var(--surface-2); }
[data-theme="dark"] .ql-snow .ql-stroke { stroke: var(--text-2); }
[data-theme="dark"] .ql-snow .ql-fill { fill: var(--text-2); }
[data-theme="dark"] .ql-snow .ql-picker { color: var(--text-2); }

.premium-tool-btn.save { width: 140px; background: var(--success); color: #fff; }
.premium-tool-btn.save:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3); }

.premium-tool-btn.cancel { width: 140px; background: var(--surface-4); color: var(--text-2); border: 1px solid var(--border-1); }
.premium-tool-btn.cancel:hover { background: var(--surface-3); color: var(--text-1); transform: translateY(-2px); }

.add-btn {
    width: 38px;
    height: 38px;
    background: var(--issue-primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.add-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.sidebar-add-member {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.sidebar-add-member select {
    flex: 1;
    height: 40px;
    margin-bottom: 0 !important;
    border-radius: var(--r-md);
    font-size: 0.85rem;
}

.people-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    margin: 0 -10px;
    border-radius: var(--r-md);
    transition: all var(--t-fast);
}

.people-list-item:hover {
    background: var(--surface-4);
    transform: translateX(4px);
}

.people-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.people-role {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-3);
}

.fade-in { animation: fadeIn 0.4s ease-out forwards; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}