/* =============================================================
   BarStock — Main Stylesheet
   Version  : 1.0.0
   Stack    : Vanilla CSS (no framework)
   Fonts    : Montserrat (headers/nav) | IBM Plex Mono (data)
   Theme    : Strict Dark Mode
   Approach : Design-token first, BEM-ish naming
============================================================= */

/* ─────────────────────────────────────────────────────────────
   1. DESIGN TOKENS (CSS Custom Properties)
   All color, spacing, and typography values live here.
   Changing a token updates the entire UI consistently.
───────────────────────────────────────────────────────────── */
:root {
  /* ── Color Palette ── */
  /* Background layers — progressively lighter for depth */
  --color-bg-base:       #0D1117;   /* Deepest — page canvas              */
  --color-bg-surface:    #161B27;   /* Cards, panels                      */
  --color-bg-elevated:   #1E2535;   /* Modals, dropdowns                  */
  --color-bg-hover:      #252D40;   /* Interactive hover states            */
  --color-bg-active:     #2D374F;   /* Pressed / selected states           */

  /* Border */
  --color-border:        rgba(255, 255, 255, 0.07);
  --color-border-focus:  rgba(0, 229, 204, 0.5);

  /* Brand accent — electric teal */
  --color-accent:        #00E5CC;   /* Primary CTA, active nav, highlights */
  --color-accent-dim:    rgba(0, 229, 204, 0.12); /* Subtle tinted fills  */
  --color-accent-glow:   rgba(0, 229, 204, 0.25); /* Glow / shadow effects*/

  /* Status colors — calibrated for dark backgrounds */
  --color-critical:      #FF4D6D;   /* Out of stock / critical alert       */
  --color-critical-dim:  rgba(255, 77, 109, 0.12);
  --color-warning:       #FFB830;   /* Low stock / warning                 */
  --color-warning-dim:   rgba(255, 184, 48, 0.12);
  --color-success:       #2ECC71;   /* Healthy stock / success             */
  --color-success-dim:   rgba(46, 204, 113, 0.12);
  --color-purple:        #A78BFA;   /* Financial data accent               */
  --color-purple-dim:    rgba(167, 139, 250, 0.12);

  /* Text hierarchy */
  --color-text-primary:  #F0F4FF;   /* Main readable text                  */
  --color-text-secondary:#8B95AD;   /* Labels, metadata, muted info        */
  --color-text-tertiary: #525E78;   /* Disabled, placeholder text          */
  --color-text-inverse:  #0D1117;   /* Text on accent-colored backgrounds  */

  /* ── Typography ── */
  --font-display:   'Montserrat', system-ui, sans-serif;  /* Headers, nav   */
  --font-data:      'IBM Plex Mono', 'Courier New', monospace; /* Numbers   */

  /* Type scale */
  --text-xs:    0.6875rem;   /* 11px */
  --text-sm:    0.8125rem;   /* 13px */
  --text-base:  0.9375rem;   /* 15px */
  --text-lg:    1.0625rem;   /* 17px */
  --text-xl:    1.25rem;     /* 20px */
  --text-2xl:   1.5rem;      /* 24px */
  --text-3xl:   2rem;        /* 32px */

  /* Font weights */
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;
  --fw-extrabold:800;

  /* ── Spacing ── */
  /* 8-point grid system */
  --sp-1:  0.25rem;   /*  4px */
  --sp-2:  0.5rem;    /*  8px */
  --sp-3:  0.75rem;   /* 12px */
  --sp-4:  1rem;      /* 16px */
  --sp-5:  1.25rem;   /* 20px */
  --sp-6:  1.5rem;    /* 24px */
  --sp-8:  2rem;      /* 32px */
  --sp-10: 2.5rem;    /* 40px */
  --sp-12: 3rem;      /* 48px */
  --sp-16: 4rem;      /* 64px */

  /* ── Layout ── */
  --sidebar-width:     220px;
  --top-nav-height:     60px;
  --bottom-nav-height:  70px;  /* Mobile only */
  --content-max-width: 1100px;

  /* ── Effects ── */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* Shadows — layered for depth */
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-glow:0 0 20px var(--color-accent-glow);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow:   400ms ease;

  /* Glassmorphism / frosted glass (sidebar overlays on mobile) */
  --glass-blur:   12px;
  --glass-bg:     rgba(22, 27, 39, 0.85);
  --glass-border: rgba(255, 255, 255, 0.06);
}


/* ─────────────────────────────────────────────────────────────
   2. RESETS & BASE
───────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  min-height: 100%;
  background-color: var(--color-bg-base);
  color: var(--color-text-primary);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--fw-regular);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Safe areas for notched phones */
  padding-bottom: env(safe-area-inset-bottom);
}

/* Remove default list styles */
ul, ol { list-style: none; }

/* Links */
a {
  color: var(--color-accent);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}
a:hover { opacity: 0.8; }

/* Remove button defaults */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Form elements inherit font */
input, select, textarea {
  font-family: inherit;
}

/* Images */
img, svg { display: block; }

/* Focused ring — critical for stockroom keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Utility: visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* IBM Plex Mono utility class */
.mono {
  font-family: var(--font-data);
  letter-spacing: -0.02em;
}


