/* ════════════════════════════════════════════════════
   M-COMMERCE ERP — brand theme (mcommerce.ph identity)
   Premium dark, charcoal + amber-orange. Bootstrap 5.3
   retuned via HSL CSS variables.
     Primary bg  #111827  ·  Secondary #1F2937  ·  Card #242F3D
     Accent      #F59E0B  ·  Accent hover #E67E22
   Dark is the flagship experience; a retuned amber light
   theme is kept for the optional toggle.
   ════════════════════════════════════════════════════ */

/* ── Light theme (optional toggle — amber-accented) ─────────── */
:root,
[data-bs-theme="light"] {
  --background:        220 20% 97%;
  --foreground:        221 39% 11%;
  --card:              0 0% 100%;
  --card-foreground:   221 39% 11%;
  --popover:           0 0% 100%;
  --popover-foreground: 221 39% 11%;
  --primary:           38 92% 50%;            /* #F59E0B amber */
  --primary-foreground: 221 39% 11%;          /* dark ink on amber */
  --secondary:         220 14% 96%;
  --secondary-foreground: 221 39% 11%;
  --muted:             220 14% 96%;
  --muted-foreground:  220 9% 46%;
  --accent:            38 92% 94%;
  --accent-foreground: 26 83% 32%;
  --destructive:       0 84% 60%;
  --destructive-foreground: 0 0% 100%;
  --success:           142 71% 42%;
  --success-foreground: 0 0% 100%;
  --warning:           38 92% 50%;
  --warning-foreground: 26 83% 14%;
  --info:              199 89% 48%;
  --info-foreground:   0 0% 100%;
  --border:            220 13% 91%;
  --input:             220 13% 91%;
  --ring:              38 92% 50%;
  --radius:            0.7rem;

  /* Override Bootstrap's own primary so every built-in component is amber */
  --bs-primary:     #F59E0B;
  --bs-primary-rgb: 245, 158, 11;
  --bs-link-color:  #B45309;
  --bs-link-color-rgb: 180, 83, 9;
  --bs-link-hover-color: #92400E;

  /* Sidebar stays dark charcoal even in light mode */
  --sidebar-bg:        221 41% 9%;
  --sidebar-fg:        210 17% 90%;
  --sidebar-muted:     216 12% 58%;
  --sidebar-border:    216 24% 16%;
  --sidebar-hover:     215 27% 14%;
  --sidebar-active-bg: 38 92% 50%;
  --sidebar-active-fg: 38 92% 62%;

  /* Convenience aliases used throughout the app's custom mg-* classes */
  --mg-bg: hsl(var(--background));
  --mg-surface: hsl(var(--card));
  --mg-surface-2: hsl(var(--secondary));
  --mg-border: hsl(var(--border));
  --mg-border-soft: hsl(var(--border) / 0.6);
  --mg-text: hsl(var(--foreground));
  --mg-text-muted: hsl(var(--muted-foreground));
  --mg-accent: hsl(var(--primary));
  --mg-accent-hover: hsl(28 80% 48%);         /* #E67E22 darker */
  --mg-accent-soft: hsl(var(--primary) / 0.12);
  --mg-success: hsl(var(--success));
  --mg-warning: hsl(var(--warning));
  --mg-danger:  hsl(var(--destructive));
  --mg-info:    hsl(var(--info));

  --mg-shadow-sm: 0 1px 2px 0 hsl(var(--foreground) / 0.04);
  --mg-shadow-md: 0 4px 14px hsl(var(--foreground) / 0.08);
  --mg-shadow-lg: 0 24px 48px hsl(var(--foreground) / 0.18);

  --mg-sidebar-w:      260px;
  --mg-sidebar-icon-w: 70px;
  --mg-header-h:       60px;
  --mg-trans:          0.25s ease;
}

