/* ===== CSS VARIABLES / THEME ===== */
:root {
  --primary: #334155;
  --primary-hover: #1e293b;
  --secondary: #7c2d2d;
  --accent: #e87260;
  --accent-hover: #d45f4e;
  --accent-light: #f4a89a;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #0284c7;
  --info-bg: #e0f2fe;
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --transition: 0.2s ease;
  /* Bold SaaS shell — sidebar is intentionally dark in both themes (Stripe/Vercel-style),
     decoupled from --primary so it doesn't ripple into buttons/links elsewhere. */
  --sidebar-bg: #0b1120;
  --sidebar-bg-2: #131c31;
  --sidebar-accent: #6366f1;
  --sidebar-accent-light: #818cf8;
  --sidebar-accent-glow: rgba(99,102,241,0.35);
}
[data-theme="dark"] {
  --primary: #6d28d9;
  --primary-hover: #5b21b6;
  --secondary: #db2777;
  --accent: #dc2626;
  --accent-hover: #b91c1c;
  --accent-light: #ea580c;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #0f172a;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --success: #22c55e;
  --success-bg: #14532d;
  --warning: #f59e0b;
  --warning-bg: #451a03;
  --danger: #ef4444;
  --danger-bg: #450a0a;
  --info: #38bdf8;
  --info-bg: #0c4a6e;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14.5px; }
body { font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Inter', Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; letter-spacing: 0.01em; }
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; letter-spacing: 0.01em; }
input, select, textarea { font-family: inherit; font-size: inherit; line-height: 1.5; }
h1, h2, h3, h4 { line-height: 1.3; letter-spacing: -0.01em; }
p { line-height: 1.65; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== LOGIN PAGE ===== */
#login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}
.login-card {
  background: var(--surface); border-radius: 16px; padding: 48px 40px; width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo svg { width: 56px; height: 56px; }
.login-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); margin-top: 12px; }
.login-logo p { color: var(--text-muted); font-size: 0.875rem; }

/* ===== APP LAYOUT ===== */
#app { display: flex; height: 100vh; overflow: hidden; }
#app.hidden { display: none; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width); background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%); color: white;
  display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; overflow-x: hidden;
  transition: width var(--transition);
}
.sidebar-header {
  padding: 14px 16px; display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid rgba(255,255,255,0.08); flex-shrink: 0; background: #fff;
}
.sidebar-header img { display: block; }
.sidebar-nav { flex: 1; padding: 8px 0; }
.nav-section { padding: 8px 16px 4px; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.5; }

/* Module divider in sidebar */
.nav-module-divider {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px 4px; margin-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.nav-module-divider span {
  font-size: 0.62rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.1em; color: rgba(255,255,255,0.4);
  white-space: nowrap;
}
.nav-module-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.1);
}
.nav-item.nav-dimmed { opacity: 0.45; }
.nav-item.nav-dimmed::after { content: 'Soon'; margin-left: auto; font-size: 0.6rem; background: rgba(255,255,255,0.15); padding: 1px 5px; border-radius: 4px; font-weight: 700; }

/* ===== TICKETING TOOL — now a fully separate app at /ticketing (public/ticketing/index.html) ===== */
body.ticketing-mode [data-section]:not([data-section="helpdesk"]) { display: none !important; }

/* ===== MENU CUSTOMIZATION — collapsible sidebar groups ===== */
.nav-group-chevron { font-size: 0.65rem; opacity: 0.6; transition: transform var(--transition); margin-left: 2px; }
.nav-module-divider.is-collapsed .nav-group-chevron { transform: rotate(-90deg); }