/* ─────────────────────────────────────────────────────────────
   3. SKIP LINK (Accessibility)
───────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  z-index: 9999;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  font-weight: var(--fw-bold);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-md);
  transition: top var(--transition-fast);
}
.skip-link:focus { top: var(--sp-2); }


/* ─────────────────────────────────────────────────────────────
   4. APP WRAPPER & LAYOUT
───────────────────────────────────────────────────────────── */
.app-wrapper {
  display: none;                /* Hidden by default — shown only after auth */
  flex-direction: column;
  min-height: 100dvh;
}
.app-wrapper.app-wrapper--authed {
  display: flex;                /* Only render the full layout once authenticated */
}

/* Main 2-column layout (sidebar + content) */
.layout {
  display: flex;
  flex: 1;
  /* Reserve space for top nav and bottom mobile nav */
  padding-top: var(--top-nav-height);
  padding-bottom: var(--bottom-nav-height);
}

/* Desktop: sidebar visible, no bottom nav offset */
@media (min-width: 768px) {
  .layout {
    padding-bottom: 0;
  }
}


/* ─────────────────────────────────────────────────────────────
   5. TOP NAVIGATION BAR
───────────────────────────────────────────────────────────── */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--top-nav-height);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
}

.top-nav__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  height: 100%;
  padding: 0 var(--sp-4);
  max-width: calc(var(--sidebar-width) + var(--content-max-width));
  margin: 0 auto;
}

/* Brand / Logo */
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--color-text-primary);
  flex-shrink: 0;
}

.brand__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}

.brand__name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  letter-spacing: -0.03em;
  color: var(--color-text-primary);
}

/* Location selector */
.location-selector {
  position: relative;
  flex: 1;
  max-width: 200px;
}

.location-selector__btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  transition: background var(--transition-fast), border-color var(--transition-fast);
  width: 100%;
}

.location-selector__btn:hover {
  background: var(--color-bg-hover);
  border-color: rgba(255,255,255,0.12);
}

.location-selector__label { flex: 1; text-align: left; }

.location-selector__chevron {
  transition: transform var(--transition-fast);
  color: var(--color-text-secondary);
}

.location-selector__btn[aria-expanded="true"] .location-selector__chevron {
  transform: rotate(180deg);
}

.location-selector__dropdown {
  position: absolute;
  top: calc(100% + var(--sp-2));
  left: 0;
  right: 0;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}

.location-selector__dropdown[hidden] { display: none; }

.location-selector__option {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.location-selector__option:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.location-selector__option--selected {
  color: var(--color-accent);
  background: var(--color-accent-dim);
}

/* Top-nav global actions */
.top-nav__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

/* Icon button */
.icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.icon-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.icon-btn .icon {
  width: 18px;
  height: 18px;
}

/* Avatar button */
.avatar-btn { padding: 0; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #4F46E5, var(--color-accent));
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.05em;
}

/* SVG icon utilities */
.icon { width: 20px; height: 20px; }
.icon--sm { width: 16px; height: 16px; }
.icon--xs { width: 12px; height: 12px; }


/* ─────────────────────────────────────────────────────────────
   6. BADGE COMPONENT
───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Notification count badge */
.badge--alert {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 16px;
  height: 16px;
  padding: 0;
  background: var(--color-critical);
  color: white;
  font-size: 9px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Category badge */
.badge--category {
  background: var(--color-accent-dim);
  color: var(--color-accent);
  border: 1px solid rgba(0, 229, 204, 0.2);
}

/* Unit badge */
.badge--unit {
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

/* Transaction type badges */
.badge--pos {
  background: var(--color-purple-dim);
  color: var(--color-purple);
}

.badge--manual {
  background: var(--color-success-dim);
  color: var(--color-success);
}

.badge--voice {
  background: var(--color-accent-dim);
  color: var(--color-accent);
}


/* ─────────────────────────────────────────────────────────────
   7. SIDEBAR NAVIGATION (Desktop)
───────────────────────────────────────────────────────────── */
.sidebar {
  display: none; /* Hidden on mobile — bottom nav takes over */
  flex-shrink: 0;
  width: var(--sidebar-width);
  background: var(--color-bg-surface);
  border-right: 1px solid var(--color-border);
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: var(--top-nav-height);
  height: calc(100dvh - var(--top-nav-height));
  overflow-y: auto;
  padding: var(--sp-4) 0;
}

@media (min-width: 768px) {
  .sidebar { display: flex; }
}

.sidebar__nav { padding: 0; }

.sidebar__nav-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: 0 var(--sp-3);
}

.sidebar__nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
  text-decoration: none;
}

.sidebar__nav-link:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  opacity: 1; /* Override default link hover */
}

/* Active state */
.sidebar__nav-link--active {
  background: var(--color-accent-dim);
  color: var(--color-accent);
  font-weight: var(--fw-semibold);
}

.sidebar__nav-link--active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 3px;
  background: var(--color-accent);
  border-radius: 0 3px 3px 0;
  margin-left: calc(-1 * var(--sp-3));
}

.sidebar__nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar__nav-label { flex: 1; }

/* Badge on sidebar nav items */
.sidebar__nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 var(--sp-1);
  background: var(--color-critical);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sidebar footer: POS status */
