@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #2563EB;
  --primary-dark: #1E40AF;
  --primary-darker: #1E3A8A;
  --primary-light: #DBEAFE;
  --primary-lighter: #EFF6FF;
  --primary-rgb: 37, 99, 235;
  --secondary: #D97706;
  --secondary-light: #FEF3C7;
  --success: #059669;
  --success-light: #D1FAE5;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --info: #0284C7;
  --info-light: #E0F2FE;

  --bg-app: #F1F5F9;
  --bg-card: #FFFFFF;
  --bg-soft: #F8FAFC;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-faint: #94A3B8;
  --border: #E2E8F0;
  --border-focus: #94A3B8;

  /* Semantic surfaces. Everything that paints a background reads these,
     so a theme switch only has to redefine this block. */
  --surface-1: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-hover: #F1F5F9;
  --surface-inset: #F8FAFC;
  --overlay-scrim: rgba(15, 23, 42, 0.5);
  --scrollbar-thumb: #CBD5E1;
  --scrollbar-thumb-hover: #94A3B8;

  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-2: 0 4px 10px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-3: 0 12px 28px -6px rgba(15, 23, 42, 0.14), 0 4px 10px -4px rgba(15, 23, 42, 0.08);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-w: 264px;
  --header-h: 68px;

  --font-sans: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  color-scheme: light;
}

/* =============================================================
   DARK THEME
   Only surfaces, text, borders and shadows are overridden. Brand
   hues (primary/success/danger/info) are shared so status colours
   stay recognisable in both themes.
   ============================================================= */
[data-theme="dark"] {
  --bg-app: #0B1220;
  --bg-card: #131C2E;
  --bg-soft: #182338;
  --text-main: #E8EEF9;
  --text-muted: #97A6BF;
  --text-faint: #6B7C99;
  --border: #26334A;
  --border-focus: #4A5C7A;

  --surface-1: #131C2E;
  --surface-2: #182338;
  --surface-hover: #1E2A42;
  --surface-inset: #0F1826;
  --overlay-scrim: rgba(2, 6, 14, 0.66);
  --scrollbar-thumb: #33425C;

  /* Tinted brand washes need lifting to stay legible on dark surfaces */
  --primary-lighter: #16233C;
  --primary-light: #1B2F55;
  --info-light: #10283C;
  --success-light: #0C2C24;
  --danger-light: #331A1C;
  --secondary-light: #33270E;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 4px 10px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 12px 28px -6px rgba(0, 0, 0, 0.6), 0 4px 10px -4px rgba(0, 0, 0, 0.5);

  --scrollbar-thumb-hover: #455672;

  color-scheme: dark;
}

/* Follow the OS when the operator has not chosen explicitly. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-app: #0B1220;
    --bg-card: #131C2E;
    --bg-soft: #182338;
    --text-main: #E8EEF9;
    --text-muted: #97A6BF;
    --text-faint: #6B7C99;
    --border: #26334A;
    --border-focus: #4A5C7A;
    --surface-1: #131C2E;
    --surface-2: #182338;
    --surface-hover: #1E2A42;
    --surface-inset: #0F1826;
    --overlay-scrim: rgba(2, 6, 14, 0.66);
    --scrollbar-thumb: #33425C;
    --scrollbar-thumb-hover: #455672;
    --primary-lighter: #16233C;
    --primary-light: #1B2F55;
    --info-light: #10283C;
    --success-light: #0C2C24;
    --danger-light: #331A1C;
    --secondary-light: #33270E;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 4px 10px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-3: 0 12px 28px -6px rgba(0, 0, 0, 0.6), 0 4px 10px -4px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "tnum";
}

::selection {
  background: rgba(var(--primary-rgb), 0.16);
}

/* Keyboard focus. Uses :focus-visible so pointer users never see a ring,
   but Tab / Shift+Tab always does. */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.sidebar :focus-visible {
  outline-color: #93C5FD;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .skeleton {
    animation: none;
    background: var(--bg-soft);
  }
}

