/* ==========================================================================
   Atmos ERP — Design System (Figma-grade polish)
   Matching: Aether ERP Figma references — glassmorphism, bento grids,
   dense metrics, accent cards, timeline feeds, entity tables.
   ========================================================================== */

/* --- CSS Variables --- */
:root {
  --font-primary: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Company (overridden per tenant in base.html) */
  --company-primary: #0284c7;
  --company-primary-dark: #0369a1;
  --company-primary-light: #e0f2fe;
  --company-secondary: #0F172A;

  /* Sky palette (matches Figma sky-600 primary) */
  --sky-50: #f0f9ff;
  --sky-100: #e0f2fe;
  --sky-200: #bae6fd;
  --sky-300: #7dd3fc;
  --sky-400: #38bdf8;
  --sky-500: #0ea5e9;
  --sky-600: #0284c7;
  --sky-700: #0369a1;
  --sky-800: #075985;
  --sky-900: #0c4a6e;

  /* Text */
  --text-primary: #0F172A;
  --text-body: #334155;
  --text-muted: #64748B;
  --text-faint: #94A3B8;

  /* Slate */
  --slate-50: #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-300: #CBD5E1;
  --slate-400: #94A3B8;
  --slate-500: #64748B;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-900: #0F172A;

  /* Semantic */
  --success: #10B981;
  --success-bg: #ECFDF5;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --info: #0284c7;
  --info-bg: #e0f2fe;
  --teal: #0D9488;
  --teal-bg: #F0FDFA;
  --violet: #7073ff;
  --violet-bg: #e1e0ff;

  /* Surfaces */
  --bg-page: #f7f9fb;
  --bg-card: rgba(255, 255, 255, 0.80);
  --bg-card-solid: #FFFFFF;
  --bg-sidebar: rgba(248, 250, 252, 0.90);
  --bg-navbar: rgba(255, 255, 255, 0.80);
  --bg-input: #f2f4f6;

  /* Borders */
  --border-default: #E2E8F0;
  --border-glass: rgba(255, 255, 255, 0.40);
  --border-subtle: rgba(226, 232, 240, 0.15);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-pill: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-glass: 0 4px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-primary: 0 4px 14px -3px rgba(2, 132, 199, 0.25);

  /* Layout */
  --sidebar-width: 256px;
  --navbar-height: 64px;
  --content-padding: 40px;
  --card-gap: 24px;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-weight: 400;
  color: var(--text-body);
  background: var(--bg-page);
  line-height: 1.5;
}

::selection {
  background: var(--sky-200);
  color: var(--sky-900);
}

a { color: var(--company-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Typography (matches Figma Manrope scale) --- */
h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  line-height: 1.1;
}
h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
h3 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: var(--sp-4);
}
h4 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* Figma label style: 10px uppercase bold tracking-widest */
.caption, .label, .metric-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* --- Layout --- */
.app-layout {
  display: flex;
  height: calc(100vh - var(--navbar-height));
  margin-top: var(--navbar-height);
  overflow: hidden;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--content-padding);
  min-width: 0;
  max-width: 1400px;
  overflow-y: auto;
}

.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  background: linear-gradient(145deg, #f0f4ff 0%, var(--bg-page) 50%, #f0fdf4 100%);
}

/* --- Top Navbar (Figma: bg-white/80 backdrop-blur-xl) --- */
.top-navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  background: var(--bg-navbar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: none;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-10);
  z-index: 100;
}

.navbar-left { display: flex; align-items: center; gap: var(--sp-8); }
.navbar-logo { height: 28px; }

.navbar-links { display: flex; align-items: center; gap: var(--sp-1); }
.navbar-links a {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: all 0.15s ease;
}
.navbar-links a:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.5);
  text-decoration: none;
}
.navbar-links a.active {
  color: var(--sky-700);
  background: rgba(255,255,255,0.6);
  font-weight: 600;
}

/* --- Module Icon Strip (top bar icon-only module switcher) --- */
.module-icon-strip {
  display: flex;
  align-items: center;
  gap: 2px;
}
.module-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
  position: relative;
}
.module-icon-btn:hover {
  color: var(--text-primary);
  background: rgba(241, 245, 249, 0.6);
  text-decoration: none;
}
.module-icon-btn.active {
  color: var(--company-primary);
  background: var(--sky-100);
}
.module-icon-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}
/* Tooltip on hover */
.module-icon-btn::after {
  content: attr(title);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--slate-800);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 200;
}
.module-icon-btn:hover::after {
  opacity: 1;
}

.navbar-right { display: flex; align-items: center; gap: var(--sp-4); }

.search-pill {
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--bg-input);
  border: none;
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  color: var(--text-faint);
  font-size: 13px;
  cursor: pointer;
  min-width: 240px;
  transition: all 0.2s ease;
}
.search-pill:hover { background: white; box-shadow: 0 0 0 2px rgba(2,132,199,0.1); }
.search-pill svg { width: 16px; height: 16px; }

.navbar-divider {
  width: 1px;
  height: 32px;
  background: var(--slate-200);
  opacity: 0.5;
}

.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 10px;
  border-radius: var(--radius-pill);
  position: relative;
  transition: all 0.15s ease;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: rgba(241,245,249,0.5); color: var(--text-primary); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .notification-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid white;
}

.user-avatar-btn {
  display: flex; align-items: center; gap: var(--sp-3);
  text-decoration: none;
  padding: 4px 6px 4px 12px;
  border-radius: var(--radius-pill);
  transition: all 0.15s ease;
}
.user-avatar-btn:hover { background: rgba(241,245,249,0.5); text-decoration: none; }
.user-avatar-btn .user-name {
  font-size: 12px; font-weight: 700; color: var(--text-primary); line-height: 1;
}
.user-avatar-btn .user-role {
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; font-weight: 600; letter-spacing: 0.02em;
}
.user-avatar-btn .user-info { text-align: right; line-height: 1.4; }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--company-primary), var(--company-primary-dark));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  overflow: hidden; text-decoration: none;
  flex-shrink: 0;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* --- Sidebar (Figma: bg-slate-50/90 backdrop-blur-lg) --- */
.sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--navbar-height));
  background: var(--bg-sidebar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 90;
  padding: var(--sp-4);
}

.sidebar-header {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-2);
  margin-bottom: var(--sp-8);
}

.company-avatar {
  width: 40px; height: 40px;
  border-radius: var(--radius-xl);
  background: var(--company-primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.2);
}
.company-avatar img { width: 100%; height: 100%; object-fit: cover; }