.sidebar__footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.pos-status {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
}

.pos-status__indicator {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.pos-status__indicator--live {
  background: var(--color-success);
  /* Animated pulse to indicate live connection */
  animation: livePulse 2s ease infinite;
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(46, 204, 113, 0); }
}

.pos-status__label {
  color: var(--color-text-secondary);
  flex: 1;
}

.pos-status__value--live { color: var(--color-success); font-weight: var(--fw-semibold); }


/* ─────────────────────────────────────────────────────────────
   8. MAIN CONTENT AREA
───────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0; /* Prevent flex overflow */
  overflow-y: auto;
  padding: var(--sp-6) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

@media (min-width: 768px) {
  .main-content {
    padding: var(--sp-8) var(--sp-8);
  }
}


/* ─────────────────────────────────────────────────────────────
   9. PAGE SECTIONS
───────────────────────────────────────────────────────────── */
.page {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  animation: pageFadeIn var(--transition-normal) ease;
}

.page[hidden] { display: none; }

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Page header row */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
}

.page-header__eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--sp-1);
}

.page-header__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.04em;
  color: var(--color-text-primary);
  line-height: 1.1;
}

@media (min-width: 768px) {
  .page-header__title { font-size: var(--text-3xl); }
}


/* ─────────────────────────────────────────────────────────────
   10. BUTTON SYSTEM
───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-5);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  transition: background var(--transition-fast),
              box-shadow var(--transition-fast),
              transform var(--transition-fast),
              opacity var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  flex-shrink: 0;
}

/* Active micro-animation */
.btn:active { transform: scale(0.97); }

/* Primary — teal accent */
.btn--primary {
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 0 var(--color-accent-glow);
}
.btn--primary:hover {
  box-shadow: var(--shadow-glow);
  opacity: 0.9;
}

/* Ghost — transparent with border */
.btn--ghost {
  background: transparent;
  color: var(--color-text-primary);
  border-color: var(--color-border);
}
.btn--ghost:hover {
  background: var(--color-bg-hover);
  border-color: rgba(255,255,255,0.15);
}

/* Small size modifier */
.btn--sm {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}


/* ─────────────────────────────────────────────────────────────
   11. CARD COMPONENT
───────────────────────────────────────────────────────────── */
.card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.card:hover { border-color: rgba(255,255,255,0.1); }

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-5) 0;
}

.card__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
}

.card__link {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card__body {
  padding: var(--sp-5);
}

/* Flush body — for tables that extend to card edges */
.card__body--flush { padding: 0; }


/* ─────────────────────────────────────────────────────────────
   12. STAT / KPI CARDS
───────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
}

@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.12);
}

.stat-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card__label {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Colored icon container */
.stat-card__icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card__icon svg { width: 14px; height: 14px; }

.stat-card__icon--teal   { background: var(--color-accent-dim); color: var(--color-accent); }
.stat-card__icon--amber  { background: var(--color-warning-dim); color: var(--color-warning); }
.stat-card__icon--purple { background: var(--color-purple-dim); color: var(--color-purple); }

/* The big number */
.stat-card__value {
  font-family: var(--font-data);
  font-size: var(--text-2xl);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  line-height: 1;
  letter-spacing: -0.03em;
}

/* Delta / change indicator */
.stat-card__delta {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}
.stat-card__delta--up      { color: var(--color-success); }
.stat-card__delta--warn    { color: var(--color-warning); }
.stat-card__delta--neutral { color: var(--color-text-tertiary); }


/* ─────────────────────────────────────────────────────────────
   13. ALERT LIST (Low Stock)
───────────────────────────────────────────────────────────── */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.alert-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  transition: background var(--transition-fast);
}

.alert-item:hover { background: var(--color-bg-hover); }

/* Left border accent by severity */
.alert-item--critical { border-left: 3px solid var(--color-critical); }
.alert-item--warning  { border-left: 3px solid var(--color-warning); }

.alert-item__info {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  flex: 1;
  min-width: 0;
}

.alert-item__name {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-item__stock {
  display: flex;
  align-items: baseline;
  gap: var(--sp-1);
  flex-shrink: 0;
}

.alert-item__current {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-warning);
}

.alert-item--critical .alert-item__current { color: var(--color-critical); }

.alert-item__threshold {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}


/* ─────────────────────────────────────────────────────────────
   14. DATA TABLE
───────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table__head {
  border-bottom: 1px solid var(--color-border);
}

.data-table__th {
  padding: var(--sp-3) var(--sp-5);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.data-table__th--mono { font-family: var(--font-data); }

.data-table__row {
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
}

.data-table__row:last-child { border-bottom: none; }
.data-table__row:hover { background: var(--color-bg-hover); }

.data-table__td {
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.data-table__td--mono   { font-family: var(--font-data); }
.data-table__td--muted  { color: var(--color-text-tertiary); }
.data-table__td--deduct { color: var(--color-critical); }
.data-table__td--add    { color: var(--color-success); }

/* Overflow for wide tables on mobile */
.card__body--flush {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}


/* ─────────────────────────────────────────────────────────────
   15. INVENTORY PAGE COMPONENTS
───────────────────────────────────────────────────────────── */