/* Layout */
#app {
  display: flex;
  min-height: 100vh;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: content-box;
  border: 2px solid transparent;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0F172A 0%, #111827 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 24px -8px rgba(15, 23, 42, 0.35);
}

.sidebar-header {
  height: var(--header-h);
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), #6366F1);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 19px;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
}

.logo-text h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--surface-1);
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.logo-text p {
  font-size: 11px;
  color: var(--text-faint);
}

.sidebar-role-badge {
  margin: 16px 14px 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.2), rgba(99, 102, 241, 0.1));
  border-radius: var(--radius);
  border: 1px solid rgba(var(--primary-rgb), 0.35);
}

.role-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #93C5FD;
  font-weight: 800;
}

.role-persona {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--surface-1);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
}

.nav-section-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 12px 8px;
  letter-spacing: 0.8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #CBD5E1;
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 3px;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--surface-1);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(var(--primary-rgb), 0.25), rgba(var(--primary-rgb), 0.12));
  color: var(--surface-1);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav-item .icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
  filter: saturate(0.9);
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.18);
}

.sidebar-footer div {
  color: #94A3B8 !important;
}

/* Main Area */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--bg-app) 100%);
}

/* Header */
.top-header {
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.toggle-sidebar-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-main);
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.server-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--success-light);
  color: var(--success);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(5, 150, 105, 0.18);
  white-space: nowrap;
}

.server-pill.is-down {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.22);
}

.server-pill.is-down .dot {
  background: var(--danger);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.25);
  animation: none;
}

.server-pill.is-pending {
  background: var(--surface-hover);
  color: var(--text-muted);
  border-color: var(--border);
}

.server-pill.is-pending .dot {
  background: var(--text-faint);
  box-shadow: none;
  animation: none;
}

/* Light / dark / system cycle */
.theme-toggle {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s;
}

.theme-toggle:hover {
  border-color: var(--border-focus);
  background: var(--surface-hover);
}

.theme-toggle:active {
  transform: scale(0.94);
}

.theme-icon {
  display: block;
  line-height: 1;
}

.server-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.25);
  animation: pulseDot 2s infinite;
  flex-shrink: 0;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.4); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(46, 125, 50, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 125, 50, 0); }
}

.switcher-dropdown-wrap select {
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.switcher-dropdown-wrap select:hover {
  border-color: var(--border-focus);
}

.switcher-dropdown-wrap select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  background: var(--surface-2);
  border-radius: 999px;
  border: 1px solid var(--border);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6366F1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(var(--primary-rgb), 0.3);
}

.user-info {
  line-height: 1.2;
}

.user-name {
  font-weight: 600;
  font-size: 12.5px;
}

.user-role-label {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--danger-light);
  border-color: rgba(220, 38, 38, 0.3);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.12);
}

/* Content Container */
.content-body {
  padding: 32px;
  flex: 1;
}

.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.page-title-group h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.page-title-group p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.action-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Maintenance Banner */
.maintenance-banner {
  background: linear-gradient(90deg, #FEF3C7, #FFFBEB);
  border-bottom: 1px solid #FDE68A;
  color: #92400E;
  padding: 10px 28px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  opacity: 1;
}

.kpi-card.green::before { background: var(--success); }
.kpi-card.amber::before { background: var(--secondary); }
.kpi-card.red::before { background: var(--danger); }

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.6);
}

.kpi-icon.blue { background: var(--primary-light); color: var(--primary-dark); }
.kpi-icon.green { background: var(--success-light); color: var(--success); }
.kpi-icon.amber { background: var(--secondary-light); color: var(--secondary); }
.kpi-icon.red { background: var(--danger-light); color: var(--danger); }

.kpi-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Interactive Visual Gauge & Progress Bars */
.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 6px 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.progress-bar-fill.green { background: var(--success); }
.progress-bar-fill.amber { background: var(--secondary); }
.progress-bar-fill.red { background: var(--danger); }