.company-info { overflow: hidden; }
.company-name {
  display: block; font-weight: 800; font-size: 15px;
  color: var(--text-primary); line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.company-type {
  display: block; font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600;
  margin-top: 3px;
}

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: var(--sp-2) var(--sp-4);
  margin-bottom: var(--sp-1);
}

.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px var(--sp-4);
  color: var(--text-muted);
  font-size: 14px; font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-xl);
  transition: all 0.15s ease;
}
.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.4);
  text-decoration: none;
}
.nav-item.active {
  color: var(--sky-700);
  background: rgba(255, 255, 255, 0.6);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.8; }
.nav-item.sub { padding-left: 40px; font-size: 12px; }

.sidebar-footer { margin-top: auto; padding-top: var(--sp-2); }
.sidebar-divider {
  height: 1px;
  background: rgba(226, 232, 240, 0.2);
  margin: var(--sp-2) var(--sp-3);
}

.sidebar-cta {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  margin: var(--sp-3) 0;
  padding: var(--sp-3);
  background: var(--company-primary);
  color: white;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-primary);
}
.sidebar-cta:hover { opacity: 0.9; text-decoration: none; transform: translateY(-1px); }
.sidebar-cta svg { width: 18px; height: 18px; }

/* --- Glass Card (Figma: rgba(255,255,255,0.8) backdrop-blur border-white/40) --- */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-6);
  transition: all 0.2s ease;
}
.glass-card:hover { box-shadow: var(--shadow-md); }

/* --- Accent Card (dark/gradient hero cards) --- */
.accent-card {
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  color: white;
  position: relative;
  overflow: hidden;
}
.accent-card.accent-primary {
  background: linear-gradient(135deg, var(--company-primary), var(--company-primary-dark));
}
.accent-card.accent-dark {
  background: linear-gradient(135deg, var(--slate-800), var(--slate-900));
}
.accent-card.accent-teal {
  background: linear-gradient(135deg, #0D9488, #0F766E);
}
.accent-card.accent-success {
  background: linear-gradient(135deg, var(--success), #059669);
}
.accent-card .accent-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  opacity: 0.85; margin-bottom: var(--sp-3);
}
.accent-card .accent-value {
  font-size: 2.5rem; font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.1;
  margin-bottom: var(--sp-2);
}
.accent-card .accent-sub {
  font-size: 13px; opacity: 0.8; font-weight: 500;
}
.accent-card .accent-bg-icon {
  position: absolute; right: -10px; bottom: -10px;
  opacity: 0.05; font-size: 180px;
}
.accent-card .accent-progress {
  margin-top: var(--sp-4);
  height: 8px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.accent-card .accent-progress-bar {
  height: 100%;
  background: rgba(255,255,255,0.85);
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
}
.accent-card .accent-meta {
  display: flex; justify-content: space-between;
  margin-top: var(--sp-2);
  font-size: 12px; opacity: 0.7;
}

/* --- Metric Card (Figma style) --- */
.metric-card {
  display: flex; flex-direction: column;
  padding: var(--sp-6);
}
.metric-card .metric-label {
  display: block; margin-bottom: var(--sp-3);
}
.metric-card .metric-value {
  font-size: 2.5rem; font-weight: 800;
  letter-spacing: -0.03em; color: var(--text-primary);
  line-height: 1.1;
}
.metric-card .metric-sub {
  font-size: 12px; color: var(--text-muted); margin-top: var(--sp-2);
}
.metric-card .metric-trend {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: 12px; font-weight: 700;
  margin-top: var(--sp-2);
}
.metric-card .metric-trend.up { color: var(--success); }
.metric-card .metric-trend.down { color: var(--danger); }
.metric-card .metric-trend svg { width: 14px; height: 14px; }

/* Icon container for metric cards */
.metric-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-3);
}
.metric-icon svg { width: 22px; height: 22px; }
.metric-icon.icon-blue { background: var(--info-bg); color: var(--info); }
.metric-icon.icon-green { background: var(--success-bg); color: var(--success); }
.metric-icon.icon-orange { background: var(--warning-bg); color: var(--warning); }
.metric-icon.icon-red { background: var(--danger-bg); color: var(--danger); }
.metric-icon.icon-teal { background: var(--teal-bg); color: var(--teal); }
.metric-icon.icon-violet { background: var(--violet-bg); color: var(--violet); }

/* Sub-metric boxes (Figma: p-4 bg-surface-container-low rounded-xl) */
.sub-metric {
  padding: var(--sp-4);
  background: var(--bg-input);
  border-radius: var(--radius-lg);
}
.sub-metric .sub-metric-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; color: var(--text-muted);
}
.sub-metric .sub-metric-value {
  font-size: 1.25rem; font-weight: 800;
  color: var(--text-primary); margin-top: 4px;
}

/* --- Progress Bar --- */
.progress-bar-wrap {
  height: 6px;
  background: var(--slate-100);
  border-radius: var(--radius-pill);
  overflow: hidden;
  width: 100%;
}
.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
}
.progress-bar-fill.fill-blue { background: var(--company-primary); }
.progress-bar-fill.fill-green { background: var(--success); }
.progress-bar-fill.fill-orange { background: var(--warning); }
.progress-bar-fill.fill-red { background: var(--danger); }
.progress-bar-fill.fill-teal { background: var(--teal); }
.progress-bar-fill.fill-violet { background: var(--violet); }

.progress-bar-sm { height: 4px; }
.progress-bar-lg { height: 10px; }

/* Inline progress with score (Figma supplier perf score) */
.progress-inline {
  display: flex; align-items: center; gap: 6px;
}
.progress-inline .progress-bar-wrap { width: 96px; }
.progress-inline .progress-score {
  font-size: 10px; font-weight: 700; color: var(--text-primary);
}

/* --- Donut / Ring indicator --- */
.ring-stat {
  display: flex; align-items: center; gap: var(--sp-4);
}
.ring-visual {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: var(--text-primary);
  position: relative;
}

/* --- Activity Feed (Figma timeline style) --- */
.activity-feed {
  display: flex; flex-direction: column; gap: 0;
  position: relative;
}

.activity-item {
  display: flex; gap: var(--sp-4);
  padding: var(--sp-4) 0;
  position: relative;
}
.activity-item + .activity-item { border-top: 1px solid var(--slate-100); }