/* Filter Tab Switcher */
.filter-tabs {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: var(--sp-1); /* Prevents clipping on scroll */
}
.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
  flex-shrink: 0;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-secondary);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  transition: background var(--transition-fast),
              color var(--transition-fast),
              border-color var(--transition-fast);
}

.filter-tab:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.filter-tab--active {
  background: var(--color-accent-dim);
  color: var(--color-accent);
  border-color: rgba(0, 229, 204, 0.3);
  font-weight: var(--fw-semibold);
}

/* Toolbar: search + sort */
.toolbar {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.search-input__icon {
  position: absolute;
  left: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-tertiary);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: var(--sp-3) var(--sp-3) var(--sp-3) calc(var(--sp-3) + 16px + var(--sp-2));
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input::placeholder { color: var(--color-text-tertiary); }
.search-input:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(0, 229, 204, 0.1);
  outline: none;
}

/* Remove native search input clear button */
.search-input::-webkit-search-cancel-button { display: none; }

/* Select / Dropdown */
.select {
  padding: var(--sp-3) var(--sp-10) var(--sp-3) var(--sp-3);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-display);
  appearance: none;
  -webkit-appearance: none;
  /* Custom chevron arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%238B95AD' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  background-size: 14px;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.select:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(0, 229, 204, 0.1);
  outline: none;
}

/* Inventory Item Cards */
.inventory-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.inventory-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.inventory-card:hover { transform: translateX(2px); }

/* Left-edge status stripe */
.inventory-card--critical { border-left: 3px solid var(--color-critical); }
.inventory-card--warning  { border-left: 3px solid var(--color-warning); }

.inventory-card__meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}

.inventory-card__name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
}

.inventory-card__tags {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Numerical data row */
.inventory-card__data {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
}

.inventory-card__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inventory-card__stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.inventory-card__stat-value {
  font-family: var(--font-data);
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  line-height: 1.2;
}

.inventory-card__stat-unit {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

/* Stock level progress bar */
.stock-bar {
  height: 4px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.stock-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.stock-bar__fill--critical { background: var(--color-critical); }
.stock-bar__fill--warning  { background: var(--color-warning); }
.stock-bar__fill--healthy  { background: var(--color-success); }

.inventory-card__actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
}


/* ─────────────────────────────────────────────────────────────
   16. VOICE ENTRY PAGE
───────────────────────────────────────────────────────────── */
.voice-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-6);
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
}

.voice-panel__display {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-panel__prompt {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  max-width: 300px;
  line-height: 1.6;
}

.voice-panel__transcript {
  font-family: var(--font-data);
  font-size: var(--text-lg);
  color: var(--color-accent);
  font-weight: var(--fw-medium);
  letter-spacing: -0.01em;
}

.voice-panel__transcript[hidden] { display: none; }

/* Microphone Button */
.mic-btn {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-glow);
}

.mic-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 32px var(--color-accent-glow);
}

.mic-btn:active { transform: scale(0.95); }

.mic-btn.is-recording {
  background: var(--color-critical);
  box-shadow: 0 0 32px rgba(255, 77, 109, 0.4);
}

.mic-btn__icon {
  width: 40px;
  height: 40px;
}

/* Animated pulse ring — visible during recording */
.mic-btn__pulse {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  opacity: 0;
  border: 2px solid var(--color-accent);
  animation: none;
}

.mic-btn.is-recording .mic-btn__pulse {
  animation: micPulse 1.2s ease infinite;
}

@keyframes micPulse {
  0%   { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* Voice result preview box */
.voice-result {
  width: 100%;
  max-width: 360px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  animation: pageFadeIn var(--transition-normal);
}

.voice-result[hidden] { display: none; }

.voice-result__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.voice-result__row:last-of-type { border-bottom: none; }

.voice-result__label {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.voice-result__value {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  font-weight: var(--fw-medium);
}

.voice-result__actions {
  display: flex;
  gap: var(--sp-3);
  padding-top: var(--sp-2);
}

.voice-result__actions .btn { flex: 1; }

/* Tips list */
.tips-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.tips-list__item {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.tips-list__example {
  font-family: var(--font-data);
  font-size: var(--text-sm);
  color: var(--color-accent);
  background: var(--color-accent-dim);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  display: inline-block;
}

.tips-list__desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  padding-left: var(--sp-1);
}


/* ─────────────────────────────────────────────────────────────
   17. BOTTOM NAVIGATION (Mobile ≤ 768px)
───────────────────────────────────────────────────────────── */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--bottom-nav-height);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border-top: 1px solid var(--glass-border);
  /* Safe area for iPhones with home indicator */
  padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (min-width: 768px) {
  .bottom-nav { display: none; }
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  text-decoration: none;
  transition: color var(--transition-fast);
  padding: var(--sp-2) 0;
}

.bottom-nav__item--active {
  color: var(--color-accent);
}

.bottom-nav__item:hover { color: var(--color-text-secondary); opacity: 1; }

.bottom-nav__icon {
  width: 22px;
  height: 22px;
}

/* CTA item — voice button is larger */
.bottom-nav__item--cta {
  position: relative;
}

.bottom-nav__item--cta .bottom-nav__icon {
  width: 24px;
  height: 24px;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  padding: 8px;
  border-radius: var(--radius-full);
  width: 44px;
  height: 44px;
  margin-top: -12px;
  box-shadow: var(--shadow-glow);
}


/* ─────────────────────────────────────────────────────────────
   18. MODAL / DIALOG
───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(7, 10, 18, 0.75);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;   /* Sheet from bottom on mobile */
  justify-content: center;
  padding: 0;
  animation: overlayFadeIn var(--transition-normal);
}

.modal-overlay[hidden] { display: none; }

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding: var(--sp-6);
  }
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp var(--transition-normal);
  max-height: 92dvh;
  overflow-y: auto;
}