/* Circular Meter */
.circle-meter {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.circle-dial {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--pct) * 1%), var(--border) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.circle-dial::after {
  content: '';
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
}

.circle-text {
  position: absolute;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-main);
}

/* Radar & GPS status pill */
.geofence-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(46, 125, 50, 0.2);
}

.geofence-pill.flagged {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(211, 47, 47, 0.2);
}

/* Module Grid Cards */
.module-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.module-item-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

.module-item-card:hover {
  border-color: rgba(var(--primary-rgb), 0.4);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}

.module-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-lighter));
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  overflow: hidden;
}

/* Panels & Cards */
.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface-1);
}

.panel-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.2px;
}

.panel-body {
  padding: 24px;
}

/* Search Bar & Chip Filters */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-input-wrap input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface-1);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 15px;
}

.chip-filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-1);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.filter-chip:hover {
  background: var(--bg-soft);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}

.chip-check {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.chip-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip-check span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-1);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.chip-check:hover span {
  background: var(--bg-soft);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.chip-check input:checked + span {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: var(--bg-soft);
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: 0.4px;
  font-size: 11.5px;
  text-transform: uppercase;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.12s;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tfoot td {
  font-weight: 700;
  background: var(--bg-soft);
  padding: 12px 16px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-normal, .badge-success, .badge-closed {
  background: var(--success-light);
  color: var(--success);
}

.badge-secondary {
  background: var(--bg-app);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-mam, .badge-warning, .badge-referred {
  background: var(--secondary-light);
  color: var(--secondary);
}

.badge-sam, .badge-danger, .badge-open {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-info, .badge-primary {
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn:disabled:hover,
.btn[aria-disabled="true"]:hover {
  box-shadow: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

.btn-primary:hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.35);
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-main);
  box-shadow: var(--shadow-1);
}

.btn-secondary:hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--bg-soft);
  border-color: var(--border-focus);
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

.btn-danger:hover:not(:disabled):not([aria-disabled="true"]) {
  background: #B91C1C;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-main);
  background: var(--surface-1);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.form-input:hover, .form-select:hover, .form-textarea:hover {
  border-color: var(--border-focus);
}

/* Switch & Toggles */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.switch-info h4 {
  font-size: 14px;
  font-weight: 600;
}

.switch-info p {
  font-size: 12px;
  color: var(--text-muted);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-focus);
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Module Sub-Views (Cards, Timelines) */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface-1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-1);
}

.timeline-card.urgent {
  border-left-color: var(--danger);
  background: var(--surface-1);
}

/* Modal & Dialogs */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--overlay-scrim);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-dialog {
  background: var(--surface-1);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.35);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-1);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close-btn:hover {
  background: var(--bg-app);
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-app);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-dialog.modal-lg {
  max-width: 840px;
}

.form-section-header {
  grid-column: span 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 6px 0;
  border-bottom: 1.5px solid var(--border);
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
}

.form-section-header:first-of-type {
  margin-top: 0;
}

.gender-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.gender-card-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface-1);
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.2s ease;
}

.gender-card-label:hover {
  border-color: var(--primary);
  background: var(--bg-app);
}

.gender-card-label input[type="radio"] {
  accent-color: var(--primary);
}

.gender-card-label:has(input:checked) {
  border-color: var(--primary);
  background: #E8F5E9;
  color: #1B5E20;
}

.live-calc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #E3F2FD;
  color: #1565C0;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.45;
}

/* Quick-select reason chips (child exit modal) */
.quick-reason-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.quick-reason {
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 9px;
  color: var(--text-muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}

.quick-reason:hover {
  color: var(--primary);
  background: var(--primary-lighter);
  border-color: var(--primary-light);
}

.quick-reason:active {
  transform: translateY(1px);
}

.child-exit-summary {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: var(--radius);
}

.child-exit-summary-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
}