.activity-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.activity-dot.dot-blue { background: var(--info); }
.activity-dot.dot-green { background: var(--success); }
.activity-dot.dot-red { background: var(--danger); }
.activity-dot.dot-orange { background: var(--warning); }
.activity-dot.dot-gray { background: var(--slate-300); }

/* Timeline variant (vertical line like Figma CRM) */
.timeline-feed { position: relative; }
.timeline-feed::before {
  content: '';
  position: absolute;
  left: 15px; top: 28px; bottom: 28px;
  width: 1px;
  background: var(--slate-200);
}
.timeline-item {
  display: flex; gap: var(--sp-4);
  padding: var(--sp-3) 0;
  position: relative;
  z-index: 1;
}
.timeline-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.timeline-icon svg { width: 14px; height: 14px; }
.timeline-icon.ti-blue { background: var(--sky-100); color: var(--sky-700); }
.timeline-icon.ti-green { background: var(--success-bg); color: var(--success); }
.timeline-icon.ti-violet { background: var(--violet-bg); color: var(--violet); }
.timeline-icon.ti-orange { background: var(--warning-bg); color: var(--warning); }

.activity-content { flex: 1; min-width: 0; }
.activity-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.activity-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.5; }
.activity-time {
  font-size: 10px; font-weight: 600; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-top: var(--sp-1);
}
.activity-time.time-danger { color: var(--danger); }
.activity-time.time-info { color: var(--info); }

/* --- Entity Row (Figma: icon + text in tables) --- */
.entity-cell { display: flex; align-items: center; gap: var(--sp-3); }
.entity-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 12px; font-weight: 700;
  background: var(--slate-100);
  color: var(--slate-600);
}
.entity-icon.ei-blue { background: var(--info-bg); color: var(--info); }
.entity-icon.ei-green { background: var(--success-bg); color: var(--success); }
.entity-icon.ei-orange { background: var(--warning-bg); color: var(--warning); }
.entity-icon.ei-red { background: var(--danger-bg); color: var(--danger); }
.entity-icon.ei-teal { background: var(--teal-bg); color: var(--teal); }
.entity-icon.ei-slate { background: var(--slate-100); color: var(--slate-600); }

.entity-text strong { display: block; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.entity-text span { font-size: 12px; color: var(--text-muted); }

/* Colored amounts */
.amount-positive { color: var(--success); font-weight: 700; }
.amount-negative { color: var(--danger); font-weight: 700; }
.amount-neutral { color: var(--text-primary); font-weight: 700; }

/* --- Bento Grid (Figma 12-col equivalent) --- */
.bento-grid { display: grid; gap: var(--card-gap); }
.bento-grid.two-col { grid-template-columns: 1fr 1fr; }
.bento-grid.three-col { grid-template-columns: repeat(3, 1fr); }
.bento-grid.four-col { grid-template-columns: repeat(4, 1fr); }
.bento-grid.two-third-one-third { grid-template-columns: 2fr 1fr; }
.bento-grid.one-third-two-third { grid-template-columns: 1fr 2fr; }
.bento-section { margin-top: var(--sp-8); }

/* --- Page Header (Figma: caption + large title + action buttons) --- */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--sp-8);
}
.page-header .caption { margin-bottom: var(--sp-1); display: block; }
.page-header h1 { line-height: 1; }
.page-actions { display: flex; gap: var(--sp-3); align-items: center; }

/* --- Buttons (Figma: rounded-full pills with shadow) --- */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  border: none; border-radius: var(--radius-pill);
  padding: 10px 24px;
  font-family: var(--font-primary);
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--company-primary);
  color: white;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-secondary {
  background: white;
  color: var(--text-body);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover { background: var(--slate-50); border-color: var(--slate-300); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
}
.btn-ghost:hover { background: rgba(241,245,249,0.5); color: var(--text-primary); }

.btn-danger { background: var(--danger); color: white; box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25); }
.btn-danger:hover { opacity: 0.9; }

.btn-outline-primary {
  background: transparent;
  color: var(--company-primary);
  border: 1px solid rgba(2, 132, 199, 0.2);
}
.btn-outline-primary:hover { background: var(--sky-50); }

.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 14px; }

/* --- Badges (Figma: px-2 py-1 text-[10px] font-bold rounded-md border) --- */
.badge {
  display: inline-flex; align-items: center;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 10px; font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.15); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.15); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.15); }
.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(2,132,199,0.15); }
.badge-neutral { background: var(--slate-100); color: var(--slate-600); border: 1px solid rgba(226,232,240,0.5); }
.badge-teal { background: var(--teal-bg); color: var(--teal); border: 1px solid rgba(13,148,136,0.15); }

/* Pill-shaped badge variant */
.badge-pill { border-radius: var(--radius-pill); padding: 3px 10px; }

/* Badge with dot */
.badge-dot { display: inline-flex; align-items: center; gap: 6px; }
.badge-dot::before {
  content: ''; width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* --- Data Table (Figma style: 10px uppercase headers) --- */
.table-container { overflow-x: auto; }

.table-header-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table thead th {
  text-align: left;
  padding: var(--sp-4) var(--sp-3);
  font-size: 10px; font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--slate-200);
}
.data-table tbody td {
  padding: var(--sp-4) var(--sp-3);
  font-size: 14px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}
.data-table tbody tr { transition: all 0.1s ease; }
.data-table tbody tr:hover { background: rgba(248, 250, 252, 0.5); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Table footer / Pagination */
.table-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: var(--sp-4);
  font-size: 13px; color: var(--text-muted);
}
.pagination { display: flex; gap: var(--sp-1); }
.pagination a, .pagination span {
  min-width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
}
.pagination a { color: var(--text-body); }
.pagination a:hover { background: var(--slate-100); text-decoration: none; }
.pagination a.current, .pagination .btn-primary { background: var(--company-primary); color: white; }
.pagination-ellipsis { padding: 6px 8px; color: var(--text-muted); }

