/* ============================================================
   QFE POS — Design System
   "Aurora Glass" — white liquid-glass theme over a soft, shaded
   mesh background. Same structure/classes as before so every
   page (30+ PHP views) re-themes automatically — only the visual
   tokens and glass/hover treatments changed, not the layout logic.
   ============================================================ */

:root {
  /* Base surfaces */
  --color-canvas: #ffffff;                 /* solid white, used where blur would hurt legibility (inputs, table cells) */
  --color-glass: rgba(255, 255, 255, 0.66); /* translucent glass panels: sidebar, topbar, cards, modals */
  --color-glass-strong: rgba(255, 255, 255, 0.8);
  --color-surface: #f5f6fb;
  --color-surface-hover: #eef0fa;
  --color-border: rgba(20, 20, 40, 0.08);
  --color-border-strong: rgba(20, 20, 40, 0.16);

  /* Accent — indigo → violet, echoes the aurora mesh */
  --color-primary: #5b5bf0;
  --color-primary-hover: #4747d8;
  --color-primary-surface: #eeeeff;
  --color-primary-2: #a855f7; /* secondary accent for gradients */

  --color-text: #15151f;
  --color-text-secondary: #6b6b80;
  --color-text-disabled: #a4a4b8;

  --color-danger: #e0392c;
  --color-danger-surface: #fdeceb;
  --color-warning: #e8a33d;
  --color-warning-surface: #fff6e8;
  --color-success: #1ea672;
  --color-success-surface: #e8f8f1;
  --color-info: #2c7ecb;
  --color-info-surface: #e8f2fc;

  /* Aurora mesh hues, used only by the fixed background layer */
  --aurora-1: #8fb8ff;
  --aurora-2: #c9a4ff;
  --aurora-3: #ffb3d9;
  --aurora-4: #9ff0dd;

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

  /* Radius — a touch softer, glass reads better rounded */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Shadows — soft and diffused, no hard edges */
  --shadow-sm: 0 1px 2px rgba(30, 30, 60, 0.05);
  --shadow-md: 0 8px 24px -8px rgba(30, 30, 60, 0.14);
  --shadow-lg: 0 20px 44px -16px rgba(30, 30, 60, 0.22);
  --shadow-popover: 0 24px 56px -12px rgba(30, 30, 60, 0.28);

  --glass-blur: blur(18px) saturate(160%);

  --sidebar-width: 240px;
  --topbar-height: 56px;

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { background: #fafbff; }

body {
  margin: 0;
  font-family: var(--font-ui);
  background: transparent;
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

/* ============================================================
   AURORA BACKGROUND — fixed, shaded mesh behind every page.
   Pure CSS (no extra markup needed) so it works on all 30+ pages
   without touching each template's body.
   ============================================================ */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(38vw 38vw at 8% 8%, color-mix(in srgb, var(--aurora-1) 55%, transparent), transparent 70%),
    radial-gradient(34vw 34vw at 92% 12%, color-mix(in srgb, var(--aurora-2) 50%, transparent), transparent 70%),
    radial-gradient(36vw 36vw at 12% 96%, color-mix(in srgb, var(--aurora-3) 45%, transparent), transparent 70%),
    radial-gradient(30vw 30vw at 88% 92%, color-mix(in srgb, var(--aurora-4) 45%, transparent), transparent 70%),
    #fafbff;
  background-repeat: no-repeat;
  animation: auroraDrift 30s ease-in-out infinite;
}

@keyframes auroraDrift {
  0%, 100% { background-position: 0 0, 0 0, 0 0, 0 0; }
  50% { background-position: 2vw 3vw, -3vw 2vw, 2vw -2vw, -2vw -3vw; }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }

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

.num, td.num, .money, .qty {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ============================================================
   CURSOR — a small dot + trailing ring, replaces the default
   pointer on non-touch devices. Created by assets/js/cursor.js;
   these are just the visual styles.
   ============================================================ */

@media (hover: hover) and (pointer: fine) {
  html, body, a, button, .btn, .sidebar-link, input, select, textarea,
  tbody tr.clickable, .card, [role="button"] { cursor: none !important; }
}

.cursor-dot {
  position: fixed; top: 0; left: 0;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: width .16s ease, height .16s ease, background .16s ease, opacity .12s ease;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--color-border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.sidebar-brand img {
  height: 28px;
  width: 28px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-2);
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-disabled);
  padding: var(--space-4) var(--space-3) var(--space-1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 1px;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.sidebar-link:hover {
  background: var(--color-primary-surface);
  color: var(--color-primary);
  text-decoration: none;
  transform: translateX(2px);
}

.sidebar-link.active {
  background: linear-gradient(100deg, var(--color-primary-surface), rgba(168,85,247,0.12));
  color: var(--color-primary);
}

.sidebar-link svg { flex-shrink: 0; width: 18px; height: 18px; }

.sidebar-footer {
  padding: var(--space-3);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-height);
  background: var(--color-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title { font-size: 15px; font-weight: 600; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 13px;
}

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-2));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px;
}

.role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.page-content {
  padding: var(--space-6);
  max-width: 1400px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.page-header-text p {
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
  font-size: 13.5px;
}

.page-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }

/* ============================================================
   CARDS — glass panels with a soft hover lift
   ============================================================ */

.card {
  background: var(--color-glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease;
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body { padding: var(--space-5); }
.card-body.no-pad { padding: 0; }

.card-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border);
  background: rgba(245, 246, 251, 0.6);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--color-glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  box-shadow: 0 10px 28px -12px rgba(30, 30, 60, 0.22);
  transition: transform .18s ease, box-shadow .18s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 38px -14px rgba(30, 30, 60, 0.3);
}

.stat-card.danger, .stat-card.warning, .stat-card.info { border-color: var(--color-border); }

.stat-label {
  font-size: 12.5px;
  color: var(--color-text-secondary);
  font-weight: 500;
  margin-bottom: var(--space-1);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

/* ============================================================
   REVEAL TOGGLE — small eye icon that unmasks a value for 10s
   ============================================================ */

.stat-value-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.reveal-value {
  letter-spacing: 0.02em;
  display: inline-block;
  transition: opacity .22s ease, filter .22s ease, transform .22s ease;
  filter: blur(0);
  opacity: 1;
  transform: scale(1);
}

.reveal-value.swapping {
  opacity: 0;
  filter: blur(6px);
  transform: scale(0.97);
}

.reveal-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 4px 6px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--color-text-disabled);
  cursor: pointer;
  transition: color .18s ease, background .18s ease, transform .12s ease;
  flex-shrink: 0;
}

.reveal-toggle:hover {
  color: var(--color-primary);
  background: var(--color-primary-surface);
}

.reveal-toggle:active { transform: scale(0.88); }

.reveal-toggle.revealed { color: var(--color-primary); }

.icon-stage {
  position: relative;
  width: 16px;
  height: 16px;
  display: inline-block;
}

.icon-stage svg {
  position: absolute;
  inset: 0;
  opacity: 1;
  transform: scale(1) rotate(0deg);
  transition: opacity .28s cubic-bezier(.34,1.56,.64,1), transform .28s cubic-bezier(.34,1.56,.64,1);
}

.icon-stage .icon-eye-off {
  opacity: 0;
  transform: scale(0.4) rotate(-25deg);
}

.reveal-toggle.revealed .icon-eye {
  opacity: 0;
  transform: scale(0.4) rotate(25deg);
}

.reveal-toggle.revealed .icon-eye-off {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.reveal-countdown {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 16px;
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity .2s ease, transform .2s ease;
  display: inline-block;
}

.reveal-toggle.revealed .reveal-countdown {
  opacity: 1;
  transform: translateX(0);
}

@keyframes countdownPulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.3); color: var(--color-danger); }
  100% { transform: scale(1); }
}