.child-exit-summary-code {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Inline advisory callout */
.notice {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  background: var(--info-light);
  border-left: 3px solid var(--info);
  padding: 10px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.notice strong {
  color: var(--text-main);
}

.empty-state {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 44px;
  margin-bottom: 14px;
  opacity: 0.85;
}
.empty-state h4 {
  font-size: 16px;
  color: var(--text-main);
  margin-bottom: 4px;
}
.empty-state p {
  font-size: 13px;
  margin-bottom: 16px;
}

/* Loading skeletons & async states */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-soft) 0%,
    var(--border) 40%,
    var(--bg-soft) 80%
  );
  background-size: 300% 100%;
  border-radius: var(--radius-sm);
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}

.skeleton + .skeleton {
  margin-top: 10px;
}

.skeleton-line {
  height: 12px;
}

.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.tall { height: 68px; }
.skeleton-line.medium { height: 40px; border-radius: var(--radius); }

.skeleton-panel .panel-header,
.skeleton-panel .panel-body {
  pointer-events: none;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 14px 0;
}

.skeleton-grid .skeleton + .skeleton {
  margin-top: 0;
}

@media (max-width: 900px) {
  .skeleton-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .skeleton-grid { grid-template-columns: 1fr; }
}

@keyframes skeleton-sweep {
  0%   { background-position: 150% 0; }
  100% { background-position: -50% 0; }
}

/* Inline error with retry affordance */
.load-error {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.load-error-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 20px;
  background: var(--danger-light);
  color: var(--danger);
}

.load-error h4 {
  font-size: 15px;
  color: var(--text-main);
  margin-bottom: 5px;
}

.load-error p {
  font-size: 13px;
  max-width: 420px;
  margin: 0 auto 16px;
}

/* =============================================================
   LOGIN & AUTHENTICATION PAGE
   ============================================================= */

.login-wrapper {
  flex: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background:
    radial-gradient(900px 600px at 85% -10%, rgba(var(--primary-rgb), 0.14), transparent 60%),
    radial-gradient(700px 500px at 0% 110%, rgba(99, 102, 241, 0.14), transparent 60%),
    linear-gradient(180deg, #F8FAFC 0%, #EEF2F7 100%);
}

.login-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface-1);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-3);
  padding: 36px 36px 30px;
}

.login-header {
  text-align: center;
  margin-bottom: 26px;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), #6366F1);
  color: var(--surface-1);
  font-size: 30px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(var(--primary-rgb), 0.4);
}

.login-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

.login-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

.login-card .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* 1-Click Stakeholder Switcher */
.quick-persona-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.persona-quick-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.persona-quick-card:hover {
  border-color: var(--primary);
  background: var(--primary-lighter);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.role-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.role-desc {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.3;
}

/* =============================================================
   TOAST NOTIFICATIONS
   ============================================================= */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 260px;
  max-width: 380px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); color: var(--danger); }
.toast.error  { border-left-color: var(--danger); color: var(--danger); }
.toast.warning { border-left-color: var(--secondary); color: var(--secondary); }
.toast.info { border-left-color: var(--info); }

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  color: #FFFFFF;
  background: var(--info);
}

.toast.success .toast-icon { background: var(--success); }
.toast.danger .toast-icon,
.toast.error .toast-icon { background: var(--danger); }
.toast.warning .toast-icon { background: var(--secondary); }

.toast-text {
  flex: 1;
  line-height: 1.45;
  color: var(--text-main);
  word-break: break-word;
}

.toast.danger .toast-text,
.toast.error .toast-text,
.toast.warning .toast-text {
  color: inherit;
}

