/* ============================================================
   QUANTUMHAX ERP - Professional Design System v2.0
   Modern Dark Theme | Fully Responsive | CSS Grid & Flexbox
   ============================================================ */

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

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Core Palette */
  --clr-bg:            #070b14;
  --clr-bg-2:          #0d1320;
  --clr-surface:       #111827;
  --clr-surface-2:     #1a2235;
  --clr-surface-3:     #222d42;
  --clr-border:        rgba(255,255,255,.07);
  --clr-border-focus:  rgba(99,102,241,.5);

  /* Brand Colors */
  --clr-primary:       #6366f1;
  --clr-primary-dark:  #4f46e5;
  --clr-primary-light: #818cf8;
  --clr-primary-glow:  rgba(99,102,241,.2);

  /* Semantic Colors */
  --clr-success:   #10b981;
  --clr-warning:   #f59e0b;
  --clr-danger:    #ef4444;
  --clr-info:      #06b6d4;
  --clr-purple:    #8b5cf6;
  --clr-pink:      #ec4899;
  --clr-teal:      #14b8a6;

  /* Text Hierarchy */
  --txt-primary:   #f1f5f9;
  --txt-secondary: #94a3b8;
  --txt-muted:     #64748b;
  --txt-disabled:  #475569;

  /* Spacing Scale */
  --sp-1: .25rem;  --sp-2: .5rem;   --sp-3: .75rem;  --sp-4: 1rem;
  --sp-5: 1.25rem; --sp-6: 1.5rem;  --sp-8: 2rem;    --sp-10: 2.5rem;
  --sp-12: 3rem;   --sp-16: 4rem;   --sp-20: 5rem;

  /* Border Radius */
  --r-sm: .375rem; --r-md: .625rem; --r-lg: 1rem;
  --r-xl: 1.25rem; --r-2xl: 1.5rem; --r-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.3);
  --shadow-lg:  0 12px 32px rgba(0,0,0,.6), 0 4px 12px rgba(0,0,0,.4);
  --shadow-xl:  0 20px 48px rgba(0,0,0,.7);
  --shadow-glow: 0 0 24px rgba(99,102,241,.35), 0 0 48px rgba(99,102,241,.1);

  /* Sidebar */
  --sidebar-w: 268px;
  --sidebar-collapsed-w: 0px;
  --header-h: 68px;

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
  --t-fast: 150ms var(--ease);
  --t-base: 250ms var(--ease);
  --t-slow: 400ms var(--ease);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--clr-bg);
  color: var(--txt-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,h2,h3,h4,h5,h6 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.25;
}

a { color: var(--clr-primary-light); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: #c7d2fe; }
img, svg { display: block; max-width: 100%; }
input, select, textarea, button { font-family: inherit; }
ul, ol { list-style: none; }

/* ── Layout Shell ────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar Overlay (mobile) ───────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 199;
  opacity: 0;
  transition: opacity var(--t-base);
}
.sidebar-overlay.visible { opacity: 1; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--clr-bg-2);
  border-right: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform var(--t-slow);
  overflow: hidden;
}

/* Sidebar Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--clr-border);
  min-height: var(--header-h);
  flex-shrink: 0;
}
.brand-icon {
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900; color: #fff;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.brand-text { overflow: hidden; }
.brand-name { font-size: 16px; font-weight: 800; color: var(--txt-primary); letter-spacing: -.02em; }
.brand-tagline { font-size: 10.5px; color: var(--txt-muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

/* Sidebar Scroll Area */
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-4) var(--sp-3);
  scrollbar-width: thin;
  scrollbar-color: var(--clr-surface-3) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--clr-surface-3); border-radius: 4px; }

/* Nav Sections */
.nav-section { margin-bottom: var(--sp-5); }
.nav-section-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--txt-disabled);
  padding: 0 var(--sp-3) var(--sp-2);
  display: block;
}

