/* ============================================================
   Repair Pro — Minimal Admin Console
   Color: Orange accent on a calm, refined neutral canvas
   ============================================================ */

:root {
  --primary: #f97316;
  --primary-2: #fb923c;
  --primary-dark: #ea580c;
  --primary-deep: #c2410c;
  --primary-soft: #fff4ec;          /* very light orange wash */
  --primary-glow: rgba(249, 115, 22, .28);
  --accent: #fbbf24;
  --accent-2: #f59e0b;

  --success: #16a34a;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #0ea5e9;
  --purple: #8b5cf6;

  /* Neutral canvas */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --border: #ecedf1;
  --border-strong: #e2e4ea;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;

  /* Sidebar tokens — light by default, overridden in dark mode */
  --sidebar-bg: #ffffff;
  --sidebar-border: #ecedf1;
  --sidebar-text: #5b616e;
  --sidebar-text-strong: #1a1d23;
  --sidebar-muted: #9ca3af;
  --sidebar-hover: #f5f6f8;
  --sidebar-active-bg: var(--primary-soft);
  --sidebar-active-text: var(--primary-dark);

  --gradient-1: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
  --gradient-2: linear-gradient(135deg, #ea580c 0%, #fb923c 100%);
  --gradient-dim: var(--primary-soft);

  --radius-sm: 9px;
  --radius: 13px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Soft, neutral shadows (no colored glow) */
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .04);
  --shadow: 0 2px 8px -2px rgba(17, 24, 39, .06), 0 1px 2px rgba(17, 24, 39, .04);
  --shadow-md: 0 6px 20px -6px rgba(17, 24, 39, .10);
  --shadow-lg: 0 14px 40px -12px rgba(17, 24, 39, .14);
  --shadow-glow: 0 0 0 1px rgba(249,115,22,.18), 0 8px 24px -8px rgba(249,115,22,.22);

  --t-fast: 120ms cubic-bezier(.4,0,.2,1);
  --t-base: 200ms cubic-bezier(.4,0,.2,1);
  --t-slow: 360ms cubic-bezier(.4,0,.2,1);

  --base-font-size: 16px;
}

* { box-sizing: border-box; }
html { font-size: var(--base-font-size, 16px); }

body {
  font-family: 'Sarabun', 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html[lang="en"] body { font-family: 'Inter', 'Sarabun', system-ui, sans-serif; }

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.01em; color: var(--text); }

a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary-deep); }

code, .mono { font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace; }

/* ============================================================
   Layout
   ============================================================ */
.admin-wrapper { display: flex; min-height: 100vh; position: relative; }

/* SIDEBAR — light, minimal rail */
.admin-sidebar {
  width: 258px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
  z-index: 1040;
  overflow-y: auto;
}
.admin-sidebar::-webkit-scrollbar { width: 6px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,.08); border-radius: 3px; }

.sidebar-brand {
  padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: .7rem;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: 72px;
  position: relative;
}
.sb-brand-link {
  display: flex; align-items: center; gap: .65rem;
  font-size: 1.05rem; font-weight: 700;
  color: var(--sidebar-text-strong); text-decoration: none;
  flex: 1; min-width: 0;
}
.sidebar-brand-icon {
  width: 38px; height: 38px;
  background: var(--gradient-1);
  border-radius: 11px;
  display: grid; place-items: center;
  color: #fff; font-size: 1.1rem;
  box-shadow: 0 3px 10px -3px var(--primary-glow);
  flex-shrink: 0;
}
.sb-brand-name { color: var(--sidebar-text-strong); font-weight: 700; }
.sb-brand-tag { font-size: .62rem; font-weight: 600; letter-spacing: .12em; color: var(--sidebar-muted); text-transform: uppercase; margin-top: 2px; display: block; }

.sidebar-close { display: none; }

.sidebar-nav {
  padding: .85rem .7rem 1.5rem;
  flex: 1; overflow-y: auto;
}
.sidebar-section-label {
  padding: 1rem .85rem .4rem;
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--sidebar-muted);
  font-weight: 700;
}