/* --- Forms --- */
.form-group { margin-bottom: var(--sp-5); }
.form-group label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-body);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.15s ease;
}
.form-input:focus {
  outline: none;
  border-color: var(--company-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}
.form-input-sm { padding: 6px 10px; font-size: 13px; width: auto; }

select.form-input { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.form-error {
  display: block; margin-top: var(--sp-1);
  font-size: 12px; color: var(--danger); font-weight: 500;
}

.form-row { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.form-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-6); }
.form-divider { height: 1px; background: var(--slate-200); margin: var(--sp-6) 0; }

.checkbox-label {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 14px; cursor: pointer;
}
.checkbox { width: 16px; height: 16px; accent-color: var(--company-primary); }

.colour-input { max-width: 120px; }
.colour-input input[type="color"] {
  height: 40px; padding: 4px; cursor: pointer; border-radius: var(--radius-md);
}

/* --- Flash Messages --- */
.flash-container {
  position: fixed; top: calc(var(--navbar-height) + var(--sp-4));
  right: var(--sp-6); z-index: 200;
  display: flex; flex-direction: column; gap: var(--sp-2);
  max-width: 400px;
}

.flash {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-lg);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-xl);
  animation: slideIn 0.25s ease;
  backdrop-filter: blur(8px);
}
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.flash-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.flash-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.flash-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(2,132,199,0.2); }

.flash-close {
  background: none; border: none; font-size: 18px;
  cursor: pointer; margin-left: var(--sp-3);
  opacity: 0.7; color: inherit;
}
.flash-close:hover { opacity: 1; }

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- Auth Card --- */
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card-solid);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  padding: var(--sp-10);
  border: 1px solid var(--border-glass);
}
.auth-header { text-align: center; margin-bottom: var(--sp-8); }
.auth-header h1 { margin-bottom: var(--sp-2); font-size: 28px; }
.auth-header p { color: var(--text-muted); font-size: 14px; }
.auth-form { margin-bottom: var(--sp-4); }

.auth-divider {
  display: flex; align-items: center; gap: var(--sp-4);
  margin: var(--sp-5) 0;
  color: var(--text-faint); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--slate-200);
}

/* --- Settings Cards --- */
.settings-card {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: var(--sp-2);
  text-decoration: none;
  transition: all 0.2s ease;
}
.settings-card:hover {
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}
.settings-card .settings-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-2);
}
.settings-card .settings-icon svg { width: 22px; height: 22px; }
.settings-card .settings-icon.si-blue { background: var(--info-bg); color: var(--info); }
.settings-card .settings-icon.si-green { background: var(--success-bg); color: var(--success); }
.settings-card .settings-icon.si-orange { background: var(--warning-bg); color: var(--warning); }
.settings-card .settings-icon.si-teal { background: var(--teal-bg); color: var(--teal); }
.settings-card .settings-icon.si-red { background: var(--danger-bg); color: var(--danger); }
.settings-card .settings-icon.si-slate { background: var(--slate-100); color: var(--slate-600); }

.settings-card h3 { margin-bottom: 0; font-size: 16px; }
.settings-card p { font-size: 12px; color: var(--text-muted); margin: 0; line-height: 1.5; }

/* --- Module Toggle --- */
.module-toggle {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) 0;
  cursor: pointer;
  border-bottom: 1px solid var(--slate-100);
}
.module-toggle:last-of-type { border-bottom: none; }
.module-toggle input[type="checkbox"] { display: none; }

.toggle-slider {
  width: 44px; height: 24px;
  background: var(--slate-300);
  border-radius: var(--radius-pill);
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.toggle-slider::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.module-toggle input:checked + .toggle-slider { background: var(--company-primary); }
.module-toggle input:checked + .toggle-slider::after { transform: translateX(20px); }

.toggle-label { font-size: 14px; font-weight: 500; color: var(--text-primary); }

/* --- Org Tree --- */
.org-tree { display: flex; flex-direction: column; gap: var(--sp-3); }

.org-node-header {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--slate-50);
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-100);
}

.org-children {
  margin-left: var(--sp-8);
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding-top: var(--sp-2);
}
.org-level-2 {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-left: 2px solid var(--slate-200);
}

/* --- Permission Matrix --- */
.permission-matrix { display: flex; flex-direction: column; gap: var(--sp-5); }
.perm-module h4 { margin-bottom: var(--sp-2); }
.perm-actions { display: flex; flex-wrap: wrap; gap: var(--sp-4); }

/* --- Filter Bar --- */
.filter-bar { display: flex; gap: var(--sp-3); align-items: center; }

/* --- User cell --- */
.user-cell { display: flex; align-items: center; gap: var(--sp-3); }
.avatar-sm {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--company-primary), var(--company-primary-dark));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}

/* --- Module Tags --- */
.module-tags { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* --- Quick Actions --- */
.quick-actions { display: flex; flex-direction: column; gap: var(--sp-2); }
.quick-actions .btn {
  justify-content: flex-start;
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: var(--sp-4); opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* --- Stat Row (inline stats) --- */
.stat-row {
  display: flex; gap: var(--sp-6);
  padding: var(--sp-4) 0;
}
.stat-item { text-align: center; }
.stat-item .stat-value { font-size: 24px; font-weight: 800; color: var(--text-primary); }
.stat-item .stat-label {
  font-size: 10px; font-weight: 700; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.1em;
}

/* --- Card section heading --- */
.card-section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-5);
}
.card-section-title h3 { margin-bottom: 0; }
.card-section-title a { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

/* --- Mini chart (CSS bars like Figma) --- */
.mini-chart { display: flex; align-items: flex-end; gap: 4px; height: 56px; }
.mini-bar {
  flex: 1;
  background: var(--company-primary);
  border-radius: 4px 4px 0 0;
  opacity: 0.15;
  transition: all 0.15s ease;
}
.mini-bar.active { opacity: 1; box-shadow: 0 0 12px rgba(2, 132, 199, 0.15); }
.mini-bar:hover { opacity: 0.6; }

/* --- Card Footer Button (Figma: full-width bottom border-top link) --- */
.card-footer-btn {
  display: block;
  width: calc(100% + var(--sp-6) * 2);
  margin: var(--sp-5) calc(var(--sp-6) * -1) calc(var(--sp-6) * -1);
  padding: var(--sp-4);
  text-align: center;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--company-primary);
  border-top: 1px solid var(--slate-100);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  transition: background 0.15s ease;
  text-decoration: none;
}
.card-footer-btn:hover { background: rgba(248,250,252,0.5); text-decoration: none; }

/* --- Segmented Control (Figma tab toggle) --- */
.segmented-control {
  display: flex;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-lg);
  gap: 2px;
}
.segmented-control button,
.segmented-control a {
  padding: 6px 16px;
  font-size: 11px; font-weight: 700;
  color: var(--text-faint);
  border: none; background: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.segmented-control .active {
  background: white;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* --- FAB (Floating Action Button) --- */
.fab {
  position: fixed;
  bottom: var(--sp-8); right: var(--sp-8);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--company-primary);
  color: white;
  border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.4);
  cursor: pointer;
  z-index: 50;
  transition: all 0.15s ease;
}
.fab:hover { transform: scale(1.1); }
.fab:active { transform: scale(0.95); }
.fab svg { width: 24px; height: 24px; }