/* Nav Links */
.nav-item { display: block; }
.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-3);
  border-radius: var(--r-md);
  color: var(--txt-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
  position: relative;
  white-space: nowrap;
}
.nav-link:hover {
  background: rgba(255,255,255,.05);
  color: var(--txt-primary);
  transform: translateX(2px);
}
.nav-link.active {
  background: var(--clr-primary-glow);
  color: #c7d2fe;
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--clr-primary);
  border-radius: 0 var(--r-full) var(--r-full) 0;
}
.nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
  opacity: .85;
}
.nav-badge {
  margin-left: auto;
  background: var(--clr-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-full);
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid var(--clr-border);
  padding: var(--sp-4) var(--sp-4);
  flex-shrink: 0;
}
.user-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  cursor: pointer;
  transition: background var(--t-fast);
}
.user-card:hover { background: var(--clr-surface-2); }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--clr-teal), var(--clr-primary));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.user-info { min-width: 0; flex: 1; }
.user-name { font-size: 13px; font-weight: 600; color: var(--txt-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10px; font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--r-full);
  background: rgba(99,102,241,.15);
  color: var(--clr-primary-light);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 2px;
}
.logout-btn {
  width: 28px; height: 28px;
  border-radius: var(--r-md);
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.2);
  color: var(--clr-danger);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: pointer;
  transition: background var(--t-fast);
  flex-shrink: 0;
}
.logout-btn:hover { background: rgba(239,68,68,.2); }

/* ── Main Content Area ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* ── Top Header ──────────────────────────────────────────────── */
.top-header {
  height: var(--header-h);
  background: rgba(13,19,32,.8);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-8);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: var(--sp-4);
}

/* Hamburger Menu (mobile) */
.hamburger-btn {
  display: none;
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  color: var(--txt-secondary);
  font-size: 18px;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast);
  flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--clr-surface-2); color: var(--txt-primary); }

/* Breadcrumb & Page Title */
.header-left { display: flex; flex-direction: column; gap: 1px; }
.header-page-title { font-size: 18px; font-weight: 700; color: var(--txt-primary); }
.breadcrumb { display: flex; align-items: center; gap: var(--sp-2); font-size: 11.5px; color: var(--txt-muted); }
.breadcrumb-sep { opacity: .4; }
.breadcrumb a { color: var(--txt-muted); }
.breadcrumb a:hover { color: var(--txt-secondary); }

/* Header Right Controls */
.header-right { display: flex; align-items: center; gap: var(--sp-3); }

/* Notification Bell */
.notif-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  color: var(--txt-secondary);
  font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast);
}
.notif-btn:hover { background: var(--clr-surface-2); color: var(--txt-primary); }
.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--clr-danger);
  border: 2px solid var(--clr-bg-2);
}

/* Tenant Pill */
.tenant-pill {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: rgba(99,102,241,.1);
  border: 1px solid rgba(99,102,241,.2);
  font-size: 12px; font-weight: 600;
  color: var(--clr-primary-light);
}
.tenant-pill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--clr-success); }

/* ── Page Body ───────────────────────────────────────────────── */
.page-body {
  padding: var(--sp-8);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--clr-primary-dark), #3730a3);
  color: #fff;
  box-shadow: 0 6px 20px rgba(99,102,241,.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--clr-surface-2);
  color: var(--txt-secondary);
  border-color: var(--clr-border);
}
.btn-secondary:hover { background: var(--clr-surface-3); color: var(--txt-primary); }

.btn-success { background: var(--clr-success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }

.btn-danger { background: var(--clr-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--txt-secondary);
  border-color: var(--clr-border);
}
.btn-outline:hover { background: var(--clr-surface); color: var(--txt-primary); }

.btn-xs  { padding: 5px 10px; font-size: 11.5px; border-radius: var(--r-sm); gap: var(--sp-1); }
.btn-sm  { padding: 7px 13px; font-size: 12px; }
.btn-lg  { padding: 13px 28px; font-size: 15px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--r-md); }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-xl);
  overflow: hidden;
  transition: border-color var(--t-base);
}
.card:hover { border-color: rgba(255,255,255,.12); }

.card-body { padding: var(--sp-6); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--clr-border);
}
.card-header-left { display: flex; flex-direction: column; gap: 2px; }
.card-title { font-size: 15px; font-weight: 700; color: var(--txt-primary); }
.card-subtitle { font-size: 12px; color: var(--txt-muted); }
.card-header-right { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }

/* ── Stat Cards ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-5);
}

.stat-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-xl);
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  position: relative;
  overflow: hidden;
  transition: transform var(--t-fast), border-color var(--t-fast);
}
.stat-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.14); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.stat-card-primary::before   { background: linear-gradient(90deg, var(--clr-primary), var(--clr-purple)); }
.stat-card-success::before   { background: linear-gradient(90deg, var(--clr-success), var(--clr-teal)); }
.stat-card-warning::before   { background: linear-gradient(90deg, var(--clr-warning), #f97316); }
.stat-card-danger::before    { background: linear-gradient(90deg, var(--clr-danger), var(--clr-pink)); }

.stat-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon-primary  { background: rgba(99,102,241,.15);  color: var(--clr-primary); }
.stat-icon-success  { background: rgba(16,185,129,.15);  color: var(--clr-success); }
.stat-icon-warning  { background: rgba(245,158,11,.15);  color: var(--clr-warning); }
.stat-icon-danger   { background: rgba(239,68,68,.15);   color: var(--clr-danger);  }

.stat-badge {
  font-size: 10.5px; font-weight: 700;
  padding: 3px 8px; border-radius: var(--r-full);
  display: inline-flex; align-items: center; gap: 3px;
}
.stat-badge-up   { background: rgba(16,185,129,.15); color: var(--clr-success); }
.stat-badge-down { background: rgba(239,68,68,.15);  color: var(--clr-danger);  }

.stat-card-bottom {}
.stat-value {
  font-size: 28px; font-weight: 800;
  color: var(--txt-primary);
  letter-spacing: -.04em;
  line-height: 1;
  margin-bottom: 4px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.stat-label { font-size: 12.5px; color: var(--txt-muted); font-weight: 500; }

/* ── Data Table ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table-wrap::-webkit-scrollbar { height: 4px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--clr-surface-3); border-radius: 4px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 600px;
}
.data-table thead tr {
  border-bottom: 1px solid var(--clr-border);
}
.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--txt-muted);
  background: rgba(0,0,0,.2);
  white-space: nowrap;
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  color: var(--txt-primary);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--t-fast); }
.data-table tbody tr:hover { background: rgba(255,255,255,.025); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Column helpers */
.col-bold  { font-weight: 600; }
.col-mono  { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px; }
.col-right { text-align: right; }
.col-center{ text-align: center; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }

.badge-primary   { background: rgba(99,102,241,.15);  color: #a5b4fc; }
.badge-primary::before { background: var(--clr-primary); }
.badge-success   { background: rgba(16,185,129,.15);  color: #6ee7b7; }
.badge-success::before { background: var(--clr-success); }
.badge-warning   { background: rgba(245,158,11,.15);  color: #fcd34d; }
.badge-warning::before { background: var(--clr-warning); }
.badge-danger    { background: rgba(239,68,68,.15);   color: #fca5a5; }
.badge-danger::before { background: var(--clr-danger); }
.badge-info      { background: rgba(6,182,212,.15);   color: #67e8f9; }
.badge-info::before { background: var(--clr-info); }
.badge-purple    { background: rgba(139,92,246,.15);  color: #c4b5fd; }
.badge-purple::before { background: var(--clr-purple); }
.badge-secondary { background: rgba(148,163,184,.1);  color: var(--txt-secondary); }
.badge-secondary::before { background: var(--txt-muted); }

/* Stage badge (no dot, larger) */
.stage-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
}
.stage-lead        { background: rgba(100,116,139,.15); color: #94a3b8; }
.stage-discussion  { background: rgba(6,182,212,.15);   color: var(--clr-info); }
.stage-quotation   { background: rgba(99,102,241,.15);  color: var(--clr-primary-light); }
.stage-approval    { background: rgba(245,158,11,.15);  color: var(--clr-warning); }
.stage-development { background: rgba(139,92,246,.15);  color: var(--clr-purple); }
.stage-testing     { background: rgba(236,72,153,.15);  color: var(--clr-pink); }
.stage-completed   { background: rgba(16,185,129,.15);  color: var(--clr-success); }
.stage-delivered   { background: rgba(20,184,166,.15);  color: var(--clr-teal); }
.stage-support     { background: rgba(245,158,11,.15);  color: var(--clr-warning); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.form-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--sp-5); }
.form-group  { display: flex; flex-direction: column; gap: var(--sp-2); }
.form-label  { font-size: 12px; font-weight: 600; color: var(--txt-secondary); letter-spacing: .04em; text-transform: uppercase; }

.form-control, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-md);
  color: var(--txt-primary);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}
.form-control::placeholder { color: var(--txt-disabled); }
.form-control:focus, .form-select:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px var(--clr-primary-glow);
}
textarea.form-control { min-height: 100px; resize: vertical; line-height: 1.6; }

.form-control-lg { padding: 12px 16px; font-size: 15px; }
.form-hint { font-size: 11.5px; color: var(--txt-muted); margin-top: var(--sp-1); }

/* File Input */
.file-input-wrap {
  border: 2px dashed var(--clr-border);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.file-input-wrap:hover { border-color: var(--clr-primary); background: var(--clr-primary-glow); }
.file-input-wrap input { display: none; }

/* ── Toast / Alert Banners ───────────────────────────────────── */
.alert-container { display: flex; flex-direction: column; gap: var(--sp-3); }
.alert {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  animation: slideDown .3s var(--ease);
}
.alert-success { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.25); color: #6ee7b7; }
.alert-error   { background: rgba(239,68,68,.12);  border-color: rgba(239,68,68,.25);  color: #fca5a5; }
.alert-info    { background: rgba(6,182,212,.12);  border-color: rgba(6,182,212,.25);  color: #67e8f9; }
.alert-warning { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.25); color: #fcd34d; }
@keyframes slideDown { from { opacity:0; transform: translateY(-10px); } to { opacity:1; transform: translateY(0); } }

/* ── Kanban Board (Professional Redesign) ──────────────────────── */
.kanban-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  height: calc(100vh - 160px);
  padding: 0 var(--sp-4) var(--sp-6) var(--sp-4);
  margin: 0 calc(var(--sp-4) * -1); /* Full bleed horizontally */
  
  /* Custom thin scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.kanban-wrapper::-webkit-scrollbar {
  height: 6px;
}
.kanban-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.kanban-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: var(--r-full);
}
.kanban-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}

.kanban-board {
  display: flex;
  gap: var(--sp-4);
  min-width: max-content;
  height: 100%;
  align-items: stretch;
}

.kanban-col {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.4); /* Very subtle background */
  border-radius: var(--r-xl);
  overflow: hidden;
}

.kanban-col-header {
  padding: var(--sp-4);
  position: sticky;
  top: 0;
  z-index: 10;
  background: inherit;
  backdrop-filter: blur(10px);
}

.kanban-col-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.kanban-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--clr-primary);
  box-shadow: 0 0 8px var(--clr-primary);
}

.kanban-col-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--txt-primary);
  letter-spacing: -0.01em;
  margin: 0;
}

.kanban-col-count {
  margin-left: auto;
  background: rgba(255,255,255,0.06);
  color: var(--txt-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-full);
}

.kanban-col-body {
  flex: 1;
  padding: 0 var(--sp-4) var(--sp-4);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  
  /* Scrollbar for columns */
  scrollbar-width: none;
}
.kanban-col-body::-webkit-scrollbar { display: none; }

.kanban-card {
  background: var(--clr-surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-card:hover {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.03);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.kanban-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.kanban-card-id {
  font-size: 11px;
  font-weight: 500;
  color: var(--txt-disabled);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.kanban-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--txt-primary);
  margin: 0;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.kanban-card-client {
  font-size: 12px;
  color: var(--txt-muted);
  margin: 0;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: 2px;
}

.kanban-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 600;
}
.kanban-tag svg { opacity: 0.7; }
.kanban-tag-green { background: rgba(16, 185, 129, 0.1); color: var(--clr-success); }
.kanban-tag-red   { background: rgba(239, 68, 68, 0.1); color: var(--clr-danger); }

.kanban-card-actions {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.kanban-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.kanban-select {
  appearance: none;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--txt-muted);
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.kanban-select option {
  background: var(--clr-bg);
  color: var(--txt-primary);
  font-size: 13px;
  padding: 8px;
}

.kanban-select:hover, .kanban-select:focus {
  color: var(--txt-primary);
  outline: none;
}

.kanban-select-wrapper svg {
  position: absolute;
  right: 4px;
  color: var(--txt-muted);
  pointer-events: none;
  opacity: 0.5;
}

.kanban-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100px;
  border: 1px dashed rgba(255,255,255,0.06);
  border-radius: var(--r-lg);
  color: var(--txt-disabled);
  font-size: 12px;
  font-weight: 500;
}

/* ── Modal ───────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
}
.modal-backdrop.open { display: flex; animation: fadeIn .2s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--clr-surface);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  animation: modalSlide .25s var(--ease);
}
@keyframes modalSlide { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--clr-border);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  color: var(--txt-muted);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast);
}
.modal-close:hover { background: var(--clr-surface-3); color: var(--txt-primary); }
.modal-body { padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
.modal-footer { padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--clr-border); display: flex; gap: var(--sp-3); justify-content: flex-end; }

/* ── Page Action Bar ─────────────────────────────────────────── */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.action-bar-left  { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.action-bar-right { display: flex; align-items: center; gap: var(--sp-2); }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-16) var(--sp-8);
  text-align: center;
  gap: var(--sp-3);
}
.empty-state-icon { font-size: 48px; opacity: .3; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--txt-secondary); }
.empty-state-sub   { font-size: 13px; color: var(--txt-muted); }