.toast-close {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-faint);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.toast-close:hover {
  background: var(--surface-hover);
  color: var(--text-main);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Child Roster Cards */
.module-item-card.child-card {
  gap: 6px;
}

.child-card .avatar-badge {
  flex-shrink: 0;
}

/* Print Styles */
@media print {
  .sidebar, .top-header, .action-bar, .btn, .tabs-bar, .filter-bar, .switcher-dropdown-wrap {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  body, .content-body, .panel-card {
    background: white !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }
  .data-table th, .data-table td {
    border: 1px solid #000 !important;
    padding: 6px 8px !important;
    font-size: 11px !important;
  }
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .toggle-sidebar-btn {
    display: block;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .quick-persona-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .login-card {
    padding: 28px 22px 24px;
    border-radius: 14px;
  }
  .quick-persona-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .header-right {
    gap: 8px;
  }
  .user-badge, .switcher-dropdown-wrap {
    display: none;
  }
  .creche-scope-wrap {
    display: none;
  }
  .content-body {
    padding: 20px 16px;
  }
  /* Date, number and select inputs are unusable in a 2-column grid on phones */
  .form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .form-group.full-width {
    grid-column: span 1;
  }
}

/* =============================================================
   PHOTO CAPTURE & GPS GEOLOCATION STYLES
   ============================================================= */

.photo-upload-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.photo-preview-box {
  border: 2px dashed #90CAF9;
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-preview-box:hover {
  border-color: var(--primary);
  background: var(--primary-lighter);
}

.photo-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.photo-preview-img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: var(--shadow-2);
}

.photo-thumb-mini {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  vertical-align: middle;
}

.photo-thumb-mini:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-2);
}

.child-avatar-photo {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

/* GPS Geolocation Widgets */
.gps-field-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gps-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--success-light);
  color: #1B5E20;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.gps-badge.acquiring {
  background: #FEF3C7;
  color: #92400E;
  border-color: #FDE68A;
}

.gps-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2E7D32;
  box-shadow: 0 0 6px #4CAF50;
  display: inline-block;
  animation: pulse-dot 1.8s infinite ease-in-out;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.btn-refresh-gps {
  background: var(--surface-1);
  border: 1px solid #C8E6C9;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #2E7D32;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-refresh-gps:hover {
  background: #2E7D32;
  color: var(--surface-1);
}

/* Lightbox Modal for Photo Proofs */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  background: var(--surface-1);
  padding: 8px;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  border-radius: 10px;
}

/* ==========================================================================
   ADMIN MASTER DATA
   ========================================================================== */

.master-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 16px 0 14px;
}

.master-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--surface-1);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}

.master-tab:hover {
  background: var(--bg-soft);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.master-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}