/* --- Notification Dropdown --- */
.notif-trigger { position: relative; }

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  overflow: hidden;
  display: none;
}
.notif-trigger.open .notif-dropdown,
.notif-trigger.open #notif-dropdown-content .notif-dropdown {
  display: block;
}

.notif-dropdown-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--slate-100);
}
.notif-dropdown-header h4 { margin: 0; font-size: 14px; }

.notif-dropdown-list {
  max-height: 400px;
  overflow-y: auto;
}

.notif-item, .notif-item-full {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  transition: background 0.1s ease;
  border-bottom: 1px solid var(--slate-50);
}
.notif-item:hover, .notif-item-full:hover { background: var(--slate-50); }
.notif-item.notif-unread, .notif-item-full.notif-unread {
  background: var(--sky-50);
}

.notif-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.notif-icon svg { width: 14px; height: 14px; }
.notif-icon.notif-icon-info { background: var(--info-bg); color: var(--info); }
.notif-icon.notif-icon-success { background: var(--success-bg); color: var(--success); }
.notif-icon.notif-icon-warning { background: var(--warning-bg); color: var(--warning); }
.notif-icon.notif-icon-danger { background: var(--danger-bg); color: var(--danger); }
.notif-icon.notif-icon-system { background: var(--slate-100); color: var(--slate-600); }

.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.notif-message { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.notif-time { font-size: 10px; color: var(--text-faint); margin-top: 4px; font-weight: 500; }

.notif-unread-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--company-primary);
  flex-shrink: 0;
  margin-top: 6px;
}

.notif-empty {
  padding: var(--sp-8);
  text-align: center;
  color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center;
}
.notif-empty p { font-size: 13px; margin: 0; }

.notif-dropdown-footer {
  display: block;
  padding: var(--sp-3);
  text-align: center;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--company-primary);
  border-top: 1px solid var(--slate-100);
  text-decoration: none;
  transition: background 0.1s ease;
}
.notif-dropdown-footer:hover { background: var(--slate-50); text-decoration: none; }

.notif-count-wrap {
  position: absolute; top: 0; right: 0;
  pointer-events: none;
}

.notification-count {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  background: var(--danger);
  color: white;
  border-radius: var(--radius-pill);
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
  padding: 0 3px;
}

/* Full page notification list */
.notif-list-full { display: flex; flex-direction: column; }
.notif-item-full { padding: var(--sp-4) var(--sp-5); }

/* --- Module Tabs (horizontal tab bar inside content area) --- */
.module-tabs {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--slate-200);
  margin-bottom: var(--sp-6);
  padding-bottom: 0;
}
.module-tabs a {
  padding: var(--sp-3) var(--sp-4);
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s ease;
}
.module-tabs a:hover {
  color: var(--text-primary);
  text-decoration: none;
}
.module-tabs a.active {
  color: var(--company-primary);
  border-bottom-color: var(--company-primary);
  font-weight: 700;
}

/* ==========================================================================
   Settings Pages — Figma-grade Bento Layout System
   Matches: Aether ERP Settings references (company, users, roles, prefs)
   ========================================================================== */

/* --- 12-Column Grid --- */
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--card-gap); }
/* Fallback: a .grid-12 child with no .col-span-* fills the whole row instead of
   collapsing into a single 1/12 track (the "squeezed, empty space on the right"
   bug). Same specificity as the .col-span-* classes below and defined first, so an
   explicit .col-span-* still wins. */
.grid-12 > * { grid-column: span 12; }
.col-span-12 { grid-column: span 12; }
.col-span-8 { grid-column: span 8; }
.col-span-6 { grid-column: span 6; }
.col-span-4 { grid-column: span 4; }
.col-span-3 { grid-column: span 3; }

/* --- Glass Panel (Figma: rgba(255,255,255,0.7) backdrop-blur ghost-border) --- */
.glass-panel {
  background: rgba(255, 255, 255, 0.70);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(198, 198, 205, 0.15);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.glass-panel:hover { box-shadow: var(--shadow-md); }

/* --- Section Header (icon + title + subtitle inside panels) --- */
.section-header {
  display: flex; align-items: center; gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.section-header .section-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.section-header .section-icon svg { width: 22px; height: 22px; }
.section-header .section-icon.si-blue { background: var(--info-bg); color: var(--info); }
.section-header .section-icon.si-green { background: var(--success-bg); color: var(--success); }
.section-header .section-icon.si-teal { background: var(--teal-bg); color: var(--teal); }
.section-header .section-icon.si-orange { background: var(--warning-bg); color: var(--warning); }
.section-header .section-icon.si-violet { background: var(--violet-bg); color: var(--violet); }
.section-header .section-icon.si-red { background: var(--danger-bg); color: var(--danger); }
.section-header .section-icon.si-slate { background: var(--slate-100); color: var(--slate-600); }
.section-header .section-title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 0; }
.section-header .section-subtitle { font-size: 12px; color: var(--text-muted); margin: 0; }
.section-header-right { margin-left: auto; }

/* --- Hero Banner (gradient teal/dark) --- */
.hero-banner {
  position: relative; overflow: hidden;
  border-radius: var(--radius-xl);
  padding: var(--sp-8);
  color: white;
}
.hero-banner.hero-teal { background: linear-gradient(135deg, #0D9488, #0F766E); }
.hero-banner.hero-dark { background: linear-gradient(135deg, var(--slate-800), var(--slate-900)); }
.hero-banner.hero-primary { background: linear-gradient(135deg, var(--company-primary), var(--company-primary-dark)); }
.hero-banner .hero-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.2em;
  opacity: 0.85; margin-bottom: var(--sp-2);
}
.hero-banner h2 { color: white; font-size: 1.75rem; margin-bottom: var(--sp-3); }
.hero-banner p { color: rgba(255,255,255,0.8); font-size: 14px; line-height: 1.6; max-width: 600px; }
.hero-banner .hero-bg-circle {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.08); filter: blur(40px);
}
.hero-banner .hero-bg-circle:first-of-type { width: 300px; height: 300px; right: -80px; top: -80px; }
.hero-banner .hero-bg-circle:last-of-type { width: 200px; height: 200px; right: 40px; bottom: -40px; background: rgba(255,255,255,0.04); }

/* --- Stat Card Compact (number + icon in glass panel) --- */
.stat-card-compact {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-6);
}
.stat-card-compact .stat-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted);
}
.stat-card-compact .stat-value {
  font-size: 1.75rem; font-weight: 800;
  color: var(--text-primary); margin-top: var(--sp-1);
}
.stat-card-compact .stat-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-card-compact .stat-icon svg { width: 20px; height: 20px; }
.stat-card-compact .stat-icon.si-teal { background: var(--teal-bg); color: var(--teal); }
.stat-card-compact .stat-icon.si-blue { background: var(--info-bg); color: var(--info); }
.stat-card-compact .stat-icon.si-violet { background: var(--violet-bg); color: var(--violet); }