.reveal-countdown.tick { animation: countdownPulse .3s ease; }

@media (prefers-reduced-motion: reduce) {
  .reveal-value, .icon-stage svg, .reveal-countdown, .reveal-toggle { transition: none !important; animation: none !important; }
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-strong);
  background: var(--color-glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--color-text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease;
  font-family: inherit;
  touch-action: manipulation;
}

.btn:hover { background: #ffffff; text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(100deg, var(--color-primary), var(--color-primary-2));
  border-color: transparent;
  color: white;
}
.btn-primary:hover {
  background: linear-gradient(100deg, var(--color-primary-hover), var(--color-primary-2));
  border-color: transparent;
  color: white;
  box-shadow: 0 10px 24px -8px rgba(91, 91, 240, 0.5);
}

.btn-danger { background: var(--color-danger); border-color: var(--color-danger); color: white; }
.btn-danger:hover { background: #c22e22; border-color: #c22e22; color: white; }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 11px 20px; font-size: 14.5px; }
.btn-icon { padding: 8px; }
.btn-block { width: 100%; }

.btn svg { width: 16px; height: 16px; }

/* ============================================================
   FORMS
   ============================================================ */

.form-group { margin-bottom: var(--space-4); }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-1);
  color: var(--color-text);
}

label .optional {
  font-weight: 400;
  color: var(--color-text-secondary);
  text-transform: none;
}