/* ── Dark theme — the flagship mcommerce.ph brand surface ────── */
[data-bs-theme="dark"] {
  --background:        221 39% 11%;           /* #111827 charcoal */
  --foreground:        0 0% 100%;             /* #FFFFFF */
  --card:              214 26% 19%;           /* #242F3D */
  --card-foreground:   0 0% 100%;
  --popover:           215 28% 17%;           /* #1F2937 */
  --popover-foreground: 0 0% 100%;
  --primary:           38 92% 50%;            /* #F59E0B amber */
  --primary-foreground: 221 39% 11%;          /* charcoal ink on amber */
  --secondary:         215 28% 17%;           /* #1F2937 */
  --secondary-foreground: 0 0% 100%;
  --muted:             215 25% 22%;
  --muted-foreground:  214 13% 84%;           /* #D1D5DB */
  --accent:            34 45% 18%;            /* warm amber-tinted surface */
  --accent-foreground: 38 92% 62%;
  --destructive:       0 72% 55%;
  --destructive-foreground: 0 0% 100%;
  --success:           152 58% 46%;
  --success-foreground: 0 0% 100%;
  --warning:           38 92% 55%;
  --warning-foreground: 221 39% 11%;
  --info:              199 89% 54%;
  --info-foreground:   221 39% 11%;
  --border:            215 18% 26%;           /* ≈ white @ 8% on charcoal */
  --input:             215 18% 26%;
  --ring:              38 92% 50%;

  --bs-primary:     #F59E0B;
  --bs-primary-rgb: 245, 158, 11;
  --bs-link-color:  #FBBF24;
  --bs-link-color-rgb: 251, 191, 36;
  --bs-link-hover-color: #FCD34D;

  /* Sidebar — deeper charcoal for elevation contrast */
  --sidebar-bg:        222 42% 8%;
  --sidebar-fg:        210 16% 90%;
  --sidebar-muted:     215 12% 56%;
  --sidebar-border:    216 22% 15%;
  --sidebar-hover:     215 26% 15%;
  --sidebar-active-bg: 38 92% 50%;
  --sidebar-active-fg: 38 92% 62%;

  --mg-border:      rgba(255,255,255,0.08);
  --mg-border-soft: rgba(255,255,255,0.06);
  --mg-accent-hover: hsl(28 80% 52%);         /* #E67E22 */
  --mg-accent-soft:  hsl(var(--primary) / 0.14);

  /* Deeper, softer shadows read better over charcoal */
  --mg-shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.30);
  --mg-shadow-md: 0 6px 20px rgba(0,0,0,0.40);
  --mg-shadow-lg: 0 28px 56px rgba(0,0,0,0.55);

  /* Bridge Bootstrap's own theme vars → charcoal palette so built-in
     utilities (.bg-body, .border, .text-body-secondary, .bg-body-tertiary…)
     match the brand instead of Bootstrap's default dark grey. */
  --bs-body-bg:          #111827;
  --bs-body-bg-rgb:      17, 24, 39;
  --bs-body-color:       #FFFFFF;
  --bs-body-color-rgb:   255, 255, 255;
  --bs-emphasis-color:   #FFFFFF;
  --bs-secondary-color:  rgba(209, 213, 219, 0.75);
  --bs-secondary-bg:     #1F2937;
  --bs-tertiary-bg:      #242F3D;
  --bs-border-color:     rgba(255, 255, 255, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { background: var(--mg-bg); color: var(--mg-text); }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex; min-height: 100vh; overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
.text-muted { color: var(--mg-text-muted) !important; }
.mg-serif, h1.mg-serif, h2.mg-serif, h3.mg-serif, h4.mg-serif, h5.mg-serif {
  font-family: 'Sora', 'Inter', sans-serif; letter-spacing: -0.02em;
}

/* ═══ Bootstrap baseline overrides ═════════════════════════ */
.card {
  background: var(--mg-surface);
  border: 1px solid var(--mg-border);
  border-radius: var(--radius);
  box-shadow: var(--mg-shadow-sm);
  margin-bottom: 0;
}
.card-body { padding: 20px 22px; color: var(--mg-text); }
.card-title, .card h5, .card h6 {
  color: var(--mg-text);
  font-weight: 600;
  font-family: 'Sora', 'Inter', sans-serif;
  letter-spacing: -0.01em;
}

hr { border-color: var(--mg-border); opacity: 1; }
pre {
  background: var(--mg-surface-2); color: var(--mg-text);
  border: 1px solid var(--mg-border); border-radius: 8px; padding: 10px 14px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
}
code { color: hsl(var(--accent-foreground)); background: hsl(var(--accent)); padding: 2px 6px; border-radius: 4px; font-size: 12.5px; }
.bg-light { background: var(--mg-surface-2) !important; color: var(--mg-text); }

/* ═══ Tables ════════════════════════════════════════════════ */
.table {
  color: var(--mg-text);
  --bs-table-bg: transparent;
  --bs-table-color: var(--mg-text);
  margin-bottom: 0;
}
.table > :not(caption) > * > * {
  vertical-align: middle;
  border-bottom-color: var(--mg-border);
  font-size: 13px;
  padding: 12px 16px;
}
.table > thead { background: var(--mg-surface-2); }
.table > thead th, .table-light th {
  background: var(--mg-surface-2) !important;
  color: var(--mg-text-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--mg-border);
  padding: 12px 16px;
  white-space: nowrap;
}
.table-hover > tbody > tr:hover > * {
  --bs-table-hover-bg: var(--mg-surface-2);
  --bs-table-hover-color: var(--mg-text);
}
.table-responsive { border-radius: var(--radius); overflow: hidden; }

/* Contextual row states (e.g. a locked `table-light` row, a `table-warning`
   missing-timeout row) — Bootstrap fills these with near-white / pale tints that
   read as jarring white blocks on the charcoal theme. Retune them to the brand
   surface + soft semantic washes so they stay subtle in both themes. */
.table > tbody > tr.table-light > * {
  --bs-table-bg: var(--mg-surface-2);
  --bs-table-color: var(--mg-text-muted);
}
.table > tbody > tr.table-warning > * {
  --bs-table-bg: hsl(var(--warning) / 0.12);
  --bs-table-color: var(--mg-text);
}
.table > tbody > tr.table-danger > * {
  --bs-table-bg: hsl(var(--destructive) / 0.10);
  --bs-table-color: var(--mg-text);
}
.table > tbody > tr.table-success > * {
  --bs-table-bg: hsl(var(--success) / 0.10);
  --bs-table-color: var(--mg-text);
}

/* ═══ Attendance: steady header, scrollable records ════════ */
/* Keep the title / tabs / filter / summary fixed and let ONLY the records
   table scroll. Scoped to the List tab via .att-page.att-scroll so the
   Calendar / My Schedule tabs keep normal document scrolling. Uses :has()
   (already relied on elsewhere in this file). */
.mg-content:has(> .att-page.att-scroll) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.att-page.att-scroll {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;                 /* let the table shrink so it can scroll */
}
.att-page.att-scroll .att-records {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;             /* the card clips; the inner region scrolls */
}
.att-page.att-scroll .att-records > .table-responsive {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
/* Header row rides along at the top of the scroll region. thead already has an
   opaque surface fill so rows never show through. */
.att-page.att-scroll .att-records thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}
/* Tablet / mobile: the summary cards wrap and eat vertical space, so fall back
   to normal page scrolling — the table never gets squeezed to a sliver. */
@media (max-width: 991.98px) {
  .mg-content:has(> .att-page.att-scroll) { display: block; overflow-y: auto; }
  .att-page.att-scroll { display: block; }
  .att-page.att-scroll .att-records,
  .att-page.att-scroll .att-records > .table-responsive { display: block; }
  .att-page.att-scroll .att-records thead th { position: static; }
}

/* ═══ Table pager (MGPaginate) ═════════════════════════════ */
.mg-pager {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--mg-border);
  background: var(--mg-surface);
  font-size: 12.5px;
  color: var(--mg-text-muted);
}
.mg-pager .mg-pager-info b { color: var(--mg-text); font-weight: 600; }
.mg-pager .mg-pager-nav { display: flex; align-items: center; gap: 8px; }
.mg-pager .mg-pager-nav .sep { opacity: .45; }
.mg-pager .mg-pager-page { color: var(--mg-text); font-weight: 500; }
.mg-pager button {
  border: 1px solid var(--mg-border);
  background: var(--mg-surface);
  color: var(--mg-text);
  border-radius: 7px;
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.mg-pager button:hover:not(:disabled) { background: var(--mg-surface-2); border-color: hsl(var(--primary) / 0.4); color: hsl(var(--primary)); }
.mg-pager button:disabled { opacity: .45; cursor: not-allowed; }
/* Inside the steady-scroll records card the pager is a fixed footer that never
   scrolls away. */
.att-page.att-scroll .att-records .mg-pager { flex: 0 0 auto; }

/* ═══ Forms ═════════════════════════════════════════════════ */
.form-control, .form-select {
  background: var(--mg-surface);
  color: var(--mg-text);
  border: 1px solid var(--mg-border);
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--mg-shadow-sm);
}
.form-control-sm, .form-select-sm { padding: 7px 11px; font-size: 13px; border-radius: 7px; }
.form-control:focus, .form-select:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.20);
  background: var(--mg-surface);
  color: var(--mg-text);
}