/* --- Avatar Initials (circle with 2-letter initials) --- */
.avatar-initials {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.avatar-initials.ai-blue { background: var(--info-bg); color: var(--info); }
.avatar-initials.ai-teal { background: var(--teal-bg); color: var(--teal); }
.avatar-initials.ai-violet { background: var(--violet-bg); color: var(--violet); }
.avatar-initials.ai-orange { background: var(--warning-bg); color: var(--warning); }
.avatar-initials.ai-slate { background: var(--slate-100); color: var(--slate-500); }

/* --- Role Pill (colored pill for role names in tables) --- */
.role-pill {
  display: inline-flex; align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.role-pill.rp-admin { background: rgba(112, 115, 255, 0.1); color: var(--violet); }
.role-pill.rp-manager { background: var(--teal-bg); color: var(--teal); }
.role-pill.rp-supervisor { background: var(--warning-bg); color: #B45309; }
.role-pill.rp-staff { background: var(--slate-100); color: var(--slate-600); }

/* --- Status Indicator (dot + text) --- */
.status-indicator { display: flex; align-items: center; gap: 6px; }
.status-dot-sm {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot-sm.sd-active { background: var(--success); }
.status-dot-sm.sd-inactive { background: var(--slate-300); }
.status-dot-sm.sd-suspended { background: var(--warning); }

/* --- Settings Form (Figma: no-border inputs, bg-input) --- */
.settings-form-group { margin-bottom: var(--sp-6); }
.settings-form-group .settings-label {
  display: block;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px; margin-left: 2px;
}
.settings-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.15s ease;
}
.settings-input:focus {
  outline: none;
  background: white;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}
select.settings-input {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 40px;
}
/* Form Control — standard input/select styling for module forms */
.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  background: var(--bg-input);
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--company-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
  background: #fff;
}
select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
textarea.form-control {
  resize: vertical;
  min-height: 80px;
}
.form-control::placeholder {
  color: var(--slate-400);
}

.form-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.settings-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6); }
.settings-form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-6); }
.settings-form-full { grid-column: span 2; }

/* --- Data Table Enhanced (glass card wrapper, avatar rows) --- */
.table-glass {
  overflow: hidden;
}
.table-controls {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-5) var(--sp-6);
  background: rgba(255,255,255,0.4);
}
.table-controls .table-filters { display: flex; align-items: center; gap: var(--sp-3); }
.table-controls .table-count {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted);
}
.data-table-enhanced { width: 100%; border-collapse: collapse; }
.data-table-enhanced thead th {
  text-align: left;
  padding: var(--sp-4) var(--sp-6);
  font-size: 10px; font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(242, 244, 246, 0.5);
}
.data-table-enhanced thead th:last-child { text-align: right; }
.data-table-enhanced tbody td {
  padding: var(--sp-4) var(--sp-6);
  font-size: 14px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}
.data-table-enhanced tbody tr { transition: background 0.1s ease; }
.data-table-enhanced tbody tr:hover { background: rgba(255,255,255,0.6); }
.data-table-enhanced tbody tr:last-child td { border-bottom: none; }
.data-table-enhanced .actions-cell {
  text-align: right;
  display: flex; justify-content: flex-end; gap: var(--sp-1);
}
.data-table-enhanced .action-icon {
  padding: 8px;
  border-radius: var(--radius-md);
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex; align-items: center;
}
.data-table-enhanced .action-icon:hover { background: var(--slate-100); color: var(--text-primary); }
.data-table-enhanced .action-icon.ai-danger:hover { background: var(--danger-bg); color: var(--danger); }
.data-table-enhanced .action-icon svg { width: 18px; height: 18px; }

/* --- Table Pagination Enhanced --- */
.pagination-enhanced {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-top: 1px solid var(--slate-100);
}
.pagination-enhanced .page-btn {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  background: none; border: none; cursor: pointer;
  transition: color 0.15s ease;
}
.pagination-enhanced .page-btn:hover { color: var(--text-primary); }
.pagination-enhanced .page-btn:disabled { opacity: 0.3; cursor: default; }
.pagination-enhanced .page-btn svg { width: 18px; height: 18px; }
.pagination-enhanced .page-numbers { display: flex; gap: var(--sp-1); }
.pagination-enhanced .page-num {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.pagination-enhanced .page-num:hover { background: var(--slate-100); }
.pagination-enhanced .page-num.active {
  background: var(--teal); color: white; font-weight: 700;
}

/* --- Role Sidebar (permission page) --- */
.role-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.role-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4);
  background: rgba(255,255,255,0.4);
  border: 1px solid rgba(198, 198, 205, 0.15);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.15s ease;
}
.role-item:hover { background: var(--bg-input); }
.role-item.role-active {
  background: var(--bg-input);
  border-left: 4px solid var(--company-primary);
}
.role-item .role-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.role-item .role-desc { font-size: 12px; color: var(--text-muted); }

/* --- Permission Module Card --- */
.perm-card {
  padding: var(--sp-5);
  background: var(--bg-card-solid);
  border: 1px solid rgba(198, 198, 205, 0.15);
  border-radius: var(--radius-lg);
}
.perm-card-header {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.perm-card-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}
.perm-card-icon svg { width: 16px; height: 16px; }
.perm-card-icon.pci-blue { background: var(--info-bg); color: var(--info); }
.perm-card-icon.pci-teal { background: var(--teal-bg); color: var(--teal); }
.perm-card-icon.pci-violet { background: var(--violet-bg); color: var(--violet); }
.perm-card-icon.pci-orange { background: var(--warning-bg); color: var(--warning); }
.perm-card-icon.pci-red { background: var(--danger-bg); color: var(--danger); }
.perm-card-icon.pci-slate { background: var(--slate-100); color: var(--slate-600); }
.perm-card-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }

.perm-check-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
}
.perm-check-row + .perm-check-row { border-top: 1px solid var(--slate-50); }
.perm-check-label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.perm-check-row input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--teal);
  border-radius: 4px;
  cursor: pointer;
}

/* --- Settings Footer (status bar + action buttons) --- */
.settings-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  background: rgba(242, 244, 246, 0.3);
  border-top: 1px solid rgba(198, 198, 205, 0.15);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  margin-top: var(--sp-8);
}
.settings-footer .footer-status {
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: 12px; color: var(--text-muted);
}
.settings-footer .footer-actions { display: flex; gap: var(--sp-3); }

/* --- Compliance/List Items (icon + text + badge rows) --- */
.setting-list-item {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  padding: var(--sp-4);
  border-radius: var(--radius-xl);
  background: var(--bg-input);
  transition: background 0.15s ease;
}
.setting-list-item:hover { background: var(--slate-100); }
.setting-list-item + .setting-list-item { margin-top: var(--sp-3); }
.setting-list-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  color: var(--teal);
}
.setting-list-icon svg { width: 18px; height: 18px; }
.setting-list-content { flex: 1; min-width: 0; }
.setting-list-content h4 {
  font-size: 14px; font-weight: 700;
  color: var(--text-primary); margin: 0 0 4px;
}
.setting-list-content p { font-size: 12px; color: var(--text-muted); margin: 0; line-height: 1.5; }
.setting-list-right {
  display: flex; align-items: center;
  flex-shrink: 0;
}

/* --- Logo Upload (company profile) --- */
.logo-upload-area {
  width: 120px; height: 120px;
  border-radius: var(--radius-xl);
  background: var(--slate-100);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.logo-upload-area img { width: 100%; height: 100%; object-fit: cover; }
.logo-upload-area .upload-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  color: white;
  opacity: 0;
  transition: opacity 0.15s ease;
  cursor: pointer;
}
.logo-upload-area:hover .upload-overlay { opacity: 1; }

/* --- Field Validation Errors --- */
.field-error {
  display: block;
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  font-weight: 500;
}
.settings-input.is-invalid,
select.settings-input.is-invalid {
  border: 1.5px solid var(--danger) !important;
}

/* --- Settings Card Enhanced (index page) --- */
.settings-card-enhanced {
  padding: 28px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  min-height: 200px;
}
.settings-card-enhanced:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* --- Confirmation Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-panel {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(198, 198, 205, 0.15);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}
.modal-overlay.active .modal-panel {
  transform: scale(1);
}
.modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.modal-icon.danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.modal-icon.warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
}
.modal-body {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* --- Flash Toast Notifications --- */
.flash-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 420px;
}
.flash {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(198, 198, 205, 0.15);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  font-weight: 500;
  animation: slideInRight 0.3s ease;
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.flash-success {
  border-left: 3px solid var(--success);
}
.flash-success::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.flash-error {
  border-left: 3px solid var(--danger);
}
.flash-error::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
}
.flash-warning {
  border-left: 3px solid var(--warning);
}
.flash-warning::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
}
.flash-info {
  border-left: 3px solid var(--sky-500);
}
.flash-info::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--sky-500);
  flex-shrink: 0;
}
.flash-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: auto;
  padding: 0 4px;
  line-height: 1;
}
.flash-close:hover {
  color: var(--text-primary);
}

/* --- Animated Toggle Switch --- */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--slate-300);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.25s ease;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.25s ease;
}
.toggle-switch input:checked + .toggle-track {
  background: var(--accent-teal);
}
.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(20px);
}

/* --- Empty State --- */
.empty-state-card {
  text-align: center;
  padding: 48px 32px;
}
.empty-state-card .empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-muted);
}
.empty-state-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px;
}
.empty-state-card p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 360px;
  margin: 0 auto;
}

/* --- Org Tree Connector Lines --- */
.org-tree-node {
  position: relative;
  padding-left: 0;
}
.org-tree-children {
  position: relative;
  margin-top: 12px;
  padding-left: 48px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.org-tree-children::before {
  content: '';
  position: absolute;
  left: 24px;
  top: 0;
  bottom: 16px;
  width: 1.5px;
  background: linear-gradient(to bottom, var(--slate-300), var(--slate-200));
}
.org-tree-child {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.02);
  border-radius: 8px;
}
.org-tree-child::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 50%;
  width: 24px;
  height: 1.5px;
  background: var(--slate-300);
}

/* --- Activity Bars (login frequency indicator) --- */
.activity-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}
.activity-bar {
  width: 3px;
  border-radius: 1px;
  background: var(--slate-200);
  transition: background 0.2s ease;
}
.activity-bar:nth-child(1) { height: 6px; }
.activity-bar:nth-child(2) { height: 10px; }
.activity-bar:nth-child(3) { height: 14px; }
.activity-bar.active {
  background: var(--accent-teal);
}

/* --- Table Row Hover Actions --- */
.data-table-enhanced tbody tr .row-actions {
  opacity: 0;
  transition: opacity 0.15s ease;
}
.data-table-enhanced tbody tr:hover .row-actions {
  opacity: 1;
}
.data-table-enhanced tbody tr .row-actions-always {
  opacity: 0.4;
  transition: opacity 0.15s ease;
}
.data-table-enhanced tbody tr:hover .row-actions-always {
  opacity: 1;
}