/* Geography tree */
.geo-tree {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.geo-node {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
}

.geo-node-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

.geo-district .geo-node-head { background: #EFF6FF; border-radius: var(--radius) var(--radius) 0 0; }
.geo-block .geo-node-head { background: var(--surface-2); }
.geo-node-head strong { font-size: 13px; }

.geo-icon {
  font-size: 15px;
}

.geo-code {
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 2px 7px;
}

.geo-children {
  margin-left: 22px;
  padding-left: 12px;
  border-left: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.btn-ghost {
  margin-left: auto;
  background: transparent;
  border: 1px solid transparent;
  color: var(--primary);
  font-weight: 600;
}

.btn-ghost:hover {
  background: var(--primary-lighter);
  border-color: var(--primary-light);
}

/* Meals cards */
.master-meals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.master-meal-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface-1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.master-meal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.master-meal-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-table {
  margin: 0;
}

.compact-table th {
  font-size: 10.5px;
  padding: 5px 8px;
  background: var(--bg-soft);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.compact-table td {
  padding: 5px 8px;
  font-size: 12px;
}

.perm-summary {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 320px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Permission matrix */
.perm-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.perm-matrix-module {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.perm-module-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.perm-module-head input[type="checkbox"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.perm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.perm-action-chip {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.perm-action-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.perm-action-chip span {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--surface-1);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.perm-action-chip:hover span {
  background: var(--bg-soft);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.perm-action-chip input:checked + span {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary-light);
}

/* Print Optimization (PRD Statutory Formats) */
@media print {
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }
  .sidebar, .top-header, .maintenance-banner, .action-bar, .panel-header, #reportsFilterControls, .btn-logout, .server-pill {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
    padding: 0 !important;
    background: #FFFFFF !important;
  }
  .content-body {
    padding: 0 !important;
  }
  .panel-card {
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .data-table {
    font-size: 9pt !important;
    width: 100% !important;
  }
  .data-table th, .data-table td {
    padding: 4px 6px !important;
    border: 1px solid #999999 !important;
  }
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
  }
  .kpi-card {
    border: 1px solid #CCC !important;
    box-shadow: none !important;
    padding: 10px !important;
  }
}

/* ==========================================================================
   SETTINGS & MICRO-SETTINGS SUITE (PRD System Parameters & Micro-Config)
   ========================================================================== */

.btn-header-settings {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-header-settings:hover {
  background: var(--bg-soft);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.settings-tabs-wrapper {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-1);
}

.settings-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.settings-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.settings-tab:hover {
  background: var(--bg-soft);
  color: var(--text-main);
}

.settings-tab.active {
  background: var(--primary);
  color: var(--surface-1);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.settings-tab-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
}

.settings-tab.active .settings-tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: var(--surface-1);
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-info-banner {
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.settings-info-banner .banner-icon {
  font-size: 24px;
  line-height: 1;
}

.settings-info-banner h4 {
  font-size: 14.5px;
  font-weight: 700;
  color: #1E40AF;
  margin-bottom: 3px;
}

.settings-info-banner p {
  font-size: 12.5px;
  color: #1E3A8A;
  margin: 0;
  line-height: 1.5;
}

.micro-setting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.micro-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-1);
  transition: all 0.2s ease;
}

.micro-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-2);
}

.micro-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.micro-card-title-group {
  flex: 1;
}

.micro-card-title-group h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.micro-card-title-group p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

.micro-key-pill {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
  font-size: 10.5px;
  background: var(--bg-soft);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  display: inline-block;
  margin-top: 4px;
}

.micro-card-control {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--bg-app);
}

.input-unit-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.input-unit-group .form-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
  font-weight: 600;
}

.input-unit-addon {
  background: var(--bg-soft);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.server-connection-hub {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-1);
}

.connection-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.connection-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.status-beacon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22C55E;
  position: relative;
}

.status-beacon::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.35);
  animation: beaconPulse 2s infinite ease-out;
}

@keyframes beaconPulse {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

.preset-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 16px;
}

.preset-chip-btn {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preset-chip-btn:hover {
  background: var(--surface-1);
  border-color: var(--primary);
  box-shadow: var(--shadow-1);
}

.preset-chip-btn.active {
  background: #EFF6FF;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.preset-chip-btn .preset-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.preset-chip-btn .preset-url {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 40;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  color: var(--surface-1);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  margin-top: 24px;
}

.settings-save-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--border);
}

.settings-save-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Density: Compact support */
body.density-compact .data-table th,
body.density-compact .data-table td {
  padding: 6px 10px !important;
  font-size: 12px !important;
}

body.density-compact .kpi-card {
  padding: 12px 14px !important;
}

body.density-compact .panel-body {
  padding: 14px !important;
}

/* ==========================================================================
   MODERN LOGIN SCREEN - UPASANA EDUCATION TRUST SMART CRECHE
   ========================================================================== */