/* ── Avatar / Initials ───────────────────────────────────────── */
.avatar {
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
  flex-shrink: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.avatar-sm  { width: 28px; height: 28px; font-size: 11px; }
.avatar-md  { width: 36px; height: 36px; font-size: 13px; }
.avatar-lg  { width: 48px; height: 48px; font-size: 18px; }
.avatar-xl  { width: 64px; height: 64px; font-size: 24px; }
.av-indigo  { background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-dark)); }
.av-teal    { background: linear-gradient(135deg, var(--clr-teal), #0891b2); }
.av-green   { background: linear-gradient(135deg, var(--clr-success), #047857); }
.av-purple  { background: linear-gradient(135deg, var(--clr-purple), #6d28d9); }
.av-pink    { background: linear-gradient(135deg, var(--clr-pink), #be185d); }
.av-orange  { background: linear-gradient(135deg, #f97316, #ea580c); }

/* ── Divider ─────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--clr-border); margin: var(--sp-4) 0; }

/* ── Utilities ───────────────────────────────────────────────── */
.flex    { display: flex; }
.flex-col{ display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: var(--sp-2); }
.gap-3  { gap: var(--sp-3); }
.gap-4  { gap: var(--sp-4); }
.gap-6  { gap: var(--sp-6); }
.w-full { width: 100%; }
.min-w-0{ min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-sm  { font-size: 12.5px; }
.text-xs  { font-size: 11px; }
.text-muted { color: var(--txt-muted); }
.text-secondary { color: var(--txt-secondary); }
.text-success { color: var(--clr-success); }
.text-danger  { color: var(--clr-danger); }
.text-warning { color: var(--clr-warning); }
.text-primary-color { color: var(--clr-primary-light); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.mt-auto { margin-top: auto; }

/* ── Grid Layouts ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-5); }
.grid-dashboard { display: grid; grid-template-columns: 1fr 380px; gap: var(--sp-6); }

/* ── Print Styles ────────────────────────────────────────────── */
@media print {
  .sidebar, .top-header, .action-bar, .modal-backdrop, .btn:not(.print-visible) { display: none !important; }
  .main-content { margin-left: 0; }
  .print-document { background: #fff; color: #000; border: none; }
}

/* ── Responsive Breakpoints ──────────────────────────────────── */

/* Tablet  ≤ 1200px */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-dashboard { grid-template-columns: 1fr; }
}

/* Small Tablet  ≤ 900px */
@media (max-width: 900px) {
  :root { --sidebar-w: 240px; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(2,1fr); }
}

/* Mobile  ≤ 768px */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  .sidebar-overlay { display: block; }

  .main-content { margin-left: 0; }

  .hamburger-btn { display: flex; }

  .top-header { padding: 0 var(--sp-4); }
  .page-body  { padding: var(--sp-5) var(--sp-4); gap: var(--sp-5); }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
  .stat-value { font-size: 22px; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }

  .action-bar { flex-direction: column; align-items: flex-start; }

  .header-page-title { font-size: 15px; }
  .tenant-pill { display: none; }
}

/* Extra Small  ≤ 480px */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .kanban-col { width: 260px; }
  .stat-value { font-size: 20px; }
  .btn { padding: 8px 14px; }
}