.form-hint {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

input[type="text"], input[type="password"], input[type="number"],
input[type="email"], input[type="tel"], input[type="date"],
input[type="datetime-local"], input[type="search"], input[type="file"],
select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-canvas);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-surface);
}

/* Browser-native icons inside inputs (Edge's password reveal-eye, Chrome's
   credentials/autofill key icon) are drawn by the browser itself, outside
   our CSS's reach — cursor:none can't apply to them, so hovering one shows
   the real arrow next to our custom dot. Since we already provide our own
   styling, simplest fix is to hide these native icons entirely. */
input::-ms-reveal,
input::-ms-clear {
  display: none;
}

input::-webkit-credentials-auto-fill-button,
input::-webkit-caps-lock-indicator {
  visibility: hidden;
  display: none !important;
  pointer-events: none;
}

.form-row { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-row-2 { display: grid; gap: var(--space-4); grid-template-columns: 1fr 1fr; }
.form-row-3 { display: grid; gap: var(--space-4); grid-template-columns: 1fr 1fr 1fr; }

.input-group { display: flex; }
.input-group input { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.input-group-addon {
  padding: 8px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-left: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--color-text-secondary);
  font-size: 13.5px;
  display: flex; align-items: center;
}

/* ============================================================
   TABLES
   ============================================================ */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background: rgba(245, 246, 251, 0.7);
  color: var(--color-text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--color-primary-surface); }
tbody tr.clickable { cursor: pointer; }

td.num, th.num { text-align: right; }

/* ============================================================
   STATUS PILLS
   ============================================================ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill-success { background: var(--color-success-surface); color: var(--color-success); }
.pill-danger { background: var(--color-danger-surface); color: var(--color-danger); }
.pill-warning { background: var(--color-warning-surface); color: #92610a; }
.pill-info { background: var(--color-info-surface); color: var(--color-info); }
.pill-neutral { background: var(--color-surface); color: var(--color-text-secondary); }

/* ============================================================
   ALERTS / FLASH MESSAGES
   ============================================================ */

.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid transparent;
}

.alert-success { background: var(--color-success-surface); color: #00543d; border-color: #b3e0d4; }
.alert-danger { background: var(--color-danger-surface); color: #8a1f09; border-color: #f3c4bb; }
.alert-warning { background: var(--color-warning-surface); color: #92610a; border-color: #ffe0a3; }
.alert-info { background: var(--color-info-surface); color: #173a70; border-color: #b9d4f5; }

/* ============================================================
   EMPTY STATES
   ============================================================ */

.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-5);
  color: var(--color-text-secondary);
}

.empty-state svg { width: 48px; height: 48px; margin-bottom: var(--space-3); opacity: 0.4; }
.empty-state h3 { color: var(--color-text); margin-bottom: var(--space-1); }
.empty-state p { font-size: 13.5px; margin-bottom: var(--space-4); }

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(20, 20, 35, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--space-4);
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--color-glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-popover);
}

.modal-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
}

.modal-body { padding: var(--space-5); }
.modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  display: flex; justify-content: flex-end; gap: var(--space-2);
}

.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-secondary);
  padding: var(--space-1);
  display: flex;
  border-radius: var(--radius-sm);
  transition: background .15s ease, color .15s ease;
}
.modal-close:hover { background: var(--color-surface); color: var(--color-text); }