.login-wrapper {
  position: relative;
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
  background: 
    radial-gradient(ellipse 90% 70% at 50% -20%, rgba(37, 99, 235, 0.28) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 85% 90%, rgba(217, 119, 6, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 15% 85%, rgba(5, 150, 105, 0.12) 0%, transparent 60%),
    linear-gradient(145deg, #090e1a 0%, #0f172a 45%, #131d36 100%);
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Ambient glow blobs */
.login-bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 1;
}

.login-bg-glow-1 {
  top: 5%;
  left: 10%;
  width: 320px;
  height: 320px;
  background: rgba(37, 99, 235, 0.25);
}

.login-bg-glow-2 {
  bottom: 10%;
  right: 12%;
  width: 380px;
  height: 380px;
  background: rgba(245, 127, 23, 0.18);
}

.login-bg-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.6;
  pointer-events: none;
  z-index: 1;
}

/* Split Two-Column Container */
.login-split-container {
  display: flex;
  width: 100%;
  max-width: 1040px;
  min-height: 590px;
  background: rgba(15, 23, 42, 0.7);
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 24px 60px -12px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  overflow: hidden;
  position: relative;
  z-index: 10;
  margin: 20px auto;
}

/* Left Hero Column */
.login-hero-col {
  flex: 1.15;
  background: linear-gradient(145deg, rgba(30, 58, 138, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.login-hero-col::before {
  content: '';
  position: absolute;
  top: -60px;
  left: -60px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.22) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.login-hero-content {
  position: relative;
  z-index: 2;
}

.login-hero-logo-box {
  width: 110px;
  height: 110px;
  padding: 10px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.login-hero-logo-box:hover {
  transform: scale(1.03);
}

.login-hero-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-hero-trust-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FDE047;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 9999px;
  margin-bottom: 12px;
}

.login-hero-title {
  font-size: 32px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 6px;
  letter-spacing: -0.5px;
}

.login-hero-tagline {
  font-size: 13.5px;
  color: #93C5FD;
  font-weight: 600;
  margin: 0 0 14px;
}

.login-hero-desc {
  font-size: 13.5px;
  color: #CBD5E1;
  line-height: 1.55;
  margin: 0 0 28px;
  max-width: 420px;
}

.login-hero-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.login-hero-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.feature-bullet-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(96, 165, 250, 0.3);
  color: #60A5FA;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.login-hero-feature-item strong {
  display: block;
  font-size: 13px;
  color: #F8FAFC;
  font-weight: 700;
}

.login-hero-feature-item span {
  font-size: 12px;
  color: #94A3B8;
  line-height: 1.4;
}

.login-hero-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: #64748B;
  font-weight: 600;
}

/* Right Form Column */
.login-form-col {
  flex: 1;
  background: #ffffff;
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-form-col .login-card {
  width: 100%;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

.login-mobile-brand {
  display: none;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
}

.login-mobile-logo {
  width: 76px;
  height: 76px;
  object-fit: contain;
  margin-bottom: 8px;
}

.login-mobile-trust {
  font-size: 10.5px;
  font-weight: 800;
  color: #2563EB;
  letter-spacing: 0.8px;
}

.login-card-header {
  margin-bottom: 24px;
  text-align: left;
}

.login-card-title {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.login-card-subtitle {
  font-size: 13.5px;
  color: #64748b;
  font-weight: 500;
}

/* Responsive adjustment for Mobile (stacked layout) */
@media (max-width: 860px) {
  .login-split-container {
    flex-direction: column;
    max-width: 480px;
    border-radius: 20px;
  }
  .login-hero-col {
    display: none;
  }
  .login-mobile-brand {
    display: flex;
  }
  .login-form-col {
    padding: 34px 26px;
  }
  .login-card-header {
    text-align: center;
  }
}

/* Form Groups */
.login-field-group {
  margin-bottom: 16px;
}

.login-field-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 7px;
}

.login-field-hint {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.login-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  transition: color 0.2s;
  z-index: 2;
}

.login-input {
  width: 100%;
  height: 46px;
  padding: 0 44px 0 42px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  color: #0f172a;
  background: #f8fafc;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  box-sizing: border-box;
}

.login-input:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.login-input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  outline: none;
}

.login-input-wrap:focus-within .login-input-icon {
  color: #2563eb;
}

.login-pwd-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 2;
}

.login-pwd-toggle:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.highlight-fill {
  animation: highlightGlow 0.8s ease;
}

@keyframes highlightGlow {
  0% { background-color: #eff6ff; border-color: #3b82f6; }
  100% { background-color: #f8fafc; border-color: #e2e8f0; }
}

/* Options row */
.login-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  margin-bottom: 20px;
  font-size: 13px;
}

.login-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #475569;
  user-select: none;
  font-weight: 500;
}

.login-checkbox-label input[type="checkbox"] {
  accent-color: #2563eb;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.login-help-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}

.login-help-link:hover {
  text-decoration: underline;
  color: #1d4ed8;
}

/* Submit button */
.btn-login-submit {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-login-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.btn-login-submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-login-submit:disabled {
  opacity: 0.75;
  cursor: wait;
}

/* Demo Roles Section */
.login-demo-section {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed #e2e8f0;
}

.login-demo-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  text-align: center;
  margin-bottom: 10px;
}

.login-demo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
}

.login-demo-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.login-demo-chip:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}

.login-demo-chip:active {
  transform: translateY(0);
}

/* Footer Status Bar */
.login-footer-bar {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

.login-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: #475569;
  font-weight: 500;
}

.login-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
}