.form-label, .form-check-label {
  color: var(--mg-text);
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 6px;
}
.form-label.small { font-size: 12px; }
.form-check-input { accent-color: hsl(var(--primary)); border-color: var(--mg-border); }
.form-check-input:checked { background-color: hsl(var(--primary)); border-color: hsl(var(--primary)); }

select option { background: var(--mg-surface); color: var(--mg-text); }

/* ═══ Searchable select (MGCombo) ══════════════════════════ */
/* The native <select> is kept for form submission once enhanced. It stays
   rendered (opacity 0, 1px tall, behind the input) instead of display:none so
   that a `required` select is still focusable — the browser refuses to show the
   "please select an item" bubble on a control it cannot focus, which would
   silently block submit. */
select.mg-combo.mg-combo-native {
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px;
  padding: 0; border: 0; margin: 0;
  opacity: 0; pointer-events: none;
}
.mg-combo-wrap { position: relative; }
/* :focus included so the chevron survives `.form-control:focus`'s background
   shorthand (which would otherwise reset background-image to none). */
.mg-combo-input,
.mg-combo-input:focus {
  cursor: text;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right .65rem center;
  background-size: 13px 10px;
}
.mg-combo-clear {
  position: absolute;
  top: 50%; right: .5rem;
  transform: translateY(-50%);
  display: none;
  align-items: center; justify-content: center;
  width: 18px; height: 18px;
  padding: 0; border: 0;
  border-radius: 50%;
  background: var(--mg-surface-2);
  color: var(--mg-text-muted);
  font-size: 10px; line-height: 1;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.mg-combo-wrap.has-value .mg-combo-clear { display: inline-flex; }
.mg-combo-clear:hover { background: hsl(var(--destructive) / 0.14); color: hsl(var(--destructive)); }
/* When the clear button is visible, drop the dropdown chevron so the two
   controls don't stack in the same corner. */
.mg-combo-wrap.has-value .mg-combo-input,
.mg-combo-wrap.has-value .mg-combo-input:focus { background-image: none; }

.mg-combo-panel {
  position: absolute;
  z-index: 1056;
  top: calc(100% + 4px); left: 0; right: 0;
  background: hsl(var(--popover));
  border: 1px solid var(--mg-border);
  border-radius: 10px;
  box-shadow: var(--mg-shadow-md);
  padding: 5px;
  max-height: 260px;
  overflow-y: auto;
  display: none;
}
.mg-combo-panel.show { display: block; }
.mg-combo-opt {
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: hsl(var(--popover-foreground));
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mg-combo-opt.is-active,
.mg-combo-opt:hover { background: var(--mg-surface-2); }
.mg-combo-opt.is-selected { color: hsl(var(--primary)); font-weight: 600; }
.mg-combo-empty {
  padding: 10px;
  text-align: center;
  color: var(--mg-text-muted);
  font-size: 12.5px;
}

/* ═══ Buttons (shadcn-style) ════════════════════════════════ */
.btn {
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 500;
  font-size: 13.5px;
  font-family: inherit;
  letter-spacing: -0.005em;
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s, transform .1s;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { padding: 12px 22px; font-size: 14.5px; border-radius: 10px; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.50; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px hsl(var(--ring) / 0.30); }

/* Primary — solid blue */
/* Primary — restrained neutral slate with an amber label + accent border.
   Amber reads as the accent, not a full slab. */
.btn-primary {
  --bs-btn-color:          hsl(var(--primary));
  --bs-btn-hover-color:    hsl(var(--primary));
  --bs-btn-active-color:   hsl(var(--primary));
  --bs-btn-disabled-color: hsl(var(--primary) / 0.55);
  background-color: #2C3A4B;
  background-image: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: none;
  font-weight: 600;
}
.btn-primary:hover {
  background-color: #33445A;
  border-color: hsl(var(--primary) / 0.5);
  color: hsl(var(--primary));
}
.btn-primary:active:not(:disabled) {
  background-color: #26323F;
  border-color: hsl(var(--primary) / 0.6);
}
.btn-primary:disabled {
  background-color: #2C3A4B;
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: none;
}

/* Light = neutral surface buttons (used heavily) */
.btn-light {
  background: var(--mg-surface);
  border: 1px solid var(--mg-border);
  color: var(--mg-text);
  box-shadow: var(--mg-shadow-sm);
}
.btn-light:hover, .btn-light:focus {
  background: var(--mg-surface-2);
  border-color: var(--mg-border);
  color: var(--mg-text);
}
.btn-light.text-danger {
  color: hsl(var(--destructive)) !important;
  border-color: var(--mg-border);
}
.btn-light.text-danger:hover {
  background: hsl(var(--destructive) / 0.08);
  color: hsl(var(--destructive)) !important;
  border-color: hsl(var(--destructive) / 0.40);
}

/* Outlines */
.btn-outline-secondary {
  border: 1px solid var(--mg-border);
  color: var(--mg-text);
  background: transparent;
}
.btn-outline-secondary:hover {
  background: var(--mg-surface-2);
  border-color: var(--mg-border);
  color: var(--mg-text);
}
.btn-outline-primary {
  border: 1px solid hsl(var(--primary));
  color: hsl(var(--primary));
  background: transparent;
}
.btn-outline-primary:hover { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }

/* Semantic */
.btn-success { background: hsl(var(--success)); border-color: hsl(var(--success)); color: #fff; }
.btn-success:hover { background: hsl(142 71% 38%); border-color: hsl(142 71% 38%); color: #fff; }
.btn-danger  { background: hsl(var(--destructive)); border-color: hsl(var(--destructive)); color: #fff; }
.btn-danger:hover  { background: hsl(0 84% 50%); border-color: hsl(0 84% 50%); color: #fff; }
.btn-warning { background: hsl(var(--warning)); border-color: hsl(var(--warning)); color: hsl(var(--warning-foreground)); }

/* ═══ App shell ═════════════════════════════════════════════ */
.mg-shell { display: flex; flex: 1; min-height: 100vh; width: 100%; }

.mg-sidebar {
  width: var(--mg-sidebar-w);
  background: hsl(var(--sidebar-bg));
  color: hsl(var(--sidebar-fg));
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  transition: width var(--mg-trans);
  border-right: 1px solid hsl(var(--sidebar-border));
}
.mg-sidebar::-webkit-scrollbar { width: 0; }

.mg-brand {
  padding: 0 22px;
  height: var(--mg-header-h);
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid hsl(var(--sidebar-border));
  font-weight: 700; font-size: 17px;
  color: hsl(var(--sidebar-fg));
  white-space: nowrap; overflow: hidden;
  flex-shrink: 0;
  font-family: 'Sora', 'Inter', sans-serif;
  letter-spacing: -0.02em;
}
.mg-brand .bi-bricks {
  color: hsl(var(--primary));
  font-size: 22px; flex-shrink: 0;
  width: 30px; text-align: center;
}
.mg-brand-logo {
  width: 30px; height: 30px; flex-shrink: 0;
  object-fit: contain; border-radius: 4px;
}
.mg-brand span {
  transition: opacity var(--mg-trans), max-width var(--mg-trans);
  max-width: 200px; opacity: 1; overflow: hidden;
}

.mg-nav { padding: 12px 10px; flex: 1; }

.mg-link {
  padding: 9px 12px;
  display: flex; align-items: center; gap: 12px;
  color: hsl(var(--sidebar-muted));
  font-size: 13.5px; font-weight: 500;
  white-space: nowrap; position: relative; user-select: none;
  border-radius: 7px;
  margin-bottom: 2px;
  transition: background .15s, color .15s, padding .25s;
}
.mg-link i { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; opacity: 0.85; }
.mg-link:hover {
  background: hsl(var(--sidebar-hover));
  color: hsl(var(--sidebar-fg));
}
.mg-link.active {
  background: hsl(var(--sidebar-active-bg) / 0.14);
  color: hsl(var(--sidebar-active-fg));
  font-weight: 600;
}
.mg-link.active i { opacity: 1; color: hsl(var(--sidebar-active-fg)); }
.mg-link.active::before {
  content: '';
  position: absolute;
  left: -10px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: hsl(var(--sidebar-active-bg));
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 10px hsl(var(--sidebar-active-bg) / 0.55);
}
body.sidebar-collapsed .mg-link.active::before { left: -8px; }

/* Parent group of the current page — softer indicator (no full blue button).
   Brightens the text + adds a small left accent bar. */
.mg-link.mg-toggle.is-current {
  color: hsl(var(--sidebar-fg));
}
.mg-link.mg-toggle.is-current i { opacity: 1; }
.mg-link.mg-toggle.is-current::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: hsl(var(--primary));
  border-radius: 0 3px 3px 0;
}
body.sidebar-collapsed .mg-link.mg-toggle.is-current::before { left: -8px; }
.mg-link span {
  transition: opacity var(--mg-trans), max-width var(--mg-trans);
  max-width: 200px; opacity: 1; overflow: hidden;
  font-size: 13.5px;
}
.mg-sublink { padding-left: 38px; font-size: 13px; }
.mg-sub { padding: 4px 0 6px; }

/* Nested sub-group ─ e.g. HRIS > Settings > Departments */
.mg-link.mg-subgroup {
  padding-left: 32px;
  font-size: 12.5px;
  color: hsl(var(--sidebar-muted));
  letter-spacing: 0.02em;
  font-weight: 600;
}
.mg-link.mg-subgroup i { font-size: 13px; }
.mg-sub-nested .mg-sublink { padding-left: 52px; font-size: 12.5px; }
.mg-sub-nested .mg-link { padding-left: 52px; font-size: 12.5px; }
body.sidebar-collapsed .mg-link.mg-subgroup { display: none !important; }
body.sidebar-collapsed .mg-sub-nested { display: none !important; }
.mg-toggle .bi-chevron-down { opacity: .55; transition: transform .2s; font-size: 11px !important; }
.mg-toggle:not(.collapsed) .bi-chevron-down { transform: rotate(180deg); }

/* Sidebar collapsed (icon-only, desktop) */
@media (min-width: 992px) {
  body.sidebar-collapsed .mg-sidebar { width: var(--mg-sidebar-icon-w); }
  body.sidebar-collapsed .mg-brand { padding: 0; justify-content: center; }
  body.sidebar-collapsed .mg-brand span { max-width: 0; opacity: 0; }
  body.sidebar-collapsed .mg-link { padding: 11px 0; justify-content: center; gap: 0; margin: 2px 8px; }
  body.sidebar-collapsed .mg-link span,
  body.sidebar-collapsed .mg-link .ms-auto { max-width: 0; opacity: 0; display: none !important; }
  body.sidebar-collapsed .mg-sub { display: none !important; }

  body.sidebar-collapsed .mg-link[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(var(--mg-sidebar-icon-w) + 6px);
    top: 50%; transform: translateY(-50%) translateX(6px);
    background: hsl(var(--popover));
    color: hsl(var(--popover-foreground));
    border: 1px solid var(--mg-border);
    padding: 6px 12px; border-radius: 6px;
    font-size: 12px; font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s, transform .15s;
    z-index: 9999;
    box-shadow: var(--mg-shadow-md);
  }
  body.sidebar-collapsed .mg-link[data-tooltip]:hover::after {
    opacity: 1; transform: translateY(-50%) translateX(0);
  }
}

/* ═══ Topbar + main ═════════════════════════════════════════ */
.mg-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mg-topbar {
  height: var(--mg-header-h);
  background: var(--mg-surface);
  border-bottom: 1px solid var(--mg-border);
  padding: 0 24px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 10;
}
.mg-page-title {
  font-size: 17px; font-weight: 600; color: var(--mg-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: 'Sora', 'Inter', sans-serif;
  letter-spacing: -0.02em;
  margin: 0;
}

.mg-content { padding: 24px; flex: 1; overflow-y: auto; }
.mg-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--mg-border);
  background: var(--mg-surface);
  color: var(--mg-text-muted);
  font-size: 12px;
}

.mg-hamburger {
  background: none; border: none;
  color: var(--mg-text); font-size: 18px;
  padding: 8px 10px; border-radius: 7px;
  transition: background .15s, color .15s;
  cursor: pointer; flex-shrink: 0; line-height: 1;
}
.mg-hamburger:hover { background: var(--mg-surface-2); }

/* ═══ Stat cards ════════════════════════════════════════════ */
.mg-stat {
  background: var(--mg-surface);
  border: 1px solid var(--mg-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--mg-shadow-sm);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.mg-stat:hover {
  transform: translateY(-1px);
  box-shadow: var(--mg-shadow-md);
  border-color: hsl(var(--border) / 0.85);
}
.mg-stat .icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: grid; place-items: center;
  background: hsl(var(--primary) / 0.10); color: hsl(var(--primary));
  font-size: 18px; flex-shrink: 0;
}
.mg-stat .icon.tint-success { background: hsl(var(--success) / 0.12); color: hsl(var(--success)); }
.mg-stat .icon.tint-warning { background: hsl(var(--warning) / 0.14); color: hsl(var(--warning)); }
.mg-stat .icon.tint-danger  { background: hsl(var(--destructive) / 0.10); color: hsl(var(--destructive)); }
.mg-stat .icon.tint-info    { background: hsl(var(--info) / 0.12); color: hsl(var(--info)); }
.mg-stat .label {
  font-size: 11.5px; color: var(--mg-text-muted);
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
  margin-bottom: 2px;
}
.mg-stat .value {
  font-size: 26px; font-weight: 700; color: var(--mg-text);
  font-family: 'Sora', 'Inter', sans-serif; line-height: 1.1;
  letter-spacing: -0.02em;
}
/* Amber-accented KPI — for the hero metric(s) in an executive row */
.mg-stat.mg-stat-accent {
  border-color: hsl(var(--primary) / 0.35);
  background:
    linear-gradient(135deg, hsl(var(--primary) / 0.10), transparent 55%),
    var(--mg-surface);
}
.mg-stat.mg-stat-accent::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: hsl(var(--primary));
  border-radius: var(--radius) 0 0 var(--radius);
}
.mg-stat { position: relative; overflow: hidden; }
.mg-stat.mg-stat-accent .value { color: hsl(var(--primary)); }
.mg-stat .delta { font-size: 12px; font-weight: 600; }
.mg-stat .delta.up   { color: hsl(var(--success)); }
.mg-stat .delta.down { color: hsl(var(--destructive)); }

/* ═══ Empty state ═══════════════════════════════════════════ */
.mg-empty { text-align: center; padding: 56px 16px; color: var(--mg-text-muted); }
.mg-empty .bi {
  font-size: 32px; color: hsl(var(--primary)); opacity: .8;
  display: inline-grid; place-items: center;
  width: 64px; height: 64px; border-radius: 12px;
  background: hsl(var(--primary) / 0.08); margin-bottom: 14px;
}
.mg-empty h6 { color: var(--mg-text); margin-bottom: 4px; font-weight: 600; font-family: 'Sora', 'Inter', sans-serif; }
.mg-empty p { font-size: 13px; margin-bottom: 16px; }

/* ═══ Skeletons ════════════════════════════════════════════ */
.mg-skel {
  background: linear-gradient(90deg,
    var(--mg-surface-2) 25%,
    hsl(var(--border)) 50%,
    var(--mg-surface-2) 75%);
  background-size: 200% 100%;
  animation: mg-skel 1.4s ease-in-out infinite;
  border-radius: 6px;
  display: inline-block;
}
@keyframes mg-skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.mg-skel-line { height: 12px; width: 100%; margin-bottom: 8px; }
.mg-skel-bubble { height: 36px; width: 60%; margin-bottom: 10px; border-radius: 12px; }

/* ═══ Notifications dropdown ════════════════════════════════ */
.mg-notif-menu {
  min-width: 340px;
  max-width: 380px;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
}
.mg-notif-menu .mg-notif-list {
  max-height: 400px;
  overflow-y: auto;
}
.mg-notif-menu .mg-notif-item {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--mg-border, #e5e7eb);
  background: rgba(245, 158, 11, .05);
  overflow: hidden; /* keep slide-out animation clean */
  position: relative;
}
.mg-notif-menu .mg-notif-item:last-child { border-bottom: 0; }
.mg-notif-menu .mg-notif-item:hover { background: rgba(245, 158, 11, .10); }
.mg-notif-menu .mg-notif-link {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 6px 10px 14px;
  text-decoration: none;
  color: var(--mg-text, #111827);
  min-width: 0;
}
.mg-notif-menu .mg-notif-link:hover { color: var(--mg-text, #111827); }
.mg-notif-menu .mg-notif-dismiss {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: var(--mg-muted, #6b7280);
  padding: 0 12px;
  font-size: 1.15em;
  line-height: 1;
  cursor: pointer;
  opacity: .55;
  transition: opacity .12s, color .12s, background .12s;
}
.mg-notif-menu .mg-notif-item:hover .mg-notif-dismiss { opacity: 1; }
.mg-notif-menu .mg-notif-dismiss:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, .08);
}
.mg-notif-menu .mg-notif-dot {
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: hsl(var(--primary));
  flex-shrink: 0;
}
.mg-notif-menu .mg-notif-body-wrap {
  flex: 1 1 auto;
  min-width: 0;            /* allows ellipsis truncation in flex children */
}
.mg-notif-menu .mg-notif-row-1 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.mg-notif-menu .mg-notif-title {
  font-weight: 600;
  font-size: .88em;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  color: hsl(var(--primary));
}
.mg-notif-menu .mg-notif-time {
  font-size: .72em;
  color: var(--mg-muted, #6b7280);
  white-space: nowrap;
  flex-shrink: 0;
}
.mg-notif-menu .mg-notif-msg {
  display: block;
  margin-top: 2px;
  font-size: .78em;
  color: var(--mg-muted, #6b7280);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ═══ Toasts ════════════════════════════════════════════════ */
.mg-toast-container {
  position: fixed; top: 72px; right: 20px; z-index: 1090;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.mg-toast {
  pointer-events: auto;
  background: var(--mg-surface); color: var(--mg-text);
  border: 1px solid var(--mg-border); border-left: 3px solid hsl(var(--primary));
  border-radius: 10px; padding: 12px 14px;
  min-width: 280px; max-width: 380px;
  box-shadow: var(--mg-shadow-md);
  display: flex; align-items: flex-start; gap: 10px;
  animation: mg-toast-in .25s ease-out;
}
.mg-toast.t-success { border-left-color: hsl(var(--success)); }
.mg-toast.t-success .mg-toast-icon { color: hsl(var(--success)); }
.mg-toast.t-warning { border-left-color: hsl(var(--warning)); }
.mg-toast.t-warning .mg-toast-icon { color: hsl(var(--warning)); }
.mg-toast.t-danger  { border-left-color: hsl(var(--destructive)); }
.mg-toast.t-danger  .mg-toast-icon { color: hsl(var(--destructive)); }
.mg-toast.t-info    { border-left-color: hsl(var(--primary)); }
.mg-toast.t-info    .mg-toast-icon { color: hsl(var(--primary)); }
.mg-toast-icon { font-size: 18px; line-height: 1; }
.mg-toast-body { font-size: 13.5px; flex: 1; }
.mg-toast-close {
  background: none; border: 0; color: var(--mg-text-muted);
  cursor: pointer; font-size: 18px; line-height: 1; padding: 0;
}
.mg-toast.is-leaving { animation: mg-toast-out .2s ease-in forwards; }
@keyframes mg-toast-in  { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes mg-toast-out { to   { transform: translateX(20px); opacity: 0; } }

/* ═══ Theme toggle button ═══════════════════════════════════ */
.mg-theme-toggle .bi-sun-fill   { display: none; }
.mg-theme-toggle .bi-moon-stars { display: inline-block; }
[data-bs-theme="dark"] .mg-theme-toggle .bi-sun-fill   { display: inline-block; }
[data-bs-theme="dark"] .mg-theme-toggle .bi-moon-stars { display: none; }

/* ═══ Badges (shadcn pill style) ═══════════════════════════ */
.badge {
  font-family: inherit;
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0;
  padding: 3px 9px;
  border-radius: 6px;
  text-transform: none;
  border: 1px solid transparent;
}
.badge.text-bg-secondary {
  background: var(--mg-surface-2) !important;
  color: var(--mg-text) !important;
  border-color: var(--mg-border);
}
.badge.text-bg-success {
  background: hsl(var(--success) / 0.12) !important;
  color: hsl(142 71% 30%) !important;
  border-color: hsl(var(--success) / 0.30);
}
.badge.text-bg-warning {
  background: hsl(var(--warning) / 0.14) !important;
  color: hsl(26 83% 30%) !important;
  border-color: hsl(var(--warning) / 0.30);
}
.badge.text-bg-danger {
  background: hsl(var(--destructive) / 0.10) !important;
  color: hsl(var(--destructive)) !important;
  border-color: hsl(var(--destructive) / 0.30);
}
.badge.text-bg-info {
  background: hsl(var(--info) / 0.10) !important;
  color: hsl(var(--info)) !important;
  border-color: hsl(var(--info) / 0.30);
}
.badge.text-bg-primary {
  background: hsl(var(--accent)) !important;
  color: hsl(var(--accent-foreground)) !important;
  border-color: hsl(var(--primary) / 0.20);
}
.badge.text-bg-dark {
  background: hsl(var(--foreground)) !important;
  color: hsl(var(--background)) !important;
}
.badge.bg-secondary { background: var(--mg-surface-2) !important; color: var(--mg-text) !important; border: 1px solid var(--mg-border); }
.badge.bg-danger    { background: hsl(var(--destructive)) !important; }
.badge.bg-success   { background: hsl(var(--success)) !important; }

/* Soft status pills (text-bg-success/warning/danger/info/primary) carry a dark
   ink tuned for the LIGHT theme — on charcoal that ink is nearly invisible
   (e.g. an "ACTIVE" green pill). On the dark theme, render them as SOLID light
   chips (light fill + dark ink) — the same readable style as the badge-soft
   pills (Time In / duplicate / Time Out). */
[data-bs-theme="dark"] .badge.text-bg-success {
  background: #dcfce7 !important;
  color: #15803d !important;
  border-color: #bbf7d0;
}
[data-bs-theme="dark"] .badge.text-bg-warning {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border-color: #fde68a;
}
[data-bs-theme="dark"] .badge.text-bg-danger {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fecaca;
}
[data-bs-theme="dark"] .badge.text-bg-info {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border-color: #bae6fd;
}
[data-bs-theme="dark"] .badge.text-bg-primary {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border-color: #fde68a;
}
/* Solid semantic badges (.bg-success/.bg-danger without text-bg) need light ink
   on their filled color so the label doesn't vanish. */
[data-bs-theme="dark"] .badge.bg-success,
[data-bs-theme="dark"] .badge.bg-danger,
[data-bs-theme="dark"] .badge.bg-primary { color: #fff !important; }

/* Neutral "light" chips (`badge bg-light text-dark`) — on the dark theme the
   .bg-light surface became charcoal, so the paired .text-dark would be
   unreadable. Give these a subtle surface + legible text + hairline border.
   Amber/info/warning badges keep their dark ink (readable on a light fill). */
.badge.bg-light,
.badge.text-bg-light {
  background: var(--mg-surface-2) !important;
  color: var(--mg-text) !important;
  border: 1px solid var(--mg-border);
}
[data-bs-theme="dark"] .badge.bg-light.text-dark,
[data-bs-theme="dark"] .badge.text-bg-light.text-dark,
[data-bs-theme="dark"] .badge.bg-light.text-muted {
  color: var(--mg-text) !important;
}

/* ═══ Pagination ════════════════════════════════════════════ */
.pagination { gap: 4px; margin-top: 8px; }
.page-link {
  background: var(--mg-surface);
  border: 1px solid var(--mg-border);
  border-radius: 7px !important;
  color: var(--mg-text);
  font-size: 13px; font-weight: 500;
  padding: 7px 12px;
  transition: all .15s;
  box-shadow: var(--mg-shadow-sm);
}
.page-link:hover { background: var(--mg-surface-2); color: var(--mg-text); }
.page-item.active .page-link {
  background: hsl(var(--primary)); border-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

/* ═══ Tabs ═════════════════════════════════════════════════ */
.nav-tabs { border-color: var(--mg-border); }
.nav-tabs .nav-link {
  color: var(--mg-text-muted); border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500; font-size: 13.5px;
  padding: 10px 16px;
}
.nav-tabs .nav-link:hover { color: var(--mg-text); border-color: transparent; }
.nav-tabs .nav-link.active {
  color: hsl(var(--primary)); background: transparent;
  border-bottom-color: hsl(var(--primary));
  font-weight: 600;
}

/* ═══ Dropdowns ════════════════════════════════════════════ */
.dropdown-menu {
  background: hsl(var(--popover));
  border: 1px solid var(--mg-border);
  border-radius: 10px;
  box-shadow: var(--mg-shadow-md);
  padding: 5px;
  min-width: 220px;
}
.dropdown-item {
  color: hsl(var(--popover-foreground));
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  display: flex; align-items: center; gap: 10px;
}
.dropdown-item:hover, .dropdown-item:focus {
  background: var(--mg-surface-2);
  color: hsl(var(--popover-foreground));
}
.dropdown-item.text-danger { color: hsl(var(--destructive)) !important; }
.dropdown-item.text-danger:hover { background: hsl(var(--destructive) / 0.08); color: hsl(var(--destructive)) !important; }
.dropdown-divider { border-color: var(--mg-border); margin: 5px 0; }

/* Topbar user button — soft pill */
.mg-topbar .dropdown > .dropdown-toggle {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--mg-text);
  font-weight: 500;
  font-size: 13px;
}
.mg-topbar .dropdown > .dropdown-toggle:hover {
  background: var(--mg-surface-2);
  border-color: var(--mg-border);
  color: var(--mg-text);
}
.mg-topbar .dropdown > .dropdown-toggle::after { display: none; }

/* ═══ Modals ═══════════════════════════════════════════════ */
.modal-content {
  background: var(--mg-surface);
  border: 1px solid var(--mg-border);
  border-radius: var(--radius);
  box-shadow: var(--mg-shadow-lg);
}
.modal-header { border-bottom: 1px solid var(--mg-border); padding: 18px 22px; }
.modal-title { color: var(--mg-text); font-weight: 600; font-size: 16px; font-family: 'Sora', 'Inter', sans-serif; letter-spacing: -0.01em; }
.modal-body { padding: 22px; }
.modal-backdrop.show { background: hsl(var(--foreground)); opacity: 0.55; backdrop-filter: blur(2px); }

/* ═══ List groups ═══════════════════════════════════════════ */
.list-group-item {
  background: var(--mg-surface); color: var(--mg-text);
  border-color: var(--mg-border);
  font-size: 13.5px;
  padding: 10px 14px;
}
.list-group-item-action:hover { background: var(--mg-surface-2); color: var(--mg-text); }
.list-group-item.active {
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

/* When the page already has a global live-search input, never show the
   per-table DataTables filter — uses :has() (Chrome/Edge 105+, Safari 15.4+,
   Firefox 121+). Keeps things clean even if the JS init misses. */
body:has(input.mg-livesearch) .dataTables_filter,
body:has(input.mg-livesearch) .dataTables_wrapper > .row:first-child > .col-md-6:last-child {
  display: none !important;
}

/* ═══ DataTables tweaks ═══════════════════════════════════ */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: var(--mg-surface); color: var(--mg-text);
  border: 1px solid var(--mg-border); border-radius: 7px;
  padding: 6px 10px; font-size: 13px; font-family: inherit;
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  border-color: hsl(var(--ring)); outline: none;
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.20);
}
.dataTables_wrapper .dataTables_paginate .paginate_button { color: var(--mg-text) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: hsl(var(--primary)) !important;
  color: hsl(var(--primary-foreground)) !important;
  border-color: hsl(var(--primary)) !important;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  color: var(--mg-text-muted); font-size: 13px;
}

/* ═══ Alerts ═══════════════════════════════════════════════ */
.alert {
  border-radius: 8px; border: 1px solid var(--mg-border);
  font-weight: 500; font-size: 13.5px;
  padding: 12px 16px;
}
.alert-info {
  background: hsl(var(--accent));
  border-color: hsl(var(--primary) / 0.20);
  color: hsl(var(--accent-foreground));
}
.alert-warning {
  background: hsl(var(--warning) / 0.10);
  border-color: hsl(var(--warning) / 0.30);
  color: hsl(26 83% 25%);
}
.alert-danger {
  background: hsl(var(--destructive) / 0.08);
  border-color: hsl(var(--destructive) / 0.30);
  color: hsl(var(--destructive));
}
.alert-success {
  background: hsl(var(--success) / 0.10);
  border-color: hsl(var(--success) / 0.30);
  color: hsl(142 71% 25%);
}
/* Dark theme: the hardcoded light-theme text above is dark-on-dark (unreadable).
   Lift warning/success alert text to a bright, legible tint on the charcoal surface. */
[data-bs-theme="dark"] .alert-warning { color: hsl(38 96% 78%); }
[data-bs-theme="dark"] .alert-success { color: hsl(152 60% 74%); }
/* Links inside alerts inherit the alert text color (global `a` clears both) —
   underline them so they stay legible and obviously clickable in either theme. */
.alert a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ═══ Login screen ═════════════════════════════════════════ */
.mg-login {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(900px 500px at 0% 0%, hsl(var(--primary) / 0.20), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, hsl(28 80% 46% / 0.16), transparent 60%),
    var(--mg-bg);
}
.mg-login .card {
  width: 100%; max-width: 420px;
  border: 1px solid var(--mg-border); border-radius: var(--radius);
  box-shadow: var(--mg-shadow-lg);
  background: var(--mg-surface);
}
.mg-login .card .bi-bricks { color: hsl(var(--primary)) !important; }
.mg-login .card h4 { color: var(--mg-text); font-family: 'Sora', 'Inter', sans-serif; letter-spacing: -0.02em; }

/* ═══ Kiosk ═══════════════════════════════════════════════ */
.kiosk-pad button { font-size: 24px; padding: 22px 40px; border-radius: 12px; font-weight: 600; }

/* ═══ Mobile ═══════════════════════════════════════════════ */
@media (max-width: 991.98px) {
  .mg-sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%); transition: transform .25s ease;
    z-index: 1050; box-shadow: var(--mg-shadow-lg);
  }
  .mg-sidebar.show { transform: translateX(0); }
  .mg-content { padding: 16px; }
  .mg-link::after, .mg-link::before { display: none !important; }
}

@media (max-width: 767.98px) {
  .mg-content { padding: 12px; }
  .mg-topbar { padding: 0 14px; height: 54px; }
  .mg-page-title { font-size: 15px; }
  .mg-stat { padding: 14px; }
  .mg-stat .value { font-size: 22px; }

  table.mg-stacked thead { display: none; }
  table.mg-stacked, table.mg-stacked tbody, table.mg-stacked tr, table.mg-stacked td { display: block; width: 100%; }
  table.mg-stacked tr {
    background: var(--mg-surface); border: 1px solid var(--mg-border);
    border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
  }
  table.mg-stacked td { border: none; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; }
  table.mg-stacked td::before {
    content: attr(data-label);
    color: var(--mg-text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
    font-weight: 600; flex-shrink: 0;
  }
}

/* ═══ Misc ═════════════════════════════════════════════════ */
.text-success { color: hsl(var(--success)) !important; }
.text-danger  { color: hsl(var(--destructive)) !important; }
.text-warning { color: hsl(var(--warning)) !important; }
.text-primary { color: hsl(var(--primary)) !important; }
.fw-bold { font-weight: 600; }

/* Smooth scroll bars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--mg-surface-2); }
::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 5px; border: 2px solid var(--mg-surface-2); }
::-webkit-scrollbar-thumb:hover { background: var(--mg-text-muted); }