@media (min-width: 640px) {
  .modal {
    border-radius: var(--radius-xl);
    animation: modalScaleIn var(--transition-normal);
  }
}

@keyframes modalSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--color-border);
  /* Drag handle on mobile */
  position: sticky;
  top: 0;
  background: var(--color-bg-elevated);
  z-index: 1;
}

.modal__header::before {
  content: '';
  position: absolute;
  top: var(--sp-3);
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
}

@media (min-width: 640px) {
  .modal__header::before { display: none; }
}

.modal__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  letter-spacing: -0.03em;
  padding-top: var(--sp-3);
}

@media (min-width: 640px) {
  .modal__title { padding-top: 0; }
}

.modal__close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
  margin-top: var(--sp-3);
}

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

.modal__close:hover {
  background: var(--color-critical-dim);
  color: var(--color-critical);
}

@media (min-width: 640px) {
  .modal__close { margin-top: 0; }
}

.modal__body {
  padding: var(--sp-6);
}

.modal__actions {
  display: flex;
  gap: var(--sp-3);
  padding-top: var(--sp-2);
  margin-top: var(--sp-2);
  border-top: 1px solid var(--color-border);
}

.modal__actions .btn { flex: 1; }


/* ─────────────────────────────────────────────────────────────
   19. FORM COMPONENTS
───────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-secondary);
  letter-spacing: 0.02em;
}

/* Shared input/select/textarea base */
.form-control {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(0, 229, 204, 0.1);
  outline: none;
}

.input.form-control {
  padding: var(--sp-3) var(--sp-4);
  width: 100%;
}

.form-control--textarea {
  resize: vertical;
  padding: var(--sp-3) var(--sp-4);
  min-height: 80px;
  width: 100%;
  line-height: 1.5;
}

/* Input with unit suffix (e.g. "btl", "oz") */
.input-with-unit {
  position: relative;
}

.input-with-unit .input.form-control {
  padding-right: 56px; /* Make room for unit label */
}

.input-unit {
  position: absolute;
  right: var(--sp-4);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-data);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-text-tertiary);
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Radio group */
.radio-group {
  display: flex;
  gap: var(--sp-4);
}