.login-status-dot.online {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.login-status-dot.offline {
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

.login-api-toggle-btn {
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
  font-family: inherit;
}

.login-api-toggle-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

/* Inline API Box */
.login-api-box {
  margin-top: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  animation: fadeIn 0.2s ease;
}

.login-api-box-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 4px;
}

.login-api-url {
  font-size: 11px;
  font-family: monospace;
  color: #0f172a;
  background: #ffffff;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  word-break: break-all;
  margin-bottom: 8px;
}

.login-api-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.api-preset-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.api-preset-chip:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}

/* Accreditation Footer */
.login-accreditation {
  margin-top: 22px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  line-height: 1.5;
}

.login-accreditation strong {
  color: #ffffff;
  font-weight: 600;
}

.accreditation-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 2px;
}

/* Mobile adjustments */
@media (max-width: 540px) {
  .login-card {
    padding: 24px 20px 20px;
    border-radius: 16px;
  }
  .login-logo-container {
    width: 82px;
    height: 82px;
  }
  .login-system-title {
    font-size: 20px;
  }
}

/* =============================================================
   CHARTS & ANALYTICS VISUALIZATIONS
   ============================================================= */
.charts-section {
  margin-bottom: 24px;
}

.charts-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.charts-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.charts-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.charts-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .charts-grid-2x2,
  .charts-grid-2 {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.chart-card:hover {
  box-shadow: var(--shadow-2);
}

.chart-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bg-app);
}

.chart-card-title-group h4 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.chart-card-title-group p {
  font-size: 12px;
  color: var(--text-muted);
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-stat-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.chart-stat-overlay .number {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.chart-stat-overlay .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =============================================================
   NOTIFICATIONS BELL & PANEL
   ============================================================= */
.notif-bell-wrap {
  position: relative;
}

.notif-bell-btn {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  position: relative;
  color: var(--text-main);
  transition: all 0.2s;
}

.notif-bell-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-focus);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: white;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 380px;
  max-width: 90vw;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  z-index: 1000;
  display: none;
  flex-direction: column;
  animation: notifDropIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-dropdown.show {
  display: flex;
}

@keyframes notifDropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.notif-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.notif-list {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notif-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--bg-app);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.notif-item:hover {
  background: var(--surface-2);
}

.notif-item.unread {
  background: #F0FDF4;
}

.notif-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.notif-item-icon.warning { background: #FEF3C7; color: #D97706; }
.notif-item-icon.danger { background: #FEE2E2; color: #DC2626; }
.notif-item-icon.info { background: #E0F2FE; color: #0284C7; }
.notif-item-icon.success { background: #D1FAE5; color: #059669; }

.notif-item-content {
  flex: 1;
}

.notif-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}

.notif-item-body {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.notif-item-time {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}

.notif-empty {
  padding: 36px 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}


