@import url('https://api.fontshare.com/v2/css?f[]=cabinet-grotesk@400,500,600,700,800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

:root {
  --font: "Cabinet Grotesk", "Space Grotesk", system-ui, sans-serif;
  --bg-body: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-topbar: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f8fafc;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-subtle: #eff6ff;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #0891b2;
  --info-light: #cffafe;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --teal: #0d9488;
  --teal-light: #ccfbf1;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --sidebar-w: 252px;
  --topbar-h: 62px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

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

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .25s ease, transform .25s ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── SIDEBAR BRAND ── */
.sidebar-brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
  min-height: 68px;
}
.brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 17px; font-weight: 800;
  letter-spacing: -0.5px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37,99,235,.35);
}
.brand-text { line-height: 1.2; flex: 1; overflow: hidden; transition: opacity .2s, width .25s; }
.brand-name { font-size: 15px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.3px; white-space: nowrap; }
.brand-sub { font-size: 10px; font-weight: 500; color: var(--text-faint); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }

/* ── TOGGLE BUTTON ── */
.sidebar-toggle {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s, opacity .2s;
  margin-left: auto;
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── NAV ── */
.sidebar-nav { flex: 1; padding: 10px; overflow-y: auto; overflow-x: hidden; }

.nav-section { margin-bottom: 4px; }
.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 10px 10px 4px;
  display: block;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity .2s, height .2s;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8.5px 10px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .12s, color .12s, padding .25s;
  position: relative;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link-btn { width: 100%; background: none; border: none; text-align: left; cursor: pointer; }

/* ── NESTED NAV GROUPS ── */
.nav-group { margin-bottom: 1px; }
.nav-group-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 9px; padding: 8.5px 10px; border-radius: var(--r-sm);
  color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
  cursor: pointer; user-select: none; border: none; background: none;
  width: 100%; text-align: left; transition: background .12s, color .12s;
  white-space: nowrap; overflow: hidden;
}
.nav-group-header:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-group-header .icon { width: 17px; height: 17px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; opacity: .75; }
.nav-group-header .nav-label { flex: 1; }
.nav-group-chevron { width: 14px; height: 14px; flex-shrink: 0; transition: transform .2s; color: var(--text-faint); }
.nav-group.open .nav-group-chevron { transform: rotate(90deg); }
.nav-group-children { overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.nav-group.open .nav-group-children { max-height: 400px; }
.nav-children-inner { padding-left: 14px; border-left: 2px solid var(--border-light); margin-left: 18px; padding-top: 2px; padding-bottom: 4px; }
.nav-group-add {
  display: flex; align-items: center; gap: 7px; padding: 6px 10px;
  border-radius: var(--r-sm); font-size: 12.5px; font-weight: 500;
  color: var(--primary); cursor: pointer; border: none; background: none;
  width: 100%; text-align: left; transition: background .12s;
}
.nav-group-add:hover { background: var(--primary-subtle); }
.nav-link.active {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 600;
}
.nav-link .icon {
  width: 17px; height: 17px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: .75;
}
.nav-link.active .icon { opacity: 1; }
.nav-label { transition: opacity .2s; }

/* tooltip shown in collapsed mode */
.nav-link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%; transform: translateY(-50%);
  background: #1e293b;
  color: white;
  font-size: 12px; font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 300;
}
.nav-link::before {
  content: '';
  position: absolute;
  left: calc(100% + 6px);
  top: 50%; transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: #1e293b;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 300;
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background: var(--danger);
  color: white;
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
  line-height: 1.6;
}

/* ── FOOTER ── */
.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  overflow: hidden;
}

/* ── COLLAPSED STATE ── */
.sidebar.collapsed {
  width: 64px;
}
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .user-info {
  opacity: 0;
  pointer-events: none;
  width: 0;
}
.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: 18px 12px 14px;
  gap: 0;
}
.sidebar.collapsed .sidebar-toggle {
  position: absolute;
  right: -13px;
  top: 22px;
  background: white;
  border-color: var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  z-index: 10;
}
.sidebar.collapsed .toggle-icon-collapse { display: none !important; }
.sidebar.collapsed .toggle-icon-expand { display: block !important; }
.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 8.5px;
  gap: 0;
}
.sidebar.collapsed .nav-link:hover::after,
.sidebar.collapsed .nav-link:hover::before { opacity: 1; }
.sidebar.collapsed .sidebar-user {
  justify-content: center;
  padding: 8px;
}
.sidebar.collapsed .sidebar-logout {
  justify-content: center;
  padding: 7px;
}
.sidebar.collapsed .sidebar-logout svg { margin: 0; }