.radio-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.radio-label input[type="radio"] {
  accent-color: var(--color-accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.radio-label:has(input:checked) .radio-label__text {
  color: var(--color-accent);
  font-weight: var(--fw-semibold);
}


/* ─────────────────────────────────────────────────────────────
   20. SCROLLBAR STYLING
   Subtle custom scrollbars for desktop
───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-bg-active);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-border); }


/* ─────────────────────────────────────────────────────────────
   21. UTILITY CLASSES
───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-accent  { color: var(--color-accent); }
.text-muted   { color: var(--color-text-secondary); }
.text-tertiary{ color: var(--color-text-tertiary); }
.text-critical{ color: var(--color-critical); }
.text-warning { color: var(--color-warning); }
.text-success { color: var(--color-success); }


/* =============================================================
   SECTION 22 — REPORTS TAB COMPONENTS
   Date pills · KPI stat extensions · SVG bar chart · Top Movers
============================================================= */

/* ─────────────────────────────────────────────────────────────
   22a. Date Range Pill Selector
   Same interaction model as .filter-tab (inventory page) but
   styled as compact pills to match a "top filter bar" context.
───────────────────────────────────────────────────────────── */
.date-range-selector {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: var(--sp-1);
}
.date-range-selector::-webkit-scrollbar { display: none; }

.date-pill {
  flex-shrink: 0;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-secondary);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  transition: background var(--transition-fast),
              color var(--transition-fast),
              border-color var(--transition-fast);
  cursor: pointer;
}

.date-pill:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.date-pill--active,
.date-pill[aria-pressed="true"] {
  background: var(--color-accent-dim);
  color: var(--color-accent);
  border-color: rgba(0, 229, 204, 0.3);
  font-weight: var(--fw-semibold);
}

/* Custom date range field row — expands below the pills */
.date-range-custom {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  animation: pageFadeIn var(--transition-normal);
}

.date-range-custom[hidden] { display: none; }

.date-range-custom__fields {
  display: flex;
  gap: var(--sp-4);
  align-items: flex-end;
  flex-wrap: wrap;
}

.date-range-custom__fields .form-group {
  flex: 1;
  min-width: 130px;
  margin-bottom: 0;
}

/* Native date input — override accent for dark mode */
input[type="date"] {
  color-scheme: dark;
}

/* ─────────────────────────────────────────────────────────────
   22b. stat-card extensions for Reports
   .stat-card--wide   → spans 2 columns on 4-col grid breakpoint
   .stat-card__value-unit → small suffix unit (%, btl)
   .stat-card__value--warn → amber coloured value
   .stat-card__delta-note  → lighter parenthetical note
───────────────────────────────────────────────────────────── */

/* On the 4-column grid, wide cards take 2 columns */
@media (min-width: 640px) {
  .stat-card--wide {
    grid-column: span 2;
  }
}

.stat-card__value-unit {
  font-family: var(--font-data);
  font-size: var(--text-base);
  font-weight: var(--fw-medium);
  color: var(--color-text-secondary);
  margin-left: var(--sp-1);
  vertical-align: bottom;
  line-height: 1.6;
}

.stat-card__value--warn {
  color: var(--color-warning);
}

.stat-card__delta-note {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-weight: var(--fw-regular);
  margin-left: var(--sp-1);
}

/* ─────────────────────────────────────────────────────────────
   22c. Chart Legend
───────────────────────────────────────────────────────────── */
.chart-legend {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.chart-legend__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  color: var(--color-text-secondary);
}

.chart-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.chart-legend__dot--theo   { background: var(--color-accent); }
.chart-legend__dot--actual { background: var(--color-warning); }

/* ─────────────────────────────────────────────────────────────
   22d. SVG Bar Chart
   - .chart-wrap     → responsive container (aspect ratio box)
   - .bar-chart      → the SVG element itself
   - .chart-bar      → individual bar <rect> elements
   - Bars animate up from y=200 (baseline) via JS
───────────────────────────────────────────────────────────── */
.chart-wrap {
  width: 100%;
  overflow: hidden;
  /* Maintain 420:260 aspect ratio of the SVG viewBox */
  aspect-ratio: 420 / 260;
  border-radius: var(--radius-md);
}

.bar-chart {
  width: 100%;
  height: 100%;
  display: block;
}

/* Theoretical bars — teal accent */
.chart-bar--theo {
  fill: var(--color-accent);
  opacity: 0.85;
  transition: opacity var(--transition-fast);
}

.chart-bar--theo:hover { opacity: 1; }

/* Actual bars — amber warning */
.chart-bar--actual {
  fill: var(--color-warning);
  opacity: 0.85;
  transition: opacity var(--transition-fast);
}

.chart-bar--actual:hover { opacity: 1; }

/* ─────────────────────────────────────────────────────────────
   22e. Top Movers List
───────────────────────────────────────────────────────────── */
.movers-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.mover-item {
  display: grid;
  /* rank | info | stats | variance */
  grid-template-columns: 32px 1fr auto auto;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-2);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.mover-item:hover { background: var(--color-bg-hover); }

.mover-item + .mover-item {
  border-top: 1px solid var(--color-border);
}

.mover-item__rank {
  font-family: var(--font-data);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-text-tertiary);
  letter-spacing: 0.08em;
  text-align: center;
}

.mover-item__info {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-width: 0;
}

.mover-item__name {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mover-item__stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-1);
  min-width: 80px;
}

.mover-item__depletion {
  font-family: var(--font-data);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* Mini horizontal usage bar inside the movers list */
.mover-item__bar-wrap {
  width: 80px;
  height: 4px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.mover-item__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-warning));
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

/* Variance column — colored by direction */
.mover-item__variance {
  font-family: var(--font-data);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  padding: 2px var(--sp-2);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.mover-item__variance--over {
  /* Over-pour: actual > theoretical — amber warning */
  background: var(--color-warning-dim);
  color: var(--color-warning);
}

.mover-item__variance--under {
  /* Under-pour: actual < theoretical — green (could be good or bad) */
  background: var(--color-success-dim);
  color: var(--color-success);
}

/* Responsive: collapse rank and variance on very small screens */
@media (max-width: 400px) {
  .mover-item {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }
  .mover-item__rank    { display: none; }
  .mover-item__stats   { grid-column: 1; grid-row: 2; align-items: flex-start; }
  .mover-item__variance{ grid-column: 2; grid-row: 2; align-self: flex-end; }
}


/* =============================================================
   SECTION 23 — SETTINGS TAB COMPONENTS
   Profile · Integration card · Toggle switch · Danger Zone
============================================================= */

/* ─────────────────────────────────────────────────────────────
   23a. Settings Section Card Spacing
   Adds a consistent top margin between sequential settings cards.
───────────────────────────────────────────────────────────── */
.settings-section + .settings-section {
  /* gap is already handled by .page flex gap — this is a fallback */
}

/* ─────────────────────────────────────────────────────────────
   23b. Account Profile
───────────────────────────────────────────────────────────── */
.settings-profile {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding-bottom: var(--sp-5);
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--color-border);
}

/* Large avatar for the settings page */
.settings-profile__avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #4F46E5, var(--color-accent));
  color: white;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.settings-profile__name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.settings-profile__role {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--sp-1);
}

/* ─────────────────────────────────────────────────────────────
   23c. Settings Info List (key/value rows in cards)
───────────────────────────────────────────────────────────── */
.settings-info-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Slightly denser variant used inside integration cards */
.settings-info-list--compact .settings-info-row {
  padding: var(--sp-2) 0;
}

.settings-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.settings-info-row:last-child { border-bottom: none; }