/* ============================================================
   LOGIN PAGE — glass card floating over the aurora mesh
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  padding: var(--space-4);
}

.login-card {
  background: var(--color-glass-strong);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  top: -40%; left: -20%;
  width: 70%; height: 70%;
  background: radial-gradient(circle, rgba(255,255,255,0.7), transparent 70%);
  pointer-events: none;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--space-6);
  text-align: center;
  position: relative;
}

.login-logo img { height: 56px; width: 56px; object-fit: contain; margin-bottom: var(--space-3); border-radius: var(--radius-md); }
.login-logo h1 { font-size: 18px; }
.login-logo p { color: var(--color-text-secondary); font-size: 13px; margin-top: 2px; }

.login-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 4px 12px 4px 8px;
  border-radius: 999px;
  margin-bottom: var(--space-4);
}
.login-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-success); box-shadow: 0 0 6px var(--color-success); }

/* ============================================================
   UTILITIES
   ============================================================ */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); } .gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); } .gap-4 { gap: var(--space-4); }
.text-secondary { color: var(--color-text-secondary); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-semibold { font-weight: 600; }
.mt-2 { margin-top: var(--space-2); } .mt-4 { margin-top: var(--space-4); }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--space-2); } .mb-4 { margin-bottom: var(--space-4); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--color-border); margin: var(--space-4) 0; }

/* ============================================================
   RESPONSIVE / MOBILE
   ============================================================ */

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(20, 20, 35, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 19;
}
.sidebar-overlay.active { display: block; }

.mobile-menu-btn {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: var(--space-2);
  align-items: center;
  border-radius: var(--radius-sm);
  -webkit-tap-highlight-color: transparent;
}

.js-install-app-btn.hidden { display: none !important; }

.ios-install-hint {
  position: fixed;
  left: var(--space-3); right: var(--space-3);
  bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  background: var(--color-text);
  color: white;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  box-shadow: var(--shadow-popover);
  z-index: 200;
}
.ios-install-hint button {
  background: none; border: none; color: white;
  font-size: 20px; line-height: 1; cursor: pointer; padding: 0 var(--space-1);
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-popover);
    width: min(var(--sidebar-width), 82vw);
    padding-top: env(safe-area-inset-top, 0px);
  }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .mobile-menu-btn { display: flex !important; }

  input, select, textarea { font-size: 16px; }

  .topbar {
    padding: 0 var(--space-3);
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(var(--topbar-height) + env(safe-area-inset-top, 0px));
  }
  .topbar-user { gap: var(--space-2); }
  .role-badge { display: none; }

  .page-content {
    padding: var(--space-4);
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-actions { flex-wrap: wrap; }
  .page-actions .btn { flex: 1 1 auto; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: var(--space-3); }

  table { font-size: 12.5px; }
  thead th, tbody td { padding: var(--space-2) var(--space-3); }
  .table-wrap { -webkit-overflow-scrolling: touch; }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: none;
    width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .modal-body { padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px)); }

  .pos-layout {
    display: block !important;
    height: auto !important;
  }
  .pos-layout > div { border-right: none !important; }

  /* Dot cursor makes no sense with touch input — hidden, native cursor stays */
  .cursor-dot { display: none !important; }
  html, body, a, button, .btn, .sidebar-link, input, select, textarea,
  tbody tr.clickable, .card, [role="button"] { cursor: auto !important; }

  /* Glass blur is expensive on a lot of mid-range Android GPUs — trim it
     back on mobile so scrolling long tables/lists stays smooth. */
  .card, .stat-card, .btn { backdrop-filter: blur(8px) saturate(140%); -webkit-backdrop-filter: blur(8px) saturate(140%); }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .install-btn-label { display: none; }
  .topbar-user span:not(.user-avatar) { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .card-body { padding: var(--space-4); }
  .login-card { padding: var(--space-6); }
}

@media (hover: none) {
  .cursor-dot { display: none !important; }
  html, body, a, button, .btn, .sidebar-link, input, select, textarea,
  tbody tr.clickable, .card, [role="button"] { cursor: auto !important; }
}

@media (pointer: coarse) {
  .btn, input, select, textarea { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .sidebar-link { padding: 10px var(--space-3); }
  input[type="checkbox"], input[type="radio"] { min-height: 0; width: 18px; height: 18px; }
}

@supports not (backdrop-filter: blur(1px)) {
  .sidebar, .topbar, .card, .stat-card, .modal, .login-card, .btn {
    background: #ffffff;
  }
}

@media print {
  .no-print { display: none !important; }
  body::before { display: none; }
  .card, .stat-card, .btn { box-shadow: none !important; backdrop-filter: none !important; }
}