/* ===== APP LAUNCHER ===== */
.launcher-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: calc(100vh - 130px); padding: 20px; }
.launcher-greeting { text-align: center; margin-bottom: 48px; }
.launcher-greeting h2 { font-size: 1.8rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.launcher-greeting p { font-size: 0.9rem; color: var(--text-muted); }
.app-module-grid { display: grid; grid-template-columns: repeat(3, 280px); gap: 20px; justify-content: center; }
@media (max-width: 960px) { .app-module-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .app-module-grid { grid-template-columns: 1fr; } }
.app-module-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 16px; padding: 32px 24px; text-align: center;
  cursor: pointer; transition: all 0.22s; box-shadow: var(--shadow);
}
.app-module-card:hover { transform: translateY(-6px); box-shadow: 0 16px 40px rgba(0,0,0,0.12); border-color: var(--accent); }
.app-module-card.amc-disabled { opacity: 0.55; cursor: not-allowed; }
.app-module-card.amc-disabled:hover { transform: none; box-shadow: var(--shadow); border-color: var(--border); }
.amc-icon { font-size: 3.2rem; margin-bottom: 16px; display: block; }
.amc-name { font-size: 1.1rem; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.amc-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.8; margin-bottom: 18px; }
.amc-stat { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; background: var(--surface2); border-radius: 999px; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.amc-stat.amc-live { color: var(--accent); }
.amc-stat.amc-soon { font-style: italic; }
.amc-ribbon { display: inline-block; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 4px; margin-bottom: 12px; background: var(--surface2); color: var(--text-muted); }
.amc-ribbon.amc-ribbon-live { background: #dcfce7; color: #15803d; }
.amc-ribbon.amc-ribbon-soon { background: #fef3c7; color: #92400e; }
.launcher-footer { margin-top: 40px; font-size: 0.72rem; color: var(--text-muted); text-align: center; }

/* Helpdesk / Phishing coming-soon page */
.coming-soon-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; text-align: center; }
.coming-soon-wrap .cs-icon { font-size: 4rem; margin-bottom: 16px; }
.coming-soon-wrap h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; }
.coming-soon-wrap p { color: var(--text-muted); max-width: 380px; margin-bottom: 20px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer;
  transition: background var(--transition); border-radius: 0; color: rgba(255,255,255,0.8);
  font-size: 0.875rem; position: relative;
}
.nav-item:hover { background: var(--sidebar-accent-glow); color: white; }
.nav-item.active { background: linear-gradient(90deg, var(--sidebar-accent-glow), transparent); color: white; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--sidebar-accent-light); border-radius: 0 2px 2px 0; box-shadow: 0 0 10px var(--sidebar-accent); }
.nav-item .icon { width: 18px; text-align: center; flex-shrink: 0; font-size: 1rem; }
.nav-badge { margin-left: auto; background: var(--sidebar-accent); color: white; border-radius: 10px; padding: 1px 7px; font-size: 0.65rem; font-weight: 700; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.user-info { display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--sidebar-accent), var(--sidebar-accent-light)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.875rem; flex-shrink: 0; }
.user-info .name { font-size: 0.8rem; font-weight: 600; }
.user-info .role { font-size: 0.7rem; opacity: 0.6; }

/* ===== MAIN CONTENT ===== */
.main-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  min-height: var(--header-height); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 10px 24px; gap: 16px; flex-shrink: 0;
  flex-wrap: wrap; row-gap: 8px;
  box-shadow: var(--shadow);
}
.topbar-title { font-size: 1.1rem; font-weight: 700; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.content-area { flex: 1; overflow-y: auto; padding: 24px; }

/* ===== CARDS ===== */
.card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 0.95rem; font-weight: 600; }
.card-body { padding: 20px; }

