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

:root {
  --bg:          #F7F6F2;
  --surface:     #FFFFFF;
  --surface2:    #F2F0EB;
  --border:      #E4E1D8;
  --border2:     #D0CCC0;
  --text:        #1A1916;
  --text2:       #6B6860;
  --text3:       #9E9C96;
  --accent:      #1D4ED8;
  --accent-bg:   #EEF2FF;
  --accent-text: #1D3FA8;
  --green:       #15803D;
  --green-bg:    #F0FDF4;
  --green-text:  #14532D;
  --amber:       #B45309;
  --amber-bg:    #FFFBEB;
  --amber-text:  #92400E;
  --red:         #DC2626;
  --red-bg:      #FEF2F2;
  --red-text:    #991B1B;
  --purple:      #7C3AED;
  --purple-bg:   #F5F3FF;
  --purple-text: #4C1D95;
  --sidebar-w:   240px;
  --radius:      10px;
  --radius-sm:   6px;
  --radius-lg:   14px;
  --shadow:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,.08);
  --font:        'DM Sans', sans-serif;
  --font-mono:   'DM Mono', monospace;
  --font-serif:  'Playfair Display', serif;
  --transition:  150ms ease;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}


/* ── Sidebar ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  color: var(--accent);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-name {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--text);
  flex: 1;
}
.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  padding: 4px;
  border-radius: var(--radius-sm);
}
.sidebar-toggle:hover { color: var(--text); background: var(--surface2); }

.sidebar-company {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.company-avatar {
  width: 32px; height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.company-name { font-size: 13px; font-weight: 500; display: block; }
.company-type { font-size: 11px; color: var(--text3); display: block; }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  padding: 10px 8px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.nav-section-label:hover { background: var(--surface2); }
.nav-section-label .nav-chevron {
  transition: transform .2s ease;
  opacity: .5;
  flex-shrink: 0;
}
.nav-section-label.collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-section-items {
  overflow: hidden;
  max-height: 800px;
  transition: max-height .25s ease, opacity .2s ease;
  opacity: 1;
}
.nav-section-items.collapsed {
  max-height: 0;
  opacity: 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 400;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.nav-item svg { flex-shrink: 0; opacity: .7; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--accent-text); font-weight: 500; }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--surface2);
  color: var(--text2);
  font-size: 11px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 99px;
  font-family: var(--font-mono);
}
.nav-badge-warn { background: var(--amber-bg); color: var(--amber-text); }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}
.user-avatar {
  width: 30px; height: 30px;
  background: var(--purple-bg);
  color: var(--purple-text);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; display: block; }
.user-role { font-size: 11px; color: var(--text3); display: block; }

/* ── Main ─────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  transition: margin-left var(--transition);
}

/* ── Page Layout ──────────────────────────────────── */
.page { padding: 28px 32px; max-width: 1400px; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-title { font-family: var(--font-serif); font-size: 26px; font-weight: 600; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text3); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #1a44c0; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border2); }
.btn-secondary:hover { background: var(--surface2); }
.btn-ghost { background: none; color: var(--text2); border-color: transparent; }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn svg { flex-shrink: 0; }

/* ── Cards ────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.card-subtitle { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* ── KPI Cards ────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.kpi-label { font-size: 12px; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.kpi-value { font-size: 28px; font-weight: 600; color: var(--text); font-family: var(--font-mono); line-height: 1; }
.kpi-delta {
  font-size: 12px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi-delta.neutral { color: var(--text3); }

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

/* ── Tables ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); cursor: pointer; }

/* ── Badges / Tags ────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
}
.badge-green { background: var(--green-bg); color: var(--green-text); }
.badge-amber { background: var(--amber-bg); color: var(--amber-text); }
.badge-red   { background: var(--red-bg);   color: var(--red-text);   }
.badge-blue  { background: var(--accent-bg); color: var(--accent-text); }
.badge-purple{ background: var(--purple-bg); color: var(--purple-text); }
.badge-gray  { background: var(--surface2); color: var(--text2); }

/* ── Progress Bar ─────────────────────────────────── */
.progress-bar { height: 6px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s ease; }
.progress-fill.green { background: var(--green); }
.progress-fill.amber { background: var(--amber); }
.progress-fill.red   { background: var(--red); }

/* ── Avatar ───────────────────────────────────────── */
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }
.av-blue   { background: var(--accent-bg); color: var(--accent-text); }
.av-green  { background: var(--green-bg);  color: var(--green-text); }
.av-amber  { background: var(--amber-bg);  color: var(--amber-text); }
.av-purple { background: var(--purple-bg); color: var(--purple-text); }
.av-red    { background: var(--red-bg);    color: var(--red-text); }

/* ── Form Elements ────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29,78,216,.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* ── Toolbar / Filters ────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.search-input input {
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 13.5px;
  background: none;
  color: var(--text);
  flex: 1;
}
.search-input svg { color: var(--text3); flex-shrink: 0; }
.filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  font-family: var(--font);
}
.filter-btn:hover { background: var(--surface2); }
.filter-btn.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-text); }

/* ── Tabs ─────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Login Screen (centre absolu) ────────────────── */
#login-screen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 9999 !important;
}