.settings-info-row__label {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.settings-info-row__value {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  text-align: right;
}

/* ─────────────────────────────────────────────────────────────
   23d. Integration Card (Tabit POS)
   Prominently styled with a gradient border to signal importance.
   Uses a custom border via box-shadow rather than border to allow
   border-radius without clipping the inner content.
───────────────────────────────────────────────────────────── */
.integration-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  background: var(--color-bg-elevated);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

/* Connected state: teal glow border */
.integration-card--connected {
  border-color: rgba(0, 229, 204, 0.2);
  box-shadow: 0 0 0 1px rgba(0, 229, 204, 0.1),
              inset 0 1px 0 rgba(0, 229, 204, 0.05);
}

.integration-card__header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.integration-card__logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.integration-card__logo svg { width: 100%; height: 100%; }

.integration-card__meta {
  flex: 1;
  min-width: 0;
}

.integration-card__name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.integration-card__desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* Status chip in the top-right of the integration card header */
.integration-card__status {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  background: var(--color-success-dim);
  border: 1px solid rgba(46, 204, 113, 0.25);
  flex-shrink: 0;
}

.integration-card__status-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-success);
}

.integration-card__actions {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* Spinning icon animation — applied via JS when sync is in progress */
.sync-spinner {
  animation: spinCW 0.8s linear infinite;
}

@keyframes spinCW {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ─────────────────────────────────────────────────────────────
   23e. Toggle Switch (iOS-style)
   Pure CSS — no JS needed for the visual. JS only persists the
   state and triggers API calls on change.

   Structure:
     <label class="toggle-switch">
       <input type="checkbox" class="toggle-switch__input" />
       <span class="toggle-switch__track">
         <span class="toggle-switch__thumb"></span>
       </span>
     </label>
───────────────────────────────────────────────────────────── */
.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--color-border);
}

.toggle-row:last-child { border-bottom: none; }

.toggle-row__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.toggle-row__label {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
}

.toggle-row__desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* The label wrapper — makes the whole toggle clickable */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Hide native checkbox — still accessible via label */
.toggle-switch__input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

/* The track (background pill) */
.toggle-switch__track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: var(--color-bg-elevated);
  border: 1.5px solid var(--color-border);
  transition: background var(--transition-normal), border-color var(--transition-normal);
  display: flex;
  align-items: center;
}

/* When checked: accent track */
.toggle-switch__input:checked + .toggle-switch__track {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

/* Focus ring — keyboard accessible */
.toggle-switch__input:focus-visible + .toggle-switch__track {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* The sliding thumb circle */
.toggle-switch__thumb {
  position: absolute;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--color-text-secondary);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), background var(--transition-normal);
  will-change: transform;
}

/* When checked: slide thumb right + turn white */
.toggle-switch__input:checked + .toggle-switch__track .toggle-switch__thumb {
  transform: translateX(20px);
  background: var(--color-text-inverse);
}

/* ─────────────────────────────────────────────────────────────
   23f. Settings Meta (version row)
───────────────────────────────────────────────────────────── */
.settings-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
}

.settings-meta__item {
  font-family: var(--font-data);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.settings-meta__sep {
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
}

.settings-meta__link {
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  color: var(--color-text-secondary);
}

.settings-meta__link:hover { color: var(--color-accent); opacity: 1; }

/* ─────────────────────────────────────────────────────────────
   23g. Danger Zone
   Intentionally distinct: elevated margin-top, red border,
   and the Logout button uses a dedicated danger variant.
───────────────────────────────────────────────────────────── */
.danger-zone {
  margin-top: var(--sp-4);
}

.danger-zone__heading {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-critical);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--sp-3);
}

.danger-zone__card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--color-bg-surface);
  /* Red border — visually distinct without being alarming at rest */
  border: 1px solid rgba(255, 77, 109, 0.3);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-fast);
}

.danger-zone__card:hover {
  border-color: rgba(255, 77, 109, 0.6);
}

.danger-zone__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.danger-zone__action-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
}

.danger-zone__action-desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

/* btn--danger: subtle danger variant — red text at rest, red glow on hover.
   Intentionally minimal so it doesn't clash with the dark minimalist aesthetic. */
.btn--danger {
  background:  transparent;
  color:       rgba(248, 113, 113, 0.7);   /* muted red at rest */
  border:      1.5px solid transparent;
  transition:  color            var(--transition-fast),
               border-color     var(--transition-fast),
               background       var(--transition-fast),
               box-shadow       var(--transition-fast);
}

.btn--danger:hover {
  color:        #f87171;
  border-color: rgba(248, 113, 113, 0.45);
  background:   rgba(248, 113, 113, 0.08);
  box-shadow:   0 0 10px rgba(248, 113, 113, 0.15);
}

.btn--danger:active { transform: scale(0.97); }

/* ─── Vision Scanner — Review staging rows ─────────────────────────────────
   Ensures checkbox + label text are always inline, never stack vertically.
   Applied on the <label> elements in the openReview() HTML template.        */
.scan-review-row {
  display:         flex;
  flex-direction:  row;
  align-items:     center;
  flex-wrap:       nowrap;
  gap:             10px;
  margin-bottom:   6px;
  cursor:          pointer;
}