/* ── MAIN offset transition ── */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left .25s ease; }
.main.sidebar-collapsed { margin-left: 64px; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .12s;
}
.sidebar-user:hover { background: var(--bg-hover); }
.user-av {
  width: 33px; height: 33px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.user-av.green { background: linear-gradient(135deg,#16a34a,#065f46); }
.user-av.orange { background: linear-gradient(135deg,#d97706,#92400e); }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.user-role { font-size: 11px; color: var(--text-muted); }
.sidebar-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin-top: 2px;
  border-radius: var(--r-sm);
  color: var(--danger);
  font-size: 13px; font-weight: 500;
  transition: background .12s;
}
.sidebar-logout:hover { background: var(--danger-light); }

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
  gap: 14px;
}
.topbar-left { flex: 1; }
.topbar-left h1 { font-size: 17px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.topbar-left p { font-size: 12px; color: var(--text-muted); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: white;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all .15s;
  position: relative;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── PAGE ── */
.page { flex: 1; padding: 22px 24px 32px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.page-head-info h2 { font-size: 19px; font-weight: 700; color: var(--text-primary); letter-spacing: -.3px; }
.page-head-info p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-head-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.card-body { padding: 20px; }

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex; gap: 14px; align-items: flex-start;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-ic {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 20px;
}
.ic-blue { background: var(--primary-subtle); color: var(--primary); }
.ic-green { background: var(--success-light); color: var(--success); }
.ic-orange { background: var(--warning-light); color: var(--warning); }
.ic-red { background: var(--danger-light); color: var(--danger); }
.ic-purple { background: var(--purple-light); color: var(--purple); }
.ic-cyan { background: var(--info-light); color: var(--info); }
.stat-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.stat-val { font-size: 23px; font-weight: 800; color: var(--text-primary); line-height: 1.1; letter-spacing: -.5px; }
.stat-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.stat-up { color: var(--success); }
.stat-down { color: var(--danger); }

/* ── TABLES ── */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td {
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #fafbfc; }

/* ── TABLE PAGINATION ── */
.tbl-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 0 0 var(--r-md) var(--r-md);
}
.tbl-pagination .pg-info { font-size: 12.5px; color: var(--text-muted); }
.tbl-pagination .pg-controls { display: flex; align-items: center; gap: 6px; }
.tbl-pagination .pg-btn {
  padding: 4px 12px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.6;
}
.tbl-pagination .pg-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--primary); border-color: var(--primary); }
.tbl-pagination .pg-btn:disabled { opacity: .4; cursor: default; }
.tbl-pagination .pg-num { font-size: 12.5px; color: var(--text-secondary); min-width: 80px; text-align: center; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.b-success { background: var(--success-light); color: var(--success); }
.b-warning { background: var(--warning-light); color: var(--warning); }
.b-danger { background: var(--danger-light); color: var(--danger); }
.b-info { background: var(--info-light); color: var(--info); }
.b-primary { background: var(--primary-light); color: var(--primary); }
.b-muted { background: #f1f5f9; color: var(--text-muted); }
.b-purple { background: var(--purple-light); color: var(--purple); }
.b-teal   { background: var(--teal-light);  color: var(--teal); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8.5px 16px;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 13.5px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.3;
}
.btn svg { width: 15px; height: 15px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-xs { padding: 4px 9px; font-size: 12px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: white; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid transparent;
  padding: 6px 8px;
  border-radius: var(--r-sm);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border); }
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: white; color: var(--text-muted);
  transition: all .15s;
  cursor: pointer;
}
.btn-icon:hover { color: var(--primary); border-color: var(--primary-light); background: var(--primary-subtle); }
.btn-icon.del:hover { color: var(--danger); border-color: var(--danger-light); background: var(--danger-light); }

/* ── FORMS ── */
.form-group { margin-bottom: 15px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
.form-control {
  width: 100%;
  padding: 8.5px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text-primary);
  background: white;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-control::placeholder { color: var(--text-faint); }
select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
textarea.form-control { resize: vertical; min-height: 78px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* ── MODALS ── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
  backdrop-filter: blur(3px);
}
.overlay.show { opacity: 1; pointer-events: all; }
.modal {
  background: white;
  border-radius: var(--r-xl);
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(14px) scale(.99);
  transition: transform .2s;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.overlay.show .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 700px; }
.modal-head {
  padding: 20px 24px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; background: white; z-index: 1;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 7px; border: none;
  background: var(--bg-hover); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
}
.modal-close:hover { background: var(--border); color: var(--text-primary); }
.modal-body { padding: 20px 24px; }
.modal-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ── ALERTS ── */
.alert {
  padding: 11px 15px;
  border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 500;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.alert-success { background: var(--success-light); color: var(--success); }
.alert-danger { background: var(--danger-light); color: var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning); }

/* ── SEARCH ── */
.search-wrap { position: relative; }
.search-wrap input { padding-left: 36px; }
.search-icon {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint); pointer-events: none;
}

/* ── TOOLBAR (filter row) ── */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar .search-wrap input { width: 240px; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; }

/* ── CHARTS ── */
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 20px; }
.chart-area { position: relative; height: 230px; }

/* ── EMPTY STATE ── */
.empty { text-align: center; padding: 52px 24px; }
.empty svg { width: 48px; height: 48px; color: var(--text-faint); margin-bottom: 12px; }
.empty h3 { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
.empty p { font-size: 13px; color: var(--text-muted); }

/* ── PRODUCT ITEM ROW in order form ── */
.order-item-row { display: grid; grid-template-columns: 1fr 90px 110px 30px; gap: 8px; align-items: end; margin-bottom: 8px; }
.order-items-list { margin-bottom: 10px; }

/* ── LOGIN ── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(145deg, #f0f4ff 0%, #fefefe 55%, #f0fff7 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-box {
  background: white;
  border-radius: var(--r-xl);
  padding: 42px 40px;
  width: 100%; max-width: 400px;
  box-shadow: 0 8px 48px rgba(0,0,0,.09), 0 0 0 1px rgba(0,0,0,.04);
}
.login-brand { text-align: center; margin-bottom: 30px; }
.login-icon {
  width: 58px; height: 58px;
  background: linear-gradient(135deg,#2563eb,#1d4ed8);
  border-radius: 17px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  color: white; font-size: 24px; font-weight: 900;
  box-shadow: 0 4px 16px rgba(37,99,235,.4);
}
.login-title { font-size: 22px; font-weight: 800; color: var(--text-primary); letter-spacing: -.4px; }
.login-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-form h2 { font-size: 17px; font-weight: 700; margin-bottom: 5px; }
.login-form .tagline { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.login-demo { margin-top: 20px; padding: 12px 14px; background: #f8fafc; border-radius: var(--r-md); border: 1px solid var(--border); }
.login-demo p { font-size: 12px; color: var(--text-muted); }
.login-demo code { font-size: 12px; color: var(--primary); font-weight: 600; }

/* ── UTILS ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 4px; }
.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-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11.5px; }
.text-muted { color: var(--text-muted); }
.text-primary-c { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.fw-700 { font-weight: 700; }
.fw-600 { font-weight: 600; }
.fw-500 { font-weight: 500; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
.mono { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12.5px; }

/* ── TABS ── */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border-light); margin-bottom: 18px; }
.tab {
  padding: 8px 16px;
  font-size: 13.5px; font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ── RESPONSIVE ── */
@media (max-width: 1200px) { .stats-grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 1024px) { .stats-grid { grid-template-columns: repeat(2,1fr); } .charts-grid { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page { padding: 16px; }
}
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr; } }


/* ── Select2 theme overrides ── */
.select2-container { font-family: var(--font); font-size: 14px; }
.select2-container--default .select2-selection--single {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: #fff;
  outline: none;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 36px;
  color: var(--text-primary);
  font-size: 14px;
  padding-left: 10px;
  padding-right: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--text-muted); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 34px; right: 6px; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.select2-container--default .select2-selection--single .select2-selection__clear { font-size: 18px; font-weight: 400; margin-right: 8px; color: var(--text-muted); }
.select2-container--default .select2-selection--single .select2-selection__clear:hover { color: var(--danger); }
.select2-dropdown {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  font-family: var(--font);
  font-size: 14px;
  z-index: 99999;
}
.select2-search--dropdown { padding: 8px; }
.select2-search--dropdown .select2-search__field {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
  width: 100%;
}
.select2-search--dropdown .select2-search__field:focus { border-color: var(--primary); }
.select2-results__options { max-height: 220px; overflow-y: auto; padding: 4px; }
.select2-results__option { font-size: 14px; padding: 7px 10px; border-radius: 4px; color: var(--text-primary); }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--primary-subtle); color: var(--primary); }
.select2-container--default .select2-results__option[aria-selected=true] { background: var(--primary); color: #fff; }
.select2-container--default .select2-results__option--highlighted[aria-selected=true] { background: var(--primary); color: #fff; }