/* --- Side Drawer --- */
.side-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.side-drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 90vw;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid rgba(198, 198, 205, 0.15);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  padding: 32px;
}
.side-drawer.active {
  transform: translateX(0);
}
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(198,198,205,0.15);
}
.drawer-header h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}
.drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 6px;
  transition: all 0.15s;
}
.drawer-close:hover {
  background: var(--slate-100);
  color: var(--text-primary);
}
.drawer-field {
  margin-bottom: 16px;
}
.drawer-field-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.drawer-field-value {
  font-size: 14px;
  color: var(--text-primary);
}
.drawer-json {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
  color: var(--text-body);
}

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--slate-100) 25%, var(--slate-200) 50%, var(--slate-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }
.skeleton-circle { border-radius: 50%; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Responsive additions --- */
@media (max-width: 768px) {
  .col-span-8 { grid-column: span 12; }
  .col-span-6 { grid-column: span 12; }
  .col-span-4 { grid-column: span 12; }
  .col-span-3 { grid-column: span 6; }
  .settings-form-grid-3 { grid-template-columns: 1fr; }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .bento-grid.four-col { grid-template-columns: repeat(2, 1fr); }
  .bento-grid.three-col { grid-template-columns: repeat(2, 1fr); }
  .bento-grid.two-third-one-third { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: var(--sp-6); }
  .top-navbar { padding: 0 var(--sp-4); }
  .navbar-links { display: none; }
  .bento-grid.two-col, .bento-grid.four-col, .bento-grid.three-col {
    grid-template-columns: 1fr;
  }
  .form-row-2 { grid-template-columns: 1fr; }
  h1 { font-size: 1.75rem; }
  .page-header { flex-direction: column; gap: var(--sp-4); align-items: flex-start; }
}


/* ==========================================================================
   PREMIUM ENHANCEMENTS — Appended overrides for modern polish
   ========================================================================== */

/* --- 1. Better Button Styles --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn svg {
  flex-shrink: 0;
}
.btn-primary {
  background: linear-gradient(135deg, var(--company-primary) 0%, var(--company-primary-dark) 100%);
  box-shadow: 0 2px 8px -2px rgba(2, 132, 199, 0.35);
}
.btn-primary:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px -4px rgba(2, 132, 199, 0.4);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.25);
}
.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-secondary:active {
  transform: translateY(0);
}
.btn-danger {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}
.btn-danger:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px -4px rgba(239, 68, 68, 0.35);
}
.btn-ghost:active {
  transform: scale(0.97);
}

/* --- 2. Better Card Depth --- */
.glass-card {
  border-image: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(226,232,240,0.3)) 1;
  border-width: 1px;
  border-style: solid;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}
.glass-panel {
  border-image: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(226,232,240,0.3)) 1;
  border-width: 1px;
  border-style: solid;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-panel:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}

/* --- 3. Better Data Tables --- */
.data-table thead th,
.data-table-enhanced thead th {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-card-solid);
}
.data-table tbody tr:nth-child(even),
.data-table-enhanced tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.4);
}
.data-table tbody tr:hover,
.data-table-enhanced tbody tr:hover {
  background: rgba(224, 242, 254, 0.3);
}

/* --- 4. Better Form Inputs --- */
.form-control {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.form-control:focus {
  border-color: var(--company-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
  background: #fff;
  outline: none;
}
.form-control::placeholder {
  color: var(--slate-400);
  font-weight: 400;
  opacity: 0.8;
}
select.form-control:focus {
  border-color: var(--company-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

/* --- 5. Navigation Polish --- */
.sidebar .sidebar-link.active,
.sidebar .nav-link.active,
.sidebar a.active {
  border-left: 3px solid var(--company-primary);
  padding-left: calc(var(--sp-3) - 3px);
  background: rgba(2, 132, 199, 0.06);
  color: var(--company-primary);
  font-weight: 600;
}
.top-navbar {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* Sidebar slide-in on mobile */
@media (max-width: 768px) {
  .sidebar.is-open {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    width: var(--sidebar-width);
    animation: slideInLeft 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  }
  @keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 999;
    animation: fadeIn 0.2s ease;
  }
}

/* --- 6. Status Badges --- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-badge.success { background: rgba(34, 197, 94, 0.1); color: #16a34a; }
.status-badge.success::before { background: #16a34a; }
.status-badge.warning { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.status-badge.warning::before { background: #d97706; }
.status-badge.danger { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.status-badge.danger::before { background: #dc2626; }
.status-badge.info { background: rgba(59, 130, 246, 0.1); color: #2563eb; }
.status-badge.info::before { background: #2563eb; }
.status-badge.neutral { background: rgba(148, 163, 184, 0.1); color: #64748b; }
.status-badge.neutral::before { background: #64748b; }

/* --- 7. KPI / Metric Cards --- */
.kpi-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-card-solid);
  border: 1px solid var(--slate-100);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--company-primary), var(--sky-400));
  opacity: 0;
  transition: opacity 0.25s ease;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.kpi-card:hover::before {
  opacity: 1;
}
.kpi-card .kpi-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.kpi-card .kpi-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-primary);
}
.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.kpi-card .kpi-sub .kpi-trend-up {
  color: #16a34a;
  font-weight: 700;
}
.kpi-card .kpi-sub .kpi-trend-down {
  color: #dc2626;
  font-weight: 700;
}
.kpi-card .kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.kpi-card .kpi-icon.primary { background: var(--company-primary-light); color: var(--company-primary); }
.kpi-card .kpi-icon.success { background: var(--success-bg); color: var(--success); }
.kpi-card .kpi-icon.warning { background: var(--warning-bg); color: var(--warning); }
.kpi-card .kpi-icon.danger { background: var(--danger-bg); color: var(--danger); }
.kpi-card .kpi-icon.teal { background: var(--teal-bg); color: var(--teal); }
.kpi-card .kpi-icon.violet { background: var(--violet-bg); color: var(--violet); }

/* --- 8. Print Styles --- */
@media print {
  .sidebar,
  .top-navbar,
  .page-actions,
  .btn,
  .sidebar-overlay,
  .flash-message,
  .mobile-menu-toggle { display: none !important; }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    background: white !important;
  }

  body { background: white !important; }

  .glass-panel,
  .glass-card,
  .kpi-card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    background: white !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: none !important;
  }

  .data-table,
  .data-table-enhanced { font-size: 10px; }

  .data-table thead th,
  .data-table-enhanced thead th {
    background: #f3f3f3 !important;
    color: #333 !important;
  }

  .status-badge {
    border: 1px solid currentColor;
    background: transparent !important;
  }

  a[href]::after { content: none !important; }
}

/* --- 9. Smooth Page Transitions --- */
.module-content {
  animation: fadeInUp 0.3s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Fade in for generic content areas */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- 10. Extra Polish Utilities --- */

/* Smooth scrollbar for WebKit */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }

/* Focus-visible for keyboard users only */
:focus-visible {
  outline: 2px solid var(--company-primary);
  outline-offset: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
}

/* Disabled button state */
.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

/* Loading spinner utility */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--slate-200);
  border-top-color: var(--company-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner.lg { width: 24px; height: 24px; border-width: 3px; }
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty state styling */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  color: var(--slate-300);
}
.empty-state h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 13px;
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Tooltip utility */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--slate-800);
  color: white;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.15s ease;
  z-index: 100;
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: var(--sp-6) 0;
}

/* Truncate text */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