.sb-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .8rem;
  margin-bottom: .1rem;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  font-size: .9rem;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.sb-link i { font-size: 1.05rem; width: 22px; display: inline-grid; place-items: center; opacity: .7; }
.sb-link:hover {
  color: var(--sidebar-text-strong);
  background: var(--sidebar-hover);
}
.sb-link:hover i { opacity: 1; }
.sb-link.active {
  color: var(--sidebar-active-text);
  background: var(--sidebar-active-bg);
  font-weight: 600;
}
.sb-link.active i { color: var(--primary); opacity: 1; }
.sb-link.active::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}
.sb-link .badge-mini {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: .65rem;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-weight: 700;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--sidebar-border);
  font-size: .73rem;
  color: var(--sidebar-muted);
}
.sidebar-footer .vchip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: .68rem;
}

/* MAIN AREA */
.admin-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
  position: relative;
}

.admin-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1.5rem;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.admin-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.btn-burger {
  background: none; border: 0;
  width: 40px; height: 40px;
  display: none;
  align-items: center; justify-content: center;
  border-radius: 10px;
  color: var(--text);
}
.btn-burger:hover { background: var(--surface-2); }

.admin-content {
  padding: 1.4rem 1.6rem 3rem;
  flex: 1;
}

/* Top quick actions */
.cmd-search {
  flex: 1;
  max-width: 480px;
  margin-left: 1rem;
  position: relative;
}
.cmd-search input {
  width: 100%;
  padding: .55rem 1rem .55rem 2.4rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: .88rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.cmd-search input:focus {
  outline: 0;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(17,24,39,.04);
  background: #fff;
}
.cmd-search .icon {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
}
.cmd-search kbd {
  position: absolute; right: .6rem; top: 50%; transform: translateY(-50%);
  font-size: .65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--text-muted);
}

/* Header help button */
.header-help-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 1rem;
  transition: all var(--t-fast);
  flex-shrink: 0;
  margin-left: auto;
}
.header-help-btn:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: color-mix(in srgb, var(--primary) 25%, transparent);
}