/* ===== STAT CARDS ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow);
  transition: transform var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-info .value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-info .label { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.pink { background: #fce7f3; color: #db2777; }

/* ===== BOLD GRADIENT STAT CARDS (Dashboard) ===== */
.dash-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 24px; }
.dash-stat-card {
  border-radius: 14px; padding: 16px 18px; color: #fff; position: relative; overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.16); transition: transform var(--transition), box-shadow var(--transition);
}
.dash-stat-card.is-clickable { cursor: pointer; }
.dash-stat-card.is-clickable:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(0,0,0,0.24); }
.dash-stat-card .dsc-glow { position: absolute; top: -14px; right: -10px; font-size: 3.2rem; opacity: 0.15; line-height: 1; }
.dash-stat-card .dsc-icon { font-size: 1.2rem; opacity: 0.9; }
.dash-stat-card .dsc-value { font-size: 1.9rem; font-weight: 800; line-height: 1; margin-top: 8px; }
.dash-stat-card .dsc-label { font-size: 0.76rem; opacity: 0.85; font-weight: 600; margin-top: 4px; }
.dash-stat-card.g-blue   { background: linear-gradient(135deg,#1e3a8a,#3b82f6); }
.dash-stat-card.g-green  { background: linear-gradient(135deg,#065f46,#10b981); }
.dash-stat-card.g-orange { background: linear-gradient(135deg,#78350f,#f59e0b); }
.dash-stat-card.g-red    { background: linear-gradient(135deg,#7f1d1d,#ef4444); }
.dash-stat-card.g-purple { background: linear-gradient(135deg,#4c1d95,#8b5cf6); }
.dash-stat-card.g-pink   { background: linear-gradient(135deg,#831843,#ec4899); }
.dash-stat-card.g-indigo { background: linear-gradient(135deg,#312e81,#6366f1); }
.dash-stat-card.is-compact { padding: 12px 14px; border-radius: 12px; }
.dash-stat-card.is-compact .dsc-icon { font-size: 1rem; }
.dash-stat-card.is-compact .dsc-value { font-size: 1.4rem; margin-top: 4px; }
.dash-stat-card.is-compact .dsc-label { font-size: 0.7rem; margin-top: 2px; }
.dash-stat-card.is-compact .dsc-glow { font-size: 2.2rem; top: -8px; right: -6px; }

/* ===== Dashboard v2 stat cards (flat, brand-colored, trend-aware) ===== */
.dash-stat-grid-v2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.dash-stat-card-v2 {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  position: relative; transition: transform var(--transition), box-shadow var(--transition);
}
.dash-stat-card-v2.is-clickable { cursor: pointer; }
.dash-stat-card-v2.is-clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.dash-stat-card-v2.is-solid { background: var(--primary); border-color: var(--primary); color: #fff; }
.dash-stat-card-v2 .dscv2-icon { font-size: 1.3rem; position: absolute; top: 12px; right: 14px; opacity: 0.35; }
.dash-stat-card-v2 .dscv2-label { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em; color: var(--text-muted); }
.dash-stat-card-v2.is-solid .dscv2-label { color: rgba(255,255,255,0.75); }
.dash-stat-card-v2 .dscv2-value { font-size: 1.7rem; font-weight: 700; margin-top: 4px; color: var(--text); }
.dash-stat-card-v2.is-solid .dscv2-value { color: #fff; }
.dash-stat-card-v2 .dscv2-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.dash-stat-card-v2.is-solid .dscv2-sub { color: rgba(255,255,255,0.7); }

/* ===== ASSETS PAGE — bold SaaS polish (scoped to this page only) ===== */
.assets-filters-bar { border-radius: 16px; box-shadow: var(--shadow-md); }
.assets-filters-bar .form-control:focus { border-color: var(--sidebar-accent); box-shadow: 0 0 0 3px var(--sidebar-accent-glow); }
#assets-table-wrap { border-radius: 16px; overflow: hidden; }
#assets-table tbody tr { transition: background var(--transition); }
#assets-table tbody tr:hover { background: linear-gradient(90deg, var(--sidebar-accent-glow) 0%, transparent 12%); }
#assets-table tbody tr.selected { background: rgba(99,102,241,0.1) !important; }
#assets-table td[data-col="asset_tag"] span { background: var(--sidebar-accent-glow); padding: 3px 9px; border-radius: 6px; }
#assets-table-wrap .page-btn.active { background: linear-gradient(135deg, var(--sidebar-accent), var(--sidebar-accent-light)); border-color: transparent; color: #fff; box-shadow: 0 2px 8px var(--sidebar-accent-glow); }

/* ===== TICKETS PAGE (Ticketing Tool) — bold SaaS polish (scoped to this page only) ===== */
.tickets-filters-bar { border-radius: 16px; box-shadow: var(--shadow-md); }
.tickets-filters-bar .form-control:focus { border-color: var(--sidebar-accent); box-shadow: 0 0 0 3px var(--sidebar-accent-glow); }
#tickets-table-wrap { border-radius: 16px; overflow: hidden; }
#tickets-table tbody tr { transition: background var(--transition); }
#tickets-table tbody tr:hover { background: linear-gradient(90deg, var(--sidebar-accent-glow) 0%, transparent 12%); }
#tickets-table td.tk-number span { background: var(--sidebar-accent-glow); padding: 3px 9px; border-radius: 6px; }

/* ===== ACCESS CARDS PAGE — bold SaaS polish (scoped to this page only) ===== */
.access-cards-filters-bar { border-radius: 16px; box-shadow: var(--shadow-md); }
.access-cards-filters-bar .form-control:focus { border-color: var(--sidebar-accent); box-shadow: 0 0 0 3px var(--sidebar-accent-glow); }
#ac-table tbody tr:hover { background: linear-gradient(90deg, var(--sidebar-accent-glow) 0%, transparent 12%); }
#ac-table td.ac-number span { background: var(--sidebar-accent-glow); padding: 3px 9px; border-radius: 6px; color: var(--text); }
#ac-pagination .page-btn.active { background: linear-gradient(135deg, var(--sidebar-accent), var(--sidebar-accent-light)); border-color: transparent; color: #fff; box-shadow: 0 2px 8px var(--sidebar-accent-glow); }

/* ===== EMPLOYEES PAGE — bold SaaS polish (scoped to this page only) ===== */
.employees-filters-bar { border-radius: 16px; box-shadow: var(--shadow-md); }
.employees-filters-bar .form-control:focus { border-color: var(--sidebar-accent); box-shadow: 0 0 0 3px var(--sidebar-accent-glow); }
#emp-table tbody tr:hover { background: linear-gradient(90deg, var(--sidebar-accent-glow) 0%, transparent 12%); }
#emp-table td.emp-id span { background: var(--sidebar-accent-glow); padding: 3px 9px; border-radius: 6px; color: var(--text); }

/* ===== FORMS ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.form-control {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; color: var(--text); font-size: 0.9rem; transition: border-color var(--transition);
  width: 100%; line-height: 1.5;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,114,96,0.15); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-section { margin-bottom: 24px; }
.form-section-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border: none; border-radius: 8px; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition); text-decoration: none; white-space: nowrap;
}
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 11px 22px; font-size: 1rem; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--primary); color: white; }
.btn-secondary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { opacity: 0.9; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface2); }
.btn-icon { padding: 7px; border-radius: 8px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead tr { background: var(--surface2); }
th { padding: 11px 14px; text-align: left; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; line-height: 1.5; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }
tr.selected { background: rgba(232,114,96,0.08) !important; }
th.check-col, td.check-col { width: 40px; text-align: center; }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; text-transform: capitalize; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-secondary { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-primary { background: rgba(99,102,241,0.15); color: #4f46e5; }
.badge-dark { background: rgba(51,65,85,0.15); color: #334155; }
.badge-it { background: var(--info-bg); color: var(--info); }
.badge-nonit { background: var(--warning-bg); color: var(--warning); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  pointer-events: none; visibility: hidden;
  transition: background-color var(--transition), visibility 0s linear var(--transition);
}
/* Backdrop dims via background-color (not opacity) so the modal's own content is never
   see-through mid-transition — with opacity, the whole subtree (including ticket-detail
   text) faded in together, letting it visibly overlap the page underneath for ~200ms. */
.modal-overlay.open {
  background: rgba(0,0,0,0.5); pointer-events: all; visibility: visible;
  transition: background-color var(--transition);
}
.modal {
  background: var(--surface); border-radius: 14px; width: 100%; max-width: 680px;
  max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  transform: scale(0.95); transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1100px; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-shrink: 0; }

/* ===== FILTERS BAR ===== */
.filters-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.filters-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.filter-group label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.filter-search { min-width: 240px; }
/* Button-only filter-groups (Filter/Clear) shouldn't stretch to the 160px column
   width or wrap onto an awkward standalone row — size to content and stay put. */
.filter-group.filter-actions { min-width: 0; flex: 0 0 auto; align-items: flex-start; }
.filter-group.filter-actions > div { display: flex; gap: 6px; }

/* ===== TOAST ===== */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
  font-size: 0.875rem; min-width: 280px; animation: slideIn 0.3s ease;
  border-left: 4px solid var(--info);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== LOADING ===== */
.loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--text-muted); font-size: 0.875rem; gap: 10px; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn { padding: 10px 18px; border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: 0.875rem; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all var(--transition); }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== ALERT ===== */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 0.875rem; display: flex; align-items: flex-start; gap: 10px; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(217,119,6,0.2); }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220,38,38,0.2); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(22,163,74,0.2); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(2,132,199,0.2); }

/* ===== DASHBOARD CHARTS ===== */
.chart-bars { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.chart-bar-item { display: flex; align-items: center; gap: 10px; }
.chart-bar-label { width: 130px; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.chart-bar-track { flex: 1; background: var(--border); border-radius: 4px; height: 8px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width 0.6s ease; }
.chart-bar-count { width: 30px; text-align: right; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); }

/* ===== DETAIL PAGE ===== */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.detail-field { margin-bottom: 12px; }
.detail-field .lbl { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.04em; }
.detail-field .val { font-size: 0.9rem; color: var(--text); margin-top: 2px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { width: 0; position: fixed; z-index: 100; height: 100vh; }
  .sidebar.open { width: var(--sidebar-width); }
  .form-grid.cols-3, .form-grid.cols-2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== EXTENSIONS CSS ===== */
/* Admin Config Tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.tab-btn { padding: 8px 18px; border: none; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface2); color: var(--text-muted); font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all var(--transition); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab-btn:hover { background: var(--border); color: var(--text); }
.tab-btn.active { background: var(--surface); color: var(--primary); border-bottom: 2px solid var(--primary); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Admin Config — grouped left nav (Assets / Locations & Access / Organization / Helpdesk) */
.admin-cfg-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.admin-cfg-nav { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; }
.cfg-nav-group { display: flex; flex-direction: column; gap: 2px; }
.cfg-nav-header { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 0 10px 6px; }
.cfg-nav-items { display: flex; flex-direction: column; gap: 2px; }
.admin-cfg-nav .tab-btn { text-align: left; width: 100%; border-radius: var(--radius); border-bottom: none; margin-bottom: 0; padding: 8px 10px; border-left: 2px solid transparent; }
.admin-cfg-nav .tab-btn:hover { background: var(--border); }
.admin-cfg-nav .tab-btn.active { background: var(--surface2); color: var(--primary); border-bottom: none; border-left: 2px solid var(--primary); }
.admin-cfg-content { min-width: 0; }
@media (max-width: 900px) {
  .admin-cfg-layout { grid-template-columns: 1fr; }
  .admin-cfg-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 10px; }
}

/* Supplier inner tabs */
#sup-tabs { margin-bottom: 16px; border-bottom: 2px solid var(--border); }
#sup-basic, #sup-certs { display: none; }
#sup-basic.active, #sup-certs.active { display: block; }

/* Form sections */
.form-section { margin-bottom: 20px; }
.form-section-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary); margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

/* Info chip */
.info-chip { display: inline-block; padding: 2px 10px; background: var(--info-bg); color: var(--info); border-radius: 100px; font-size: 0.8rem; }

/* Badge variants for category type */
.badge-it { background: var(--info-bg); color: var(--info); padding: 3px 10px; border-radius: 100px; font-size: 0.75rem; font-weight: 600; }
.badge-nonit { background: var(--warning-bg); color: var(--warning); padding: 3px 10px; border-radius: 100px; font-size: 0.75rem; font-weight: 600; }

/* Admin-only nav items hidden for non-admins */
.admin-only { display: none; }
.admin-only.visible { display: flex; }

/* Hardware specs section highlight */
#hw-specs-section .form-section { background: color-mix(in srgb, var(--info-bg) 40%, transparent); border: 1px solid color-mix(in srgb, var(--info) 25%, transparent); border-radius: var(--radius); padding: 16px; }

/* btn-danger */
.btn-danger { background: var(--danger); color: #fff; border: none; }
.btn-danger:hover { background: #b91c1c; }

/* Warranty color helpers */
.warranty-ok { color: var(--success); }
.warranty-warn { color: var(--warning); }
.warranty-expired { color: var(--danger); font-weight: 600; }

/* ===== MISC ===== */
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; } .align-center { align-items: center; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; } .flex-wrap { flex-wrap: wrap; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 1.3rem; font-weight: 700; }
.bulk-actions { display: none; background: var(--primary); color: white; padding: 10px 16px; border-radius: 8px; align-items: center; gap: 10px; font-size: 0.875rem; }
.bulk-actions.show { display: flex; }
.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 16px; }
.page-btn { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 0.8rem; }
.page-btn:hover { background: var(--surface2); }
.page-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.info-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; font-size: 0.8rem; color: var(--text-muted); }