.scan-review-row input[type="checkbox"] {
  flex-shrink: 0;
  width:       16px;
  height:      16px;
  margin:      0;
  accent-color: var(--primary, #6366f1);
}

.scan-review-row__text {
  flex: 1;
  min-width: 0;  /* allows text-overflow: ellipsis inside flex children */
}

/* ─── Seed Inventory Modal — seed-card component ────────────────────────────
   Each card (Spirits / Drafts) is a horizontal row with an icon, description,
   and a Load button. Subtle hover glow consistent with dark theme.            */
.seed-card {
  display:       flex;
  align-items:   center;
  gap:           var(--sp-4);
  padding:       var(--sp-4) var(--sp-5);
  background:    rgba(255, 255, 255, 0.04);
  border:        1px solid var(--border-color);
  border-radius: 10px;
  transition:    border-color var(--transition-fast),
                 background   var(--transition-fast);
}

.seed-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background:   rgba(99, 102, 241, 0.05);
}

.seed-card__icon {
  font-size:   1.8rem;
  flex-shrink: 0;
  line-height: 1;
}

.seed-card__text {
  flex: 1;
  min-width: 0;
}

.seed-card__title {
  font-weight:   600;
  font-size:     0.95rem;
  margin-bottom: 2px;
}

.seed-card__desc {
  font-size: 0.8rem;
  color:     var(--text-muted);
  line-height: 1.4;
}

/* ─── Pint Yield Badge (Keg items) ──────────────────────────────────────────
   Displayed inside the On Hand stat of Beer + Keg inventory cards.           */
.pint-yield-badge {
  display:        inline-flex;
  align-items:    center;
  gap:            4px;
  margin-top:     4px;
  padding:        2px 8px;
  font-size:      0.73rem;
  font-family:    var(--font-mono, 'IBM Plex Mono', monospace);
  color:          #93c5fd;                       /* soft blue — beer palette  */
  background:     rgba(147, 197, 253, 0.1);
  border:         1px solid rgba(147, 197, 253, 0.2);
  border-radius:  20px;
  white-space:    nowrap;
}
}

/* ─── Login Screen ────────────────────────────────────────── */
.login-screen {
  display: flex;                  /* explicit — required for centering */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  padding: var(--sp-6);
  background-color: var(--color-bg-base);
  overflow: hidden;
  z-index: 9999;
}
.login-screen[hidden] {
  display: none !important;     /* Guarantee no bleed-through */
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: 0 24px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,229,204,0.06);
  text-align: center;
}
.login-title {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--sp-1);
}
.login-subtitle {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-6);
}
.login-form {
  text-align: left;
}
.login-form .form-group {
  margin-bottom: var(--sp-4);
}
.login-submit {
  width: 100%;
  margin-top: var(--sp-2);
  justify-content: center;
}
.login-error {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
  padding: var(--sp-3);
  border-radius: 8px;
  margin-bottom: var(--sp-4);
  font-size: var(--text-sm);
  text-align: center;
}
/* ─── Auth Tab Toggle ──────────────────────────────────────────────────── */
.auth-tabs {
  display: flex;
  gap: 0;
  margin: var(--sp-4) 0 var(--sp-5);
  background: var(--color-bg-base);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 4px;
}
.auth-tab {
  flex: 1;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  font-family: inherit;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.auth-tab:hover {
  color: var(--color-text-primary);
}
.auth-tab--active {
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ─── Sign Up: Success & Hint Styles ──────────────────────────────────── */
.login-success {
  color: var(--color-success);
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.25);
  padding: var(--sp-3);
  border-radius: 8px;
  margin-bottom: var(--sp-4);
  font-size: var(--text-sm);
  text-align: center;
}
.form-label-hint {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: var(--fw-regular);
  margin-left: var(--sp-1);
}

.hidden-role {
  display: none !important;
}

/* ─── UX Upgrades: Login Inputs & Remember Me ─────────────────────────── */
.login-input {
  padding: var(--sp-4);
  font-size: var(--text-lg);
  height: 56px;
  border-radius: 10px;
}
.login-remember-group {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-6);
}
.form-checkbox {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--color-accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* ─── UX Upgrades: Profile Dropdown ──────────────────────────────────── */
.profile-container {
  position: relative;
}
.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 200px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  list-style: none;
  padding: var(--sp-2) 0;
  margin: 0;
  z-index: 1000;
}
.profile-dropdown__item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: var(--sp-3) var(--sp-4);
  color: var(--color-text-primary);
  font-size: var(--text-base);
  cursor: pointer;
  transition: background 0.15s ease;
}
.profile-dropdown__item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.profile-dropdown__item--danger {
  color: #f87171;
}
.profile-dropdown__item--danger:hover {
  background: rgba(248, 113, 113, 0.1);
}
/* --- iOS Safe Area Overrides --- */
body {
  /* Prevents the top header from sliding under the iPhone time/battery */
  padding-top: env(safe-area-inset-top);
  /* Prevents the bottom menu from hiding under the iPhone swipe bar */
  padding-bottom: env(safe-area-inset-bottom);
}

/* Ensure the absolute positioned bottom nav lifts up */
.bottom-nav {
  padding-bottom: env(safe-area-inset-bottom) !important;
}