/* User menu */
.user-menu-wrap { position: relative; }
.user-menu-trigger {
  display: flex; align-items: center; gap: .55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: .3rem .8rem .3rem .3rem;
  cursor: pointer;
  transition: all var(--t-fast);
}
.user-menu-trigger:hover { background: var(--surface-2); border-color: var(--border-strong); }
.um-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gradient-1);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: .85rem;
}
.um-info { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.um-name { font-size: .82rem; font-weight: 700; color: var(--text); }
.um-role { font-size: .68rem; color: var(--text-muted); }

.megamenu {
  position: absolute; right: 0; top: calc(100% + .5rem);
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: all var(--t-base);
  z-index: 200;
}
.megamenu.show { opacity: 1; visibility: visible; transform: translateY(0); }
.mm-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .25rem .25rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .85rem;
}
.mm-avatar-lg {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--gradient-1);
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px -4px var(--primary-glow);
}
.mm-name { font-weight: 800; }
.mm-role-pill {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--gradient-dim);
  color: var(--primary-dark);
  font-size: .7rem;
  font-weight: 700;
  margin-top: 4px;
}
.mm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}
.mm-tile {
  display: flex; flex-direction: column; align-items: center;
  gap: .35rem;
  padding: .8rem .4rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all var(--t-fast);
}
.mm-tile:hover { background: var(--surface-2); transform: translateY(-2px); color: var(--text); }
.mm-tile-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
}
.mm-tile-icon.t-orange  { background: linear-gradient(135deg, #f97316, #ea580c); }
.mm-tile-icon.t-amber   { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.mm-tile-icon.t-pink    { background: linear-gradient(135deg, #ec4899, #be185d); }
.mm-tile-icon.t-purple  { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.mm-tile-icon.t-teal    { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.mm-tile-icon.t-blue    { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.mm-tile-icon.t-green   { background: linear-gradient(135deg, #22c55e, #16a34a); }
.mm-tile-label { font-size: .72rem; font-weight: 600; }

.mm-logout {
  display: flex; align-items: center; justify-content: center;
  gap: .5rem;
  padding: .7rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  color: var(--danger);
  font-weight: 700;
  text-decoration: none;
  margin-top: .85rem;
}
.mm-logout:hover { background: var(--danger); color: #fff; }

/* ============================================================
   Cards & surfaces
   ============================================================ */
.section-title {
  margin: .25rem 0 1.4rem;
  font-size: 1.4rem;
  font-weight: 700;
  display: flex; align-items: center; gap: .6rem;
}
.section-title i,
.section-title .text-gradient { color: var(--primary) !important; -webkit-text-fill-color: var(--primary); background: none; }

.card-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
}

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.1rem;
}
.section-header h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

/* Stat cards — minimal */
.stat-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.3rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.stat-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .85rem;
}
.stat-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.stat-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: grid; place-items: center;
  color: #fff;
  background: var(--stat-grad, var(--gradient-1));
  font-size: 1rem;
}
.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  line-height: 1.1;
}
.stat-trend {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .76rem;
  color: var(--text-muted);
  margin-top: .4rem;
}
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ============================================================
   Status pill
   ============================================================ */
.status-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .25rem .7rem .25rem .55rem;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--pill-color, #94a3b8) 14%, transparent);
  color: var(--pill-color, #475569);
  font-size: .76rem;
  font-weight: 700;
  border: 1px solid color-mix(in srgb, var(--pill-color, #94a3b8) 30%, transparent);
}
.status-pill .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--pill-color, #94a3b8);
  box-shadow: 0 0 8px var(--pill-color, #94a3b8);
}
@supports not (background: color-mix(in srgb, red, blue)) {
  .status-pill { background: rgba(148,163,184,.15); color: #475569; }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn { font-weight: 600; border-radius: 10px; transition: all var(--t-fast); }
.btn-primary {
  background: var(--primary);
  border: 0;
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
  box-shadow: 0 4px 12px -4px var(--primary-glow);
}
.btn-primary:focus { box-shadow: 0 0 0 3px rgba(249,115,22,.2); }
.btn-outline-primary {
  border: 1.5px solid var(--primary);
  color: var(--primary-dark);
  background: transparent;
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid color-mix(in srgb, var(--primary) 15%, transparent);
}
.btn-soft:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-danger-soft {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fee2e2;
}
.btn-danger-soft:hover { background: var(--danger); color: #fff; }

/* ============================================================
   Forms
   ============================================================ */
.form-control, .form-select {
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  padding: .58rem .85rem;
  font-size: .9rem;
  background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}
.form-control::placeholder { color: var(--text-soft); }
.form-label { font-weight: 600; font-size: .84rem; color: var(--text); margin-bottom: .4rem; }
.input-group .form-control { border-radius: 10px; }

/* Table */
.table {
  --bs-table-bg: transparent;
  margin: 0;
}
.table > :not(caption) > * > * { padding: .8rem 1rem; }
.table thead th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-soft);
  font-weight: 600;
  background: transparent;
  border-bottom: 1px solid var(--border);
}
.table tbody td { border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table-responsive { border-radius: var(--radius); overflow: hidden; }

/* Badges */
.badge {
  font-weight: 700;
  padding: .35em .7em;
  border-radius: var(--radius-pill);
}

/* ============================================================
   Toggle switch
   ============================================================ */
.rf-switch {
  display: inline-flex; align-items: center; gap: .5rem;
  cursor: pointer;
  user-select: none;
}
.rf-switch-input { position: absolute; opacity: 0; width: 0; height: 0; }
.rf-switch-track {
  position: relative;
  width: 38px; height: 22px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  transition: background var(--t-base);
  flex-shrink: 0;
}
.rf-switch-track::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base);
}
.rf-switch-input:checked + .rf-switch-track { background: var(--primary); }
.rf-switch-input:checked + .rf-switch-track::after { transform: translateX(16px); }
.rf-switch-input:disabled + .rf-switch-track { opacity: .55; }
.rf-switch-input:focus-visible + .rf-switch-track { box-shadow: 0 0 0 3px rgba(249,115,22,.2); }
.rf-switch-text { font-size: .8rem; font-weight: 600; color: var(--text-muted); min-width: 30px; }
.rf-switch-input:checked ~ .rf-switch-text { color: var(--primary-dark); }
.rf-switch-input.pin:checked + .rf-switch-track { background: var(--accent-2); }

/* ============================================================
   Repair timeline
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--primary), var(--accent), transparent);
}
.tl-item { position: relative; padding-bottom: 1.2rem; }
.tl-item::before {
  content: '';
  position: absolute;
  left: -1.5rem; top: 4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--tl-color, var(--primary));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tl-color, var(--primary)) 14%, transparent);
}
.tl-time { font-size: .75rem; color: var(--text-muted); }
.tl-title { font-weight: 700; margin: 2px 0 .15rem; }
.tl-body { font-size: .88rem; color: var(--text-muted); }

/* ============================================================
   Status flow (progress)
   ============================================================ */
.repair-flow {
  display: flex; align-items: center; gap: .4rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.flow-step {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem .7rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
}
.flow-step.done {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: color-mix(in srgb, var(--primary) 22%, transparent);
}
.flow-step.active {
  background: var(--primary);
  color: #fff;
  border: 0;
}
.flow-step.active .dot { background: #fff; box-shadow: 0 0 12px #fff; }
.flow-arrow { color: var(--text-soft); font-size: .8rem; }

/* ============================================================
   Sections hub (tiles)
   ============================================================ */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.hub-tile {
  display: flex; flex-direction: column; gap: .65rem;
  padding: 1.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
  position: relative;
  overflow: hidden;
}
.hub-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  color: var(--text);
}
.hub-tile-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--tile-grad, var(--gradient-1));
  color: #fff;
  font-size: 1.15rem;
  display: grid; place-items: center;
}
.hub-tile-name { font-weight: 700; font-size: .96rem; }
.hub-tile-desc { font-size: .8rem; color: var(--text-muted); }

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
}
.sidebar-backdrop.show { display: block; }

/* ============================================================
   Login page
   ============================================================ */
.login-bg {
  min-height: 100vh;
  display: grid; place-items: center;
  background:
    radial-gradient(1000px 700px at 20% 20%, rgba(249,115,22,.35), transparent 60%),
    radial-gradient(900px 700px at 80% 80%, rgba(251,191,36,.25), transparent 60%),
    radial-gradient(700px 500px at 50% 50%, rgba(99,102,241,.15), transparent 60%),
    linear-gradient(135deg, #0b0f1a 0%, #14192c 100%);
  position: relative;
  padding: 1.5rem;
  overflow: hidden;
}
.login-bg::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 50% at 50% 50%, #000 40%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse 80% 50% at 50% 50%, #000 40%, transparent 90%);
}
.login-card {
  position: relative; z-index: 2;
  width: 100%; max-width: 440px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 26px;
  padding: 2.2rem 2rem 1.75rem;
  box-shadow:
    0 32px 80px -20px rgba(0,0,0,.5),
    inset 0 1px 0 rgba(255,255,255,.4);
}
.login-logo {
  width: 72px; height: 72px;
  margin: 0 auto 1rem;
  border-radius: 22px;
  background: var(--gradient-1);
  display: grid; place-items: center;
  color: #fff; font-size: 1.85rem;
  box-shadow:
    0 16px 40px -10px var(--primary-glow),
    inset 0 1px 0 rgba(255,255,255,.4);
  position: relative;
}
.login-logo::after {
  content: '';
  position: absolute; inset: -10px;
  border-radius: 30px;
  background: var(--gradient-1);
  filter: blur(20px);
  opacity: .55;
  z-index: -1;
}

/* ============================================================
   Public tracking page
   ============================================================ */
.track-page {
  min-height: 100vh;
  background:
    radial-gradient(900px 700px at 0% 0%, rgba(249,115,22,.2), transparent 60%),
    radial-gradient(900px 700px at 100% 100%, rgba(251,191,36,.15), transparent 60%),
    linear-gradient(180deg, #0f1422 0%, #0b0f1a 100%);
  color: #fff;
  padding: 2rem 1rem;
}
.track-hero {
  max-width: 720px; margin: 0 auto 2rem;
  text-align: center;
}
.track-hero h1 {
  color: #fff;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 .5rem;
}
.track-hero .gradient-text {
  background: var(--gradient-1);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.track-hero p { color: rgba(255,255,255,.6); }
.track-form {
  max-width: 520px; margin: 0 auto;
  display: flex; gap: .5rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-pill);
  padding: .35rem;
  backdrop-filter: blur(8px);
}
.track-form input {
  flex: 1;
  background: transparent;
  border: 0;
  color: #fff;
  padding: .65rem 1rem;
  font-size: 1rem;
  outline: 0;
}
.track-form input::placeholder { color: rgba(255,255,255,.4); }
.track-form button {
  border: 0;
  background: var(--gradient-1);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: .6rem 1.4rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px -4px var(--primary-glow);
}

.track-detail {
  max-width: 920px; margin: 2rem auto 0;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
}
.track-detail h2 { color: #fff; }
.track-detail .label { color: rgba(255,255,255,.5); font-size: .8rem; }
.track-detail .value { color: #fff; font-weight: 600; }
.track-detail .repair-flow { background: rgba(0,0,0,.2); border-color: rgba(249,115,22,.3); }
.track-detail .flow-step:not(.done):not(.active) { background: rgba(255,255,255,.06); color: rgba(255,255,255,.5); border-color: rgba(255,255,255,.1); }

/* ============================================================
   Print styles — cover sheet / receipt
   ============================================================ */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 991.98px) {
  .admin-sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform var(--t-base);
  }
  .admin-sidebar.show { transform: translateX(0); }
  .sidebar-close { display: inline-grid; place-items: center; width: 36px; height: 36px; background: none; border: 0; color: #fff; border-radius: 10px; }
  .btn-burger { display: inline-flex; }
  .admin-content { padding: 1rem; }
  .cmd-search { display: none; }
}

@media (max-width: 575.98px) {
  .um-info { display: none; }
  .megamenu { width: calc(100vw - 2rem); right: -10px; }
}

/* Utility */
.text-gradient { background: var(--gradient-1); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* Minimal: solid accent for gradient-text inside the admin console (hero pages keep the gradient) */
.admin-content .text-gradient { background: none; -webkit-text-fill-color: var(--primary); color: var(--primary); }
.glow-orange { box-shadow: 0 0 0 1px rgba(249,115,22,.3), 0 10px 30px -8px var(--primary-glow); }
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}
.bento-grid > .b-3 { grid-column: span 3; }
.bento-grid > .b-4 { grid-column: span 4; }
.bento-grid > .b-5 { grid-column: span 5; }
.bento-grid > .b-6 { grid-column: span 6; }
.bento-grid > .b-7 { grid-column: span 7; }
.bento-grid > .b-8 { grid-column: span 8; }
.bento-grid > .b-12 { grid-column: span 12; }
@media (max-width: 991.98px) {
  .bento-grid > [class*="b-"] { grid-column: span 12; }
}

/* ============================================================
   Custom Confirm Modal (replaces native confirm())
   ============================================================ */
.rf-confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s;
}
.rf-confirm-backdrop.show { opacity: 1; visibility: visible; }

.rf-confirm {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.92);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .55);
  width: calc(100% - 2rem);
  max-width: 460px;
  z-index: 2001;
  opacity: 0;
  visibility: hidden;
  transition: transform .26s cubic-bezier(.4, 0, .2, 1), opacity .2s, visibility .2s;
  overflow: hidden;
  font-family: inherit;
}
.rf-confirm.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}
.rf-confirm::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: var(--confirm-grad, linear-gradient(90deg, var(--warning), var(--accent-2, #f59e0b)));
}

.rf-confirm-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 26px 26px 0;
}

.rf-confirm-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  flex-shrink: 0;
  position: relative;
}
.rf-confirm-icon::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 22px;
  background: inherit;
  filter: blur(14px);
  opacity: .35;
  z-index: -1;
}
.rf-confirm-icon.warning { background: linear-gradient(135deg, #fef3c7, #fbbf24); color: #b45309; }
.rf-confirm-icon.danger  { background: linear-gradient(135deg, #fee2e2, #f87171); color: #fff; }
.rf-confirm-icon.info    { background: linear-gradient(135deg, #dbeafe, #60a5fa); color: #fff; }
.rf-confirm-icon.success { background: linear-gradient(135deg, #dcfce7, #4ade80); color: #fff; }

.rf-confirm.type-danger::before  { background: linear-gradient(90deg, #ef4444, #fb7185); }
.rf-confirm.type-info::before    { background: linear-gradient(90deg, #3b82f6, #06b6d4); }
.rf-confirm.type-success::before { background: linear-gradient(90deg, #22c55e, #84cc16); }

.rf-confirm-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
  color: var(--text);
  letter-spacing: -.01em;
}

.rf-confirm-body {
  padding: 14px 26px 24px;
  font-size: .95rem;
  color: var(--text-muted);
  line-height: 1.6;
  word-break: break-word;
}

.rf-confirm-actions {
  display: flex;
  gap: 10px;
  padding: 0 26px 26px;
}
.rf-confirm-actions button {
  flex: 1;
  padding: .8rem 1.2rem;
  border-radius: 13px;
  font-weight: 700;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: .92rem;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
}
.rf-confirm-cancel {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.rf-confirm-cancel:hover { background: var(--border); }

.rf-confirm-ok {
  background: var(--gradient-1);
  color: #fff;
  box-shadow: 0 6px 18px -4px var(--primary-glow);
}
.rf-confirm-ok:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -6px var(--primary-glow); }
.rf-confirm-ok:active { transform: translateY(0); }

.rf-confirm-ok.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 6px 18px -4px rgba(239, 68, 68, .5);
}
.rf-confirm-ok.danger:hover { box-shadow: 0 10px 24px -6px rgba(239, 68, 68, .65); }

.rf-confirm-ok.info {
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  box-shadow: 0 6px 18px -4px rgba(59, 130, 246, .5);
}
.rf-confirm-ok.success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 6px 18px -4px rgba(34, 197, 94, .5);
}

/* Dark mode */
:root[data-mode="dark"] .rf-confirm {
  background: #14192c;
  color: var(--text);
}
:root[data-mode="dark"] .rf-confirm-title { color: #fff; }
:root[data-mode="dark"] .rf-confirm-cancel {
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  border-color: rgba(255, 255, 255, .1);
}
:root[data-mode="dark"] .rf-confirm-cancel:hover { background: rgba(255, 255, 255, .1); }

/* Mobile */
@media (max-width: 480px) {
  .rf-confirm { width: calc(100% - 1.5rem); }
  .rf-confirm-header { padding: 20px 20px 0; gap: 12px; }
  .rf-confirm-icon { width: 48px; height: 48px; font-size: 1.25rem; border-radius: 14px; }
  .rf-confirm-title { font-size: 1.05rem; }
  .rf-confirm-body { padding: 12px 20px 20px; }
  .rf-confirm-actions { padding: 0 20px 20px; flex-direction: column-reverse; }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}
.empty-state .icon {
  font-size: 2.5rem;
  color: var(--text-soft);
  margin-bottom: .5rem;
}

/* ============================================================
   PromptPay QR box
   ============================================================ */
.pp-box {
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}
.pp-box .pp-head {
  display: flex; align-items: center; gap: .4rem;
  font-weight: 700; font-size: .82rem; color: #0f4c81;
  order: -1;
}
.pp-box .pp-head .pp-logo {
  background: #0f4c81; color: #fff; border-radius: 6px;
  padding: 1px 7px; font-size: .7rem; letter-spacing: .03em;
}
.pp-box img.pp-qr { width: 200px; height: 200px; image-rendering: pixelated; }
.pp-box .pp-amount { font-size: 1.35rem; font-weight: 700; color: var(--text); font-family: 'JetBrains Mono', monospace; }
.pp-box .pp-id { font-size: .75rem; color: var(--text-muted); }
.pp-box .pp-hint { font-size: .72rem; color: var(--text-soft); }
.pp-missing { font-size: .82rem; color: var(--text-muted); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 12px; padding: .8rem; }

/* Brand images */
.sidebar-brand-mark { width: 38px; height: 38px; object-fit: contain; flex-shrink: 0; }
.login-brand { width: 210px; max-width: 80%; height: auto; display: block; margin: 0 auto 1rem; }

/* Install-app button (shown only when the browser offers installation) */
.header-install-btn {
  display: none; align-items: center; gap: .35rem;
  height: 38px; padding: 0 .8rem;
  border-radius: 10px;
  background: var(--primary-soft); color: var(--primary-dark);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  font-weight: 600; font-size: .82rem; cursor: pointer;
}
.header-install-btn.show { display: inline-flex; }
.header-install-btn:hover { background: var(--primary); color: #fff; }

/* Sidebar full logo (light / dark variants) */
.sb-logo-full { display: block; width: auto; max-width: 100%; height: auto; max-height: 56px; object-fit: contain; }
.sb-logo-dark { display: none; }
:root[data-mode="dark"] .sb-logo-light { display: none; }
:root[data-mode="dark"] .sb-logo-dark  { display: block; }
@media (prefers-color-scheme: dark) {
  :root[data-mode="auto"] .sb-logo-light { display: none; }
  :root[data-mode="auto"] .sb-logo-dark  { display: block; }
}

/* ============================================================
   Checkboxes render as toggle switches across the back office
   (opt out with class="no-toggle")
   ============================================================ */
.admin-content input[type="checkbox"]:not(.rf-switch-input):not(.no-toggle):not(.btn-check) {
  -webkit-appearance: none; appearance: none;
  position: relative;
  width: 38px; height: 22px;
  margin: 0 .5rem 0 0;
  border: 0; border-radius: 999px;
  background: var(--border-strong);
  vertical-align: middle;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--t-base);
}
.admin-content input[type="checkbox"]:not(.rf-switch-input):not(.no-toggle):not(.btn-check)::before {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(17,24,39,.2);
  transition: transform var(--t-base);
}
.admin-content input[type="checkbox"]:not(.rf-switch-input):not(.no-toggle):not(.btn-check):checked { background: var(--primary); }
.admin-content input[type="checkbox"]:not(.rf-switch-input):not(.no-toggle):not(.btn-check):checked::before { transform: translateX(16px); }
.admin-content input[type="checkbox"]:not(.rf-switch-input):not(.no-toggle):not(.btn-check):focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(249,115,22,.22); }
.admin-content input[type="checkbox"]:not(.rf-switch-input):not(.no-toggle):not(.btn-check):disabled { opacity: .5; cursor: not-allowed; }
.admin-content label:has(> input[type="checkbox"]) { display: inline-flex; align-items: center; cursor: pointer; }

/* ============================================================
   Mobile refinements
   ============================================================ */
.status-pill { white-space: nowrap; }

/* Dashboard stat cards: two per row on tablets/phones */
@media (max-width: 991.98px) {
  .bento-grid > .b-3,
  .bento-grid > .b-6:has(> .stat-card) { grid-column: span 6; }
}
@media (max-width: 767.98px) {
  .table-responsive .table th,
  .table-responsive .table td { white-space: nowrap; }
  .table > :not(caption) > * > * { padding: .6rem .7rem; }
  .card-section { padding: 1rem; border-radius: 14px; }
  .section-title { font-size: 1.2rem; margin-bottom: 1rem; }
}
@media (max-width: 575.98px) {
  .admin-content { padding: .85rem .75rem 2rem; }
  .bento-grid { gap: .6rem; }
  .stat-card { padding: .8rem .85rem; border-radius: 14px; }
  .stat-card-header { margin-bottom: .35rem; gap: .4rem; }
  .stat-label { font-size: .74rem; line-height: 1.3; }
  .stat-icon { width: 30px; height: 30px; border-radius: 9px; font-size: .8rem; flex-shrink: 0; }
  .stat-value { font-size: 1.35rem; overflow-wrap: anywhere; }
  .stat-trend { font-size: .7rem; margin-top: .15rem; }
}