/* ── Empty State ──────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text3);
}
.empty-state svg { margin-bottom: 12px; opacity: .4; }
.empty-state h3 { font-size: 15px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ── Modal ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal.modal-xl  { max-width: 1000px; }
.modal.modal-lg  { max-width: 760px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  padding: 4px;
  border-radius: var(--radius-sm);
}
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Kanban ───────────────────────────────────────── */
.kanban {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 12px;
}
.kanban-col {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 260px;
  flex-shrink: 0;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.kanban-col-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text3); }
.kanban-count {
  font-size: 11px;
  background: var(--surface2);
  color: var(--text2);
  padding: 1px 7px;
  border-radius: 99px;
  font-family: var(--font-mono);
}
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all var(--transition);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card-title { font-size: 13.5px; font-weight: 500; margin-bottom: 6px; }
.kanban-card-meta { font-size: 12px; color: var(--text3); display: flex; align-items: center; justify-content: space-between; }

/* ── Planning Grid ────────────────────────────────── */
.planning-grid { overflow-x:auto !important; overflow-y:visible; -webkit-overflow-scrolling:touch; display:block !important; }
.planning-grid::-webkit-scrollbar { height:10px; }
.planning-grid::-webkit-scrollbar-track { background:#f1f5f9; border-radius:5px; }
.planning-grid::-webkit-scrollbar-thumb { background:#3b82f6; border-radius:5px; }
.planning-table { border-collapse: collapse; min-width: max-content !important; width: max-content !important; font-size: 12px; }
.planning-table th, .planning-table td { padding: 0; }
.planning-row-label {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.planning-day-header {
  padding: 6px 4px;
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-width: 36px;
  background: var(--bg);
  white-space: nowrap;
}
.planning-cell {
  width: 36px;
  height: 38px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.planning-cell.occupied { background: var(--accent-bg); }
.planning-cell.partial  { background: var(--amber-bg); }
.planning-cell.free     { background: var(--surface); }
.planning-cell.weekend  { background: var(--bg); cursor: default; }
.planning-cell.occupied:hover { background: #dbeafe; }

/* ── Charts (CSS-only bars) ───────────────────────── */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 60px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.bar-label { color: var(--text2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 99px; background: var(--accent); }
.bar-fill.green  { background: var(--green); }
.bar-fill.amber  { background: var(--amber); }
.bar-value { font-family: var(--font-mono); font-size: 12px; color: var(--text2); text-align: right; }

/* ── Timeline ─────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 14px;
  padding-bottom: 20px;
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 28px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
}
.timeline-content { flex: 1; padding-top: 4px; }
.timeline-title { font-size: 13.5px; font-weight: 500; }
.timeline-meta { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* ── Notifications dot ────────────────────────────── */
.notif-dot {
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  display: inline-block;
  margin-left: auto;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .page { padding: 20px 16px; }
}
@media (max-width: 680px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Utility ──────────────────────────────────────── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text3); }
.text-secondary { color: var(--text2); }
.font-mono { font-family: var(--font-mono); }
.font-500 { font-weight: 500; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.w-full { width: 100%; }

/* ── Animations ───────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.page { animation: fadeIn .2s ease; }

.card:has(.planning-grid) { overflow: visible !important; }

/* ============================================================ */
/* DARK MODE                                                     */
/* ============================================================ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #121214;
    --surface:     #1C1C1F;
    --surface2:    #252528;
    --border:      #2E2E32;
    --border2:     #3A3A3F;
    --text:        #E8E6E3;
    --text2:       #A09E99;
    --text3:       #706E69;
    --accent:      #5B8DEF;
    --accent-bg:   rgba(91,141,239,.12);
    --accent-text: #7BABFF;
    --green:       #34D399;
    --green-bg:    rgba(52,211,153,.1);
    --green-text:  #6EE7B7;
    --amber:       #F59E0B;
    --amber-bg:    rgba(245,158,11,.1);
    --amber-text:  #FCD34D;
    --red:         #F87171;
    --red-bg:      rgba(248,113,113,.1);
    --red-text:    #FCA5A5;
    --purple:      #A78BFA;
    --purple-bg:   rgba(167,139,250,.1);
    --purple-text: #C4B5FD;
    --shadow:      0 1px 3px rgba(0,0,0,.3);
    --shadow-md:   0 4px 12px rgba(0,0,0,.4);
  }
  :root:not([data-theme="light"]) body { color-scheme: dark; }
  :root:not([data-theme="light"]) .form-input,
  :root:not([data-theme="light"]) .form-select,
  :root:not([data-theme="light"]) .form-textarea { background: var(--surface2); }
  :root:not([data-theme="light"]) .modal { background: var(--surface); }
  :root:not([data-theme="light"]) img { opacity: .9; }
}
/* Manual dark mode toggle */
[data-theme="dark"] {
  --bg:          #121214;
  --surface:     #1C1C1F;
  --surface2:    #252528;
  --border:      #2E2E32;
  --border2:     #3A3A3F;
  --text:        #E8E6E3;
  --text2:       #A09E99;
  --text3:       #706E69;
  --accent:      #5B8DEF;
  --accent-bg:   rgba(91,141,239,.12);
  --accent-text: #7BABFF;
  --green:       #34D399;
  --green-bg:    rgba(52,211,153,.1);
  --green-text:  #6EE7B7;
  --amber:       #F59E0B;
  --amber-bg:    rgba(245,158,11,.1);
  --amber-text:  #FCD34D;
  --red:         #F87171;
  --red-bg:      rgba(248,113,113,.1);
  --red-text:    #FCA5A5;
  --purple:      #A78BFA;
  --purple-bg:   rgba(167,139,250,.1);
  --purple-text: #C4B5FD;
  --shadow:      0 1px 3px rgba(0,0,0,.3);
  --shadow-md:   0 4px 12px rgba(0,0,0,.4);
}
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea { background: var(--surface2); }
[data-theme="dark"] .modal { background: var(--surface); }

/* ============================================================ */
/* ENHANCED RESPONSIVE (mobile-first)                            */
/* ============================================================ */
@media (max-width: 680px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    z-index: 200;
    width: 260px;
    transition: transform .25s ease;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { margin-left: 0 !important; }
  .page { padding: 16px 12px; }
  .page-header { flex-direction: column; gap: 10px; }
  .page-title { font-size: 20px; }
  .page-actions { flex-wrap: wrap; }
  .kpi-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  .kpi-value { font-size: 20px !important; }
  .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
  .form-row { grid-template-columns: 1fr !important; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-input { max-width: none; }
  .kanban { flex-direction: column; }
  .kanban-col { min-width: auto; }
  .modal { max-width: 95vw !important; margin: 0 auto; }
  .modal-body { padding: 14px; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab-btn { padding: 8px 12px; font-size: 12px; white-space: nowrap; }
  .bar-row { grid-template-columns: 80px 1fr 50px; gap: 6px; }
  .bar-label { font-size: 11px; }
  table { font-size: 12px; }
  thead th, tbody td { padding: 8px 10px; }
}

/* Mobile menu overlay */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 199;
}
.mobile-overlay.active { display: block; }

/* Mobile topbar */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 150;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
}
.mobile-topbar .brand-name { font-family: var(--font-serif); font-size: 16px; }
@media (max-width: 680px) {
  .mobile-topbar { display: flex; }
  .main { padding-top: 52px; }
  .sidebar-brand { display: none; }
}

/* ============================================================ */
/* ENHANCED ANIMATIONS                                           */
/* ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}
.page { animation: fadeIn .25s ease; }
.card { animation: slideUp .3s ease backwards; }
.card:nth-child(2) { animation-delay: 40ms; }
.card:nth-child(3) { animation-delay: 80ms; }
.card:nth-child(4) { animation-delay: 120ms; }
.kpi-card { animation: slideUp .3s ease backwards; }
.kpi-card:nth-child(2) { animation-delay: 50ms; }
.kpi-card:nth-child(3) { animation-delay: 100ms; }
.kpi-card:nth-child(4) { animation-delay: 150ms; }
.kpi-card:nth-child(5) { animation-delay: 200ms; }
.modal-overlay.open .modal { animation: scaleIn .2s ease; }
tbody tr { animation: fadeIn .2s ease backwards; }
tbody tr:nth-child(2) { animation-delay: 20ms; }
tbody tr:nth-child(3) { animation-delay: 40ms; }
tbody tr:nth-child(4) { animation-delay: 60ms; }
tbody tr:nth-child(5) { animation-delay: 80ms; }

/* Smooth hover effects */
.card { transition: box-shadow .2s ease, transform .2s ease; }
.card:hover { box-shadow: var(--shadow-md); }
.btn { transition: all .15s ease; }
.btn:active { transform: scale(.97); }

/* ============================================================ */
/* NOTIFICATION BADGE                                            */
/* ============================================================ */
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-family: var(--font-mono);
}
#notif-bell { position: relative; }

/* ============================================================ */
/* PRINT STYLES                                                  */
/* ============================================================ */
@media print {
  .sidebar, .mobile-topbar, .page-actions, .toolbar,
  .modal-overlay, #toast-container, #notif-panel,
  .btn, button, .tabs { display: none !important; }
  .main { margin-left: 0 !important; }
  .page { padding: 0; max-width: 100%; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .kpi-card { break-inside: avoid; }
  body { background: #fff; font-size: 12px; }
  table { font-size: 11px; }
  @page { margin: 1.5cm; }
}

/* ============================================================ */
/* SCROLLBAR CUSTOM                                              */
/* ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ============================================================ */
/* SELECTION                                                     */
/* ============================================================ */
::selection { background: var(--accent-bg); color: var(--accent-text); }

/* ============================================================ */
/* SKELETON LOADING (for future use)                             */
/* ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
