/* ============================================================
   EggLogan Design System · v2 "Warm Yolk"
   Modern, responsive UI for egg storage operations.
   Brand anchor: warm egg-yolk amber on stone neutrals.
   ============================================================ */

/* ---------- Fonts (self-hosted, offline-safe) ---------- */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/manrope-5.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/manrope-4.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  /* Brand — egg yolk amber */
  --primary: #E67E22;
  --primary-dark: #C46411;
  --primary-deep: #9A4E0B;
  --primary-light: #FBEEDD;
  --primary-glow: rgba(230, 126, 34, 0.28);

  /* Warm stone neutrals (legacy names kept for compatibility) */
  --gray-50: #FAF8F5;
  --gray-100: #F3F0EB;
  --gray-200: #E9E4DD;
  --gray-300: #DBD3C8;
  --gray-400: #BCB1A3;
  --gray-500: #97897B;
  --gray-600: #77685A;
  --gray-700: #5B4E42;
  --gray-800: #3A312A;
  --gray-900: #251E18;

  /* Semantic */
  --success: #237A57;
  --warning: #B97D10;
  --danger: #C0392B;
  --info: #2A6F97;

  /* Surfaces */
  --bg: #F6F3EE;
  --surface: #FFFFFF;
  --surface-elevated: #FFFFFF;
  --ink: #251E18;
  --muted: #8A7D70;

  /* Sidebar */
  --side-bg: #221B15;
  --side-bg-hover: #31281F;
  --side-border: #3A3026;
  --side-text: #CBBFAF;
  --side-muted: #8D7F6F;

  /* Shape & depth */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --shadow-xs: 0 1px 2px rgba(58, 44, 28, 0.04);
  --shadow-sm: 0 1px 3px rgba(58, 44, 28, 0.06), 0 2px 8px rgba(58, 44, 28, 0.04);
  --shadow-md: 0 4px 12px rgba(58, 44, 28, 0.08), 0 2px 4px rgba(58, 44, 28, 0.05);
  --shadow-lg: 0 8px 24px rgba(58, 44, 28, 0.1), 0 4px 8px rgba(58, 44, 28, 0.06);
  --shadow-xl: 0 16px 48px rgba(58, 44, 28, 0.12), 0 8px 16px rgba(58, 44, 28, 0.08);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --speed: 220ms;
  --speed-fast: 120ms;

  --sidebar-width: 250px;
  --topbar-height: 62px;
  --font: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ---------- Base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.01em;
}
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.02em; }
a { color: var(--primary-dark); text-decoration: none; }
img, svg { vertical-align: middle; }
::selection { background: var(--primary-light); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Scrollbars (subtle) */
* { scrollbar-width: thin; scrollbar-color: var(--gray-300) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

.icon { flex-shrink: 0; vertical-align: middle; }

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

.loading-skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.page-fade-in {
  animation: pageFadeIn 0.3s var(--ease-out);
}
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   LANDING PAGE
   ============================================================ */

.landing-section { padding: 80px 24px; max-width: 1120px; margin: 0 auto; }
.landing-section-title { text-align: center; font-size: 30px; font-weight: 800; margin-bottom: 44px; color: var(--ink); letter-spacing: -0.03em; }
.landing-section-subtitle { text-align: center; font-size: 15px; color: var(--gray-600); margin: -34px auto 40px; max-width: 520px; text-wrap: pretty; }

.landing-products { padding: 84px 24px; background: var(--bg); }
.landing-products-inner { max-width: 1120px; margin: 0 auto; }
.landing-sizes-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 24px; }
.landing-size-card {
  background: var(--surface); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); padding: 30px 16px; text-align: center;
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease), border-color var(--speed) var(--ease);
  position: relative;
}
.landing-size-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg, 0 16px 40px rgba(15, 23, 42, 0.14)); border-color: var(--primary); }
.landing-size-label {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--gray-100); color: var(--gray-700);
  font-size: 20px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  transition: background var(--speed), color var(--speed), transform var(--speed) var(--ease);
}
.landing-size-card:hover .landing-size-label { background: var(--primary); color: #fff; transform: scale(1.12); }
.landing-size-card:hover .landing-size-tag { background: var(--primary); color: #fff; transform: scale(1.06); }
.landing-size-card:hover h3 { color: var(--primary-deep); }
.landing-size-card h3 { font-size: 16px; font-weight: 800; margin-bottom: 5px; color: var(--ink); transition: color var(--speed); }
.landing-size-card p { font-size: 13px; color: var(--gray-500); margin-bottom: 7px; }
.landing-size-price { font-size: 14px; font-weight: 800; color: var(--gray-700); margin-bottom: 13px; }
.landing-size-price span { display: block; font-size: 12px; font-weight: 600; color: var(--gray-500); margin-top: 2px; }
.landing-size-tag {
  display: inline-block; font-size: 11px; font-weight: 800; color: var(--primary-deep);
  background: var(--primary-light); padding: 5px 12px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.05em;
  transition: background var(--speed), color var(--speed), transform var(--speed) var(--ease);
}
.landing-size-featured { border: 2px solid var(--primary); background: var(--surface); box-shadow: 0 8px 28px rgba(230, 126, 34, 0.16); }
.landing-size-featured .landing-size-label { background: var(--primary); color: #fff; }
.landing-size-featured .landing-size-tag { background: var(--primary); color: #fff; }

.landing-footer { background: var(--gray-900); color: var(--gray-300); padding: 56px 24px 0; font-size: 13.5px; }
.landing-footer-grid {
  max-width: 1120px; margin: 0 auto; display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; padding-bottom: 40px;
}

.landing-footer-brand p { color: var(--gray-400); font-size: 13px; }
.landing-footer-col h4 {
  color: #fff; font-size: 11.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.09em; margin-bottom: 15px;
}
.landing-footer-col p { line-height: 1.75; margin-bottom: 4px; color: var(--gray-400); }
.landing-footer-social {
  color: var(--gray-400); text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: 12px; background: var(--gray-800);
  transition: background var(--speed), color var(--speed); margin-top: 8px;
}
.landing-footer-social:hover { background: var(--primary); color: #fff; }
.landing-hours-time { font-weight: 700; color: var(--gray-200) !important; }
.landing-footer-bottom {
  max-width: 1120px; margin: 0 auto; padding: 20px 0;
  border-top: 1px solid var(--gray-800); text-align: center;
  font-size: 12.5px; color: var(--gray-500);
}

/* ============================================================
   LOGIN (page + popup overlay)
   ============================================================ */
.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background:
    radial-gradient(900px 480px at 85% -10%, rgba(245, 176, 65, 0.35), transparent 60%),
    linear-gradient(140deg, #C46411 0%, #E67E22 55%, #F5B041 120%);
}
.login-container {
  background: var(--surface); padding: 42px; border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 410px;
}
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo h1 { margin: 0 0 10px; }
.login-logo p { color: var(--gray-600); font-size: 14px; }
.login-subtitle { color: var(--gray-500); font-size: 12px; margin-top: 4px; }
.login-footer { text-align: center; margin-top: 20px; font-size: 12px; color: var(--gray-500); }
.login-brand-logo { display: block; width: 250px; max-width: 100%; height: auto; margin: 0 auto; }

.login-overlay {
  position: fixed; inset: 0; z-index: 298;
  background: rgba(37, 30, 24, 0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity var(--speed) var(--ease);
}
.login-overlay.show { opacity: 1; pointer-events: auto; }
.login-popup {
  visibility: hidden;
  position: fixed; z-index: 299; top: 50%; left: 50%;
  transform: translate(-50%, -46%) scale(0.97);
  width: min(410px, calc(100vw - 32px));
  max-height: calc(100vh - 32px); overflow-y: auto; overflow-x: hidden;
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 42px 34px 34px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.login-popup::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, #E67E22, #F5B041);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.login-popup.show { visibility: visible; opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.login-popup-close {
  position: absolute; top: 13px; right: 16px;
  width: 32px; height: 32px; border-radius: 999px;
  background: none; border: none; display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--gray-400); cursor: pointer; line-height: 1;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.login-popup-close:hover { color: var(--ink); background: var(--gray-100); }
.login-form .form-group { margin-bottom: 16px; }
.login-form .btn-block { width: 100%; padding: 13px; font-size: 15px; margin-top: 4px; }
.login-form .btn-block { border-radius: 999px; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app-container { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width); position: fixed; top: 0; bottom: 0; left: 0;
  overflow-y: auto; z-index: 100;
  background: linear-gradient(180deg, var(--side-bg) 0%, #1C1610 100%);
  color: var(--side-text);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}
.sidebar-header {
  padding: 26px 20px 20px; text-align: center;
  border-bottom: 1px solid var(--side-border);
  background: rgba(0,0,0,0.15);
}
.sidebar-header a { color: #fff; text-decoration: none; display: inline-flex; flex-direction: column; align-items: center; gap: 10px; }

.role-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
}
.role-admin { background: rgba(230, 126, 34, 0.18); color: #F5B041; border: 1px solid rgba(230, 126, 34, 0.4); }
.role-staff { background: rgba(35, 122, 87, 0.25); color: #6FCF9F; border: 1px solid rgba(111, 207, 159, 0.35); }

.nav-list { list-style: none; padding: 12px 12px 20px; }
.nav-list li a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin: 2px 0; border-radius: 11px;
  color: var(--side-text); text-decoration: none; font-size: 13.5px; font-weight: 600;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease), padding-left var(--speed);

}
.nav-list li a:hover { background: var(--side-bg-hover); color: #fff; }
.nav-list li a.active { background: var(--side-bg-hover); color: #fff; }
.nav-list li a .nav-ico {
  display: inline-flex; align-items: center; color: var(--side-muted);
  transition: color var(--speed), transform var(--speed) var(--ease);
  width: 20px; height: 20px; flex-shrink: 0;
}
.nav-list li a:hover .nav-ico { color: var(--primary); transform: scale(1.08); }
.nav-list li a.active .nav-ico { color: var(--primary); }
.nav-divider {
  display: flex; align-items: center; gap: 8px;
  padding: 18px 13px 8px; font-size: 10.5px; text-transform: uppercase;
  color: var(--side-muted); letter-spacing: 0.12em; font-weight: 700;
}
.divider-line { flex: 1; height: 1px; background: var(--side-border); }
.nav-icon { margin-right: 10px; color: var(--gray-500); }

.main-content {
  margin-left: var(--sidebar-width); flex: 1;
  padding: 28px 32px; min-height: 100vh; max-width: 1440px;
}

.date-display { 
  color: var(--gray-600); font-size: 13.5px; font-weight: 600; 
  min-width: 0; flex-shrink: 1;
  padding: 8px 12px; background: var(--gray-100); border-radius: 8px;
}
.alert-badge-container { position: relative; }
.alert-badge {
  font-size: 18px; text-decoration: none; position: relative;
  color: var(--gray-700); display: inline-flex; padding: 6px;
  background: var(--surface); border: 1px solid var(--gray-200); border-radius: 12px;
  transition: border-color var(--speed), color var(--speed);
}
.alert-badge:hover { color: var(--primary-dark); }
.badge-count {
  position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 800; padding: 2px 5px; border-radius: 999px;
  min-width: 17px; text-align: center;
}

/* Alerts panel */
.alert-panel {
  position: absolute; top: 100%; right: 0; z-index: 1000;
  background: var(--surface); border: 1px solid var(--gray-200);
  border-radius: var(--r-md); box-shadow: var(--shadow-md);
  padding: 14px; margin-top: 6px;
  width: 360px; max-height: 400px; overflow-y: auto;
  display: none; opacity: 0; transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.alert-panel.open { display: block; opacity: 1; transform: translateY(0); }
.alert-panel h3 { margin-bottom: 10px; font-size: 14px; font-weight: 800; }
.alert-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: var(--r-sm); margin-bottom: 8px;
  font-size: 13px;
}
.alert-item:last-child { margin-bottom: 0; }
.alert-high { background: #FCEFEC; border-left: 3px solid var(--danger); }
.alert-medium { background: #FCF5E4; border-left: 3px solid var(--warning); }
.alert-low { background: #EBF5EE; border-left: 3px solid var(--success); }
.alert-icon { display: inline-flex; align-items: center; margin-right: 2px; }
.alert-high .alert-icon { color: var(--danger); }
.alert-medium .alert-icon { color: var(--warning); }
.alert-low .alert-icon { color: var(--success); }
.alert-message { flex: 1; font-size: 13px; }
.alert-clickable { cursor: pointer; transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease); }
.alert-clickable:hover { transform: translateX(2px); box-shadow: var(--shadow-sm); }
.alert-clickable:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.alert-link { color: inherit; text-decoration: none; }
.alert-link:hover { text-decoration: underline; }
.alert-go { display: inline-flex; align-items: center; color: var(--gray-400); flex-shrink: 0; }
.alert-clickable:hover .alert-go { color: var(--primary); }
tr.row-highlight { animation: row-flash 2.4s ease-out; }
@keyframes row-flash {
  0%, 45% { box-shadow: inset 0 0 0 2px var(--primary); background: #FEF3E2; }
  100% { box-shadow: none; }
}
tr:target { box-shadow: inset 0 0 0 2px var(--primary); }



/* Stats */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--gray-200);
  border-radius: var(--r-md); padding: 22px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-value { font-size: 28px; font-weight: 800; color: var(--ink); letter-spacing: -0.03em; }
.stat-label { font-size: 12.5px; color: var(--gray-600); margin-top: 6px; font-weight: 600; }
.stat-warning .stat-value { color: var(--warning); }
.stat-success .stat-value { color: var(--success); }
.stat-ico {
  position: absolute; top: 18px; right: 18px;
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary-deep);
}
.ico-egg { background: #F7EDDC; color: #A96A10; }
.ico-warning { background: #FCF3DE; color: var(--warning); }
.ico-success { background: #E7F3EC; color: var(--success); }
.ico-primary { background: var(--primary-light); color: var(--primary-deep); }

/* Cards */
.dashboard-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 20px; margin-bottom: 24px;
}
.card {
  background: var(--surface); border: 1px solid var(--gray-200);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm); margin-bottom: 20px;
  transition: box-shadow var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--gray-300); }
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 16px 22px; border-bottom: 1px solid var(--gray-100);
  flex-wrap: wrap; background: var(--gray-50);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.card-header h3, .card-header h4 { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 9px; }

.card-body { padding: 22px; }
.card-body > .table th:first-child, .card-body > .table td:first-child { padding-left: 22px; }
.card-body > .table th:last-child, .card-body > .table td:last-child { padding-right: 22px; }
.card-subtitle { padding: 0 22px 15px; }
.quick-actions { margin-top: 20px; }
.quick-actions h3 { margin-bottom: 15px; display: flex; align-items: center; gap: 9px; font-size: 15px; }


/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card-body { overflow-x: visible; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 12px 14px; border-bottom: 2px solid var(--gray-200);
  font-weight: 800; color: var(--gray-500); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
  background: var(--gray-50);
}
.table td { padding: 14px 14px; border-bottom: 1px solid var(--gray-100); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--speed-fast) ease; }
.table tbody tr:hover { background: var(--gray-50); }

.voided-row { opacity: 0.5; text-decoration: line-through; }
.voided-row td { text-decoration: none; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; margin-bottom: 7px; font-weight: 700;
  font-size: 12.5px; color: var(--gray-700); letter-spacing: 0.01em;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--gray-300);
  border-radius: var(--r-sm); font-size: 14px; font-family: var(--font);
  background: var(--surface); color: var(--ink);
  transition: border-color var(--speed), box-shadow var(--speed), background var(--speed);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: #FFFEFD;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--gray-400); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-inline { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.inline-form { display: inline-flex; align-items: center; gap: 5px; }
.input-sm { width: 90px !important; padding: 7px 9px !important; font-size: 12.5px !important; border-radius: 8px !important; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border: none; border-radius: 11px;
  font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none;
  font-family: var(--font); white-space: nowrap;
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease),
              background var(--speed) var(--ease), filter var(--speed) var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); filter: brightness(0.96); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(180deg, #EF8B31, var(--primary)); color: #fff; box-shadow: 0 4px 14px rgba(230, 126, 34, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.btn-primary:hover { background: linear-gradient(180deg, var(--primary), var(--primary)); box-shadow: 0 8px 22px rgba(230, 126, 34, 0.45); }
.btn-success { background: var(--success); color: #fff; box-shadow: 0 4px 14px rgba(35, 122, 87, 0.3); }
.btn-success:hover { background: #1D6B4A; box-shadow: 0 8px 22px rgba(35, 122, 87, 0.4); }
.btn-warning { background: #E29A1C; color: #fff; box-shadow: 0 4px 14px rgba(226, 154, 28, 0.3); }
.btn-warning:hover { background: #C4830F; box-shadow: 0 8px 22px rgba(226, 154, 28, 0.4); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 14px rgba(192, 57, 43, 0.3); }
.btn-danger:hover { background: #A93226; box-shadow: 0 8px 22px rgba(192, 57, 43, 0.4); }
.btn-info { background: var(--info); color: #fff; box-shadow: 0 4px 14px rgba(42, 111, 151, 0.3); }
.btn-info:hover { background: #215A7B; box-shadow: 0 8px 22px rgba(42, 111, 151, 0.4); }
.btn-secondary { background: var(--surface); color: var(--gray-700); border: 1.5px solid var(--gray-300); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { border-color: var(--gray-400); background: var(--gray-50); box-shadow: var(--shadow-sm); }
.btn-link { background: none; color: var(--primary-dark); padding: 0; text-decoration: underline; box-shadow: none; }
.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: 13px; }
.btn-sm { padding: 8px 14px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-small {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-size: 12.5px; font-weight: 700; cursor: pointer; text-decoration: none;
  color: var(--gray-700); background: var(--surface); font-family: var(--font);
  transition: background var(--speed), border-color var(--speed), color var(--speed);
}
.btn-small:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn-small.btn-danger,
.btn-small.btn-info {
  border-color: transparent; color: #fff; box-shadow: none;
}
.btn-small.btn-success { background: var(--success); }
.btn-small.btn-success:hover { background: #1B6346; border-color: transparent; }
.btn-small.btn-warning { background: #E29A1C; }
.btn-small.btn-warning:hover { background: #BE8010; border-color: transparent; }
.btn-small.btn-danger { background: var(--danger); }
.btn-small.btn-danger:hover { background: #A93226; border-color: transparent; }
.btn-small.btn-info { background: var(--info); }
.btn-small.btn-info:hover { background: #215A7B; border-color: transparent; }

/* A slot that is present but not permitted has to keep its width, otherwise the row
   it sits in becomes narrower than its neighbours and the column stops lining up. */
.btn-small:disabled,
.btn-small[aria-disabled="true"] {
  opacity: 0.4; cursor: not-allowed; box-shadow: none; filter: none;
}
.btn-small:disabled:hover,
.btn-small[aria-disabled="true"]:hover {
  background: var(--gray-200); border-color: var(--gray-200); color: var(--gray-500);
}
.btn-small.btn-danger:disabled:hover,
.btn-small.btn-danger[aria-disabled="true"]:hover {
  background: var(--gray-200); border-color: transparent; color: var(--gray-500);
}

/* Status pills */
.alert { padding: 13px 16px; border-radius: var(--r-sm); margin-bottom: 15px; font-size: 13.5px; font-weight: 600; border: 1px solid transparent; }
.alert-error { background: #FCEFEC; color: var(--danger); border-color: #F5D5CF; }
.alert-success { background: #E7F3EC; color: var(--success); border-color: #CDE5D6; }
.alert-warning { background: #FCF5E4; color: var(--warning); border-color: #F0DFB4; }

/* ============================================================
   TOASTS
   Transient feedback that pops in over the page and retires itself.
   ============================================================ */
.toast-stack {
  position: fixed; top: 18px; right: 18px; z-index: 10000;
  display: flex; flex-direction: column; gap: 10px;
  width: min(340px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--gray-400);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  animation: toastIn 320ms var(--ease) both;
}
.toast.is-leaving { animation: toastOut 240ms var(--ease) both; }

.toast-icon { flex-shrink: 0; display: inline-flex; font-size: 17px; line-height: 1.35; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13.5px; font-weight: 800; color: var(--ink); }
.toast-message { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow-wrap: break-word; }
.toast-message:empty { display: none; }
.toast-close {
  flex-shrink: 0; background: none; border: 0; padding: 0 2px; margin: -2px -2px 0 0;
  font-size: 18px; line-height: 1; color: var(--gray-400);
  cursor: pointer; border-radius: 4px; transition: color var(--speed);
}
.toast-close:hover { color: var(--gray-700); }
.toast-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon { color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info { border-left-color: var(--info); }
.toast-info .toast-icon { color: var(--info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(18px) scale(0.97); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(18px) scale(0.97); }
}

body.dark-mode .toast { background: #201A15; border-color: #332A21; border-left-color: var(--gray-500); }
body.dark-mode .toast-success { border-left-color: #35A374; }
body.dark-mode .toast-error { border-left-color: #E06B5B; }
body.dark-mode .toast-warning { border-left-color: #E0A93A; }
body.dark-mode .toast-info { border-left-color: #5FA8CE; }
body.dark-mode .toast-title { color: #EDE7DF; }
body.dark-mode .toast-message { color: #A79A8A; }
body.dark-mode .toast-close:hover { color: #EDE7DF; }

@media (max-width: 480px) {
  .toast-stack { top: 10px; right: 10px; left: 10px; width: auto; }
}

.age-green, .gauge-green { background: #DFF0E5; color: #1B6B47; }
.age-yellow, .gauge-yellow { background: #FCF3DE; color: #9A6A0B; }
.age-orange { background: #FBE8D5; color: #A85B10; }
.age-red, .gauge-red { background: #FBE4E0; color: #A93226; }
.gauge-gray { background: var(--gray-100); color: var(--gray-600); }
.age-label { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.gauge { display: inline-block; padding: 5px 13px; border-radius: 999px; font-weight: 800; font-size: 13.5px; }

.size-badge { display: inline-block; padding: 4px 11px; border-radius: 8px; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: 0.02em; }

.confidence-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.confidence-high { background: #DFF0E5; color: #1B6B47; }
.confidence-medium { background: #FCF3DE; color: #9A6A0B; }
.confidence-low { background: #FBE4E0; color: #A93226; }
.confidence-none { background: #F0F0F0; color: #888; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.badge-success { background: #DFF0E5; color: #1B6B47; }
.badge-danger { background: #FBE4E0; color: #A93226; }

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.text-right { text-align: right; }

.pagination {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  margin-top: 20px; font-size: 13px; color: var(--gray-600); font-weight: 600;
}
.pagination .page-info { padding: 0 8px; color: var(--gray-500); }

/* Login tabs — segmented pill control */
.login-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--gray-100); border-radius: 999px; padding: 4px;
  margin-bottom: 22px;
}
.login-tab {
  padding: 10px 16px; border: none; border-radius: 999px; background: transparent;
  font-family: var(--font); font-size: 14px; font-weight: 700; color: var(--gray-600);
  cursor: pointer; white-space: nowrap;
  transition: color var(--speed) var(--ease), background var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.login-tab:hover { color: var(--primary-dark); }
.login-tab.login-tab-active {
  color: var(--primary-deep); background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.login-tab.login-tab-active:hover { color: var(--primary-deep); }
.login-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Chart components */
.chart-container { position: relative; width: 100%; height: 320px; }
.chart-message {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  text-align: center; padding: 24px; font-size: 13px; font-weight: 600; line-height: 1.5;
  color: var(--gray-600); background: var(--surface);
}
.chart-message-error { color: var(--danger); }
.chart-period-toggle { display: flex; gap: 4px; background: var(--gray-100); border-radius: var(--r-sm); padding: 3px; }
.period-btn {
  padding: 5px 14px; border: none; border-radius: 8px; font-size: 12px; font-weight: 700;
  color: var(--gray-500); background: transparent; cursor: pointer; transition: all var(--speed) var(--ease);
  font-family: var(--font);
}
.period-btn:hover { color: var(--gray-700); }
.period-btn.active { background: var(--surface); color: var(--primary-dark); box-shadow: var(--shadow-sm); }
.chart-category-select {
  padding: 5px 10px; border: 1px solid var(--gray-200); border-radius: 8px; font-size: 12px;
  font-weight: 600; color: var(--gray-600); background: var(--surface); cursor: pointer;
  font-family: var(--font); outline: none; transition: border-color var(--speed) var(--ease);
}
.chart-category-select:focus { border-color: var(--primary); }
.chart-legend-custom { display: flex; gap: 20px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--gray-600); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Quick actions / sale */
.action-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.sale-tips .card-body { max-height: 70vh; overflow-y: auto; }
.sale-item-row select, .sale-item-row input {
  padding: 11px 13px; border: 1.5px solid var(--gray-300); border-radius: var(--r-sm);
  font-size: 14px; font-family: var(--font); background: var(--surface);
}
.sale-total, .sale-change { font-size: 18px; font-weight: 800; padding: 10px 0; letter-spacing: -0.02em; }
.sale-change span:last-child { color: var(--success); }
.fifo-item {
  padding: 9px 0; border-bottom: 1px dashed var(--gray-200);
  font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.fifo-item:last-child { border-bottom: none; }
.fifo-item-clickable { cursor: pointer; border-radius: var(--r-sm); transition: background var(--speed); padding: 10px 12px; margin-bottom: 6px; }
.fifo-item-clickable:hover { background: var(--gray-50); }
.fifo-category-group { margin-bottom: 10px; }
.fifo-category-group:last-child { margin-bottom: 0; }
.fifo-category-header { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gray-500); padding: 4px 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.fifo-category-count { font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 10px; color: var(--gray-400); }
.fifo-tray-row { padding: 6px 8px; border-radius: var(--r-sm); margin-bottom: 3px; border-left: 3px solid transparent; }
.fifo-tray-row.fifo-highlight-urgent { border-left-color: #E74C3C; background: #FDEDEC; }
.fifo-tray-row.fifo-highlight-soon { border-left-color: #F39C12; background: #FDF6E3; }
.fifo-tray-row.fifo-highlight-ok { border-left-color: #27AE60; background: #EAF7EE; }
.fifo-tray-row-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.fifo-tray-size { font-weight: 700; min-width: 32px; }
.fifo-tray-id { font-weight: 600; color: #555; }
.fifo-tray-qty { color: #777; margin-left: auto; }
.fifo-compact-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.fifo-compact-chip { display: inline-flex; align-items: center; gap: 3px; padding: 4px 8px; border-radius: var(--r-sm); background: var(--gray-100); border: 1px solid var(--gray-200); font-size: 12px; cursor: pointer; transition: all var(--speed); }
.fifo-compact-chip:hover { background: var(--gray-200); }
.fifo-compact-chip.chip-urgent { background: #FDEDEC; border-color: #F5B7B1; }
.fifo-compact-chip.chip-urgent:hover { background: #FADBD8; }
.chip-size { font-weight: 700; }
.chip-count { color: var(--gray-500); font-size: 11px; }
.fifo-category-header { cursor: pointer; user-select: none; transition: color var(--speed); }
.fifo-category-header:hover { color: var(--primary); }
.fifo-category-header::before { content: '▸'; display: inline-block; margin-right: 4px; transition: transform 0.2s; font-size: 10px; }
.fifo-expanded > .fifo-category-header::before { transform: rotate(90deg); }
.tray-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--r-sm); background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap; }
.tray-badge .tray-badge-clear { cursor: pointer; margin-left: 2px; opacity: 0.7; font-weight: 400; }
.tray-badge .tray-badge-clear:hover { opacity: 1; }
.fifo-tray-row.fifo-selected { outline: 2px solid var(--primary); outline-offset: -2px; background: #EBF5FB !important; }
.fifo-priority-totem { border-left: 4px solid #E74C3C !important; background: #FDEDEC !important; box-shadow: 0 0 0 2px rgba(231,76,60,0.18); position: relative; }
.fifo-priority-banner { background: #E74C3C; color: #fff; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; padding: 4px 8px; border-radius: var(--r-sm); margin-bottom: 6px; text-align: center; animation: fifoPulse 2s ease-in-out infinite; }
.fifo-recommended { border-left: 4px solid #2980B9 !important; background: #EBF5FB !important; box-shadow: 0 0 0 2px rgba(41,128,185,0.15); position: relative; }
.fifo-recommended-banner { background: linear-gradient(135deg, #2980B9, #3498DB); color: #fff; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; padding: 5px 10px; border-radius: var(--r-sm); margin-bottom: 6px; text-align: center; animation: recommendedGlow 2s ease-in-out infinite; box-shadow: 0 2px 6px rgba(41,128,185,0.3); }
@keyframes recommendedGlow { 0%,100% { box-shadow: 0 2px 6px rgba(41,128,185,0.3); } 50% { box-shadow: 0 2px 12px rgba(41,128,185,0.5); } }
@keyframes fifoPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }
.fifo-empty-msg { padding: 16px; text-align: center; color: var(--gray-400); font-size: 13px; font-style: italic; }
.expired-notification { background: #FEF3E2; border: 1px solid #F5CBA7; border-left: 4px solid #E67E22; border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 16px; }
.expired-notification-content { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.expired-notification-icon { font-size: 22px; color: #E67E22; }
.expired-notification-text { flex: 1; min-width: 200px; }
.expired-notification-text strong { display: block; color: #E67E22; font-size: 14px; }
.expired-notification-text span { font-size: 12px; color: #8B6914; }
.expired-notification-actions { display: flex; gap: 6px; }
.expired-card .card-header { background: #FDEDEC; border-bottom: 1px solid #F5B7B1; }
.expired-card .card-header h3 { color: #C0392B; }
.expired-count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 11px; background: #E74C3C; color: #fff; font-size: 11px; font-weight: 800; margin-left: 6px; padding: 0 6px; }
.days-expired-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #FDEDEC; color: #C0392B; font-size: 11px; font-weight: 700; }
.dispose-btn { white-space: nowrap; }
/* The disposal queue and recent-batch log can both run long; cap them and scroll
   inside so the page below stays reachable. Headers stick for orientation. */
.expired-card .card-body,
.recent-batches-card .card-body { max-height: 360px; overflow-y: auto; overscroll-behavior: contain; }
.expired-card .card-body thead th,
.recent-batches-card .card-body thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; border-radius: 9px; font-size: 10px; font-weight: 800; margin-left: 6px; padding: 0 5px; }
.nav-badge-alert { background: #E74C3C; color: #fff; }
.alert-panel-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.alert-panel-header h3 { margin: 0; }
.alert-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #27AE60; animation: livePulse 2s ease-in-out infinite; }
@keyframes livePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.alert-panel-empty { padding: 16px; text-align: center; color: var(--gray-400); font-size: 13px; }
.fifo-flag {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px;
}
.fifo-flag-urgent { background: #FDEDEC; color: #C0392B; border: 1px solid #F5B7B1; }
.fifo-flag-soon { background: #FDF6E3; color: #B7950B; border: 1px solid #F0DC9E; }
.fifo-flag-expired { background: #E5E5E5; color: #888; border: 1px solid #CCC; text-decoration: line-through; }
.fifo-highlight-urgent { background: #FDEDEC; border-left: 4px solid #E74C3C; }
.fifo-highlight-soon { background: #FDF6E3; border-left: 4px solid #F39C12; }
.fifo-highlight-ok { background: #EAF7EE; border-left: 4px solid #27AE60; }
.fifo-tray-expired { opacity: 0.55; background: #F5F5F5; border-left: 4px solid #BBB; cursor: not-allowed; pointer-events: none; }
.fifo-expired-row-banner { background: #999; color: #fff; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; padding: 4px 8px; border-radius: var(--r-sm); margin-bottom: 6px; text-align: center; }
.fifo-expired-alert { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border-radius: var(--r-sm); background: #FDEDEC; border: 1px solid #F5B7B1; border-left: 4px solid #E74C3C; }
.fifo-expired-alert-icon { font-size: 20px; color: #E74C3C; flex-shrink: 0; }
.fifo-expired-alert-text { flex: 1; min-width: 0; }
.fifo-expired-alert-text strong { display: block; color: #C0392B; font-size: 12px; margin-bottom: 1px; }
.fifo-expired-alert-text span { font-size: 11px; color: #8B4513; }
.fifo-expired-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; border-radius: 8px; background: #E74C3C; color: #fff; font-size: 9px; font-weight: 800; padding: 0 5px; margin-left: 4px; }
.chip-expired { background: #F5F5F5 !important; border-color: #DDD !important; opacity: 0.6; }
.chip-expired-count { font-size: 9px; font-weight: 800; color: #E74C3C; background: #FDEDEC; padding: 1px 4px; border-radius: 4px; margin-left: 2px; }
.fifo-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.fifo-item-detail { font-size: 12px; color: #555; margin-top: 2px; }
.fifo-item-detail strong { color: #333; }
.fifo-hint {
  flex-basis: 100%; font-size: 12.5px; font-weight: 700;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--r-sm);
}
.fifo-hint.fifo-soon, .egg-size-select.fifo-soon {
  background-color: #FDF6E3; border: 1px solid #F0DC9E !important;
}
.fifo-hint.fifo-soon { color: #8A6D0B; box-shadow: none; }
.fifo-hint.fifo-urgent, .egg-size-select.fifo-urgent {
  background-color: #FDEDEC; border: 1px solid #F5B7B1 !important;
}
.fifo-hint.fifo-urgent { color: #C0392B; box-shadow: none; }
.stock-hint { font-size: 11px; color: #666; margin-top: 2px; display: block; width: 100%; }
.egg-size-select.fifo-soon { box-shadow: 0 0 0 3px rgba(240, 220, 158, 0.4); }
.egg-size-select.fifo-urgent { box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.22); }
body.dark-mode .fifo-hint.fifo-soon, body.dark-mode .egg-size-select.fifo-soon { background-color: #332A17; border-color: #4A3E20 !important; }
body.dark-mode .fifo-hint.fifo-soon { color: #EBC86E; }
body.dark-mode .fifo-hint.fifo-urgent, body.dark-mode .egg-size-select.fifo-urgent { background-color: #331D19; border-color: #4A2620 !important; }
body.dark-mode .fifo-hint.fifo-urgent { color: #F09384; }
body.dark-mode .fifo-item-clickable:hover { background: #241D17; }
body.dark-mode .fifo-item-detail { color: #999; }
body.dark-mode .fifo-item-detail strong { color: #ddd; }
body.dark-mode .fifo-category-header { color: #999; border-bottom-color: #3a3025; }
body.dark-mode .fifo-category-count { color: #777; }
body.dark-mode .fifo-tray-row.fifo-highlight-urgent { background: #331D19; }
body.dark-mode .fifo-tray-row.fifo-highlight-soon { background: #332A17; }
body.dark-mode .fifo-tray-row.fifo-highlight-ok { background: #1a2e1a; }
body.dark-mode .fifo-tray-id { color: #ccc; }
body.dark-mode .fifo-tray-qty { color: #999; }
body.dark-mode .fifo-compact-chip { background: #2a2218; border-color: #3a3025; color: #ddd; }
body.dark-mode .fifo-compact-chip:hover { background: #3a3025; }
body.dark-mode .fifo-compact-chip.chip-urgent { background: #331D19; border-color: #4A2620; }
body.dark-mode .fifo-compact-chip.chip-urgent:hover { background: #3D2320; }
body.dark-mode .fifo-compact-chip.chip-expired { background: #222 !important; border-color: #333 !important; opacity: 0.5; }
body.dark-mode .chip-count { color: #999; }
body.dark-mode .tray-badge { background: #5B8DEF; }
body.dark-mode .fifo-tray-row.fifo-selected { background: #1a2a3a !important; outline-color: #5B8DEF; }
body.dark-mode .fifo-priority-totem { background: #331D19 !important; box-shadow: 0 0 0 2px rgba(231,76,60,0.25); }
body.dark-mode .fifo-priority-banner { background: #C0392B; }
body.dark-mode .fifo-recommended { background: #1a2a3a !important; box-shadow: 0 0 0 2px rgba(41,128,185,0.25); }
body.dark-mode .fifo-recommended-banner { background: linear-gradient(135deg, #1a6e9e, #2980B9); box-shadow: 0 2px 6px rgba(41,128,185,0.4); }
body.dark-mode .fifo-tray-expired { background: #1a1a1a; border-left-color: #555; }
body.dark-mode .fifo-expired-row-banner { background: #555; }
body.dark-mode .fifo-expired-alert { background: #331D19; border-color: #4A2620; }
body.dark-mode .fifo-expired-alert-icon { color: #F09384; }
body.dark-mode .fifo-expired-alert-text strong { color: #F09384; }
body.dark-mode .fifo-expired-alert-text span { color: #C9A84C; }
body.dark-mode .expired-notification { background: #332A17; border-color: #4A3E20; }
body.dark-mode .expired-notification-text strong { color: #EBC86E; }
body.dark-mode .expired-notification-text span { color: #C9A84C; }
body.dark-mode .expired-card .card-header { background: #331D19; border-bottom-color: #4A2620; }
body.dark-mode .expired-card .card-body thead th,
body.dark-mode .recent-batches-card .card-body thead th { background: #201A15; }
body.dark-mode .expired-card .card-header h3 { color: #F09384; }
body.dark-mode .days-expired-badge { background: #331D19; color: #F09384; }
body.dark-mode .nav-badge-alert { background: #C0392B; }
body.dark-mode .alert-panel-header h3 { color: #eee; }
body.dark-mode .alert-panel-empty { color: #888; }
.receipt-success { text-align: center; padding: 24px; }
.receipt-success h4 { font-size: 23px; color: var(--success); margin-bottom: 15px; letter-spacing: -0.02em; }
.receipt-detail { padding: 15px; }

/* Scanner */
.scanner-container { margin-bottom: 20px; }
.video-container { position: relative; max-width: 640px; margin: 0 auto; }
.video-container video { width: 100%; border-radius: var(--r-md); display: block; background: var(--gray-900); }
.scan-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.scan-frame {
  width: 200px; height: 200px; border: 2.5px solid var(--primary); border-radius: 18px;
  box-shadow: 0 0 0 999px rgba(20, 14, 8, 0.42);
}
.scan-frame::after {
  content: ''; position: absolute; left: 12%; right: 12%; top: 50%;
  height: 2px; background: linear-gradient(90deg, transparent, rgba(230, 126, 34, 0.9), transparent);
  animation: scanline 2.4s var(--ease) infinite;
}
@keyframes scanline { 0%, 100% { transform: translateY(-70px); opacity: 0.2; } 50% { transform: translateY(70px); opacity: 1; } }
.scan-hint { position: absolute; bottom: 16px; font-size: 13px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.6); width: 100%; text-align: center; }
.scanner-controls { text-align: center; margin-top: 22px; }
.scanner-card, .manual-card { margin-bottom: 20px; }

.tray-info { padding: 16px; border-radius: var(--r-sm); }
.tray-info.expired { background: #FCEFEC; border: 1px solid #F0C8C1; }
.tray-info.expiring { background: #FCF5E4; border: 1px solid #EDDCAB; }
.tray-actions { display: flex; gap: 8px; margin-top: 15px; flex-wrap: wrap; }

/* Toggle switch */
.toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; }
.toggle-slider {
  width: 42px; height: 23px; background: var(--gray-300); border-radius: 999px;
  position: relative; transition: background var(--speed); flex-shrink: 0;
}
.toggle-slider:before {
  content: ''; position: absolute; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: transform var(--speed) var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider:before { transform: translateX(19px); }
.toggle input:focus-visible + .toggle-slider { box-shadow: 0 0 0 3px var(--primary-glow); }

/* Pick list */
.pick-section { margin-bottom: 20px; }
.pick-section.urgent .card-header { background: #FCEFEC; border-radius: var(--r-md) var(--r-md) 0 0; }
.pick-row.priority-high { background: #FDF4E7; }
.pick-row.expired { background: #FCEFEC; }
.pick-row.expiring { background: #FCF5E4; }

/* Metrics */
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric-item { text-align: center; padding: 12px 10px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--r-sm); }
.metric-label { display: block; font-size: 10.5px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800; }
.metric-value { display: block; font-size: 21px; font-weight: 800; margin-top: 4px; letter-spacing: -0.02em; }

/* ---------- Metric table (predictions) ---------- */
.metric-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.metric-table thead th {
  text-align: left; padding: 0 16px 10px; border-bottom: 2px solid var(--gray-200);
  font-size: 11.5px; font-weight: 800; color: var(--gray-600);
  text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
}
.metric-table thead th.mt-val { text-align: right; }
.metric-table thead th.mt-status { text-align: center; }
.metric-table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
.metric-table tbody tr:last-child td { border-bottom: none; }
.metric-table tbody tr:hover { background: var(--gray-50); }
.metric-table .mt-val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.metric-table .mt-status { text-align: center; white-space: nowrap; }
.metric-table .mt-group td {
  padding: 20px 16px 8px; border-bottom: 1px solid var(--gray-200);
  font-size: 11px; font-weight: 800; color: var(--primary-deep);
  text-transform: uppercase; letter-spacing: 0.09em; background: var(--gray-50);
}
.metric-table .mt-group:first-child td { padding-top: 6px; }

.mt-name { display: flex; flex-direction: column; gap: 3px; }
.mt-term {
  font-size: 14.5px; font-weight: 800; color: var(--ink);
  letter-spacing: -0.01em; line-height: 1.3;
}
.mt-alias { font-size: 12.5px; font-weight: 600; color: var(--gray-600); line-height: 1.4; }
.mt-def { font-size: 12.5px; color: var(--gray-700); line-height: 1.55; max-width: 380px; }
.mt-figure {
  font-size: 19px; font-weight: 800; color: var(--ink);
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.mt-figure-unit { font-size: 12px; font-weight: 700; color: var(--gray-500); margin-left: 2px; }
.mt-target { font-size: 12px; font-weight: 700; color: var(--gray-600); font-variant-numeric: tabular-nums; }
.mt-verdict {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap;
}
.mt-verdict-green { background: #DFF0E5; color: #1B6B47; }
.mt-verdict-yellow { background: #FCF3DE; color: #9A6A0B; }
.mt-verdict-red { background: #FBE4E0; color: #A93226; }
.mt-verdict-gray { background: var(--gray-100); color: var(--gray-600); }


.mt-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 15px 18px; border-radius: var(--r-md); margin-bottom: 20px;
}
.mt-summary-green { background: #E7F3EC; border: 1px solid #CDE5D6; }
.mt-summary-yellow { background: #FCF5E4; border: 1px solid #F0DFB4; }
.mt-summary-red { background: #FCEFEC; border: 1px solid #F5D5CF; }
.mt-summary-gray { background: var(--gray-50); border: 1px solid var(--gray-200); }
.mt-summary-score { font-size: 40px; font-weight: 800; letter-spacing: -0.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.mt-summary-green .mt-summary-score { color: var(--success); }
.mt-summary-yellow .mt-summary-score { color: var(--warning); }
.mt-summary-red .mt-summary-score { color: var(--danger); }
.mt-summary-gray .mt-summary-score { color: var(--gray-500); }
.mt-summary-text { font-size: 14px; font-weight: 600; line-height: 1.6; color: var(--gray-700); }
.mt-summary-text strong { color: var(--ink); }
.mt-summary-level {
  display: inline-block; margin-left: 6px; padding: 3px 10px;
  border-radius: 999px; font-size: 11.5px; font-weight: 800;
  background: rgba(255, 255, 255, 0.72); color: var(--gray-700);
}

.mt-scale {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px; margin-top: 20px;
}
.mt-scale-item {
  padding: 14px 16px; background: var(--gray-50);
  border: 1px solid var(--gray-200); border-radius: var(--r-sm);
}
.mt-scale-label { font-size: 12.5px; font-weight: 800; color: var(--ink); margin-bottom: 3px; }
.mt-scale-note { font-size: 12.5px; line-height: 1.55; color: var(--gray-600); }

/* ---------- Plain-language prediction layer ---------- */
.plain-kicker {
  margin: 0 0 14px; font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--gray-500);
}
.plain-hero { border-left: 4px solid var(--primary); }
.plain-hero-figures { display: flex; flex-wrap: wrap; gap: 34px; margin-bottom: 16px; }
.plain-hero-figure { display: flex; flex-direction: column; }
.plain-hero-number { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; color: var(--primary-deep); }
.plain-hero-unit { font-size: 12.5px; font-weight: 700; color: var(--gray-600); margin-top: 2px; }
.plain-summary { font-size: 14.5px; line-height: 1.65; color: var(--ink); margin: 0 0 16px; }

.plain-action-box {
  background: #FCF5E4; border: 1px solid #F0DFB4; border-left: 3px solid var(--warning);
  border-radius: var(--r-sm); padding: 14px 16px; font-size: 13.5px; line-height: 1.6;
}
.plain-action-box strong { display: block; margin-bottom: 8px; color: var(--warning); }
.plain-action-box ul { margin: 0; padding-left: 20px; }
.plain-action-box li { margin-bottom: 6px; }
.plain-action-box li:last-child { margin-bottom: 0; }
.plain-action-ok { background: #E7F3EC; border-color: #CDE5D6; border-left-color: var(--success); color: var(--success); }

.plain-sub { font-size: 11.5px; font-weight: 600; color: var(--gray-500); margin-top: 3px; }
.plain-words { font-size: 12.5px; line-height: 1.55; color: var(--gray-700); max-width: 340px; }
.plain-lede { font-size: 14px; line-height: 1.65; color: var(--ink); margin: 0 0 16px; }
.plain-subhead { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gray-500); margin: 22px 0 10px; }

.plain-verb {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; white-space: nowrap;
}
.plain-verb-success { background: #DFF0E5; color: #1B6B47; }
.plain-verb-warning { background: #FCF3DE; color: #9A6A0B; }
.plain-verb-danger { background: #FBE4E0; color: #A93226; }
.plain-verb-muted { background: #F0F0F0; color: #888; }

/* ============================================================
   SALES FORECAST LAYOUT
   Two-column hero (figures beside the action) so the eye lands on the
   number and the to-do in one pass, and right-aligned numeric columns
   in the forecast table so figures line up instead of drifting.
   ============================================================ */
.forecast-overview-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 22px; }
.forecast-overview-heading h2 { font-size: 19px; letter-spacing: -.025em; margin: 0 0 5px; }
.forecast-overview-heading p { color: var(--gray-500); font-size: 12px; margin: 0; }
.forecast-freshness { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 999px; color: var(--gray-600); font-size: 11px; white-space: nowrap; }
.fc-layout { display: grid; gap: 18px; }
.fc-hero-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.forecast-stat { display: flex; gap: 16px; align-items: start; padding: 22px; border: 1px solid var(--gray-200); border-radius: 14px; background: var(--gray-50); min-width: 0; }
.forecast-stat > div { min-width: 0; }
.forecast-stat-icon { display: grid; place-items: center; flex: 0 0 48px; height: 48px; border-radius: 14px; }
.forecast-stat-trays { background: #fff0dc; color: #b55708; }
.forecast-stat-eggs { background: #fff5d9; color: #a57908; }
.forecast-stat-sales { background: #e8f4ed; color: #19724e; }
.forecast-stat-label { display: block; font-size: 12px; color: var(--gray-600); }
.forecast-stat-value { display: block; font-size: clamp(26px, 2.4vw, 34px); line-height: 1.25; letter-spacing: -.04em; color: var(--ink); margin: 6px 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.forecast-stat-caption { display: block; color: var(--gray-500); font-size: 11px; line-height: 1.5; }
.forecast-waiting { display: flex; gap: 8px; align-items: start; font-size: 12px; color: var(--gray-500); margin: 16px 0 0; }
.forecast-waiting svg { flex-shrink: 0; }

/* Why a confidence level was lowered. */
.fc-why { color: var(--warning); font-weight: 700; }

/* Trays split by category, with the sizes nested inside each one. */
.fc-cats {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 20px;
}
.fc-cats-label {
  display: flex; align-items: baseline; gap: 7px;
  font-size: 10.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--gray-500);
}
.fc-cats-hint {
  text-transform: none; letter-spacing: 0; font-weight: 600;
  font-size: 10.5px; color: var(--gray-400);
}
.fc-cat {
  background: var(--gray-100); border: 1px solid var(--gray-200);
  border-radius: var(--r-sm);
}
.fc-cat > summary {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 16px; cursor: pointer; list-style: none;
  transition: background var(--speed);
}
.fc-cat > summary::-webkit-details-marker { display: none; }
.fc-cat > summary:hover { background: var(--gray-200); }
.fc-cat > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.fc-cat-chevron {
  flex-shrink: 0;
  color: var(--gray-400); transition: transform var(--speed) var(--ease);
}
.fc-cat[open] .fc-cat-chevron { transform: rotate(90deg); }
.fc-cat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fc-cat-fresh { background: var(--success); }
.fc-cat-salted { background: var(--info); }
.fc-cat-name { font-size: 12.5px; font-weight: 700; color: var(--gray-700); }
.fc-cat-count { font-size: 10.5px; font-weight: 600; color: var(--gray-400); }
.fc-cat-trays {
  margin-left: auto; font-size: 14px; font-weight: 800; color: var(--ink);
  font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right;
}
.fc-cat-trays small { font-size: 11px; font-weight: 500; color: var(--gray-500); }
/* Nested sizes, revealed on demand. */
.fc-cat-sizes {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 2px 11px 10px 27px;
}
.fc-cat-size {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--gray-200);
}
.fc-cat-size-code {
  font-size: 9.5px; font-weight: 800; color: #fff;
  padding: 2px 5px; border-radius: 4px; letter-spacing: 0.02em;
}
.fc-cat-size-name { font-size: 11.5px; font-weight: 600; color: var(--gray-600); }
.fc-cat-size-trays {
  font-size: 12px; font-weight: 800; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.fc-cat-size-trays::after {
  content: 't'; font-size: 9.5px; font-weight: 700; color: var(--gray-400);
}
.fc-restock { margin: 0; display: flex; flex-direction: column; }
.fc-restock ul { padding-left: 18px; }
.fc-restock li { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.fc-restock .size-badge { font-size: 11px; padding: 2px 8px; }

/* Numeric columns right-aligned, labels left. */
.fc-table td.mt-val, .fc-table th.mt-val { text-align: right; }
.fc-table td.mt-val { white-space: nowrap; font-variant-numeric: tabular-nums; }
.fc-table td.mt-val .plain-sub { text-align: right; }
.fc-table thead th { white-space: nowrap; }

/* Keep prose to a readable measure instead of letting it run the full width. */
.metric-card .plain-lede { max-width: 62ch; }

@media (max-width: 900px) {
  .forecast-stat { flex-direction: column; padding: 16px; gap: 12px; }
}
@media (max-width: 600px) {
  .forecast-overview-heading { flex-direction: column; }
  .fc-hero-figures { grid-template-columns: 1fr; gap: 10px; }
  .forecast-stat { flex-direction: row; }
  .fc-cats-label { flex-wrap: wrap; }
}

.plain-verdict {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 18px; border-radius: var(--r-md); margin-bottom: 4px;
}
.plain-verdict-green { background: #E7F3EC; border: 1px solid #CDE5D6; }
.plain-verdict-yellow { background: #FCF5E4; border: 1px solid #F0DFB4; }
.plain-verdict-red { background: #FCEFEC; border: 1px solid #F5D5CF; }
.plain-verdict-gray { background: var(--gray-50); border: 1px solid var(--gray-200); }
.plain-verdict-score { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.plain-verdict-green .plain-verdict-score { color: var(--success); }
.plain-verdict-yellow .plain-verdict-score { color: var(--warning); }
.plain-verdict-red .plain-verdict-score { color: var(--danger); }
.plain-verdict-gray .plain-verdict-score { color: var(--gray-500); }
.plain-verdict-label { font-size: 13.5px; font-weight: 600; line-height: 1.55; color: var(--gray-700); max-width: 420px; }
.plain-verdict-label em { display: block; font-style: normal; font-size: 12px; color: var(--gray-500); margin-top: 3px; }

.plain-metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 12px; }
.plain-metric {
  padding: 14px; background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--r-sm); display: flex; flex-direction: column; gap: 6px;
}
.plain-metric-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-600); }
.plain-metric-value { align-self: flex-start; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; padding: 4px 11px; border-radius: 999px; }
.plain-metric-help { font-size: 12px; line-height: 1.55; color: var(--gray-600); }

.plain-details { margin-top: 16px; border: 1px solid var(--gray-200); border-radius: var(--r-sm); background: var(--gray-50); }
.plain-details > summary {
  padding: 12px 15px; cursor: pointer; font-size: 13px; font-weight: 700;
  color: var(--primary-dark); list-style: none; user-select: none;
}
.plain-details > summary::-webkit-details-marker { display: none; }
.plain-details > summary::before { content: '\25B8'; display: inline-block; margin-right: 8px; transition: transform var(--speed) var(--ease); }
.plain-details[open] > summary::before { transform: rotate(90deg); }
.plain-details > summary:hover { color: var(--primary); }
.plain-details-body { padding: 0 15px 14px; font-size: 12.5px; line-height: 1.65; color: var(--gray-700); }
.plain-details-body p { margin-bottom: 9px; }
.plain-details-body p:last-child { margin-bottom: 0; }
.plain-details-body code { background: var(--gray-200); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }

body.dark-mode .plain-hero-number { color: #F0A860; }
body.dark-mode .plain-summary,
body.dark-mode .plain-lede { color: #E8E0D6; }
body.dark-mode .plain-words,
body.dark-mode .plain-verdict-label,
body.dark-mode .plain-metric-help,
body.dark-mode .plain-details-body { color: #B5A899; }
body.dark-mode .plain-subhead,
body.dark-mode .plain-metric-label,
body.dark-mode .plain-kicker { color: #A79A8A; }
body.dark-mode .plain-action-box { background: #2E2717; border-color: #4A3E20; color: #E8D9B0; }
body.dark-mode .fc-table tbody tr:hover { background: var(--gray-50); }
body.dark-mode .fc-cat { background: #241D17; border-color: #3A3026; }
body.dark-mode .fc-cat > summary:hover { background: #2C241C; }
body.dark-mode .fc-cat-name { color: #CBBFAF; }
body.dark-mode .fc-cat-trays { color: #EDE7DF; }
body.dark-mode .fc-cat-size { background: #201A15; border-color: #332A21; }
body.dark-mode .fc-cat-size-name { color: #A79A8A; }
body.dark-mode .fc-cat-size-trays { color: #EDE7DF; }
body.dark-mode .fc-cats { border-top-color: #2C241C; }
body.dark-mode .plain-action-ok { background: #17251C; border-color: #1F3A2B; color: #A8D9BF; }
body.dark-mode .plain-metric,
body.dark-mode .plain-details { background: #1C1611; border-color: #332A21; }
body.dark-mode .plain-details-body code { background: #2C241C; color: #CBBFAF; }
body.dark-mode .plain-verdict-green { background: #17251C; border-color: #1F3A2B; }
body.dark-mode .plain-verdict-yellow { background: #2E2717; border-color: #4A3E20; }
body.dark-mode .plain-verdict-red { background: #2E1B17; border-color: #4A2620; }
body.dark-mode .plain-verdict-gray { background: #1C1611; border-color: #332A21; }
body.dark-mode .plain-verdict-green .plain-verdict-score { color: #7FD1A5; }
body.dark-mode .plain-verdict-yellow .plain-verdict-score { color: #F0C060; }
body.dark-mode .plain-verdict-red .plain-verdict-score { color: #F09384; }
body.dark-mode .plain-verdict-green .plain-verdict-label,
body.dark-mode .plain-verdict-yellow .plain-verdict-label { color: #CBBFAF; }
.model-info-grid { display: flex; flex-wrap: wrap; gap: 0; }
.model-info-item { padding: 8px 14px; background: var(--gray-50); border: 1px solid var(--gray-200); font-size: 12px; display: flex; align-items: center; gap: 6px; margin: -0.5px; }
.model-info-item .label { font-size: 11px; color: var(--gray-500); font-weight: 600; white-space: nowrap; }
.model-info-item span:last-child { font-size: 13px; font-weight: 700; }
.calculation-details {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  padding: 16px; border-radius: var(--r-sm); margin-top: 10px; font-size: 13px;
}
.calculation-details p { margin-bottom: 5px; }
.calculation-details .calc-head {
  font-size: 10.5px; font-weight: 800; color: var(--primary-deep);
  text-transform: uppercase; letter-spacing: 0.08em; margin: 10px 0 6px;
}
.calculation-details .calc-head:first-child { margin-top: 0; }
.calculation-details p:not(.calc-head) {
  font-family: ui-monospace, 'Cascadia Mono', 'Consolas', monospace;
  font-size: 11.5px; line-height: 1.6; color: var(--gray-700);
  font-variant-numeric: tabular-nums; word-break: break-word;
}
.calculation-details p:not(.calc-head) strong {
  color: var(--ink); font-weight: 800;
}

.accuracy-gauge {
  display: flex; align-items: center; gap: 10px; margin-top: 15px;
  padding: 11px 13px; background: var(--gray-50);
  border: 1px solid var(--gray-200); border-radius: var(--r-sm);
}
.accuracy-gauge span { font-size: 13px; font-weight: 600; }

.settings-layout { display: grid; grid-template-columns: 1fr; gap: 4px; }
.quick-entry-options { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.import-entry input[type="number"] { max-width: 130px; }

/* ============================================================
   MOBILE HEADER / DRAWER (hidden on desktop)
   ============================================================ */

.hamburger { display: none; }

/* ============================================================
   RECEIPTS PAGE
   Numbers right-aligned so amounts line up, the filter strip
   flattened into one band whose controls share a height, and the
   action column given a fixed geometry so every row's buttons sit
   in exactly the same place.
   ============================================================ */
.rc-stats { margin-bottom: 18px; }
.rc-stats .stat-card { padding: 16px 18px; }
.rc-stats .stat-value { font-size: 23px; }
.rc-stats .stat-ico { width: 38px; height: 38px; border-radius: 11px; top: 14px; right: 14px; }

/* Filter strip. The inputs render at 42px (11px padding + 1.5px border) while .btn
   renders at 38px, so bottom-aligning them left the buttons sitting a few pixels low
   with ragged tops. One shared height for every control removes the guesswork. */
.rc-filters { margin-bottom: 18px; }
.rc-filters .filter-controls { padding: 0; }
.rc-filters .form-inline { align-items: flex-end; }
.rc-filters .form-group { margin-bottom: 0; }
.rc-filters .form-group label { font-size: 11px; }
.rc-filters .form-group input,
.rc-filters .form-group select { height: 44px; }
.rc-filters .form-group { flex: 0 0 170px; }
.rc-filters .btn {
  height: 44px; padding: 0 22px; border-radius: var(--r-sm);
}
.rc-filters .btn-secondary { border-width: 1.5px; }

.rc-table td.rc-num, .rc-table th.rc-num {
  text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.rc-table td.rc-num-id {
  white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums;
}
/* Short text columns are held to one line each. Wrapping "Cash" onto two lines in one
   row and not the next is what makes a table look untidy. */
.rc-table td.rc-nowrap, .rc-table th.rc-nowrap { white-space: nowrap; }
.rc-table td.rc-status, .rc-table th.rc-status { text-align: center; }

/* Action column: shrink-to-fit, right aligned, and holding two equal-width buttons.
   Equal widths are what make the row read as balanced -- "Void" next to a much wider
   "Open Receipt" was the visual imbalance on this page. */
.rc-table th.rc-actions, .rc-table td.rc-actions {
  text-align: right; white-space: nowrap; width: 1%;
}
.rc-actions-group { display: inline-flex; align-items: center; gap: 6px; }
.rc-actions-group .btn-small {
  min-width: 104px; justify-content: center; text-decoration: none;
}
/* A solid red button on all 20 rows outweighs the quiet "Open Receipt" beside it and
   made the column shout. Void starts as a soft red that matches the VOIDED badge and
   fills solid on hover, so the pair reads as one matched set while the destructive
   action still announces itself the moment it is aimed at. */
.rc-actions-group .btn-small.btn-danger {
  background: #FBE4E0; color: #A93226; border-color: #F2CCC5;
}
.rc-actions-group .btn-small.btn-danger:hover {
  background: var(--danger); color: #fff; border-color: transparent;
}

/* A voided row is dimmed and struck through, but not the controls -- line-through on
   an ancestor paints through descendants and cannot be undone by them, so the strike
   is applied to the data cells only and the actions cell keeps full contrast. */
.voided-row { opacity: 0.62; }
.voided-row td:not(.rc-actions) { text-decoration: line-through; }
.voided-row td.rc-actions { text-decoration: none; opacity: 1; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card-header .card-hint {
  font-size: 12px; font-weight: 600; color: var(--gray-500);
  margin-left: auto; white-space: nowrap;
}
.card-header { display: flex; align-items: center; gap: 10px; }

/* Pagination shares the same button geometry as the action column so the two do not
   look like they came from different pages. */
.rc-pagination { justify-content: center; gap: 12px; }
.rc-pagination .page-info {
  order: 2; font-weight: 700; color: var(--gray-600);
  font-variant-numeric: tabular-nums;
}
.rc-pagination .btn-small { min-width: 92px; justify-content: center; }
.rc-pagination .btn-prev { order: 1; }
.rc-pagination .btn-next { order: 3; }

@media (max-width: 640px) {
  .rc-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .rc-filters .form-inline { flex-direction: column; align-items: stretch; }
  .rc-filters .form-group { width: 100%; flex-basis: auto; }
  .rc-filters .btn { width: 100%; }
}

body.dark-mode .card-header .card-hint { color: #A79A8A; }

/* ============================================================
   TABLET <=1024
   ============================================================ */
@media (max-width: 1024px) {

  .dashboard-grid { grid-template-columns: 1fr; }

  /* The overlay remains visible while its parent drawer slides offscreen. */
  
  .sidebar-overlay { visibility: visible; }
  
  .hamburger {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; color: #fff; font-size: 24px;
    padding: 5px; cursor: pointer; width: 38px; height: 38px; border-radius: 9px;
  }
  .hamburger:hover { background: var(--side-bg-hover); }
  .hamburger-close { position: absolute; top: 10px; right: 12px; font-size: 28px; z-index: 203; }
  
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(24, 18, 12, 0.45);
    z-index: 199; opacity: 0; transition: opacity var(--speed);
  }
  .sidebar-overlay.show { display: block; opacity: 1; }
  /* Drawer content must stack above the overlay (which shares this
     stacking context) so nav links stay clickable and unblurred. */
  .sidebar-header, .nav-list { position: relative; z-index: 201; }
  .sidebar {
    left: calc(-1 * min(84vw, 280px) - 20px);
    visibility: hidden;
    transition: left 280ms var(--ease), visibility 280ms;
    width: min(84vw, 280px);
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; visibility: visible; }
  .sidebar .hamburger-close { display: block; }

  body { padding-top: 54px; }
  .main-content { margin-left: 0 !important; }

  /* Tablet top-bar stacking */

  .date-display { font-size: 12.5px; }
}

/* ============================================================
   TABLET 768-1024px - Landing page specific
   ============================================================ */
@media (max-width: 1024px) and (min-width: 769px) {

  .landing-products { padding: 72px 24px; }


  .landing-sizes-grid { gap: 14px; }
  .landing-section { padding: 72px 24px; }
  .landing-section-title { font-size: 28px; }
  .landing-footer-grid { gap: 32px; }
}

/* ============================================================
   MOBILE ≤768
   ============================================================ */
@media (max-width: 768px) {
  /* Burger/drawer rules are inherited from the ≤1024 block above. */

  .main-content { padding: 14px !important; }

  .date-display { font-size: 12px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 13px; }
  .stat-value { font-size: 21px; }
  .stat-label { font-size: 11px; }
  .stat-ico { top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 10px; }

  .dashboard-grid { grid-template-columns: 1fr; gap: 12px; }
  .card { margin-bottom: 12px; border-radius: var(--r-md); }
  .card-header { padding: 13px 15px; flex-wrap: wrap; gap: 6px; }
  .card-header h3, .card-header h4 { font-size: 14px; }
  .card-body { padding: 14px 15px; }
  .card-body > .table th:first-child, .card-body > .table td:first-child { padding-left: 15px; }

  .table { font-size: 12.5px; }
  .table th, .table td { padding: 9px 8px; }
  /* The table is display:block here, which breaks the sticky header in the
     capped lists -- let it scroll away and keep the height caps. */
  .expired-card .card-body thead th,
  .recent-batches-card .card-body thead th { position: static; }

  .form-row { grid-template-columns: 1fr; gap: 10px; }
  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline .input-sm { width: 100% !important; }
  .form-group input, .form-group select, .form-group textarea { padding: 12px; font-size: 16px; }
  .table input[type="number"], .table input[type="text"] { width: 100% !important; max-width: 130px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }

  .action-buttons { flex-direction: column; }
  .action-buttons .btn { width: 100%; }

  .sale-total, .sale-change { font-size: 16px; }

  .chart-container { height: 240px; }
  .chart-period-toggle { width: 100%; }
  .period-btn { flex: 1; text-align: center; padding: 7px 8px; font-size: 11px; }
  .chart-category-select { width: 100%; padding: 7px 10px; }
  .chart-legend-custom { gap: 12px; }
  .legend-item { font-size: 11px; }

  .video-container { max-width: 100%; }
  .scan-frame { width: 158px; height: 158px; }
  .scan-frame::after { display: none; }
  .scan-hint { bottom: -26px; font-size: 11px; }
  .tray-actions .btn { flex: 1; min-width: 80px; font-size: 12.5px; }

  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-value { font-size: 17px; }
  .model-info-grid { gap: 0; }
  .model-info-item { padding: 6px 10px; font-size: 11px; }
  .model-info-item .label { font-size: 10px; }
  .model-info-item span:last-child { font-size: 12px; }
  .quick-entry-options { flex-direction: column; gap: 6px; }
  .quick-entry-options .btn { width: 100%; }
  .import-entry input[type="number"] { width: 100% !important; max-width: none !important; }

  .pagination { flex-wrap: wrap; }
  .accuracy-gauge { flex-direction: column; text-align: center; }
  .alert-panel { padding: 13px; width: 300px; right: -20px; }
  .alert-item { padding: 9px 10px; font-size: 12px; flex-wrap: wrap; }
  .pick-section .card-body { padding: 8px; }


/* Landing inventory and footer responsiveness */

  .landing-products { padding: 48px 18px; }

  .landing-section { padding: 48px 18px; }
  .landing-section-title { font-size: 22px; margin-bottom: 28px; }
  .landing-section-subtitle { margin-top: -18px; margin-bottom: 26px; font-size: 14px; }
  .landing-sizes-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .landing-footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }

  .login-container { margin: 10px; padding: 28px; }
  .login-popup { padding: 34px 22px 28px; }
  .settings-layout { grid-template-columns: 1fr; }
  .role-badge { font-size: 9.5px; }
}

/* ============================================================
   SMALL PHONE ≤480
   ============================================================ */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 11px; }
  .stat-value { font-size: 18px; }
  .stat-ico { width: 32px; height: 32px; border-radius: 9px; }
  .stat-ico svg { width: 15px; height: 15px; }
  

  .table { font-size: 11.5px; }
  .table th, .table td { padding: 8px 6px; }
  .btn { padding: 11px 15px; font-size: 13.5px; }
  .btn-small { padding: 6px 9px; font-size: 11px; }

  .model-info-grid { gap: 0; }
  .model-info-item { padding: 5px 8px; font-size: 10px; flex-basis: 50%; }
  .metrics-grid { grid-template-columns: 1fr; }
  .scan-frame { width: 132px; height: 132px; }

  .login-container { margin: 8px; padding: 20px; }
  .landing-sizes-grid { gap: 8px; }

  .landing-size-label { width: 42px; height: 42px; font-size: 16px; }
  .landing-size-card h3 { font-size: 13px; }
  .landing-size-card p { font-size: 11px; }
  .landing-size-price { font-size: 13px; }
  .landing-size-tag { font-size: 10px; padding: 4px 10px; }
  .landing-footer-grid { grid-template-columns: 1fr; gap: 20px; }

  .landing-products { padding: 40px 14px; }

  .landing-section { padding: 40px 14px; }
  .landing-section-title { font-size: 20px; }
  .landing-sizes-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

  .sidebar { width: min(84vw, 280px); }
}

/* ============================================================
   LARGE SCREEN ≥1280
   ============================================================ */
@media (min-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .dashboard-grid { grid-template-columns: 1.35fr 1fr; }
  .main-content { padding: 28px 36px 40px; }

}

/* ============================================================
   DARK MODE (warm charcoal)
   ============================================================ */
body.dark-mode { background: #161210; color: #EDE7DF; }
body.dark-mode .card,
body.dark-mode .stat-card,
body.dark-mode .alert-panel,
body.dark-mode .alert-panel.open,
body.dark-mode .login-container,
body.dark-mode .metric-item,
body.dark-mode .model-info-item,
body.dark-mode .tray-info { background: #201A15; border-color: #332A21; color: #EDE7DF; }
body.dark-mode .calculation-details,
body.dark-mode .accuracy-gauge,
body.dark-mode .metric-item { background: #1C1611; }
body.dark-mode .card-header { border-bottom-color: #2C241C; }
body.dark-mode .table th { color: #A79A8A; border-bottom-color: #2C241C; }
body.dark-mode .table td { border-bottom-color: #271F18; }
body.dark-mode .table tbody tr:hover { background: #241D17; }
body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea,
body.dark-mode .sale-item-row select,
body.dark-mode .sale-item-row input,
body.dark-mode 
body.dark-mode .top-bar {
  background: rgba(22, 18, 16, 0.82); border-bottom-color: #2C241C;
}
body.dark-mode .alert-badge { background: #201A15; border-color: #332A21; color: #CBBFAF; }
body.dark-mode .sale-mode-option { background: #241D17; border-color: #3A3026; color: #EDE7DF; }
body.dark-mode .sale-mode-option.is-active { background: #2C241C; border-color: var(--primary); }
body.dark-mode .sale-mode-icon { background: #1C1611; color: #F0A35E; }
body.dark-mode .sale-mode-option.is-active .sale-mode-icon { background: var(--primary); color: #fff; }
body.dark-mode .sale-wholesale-note { background: #1C2A22; color: #8FD3B2; }
body.dark-mode .btn-secondary { background: #241D17; color: #EDE7DF; border-color: #3A3026; }
body.dark-mode .btn-secondary:hover { background: #2C241C; border-color: #4A3E32; }
body.dark-mode .btn-small { background: #241D17; color: #CBBFAF; border-color: #3A3026; }
body.dark-mode .btn-small:hover { background: #2C241C; }
/* body.dark-mode .btn-small (0-2-1) outranks .btn-small.btn-danger (0-2-0), so the
   coloured small buttons lose their fill in dark mode unless restated here. */
body.dark-mode .btn-small.btn-success { background: #237A57; color: #fff; border-color: transparent; }
body.dark-mode .btn-small.btn-success:hover { background: #2E9068; }
body.dark-mode .btn-small.btn-warning { background: #C4830F; color: #fff; border-color: transparent; }
body.dark-mode .btn-small.btn-warning:hover { background: #E29A1C; }
body.dark-mode .btn-small.btn-danger { background: #C0392B; color: #fff; border-color: transparent; }
body.dark-mode .btn-small.btn-danger:hover { background: #D14A3A; }
body.dark-mode .btn-small.btn-info { background: #2A6F97; color: #fff; border-color: transparent; }
body.dark-mode .btn-small.btn-info:hover { background: #3585B2; }
body.dark-mode .rc-actions-group .btn-small.btn-danger {
  background: #3A1F19; color: #F09384; border-color: #5A2E24;
}
body.dark-mode .rc-actions-group .btn-small.btn-danger:hover {
  background: #C0392B; color: #fff; border-color: transparent;
}
body.dark-mode .btn-small:disabled,
body.dark-mode .btn-small[aria-disabled="true"] { background: #1C1611; color: #7A6E60; border-color: #2C241C; }
body.dark-mode .voided-row td.rc-actions { opacity: 1; }
body.dark-mode .stat-value, body.dark-mode .card-header h3, body.dark-mode .landing-page { color: inherit; }
body.dark-mode .stat-label, body.dark-mode .date-display, body.dark-mode .card-body, body.dark-mode .form-group label { color: #B7AA99; }
body.dark-mode .tray-info.expired { background: #2E1B17; border-color: #4A2620; }
body.dark-mode .tray-info.expiring { background: #2E2717; border-color: #4A3E20; }
body.dark-mode .alert-high { background: #2E1B17; }
body.dark-mode .alert-medium { background: #2E2717; }
body.dark-mode .alert-low { background: #17251C; }
body.dark-mode .pick-row.priority-high { background: #2E2317; }
body.dark-mode .pick-row.expired { background: #2E1B17; }
body.dark-mode .pick-row.expiring { background: #2E2717; }
body.dark-mode .pick-section.urgent .card-header { background: #2E1B17; }
body.dark-mode .age-green { background: #1C3328; color: #7FD4A8; }
body.dark-mode .age-yellow { background: #332A17; color: #EBC86E; }
body.dark-mode .age-orange { background: #33241A; color: #EDA45C; }
body.dark-mode .age-red { background: #331D19; color: #F09384; }
body.dark-mode .gauge-gray { background: #2C241C; color: #A79A8A; }
body.dark-mode .alert-error { background: #2E1B17; border-color: #4A2620; }
body.dark-mode .alert-success { background: #17251C; border-color: #1F3A2B; }
body.dark-mode .alert-warning { background: #2E2717; border-color: #4A3E20; }
body.dark-mode .size-badge { color: #17120E; }

/* Shared dashboard shell and account controls. */
.main-content { min-width: 0; max-width: none; width: calc(100% - var(--sidebar-width)); padding-inline: clamp(24px, 3vw, 48px); }
.sidebar-header { padding: 22px 18px 18px; }
.sidebar-header .sidebar-brand { display: block; background: #fffcf6; border-radius: 12px; padding: 6px; }
.sidebar-wordmark { display: block; width: 100%; height: auto; }
.sidebar-brand-icon { display: none; }

.sidebar-resize { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--side-border); border-radius: 10px; background: transparent; color: var(--side-muted); cursor: pointer; }
.sidebar-resize:hover { background: var(--side-bg-hover); color: #fff; }
.nav-list li a { position: relative; min-height: 44px; }
.nav-list .nav-label { min-width: 0; }


.account-controls { position: relative; display: flex; align-items: center; padding-left: 0; min-height: 42px; }
.account-trigger { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; border-radius: 12px; padding: 4px 8px; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.account-trigger:hover, .account-trigger[aria-expanded="true"] { background: var(--gray-100); }
.account-chevron { display: grid; place-items: center; transform: rotate(90deg); color: var(--gray-500); }
.account-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 170px; padding: 6px; border: 1px solid var(--gray-200); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-md); z-index: 60; }
.account-menu .account-logout { width: 100%; padding: 12px; border-radius: 9px; font-size: 13px; }
.account-avatar { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--primary-light); color: var(--primary-dark); }
.account-details { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.account-name { font-size: 12px; font-weight: 800; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-role { font-size: 10px; color: var(--gray-500); }
.account-logout { display: inline-flex; align-items: center; gap: 5px; padding: 8px 10px; color: var(--gray-600); text-decoration: none; border-radius: 999px; font-size: 11px; white-space: nowrap; }
.account-logout:hover { background: var(--primary-light); color: var(--primary-dark); }
.sidebar-resize:focus-visible, .account-trigger:focus-visible, .account-logout:focus-visible, .password-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.password-field { position: relative; }
.password-field input { padding-right: 50px; }
.password-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--gray-600); cursor: pointer; }
.password-toggle:hover { background: var(--primary-light); color: var(--primary-dark); }
.password-toggle span:not([hidden]) { display: grid; place-items: center; }
.icon { flex-shrink: 0; vertical-align: middle; }
@media (min-width: 1025px) {
  :root.sidebar-minimized { --sidebar-width: 80px; }
  .sidebar-minimized .sidebar-header { padding: 20px 12px 12px; }
  .sidebar-minimized .sidebar-wordmark { display: none; }
  .sidebar-minimized .sidebar-brand-icon { display: block; width: 44px; height: 44px; object-fit: contain; }
  .sidebar-minimized .sidebar-header .sidebar-brand { padding: 3px; }
  .sidebar-minimized .sidebar .nav-label { display: none; }
  .sidebar-minimized .sidebar-resize .icon { transform: rotate(180deg); }
  
  .sidebar-minimized .nav-list { padding-inline: 12px; }
  .sidebar-minimized .nav-list li a { padding: 13px; justify-content: center; }
  .sidebar-minimized .nav-list .nav-badge { position: absolute; top: 2px; right: 0; font-size: 9px; }
  .sidebar-minimized .nav-divider { padding: 14px 2px; }
}
@media (max-width: 1024px) {
  .main-content { width: 100%; }
  
  .sidebar-header { padding-top: 60px; }


  .account-name { max-width: 160px; }
  .account-logout { padding-inline: 6px; }
  .account-controls { padding-left: 8px; gap: 8px; }
}
@media (max-width: 380px) {
  .account-avatar { width: 30px; height: 30px; }
  .account-name { max-width: 110px; font-size: 11px; }
}

.page-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; margin: 0 0 24px; padding: 0; background: transparent; border: 0; }
.page-toolbar:not(:has(button, a, input, select)) { display: none; }
.page-toolbar .pick-filters { display: flex; flex-wrap: wrap; gap: 12px; }
.page-toolbar #syncQueueBadge { position: static; }
.empty-state { padding: 36px 20px; text-align: center; white-space: normal; }
.empty-state strong { display: block; color: var(--gray-600); font-size: 14px; font-weight: 700; }
.empty-state p { margin: 6px 0 0; font-size: 12px; color: var(--gray-500); }
.date-display { background: var(--surface); border: 1px solid var(--gray-200); padding: 10px 14px; border-radius: 12px; color: var(--gray-600); font-weight: 600; }
.app-container input[type="date"] { min-height: 44px; border: 1px solid var(--gray-300); border-radius: 12px; background: var(--surface) url('../icons/hugeicons/calendar.svg') right 12px center / 20px no-repeat; padding: 10px 12px; color: var(--ink); font: inherit; font-size: 13px; }
.app-container input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0; width: 22px; cursor: pointer; }
.app-container select { border-radius: 12px; min-height: 42px; border: 1px solid var(--gray-300); background-color: var(--surface); color: var(--ink); }
.custom-select { display: inline-flex; position: relative; min-width: 150px; max-width: 100%; }
.custom-select-trigger { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--gray-300); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.custom-select-trigger .icon { transform: rotate(90deg); color: var(--gray-500); }
.custom-select-trigger:focus-visible, .custom-select-trigger[aria-expanded="true"] { outline: 2px solid var(--primary); outline-offset: 2px; }
.custom-select-trigger:disabled { opacity: .5; cursor: not-allowed; }
.custom-select-menu { position: fixed; overflow-y: auto; z-index: 400; padding: 6px; border: 1px solid var(--gray-200); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); overscroll-behavior: contain; }
.custom-select-menu:not([hidden]) { display: flex; flex-direction: column; gap: 3px; }
.custom-select-option { display: block; flex-shrink: 0; width: 100%; padding: 11px 12px; border: 0; border-radius: 8px; font: inherit; font-size: 13px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.custom-select-option:hover, .custom-select-option:focus-visible { background: var(--gray-100); outline: 0; }
.custom-select-option[aria-selected="true"] { background: var(--primary-light); color: var(--primary-deep); font-weight: 700; }
.custom-select-option:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 640px) {
  .page-toolbar { justify-content: flex-start; padding: 0; gap: 10px; }
  .page-toolbar .pick-filters, .page-toolbar .custom-select { width: 100%; }
  .page-toolbar > .btn { flex: 1 1 auto; }
  .account-trigger { gap: 7px; padding-inline: 2px; }
  .empty-state { padding: 28px 12px; }
}

.app-shell { padding-top: 0; }
.app-shell .main-content { --content-gutter: clamp(24px, 3vw, 48px); padding: 0 var(--content-gutter) 32px !important; }
.top-bar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 16px; width: calc(100% + 2 * var(--content-gutter)); min-height: 72px; margin: 0 calc(-1 * var(--content-gutter)); padding: 12px var(--content-gutter); background: var(--surface); border-bottom: 0; }
.utility-controls { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }


.utility-brand { display: none; }
.top-bar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
.page-heading { padding: 32px 0 24px; }
.page-eyebrow { display: block; margin-bottom: 8px; color: var(--primary-dark); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.page-heading h1 { font-size: 30px; font-weight: 800; line-height: 1.2; letter-spacing: -.035em; margin-bottom: 8px; }
.page-heading > p { font-size: 13px; color: var(--gray-500); line-height: 1.6; }
.top-bar .date-display { font-size: 12px; border: 0; padding: 8px 10px; white-space: nowrap; }
.top-bar .account-controls { flex-shrink: 1; min-width: 0; }
.top-bar .account-trigger { min-width: 0; }
.empty-state { font-style: normal; }
.app-shell .sidebar { display: flex; flex-direction: column; overflow: hidden; }
.sidebar-header { flex-shrink: 0; }
.sidebar .nav-list { flex: 1; min-height: 0; overflow-y: auto; }
.sidebar-footer { display: flex; justify-content: center; flex-shrink: 0; padding: 16px 12px; position: relative; z-index: 201; }
.sidebar-footer .sidebar-resize { border: 0; background: var(--side-bg-hover); }
.app-shell .alert-badge { border: 0; background: transparent; box-shadow: none; }
.app-shell .alert-badge:hover { background: var(--gray-100); }
.account-controls { border-left: 0; }
.nav-divider .divider-line { display: none; }
.app-shell .btn, .app-shell .btn-small { border-radius: 999px; }
.card-body:has(> .table:first-child), .card-body:has(> .table-wrap:first-child) { padding-top: 0; }
.confirmation-dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; margin: auto; padding: 30px; border: 1px solid var(--gray-200); border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.confirmation-dialog::backdrop { background: rgba(37, 30, 24, .5); backdrop-filter: blur(4px); }
.confirmation-dialog h2 { font: 800 22px/1.25 var(--font); letter-spacing: -.03em; margin-bottom: 12px; }
.confirmation-dialog > p { font: 400 14px/1.7 var(--font); color: var(--gray-600); white-space: pre-line; overflow-wrap: anywhere; }
.confirmation-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.confirmation-actions .btn { min-width: 110px; border-radius: 999px; }
@media (max-width: 1024px) {
  .sidebar-footer { display: none; }
  .table .empty-state { max-width: calc(100vw - 80px); position: sticky; left: 16px; }
}
@media (max-width: 1024px) {
  .app-shell .main-content { --content-gutter: 24px; }
  
  .utility-controls .hamburger { display: grid; place-items: center; color: var(--ink); width: 38px; height: 38px; }
  .utility-controls .hamburger:hover { background: var(--gray-100); }
  .utility-brand { display: block; }
  .utility-brand img { display: block; width: 130px; height: 40px; object-fit: contain; }
}
@media (max-width: 700px) {
  .app-shell .main-content { --content-gutter: 16px; }
  .top-bar { min-height: 66px; gap: 8px; padding-block: 10px; }
  .top-bar .date-display, .utility-brand { display: none; }
  .top-bar-actions { gap: 8px; }
  .top-bar .account-name { max-width: 135px; }
  .top-bar .account-avatar { width: 30px; height: 30px; }
  .page-heading { padding: 26px 0 22px; }
  .page-heading h1 { font-size: 26px; }
}
@media (max-width: 360px) {
  .top-bar .account-name { max-width: 100px; }
  .top-bar .account-controls { padding-left: 6px; }
}

.page-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 24px; }
.page-heading > .page-eyebrow, .page-heading > h1, .page-heading > p { grid-column: 1; }
.page-actions { grid-column: 2; grid-row: 1 / span 3; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.page-toolbar, .page-toolbar .pick-filters { justify-content: flex-start; }
.header-clock { display: flex; align-items: center; gap: 12px; color: var(--gray-600); font-size: 12px; white-space: nowrap; }
.header-clock [data-clock-time] { color: var(--ink); font-weight: 700; }
.form-group > .custom-select, .form-group > .custom-date { width: 100%; display: flex; }
.custom-date { position: relative; display: inline-flex; min-width: 170px; max-width: 100%; }
.enhanced-field-native { position: absolute !important; width: 1px !important; height: 1px !important; min-width: 0 !important; min-height: 0 !important; border: 0 !important; padding: 0 !important; margin: 0 !important; opacity: 0; clip-path: inset(50%); overflow: hidden; pointer-events: none; }
.custom-select-trigger { min-width: 0; }
.control-caption { flex: 1; min-width: 0; }
.custom-select-trigger .icon { transform: none; }
.custom-select-trigger .control-arrow { transform: rotate(90deg); }
.custom-select-trigger[aria-invalid="true"] { border-color: var(--danger); outline: 2px solid var(--danger); }
.sale-item-row > .stock-hint, .sale-item-row > .tray-badge, .sale-item-row > .fifo-hint { grid-column: 1 / -1; }
.sale-item-row > .stock-hint:empty, .sale-item-row > .tray-badge:empty { display: none; }
.export-control { min-width: 180px; }
.export-control .custom-select-trigger { background: var(--primary); border-color: var(--primary); color: #fff; border-radius: 999px; font-weight: 800; }
.export-control .custom-select-trigger .icon { color: #fff; }
.custom-calendar { position: fixed; z-index: 400; width: 308px; max-width: calc(100vw - 24px); box-sizing: border-box; overflow-y: auto; border: 1px solid var(--gray-200); border-radius: 18px; padding: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); overscroll-behavior: contain; }
.form-dialog { width: min(600px, calc(100vw - 32px)); }
.form-dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.form-dialog-heading h2 { margin-bottom: 6px; }
.form-dialog-heading p { color: var(--gray-500); font-size: 13px; margin: 0; }
.form-dialog .form-actions { justify-content: flex-end; }
.calendar-heading { display: flex; align-items: center; gap: 2px; margin-bottom: 12px; }
.calendar-heading strong { flex: 1; text-align: center; font-size: 13px; }
.calendar-nav { display: grid; place-items: center; width: 27px; height: 32px; border: 0; border-radius: 8px; color: var(--gray-600); background: transparent; cursor: pointer; }
.calendar-nav:hover { background: var(--gray-100); }
.calendar-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.calendar-week > span { text-align: center; padding: 6px 0; color: var(--gray-500); font-size: 10px; font-weight: 800; }
.calendar-day { border: 0; border-radius: 50%; aspect-ratio: 1; padding: 0; background: transparent; color: inherit; font: inherit; font-size: 12px; cursor: pointer; }
.calendar-day:hover, .calendar-day:focus-visible { background: var(--primary-light); outline: 2px solid var(--primary); outline-offset: -2px; }
.calendar-day[aria-selected="true"] { background: var(--primary); color: #fff; font-weight: 800; }
.calendar-day[aria-current="date"] { box-shadow: inset 0 0 0 1px var(--primary); }
.calendar-day.adjacent-month { color: var(--gray-400); }
.calendar-day:disabled { opacity: .3; cursor: not-allowed; }
.calendar-footer { display: flex; justify-content: space-between; margin-top: 12px; }
.settings-navigation { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.settings-navigation a { display: inline-flex; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--gray-200); background: var(--surface); color: var(--gray-600); text-decoration: none; font-size: 12px; font-weight: 700; }
.settings-navigation a[aria-current="location"] { color: #fff; background: var(--primary); border-color: var(--primary); }
.settings-panel[hidden] { display: none; }
.preferences-intro { margin-bottom: 22px; }
.preferences-intro h2 { font-size: 20px; letter-spacing: -.025em; margin-bottom: 6px; }
.preferences-intro p { color: var(--gray-500); font-size: 13px; }
.maintenance-card h3, .coverage-explainer h3 { font-size: 15px; margin-bottom: 5px; }
.size-setting-code { margin-left: auto; padding: 5px 8px; border-radius: 8px; background: var(--gray-100); color: var(--gray-600); font-size: 10px; font-weight: 800; }
.settings-table-card { overflow: hidden; }
.settings-edit-table { min-width: 980px; }
.settings-weight-range { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.settings-weight-range span { color: var(--gray-500); font-size: 11px; }
.settings-edit-table input.settings-weight-input { width: 68px; padding-inline: 8px; }
.settings-edit-table tbody th { font-size: 13px; font-weight: 700; text-align: left; text-transform: none; letter-spacing: normal; color: var(--ink); padding: 14px; border-bottom: 1px solid var(--gray-200); background: var(--surface); }
.settings-size-name { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.settings-edit-table input[type="number"] { width: 145px; max-width: 100%; box-sizing: border-box; min-height: 40px; border: 1px solid var(--gray-300); border-radius: 11px; padding: 9px 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; }
.settings-edit-table input:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.coverage-explainer { display: flex; align-items: start; gap: 16px; padding: 24px; }
.coverage-explainer > div { flex: 1; }
.coverage-explainer p { max-width: 75ch; font-size: 13px; color: var(--gray-600); line-height: 1.7; }
.coverage-explainer > a { flex-shrink: 0; }
.coverage-examples { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.coverage-example { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--gray-200); }
.coverage-example strong { font-size: 22px; }
.coverage-example span, .settings-footnote { color: var(--gray-500); font-size: 12px; }
.coverage-example.is-current { background: var(--primary-light); border-color: var(--primary); }
.settings-footnote { margin: 16px 0 24px; }
.maintenance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.maintenance-card { display: flex; flex-direction: column; align-items: start; padding: 24px; margin: 0; }
.maintenance-card > .preference-icon { margin-bottom: 20px; }
.maintenance-card p { color: var(--gray-500); font-size: 13px; line-height: 1.7; margin: 4px 0 24px; }
.maintenance-card button { margin-top: auto; }
@media (max-width: 1000px) { .maintenance-grid { grid-template-columns: 1fr; } .coverage-explainer { flex-wrap: wrap; } .coverage-examples { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .coverage-examples { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.preferences-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.preference-group { padding: 24px; margin-bottom: 0; }
.preference-group:first-child { grid-row: span 3; }
.preference-group-heading { display: flex; align-items: start; gap: 13px; margin-bottom: 24px; }
.preference-icon { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 13px; background: var(--primary-light); color: var(--primary-deep); }
.preference-group-heading h3 { font-size: 15px; margin-bottom: 5px; }
.preference-group-heading p, .preference-field > p { color: var(--gray-500); font-size: 12px; line-height: 1.6; margin: 0; }
.preference-field + .preference-field { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--gray-200); }
.preference-field > label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.preference-control { display: flex; gap: 10px; align-items: start; margin-top: 10px; }
.preference-control > input, .preference-control > textarea, .preference-control > .custom-select { min-width: 0; width: 100%; flex: 1; }
.preference-control > input, .preference-control > textarea { box-sizing: border-box; min-height: 44px; padding: 11px 13px; border: 1px solid var(--gray-300); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; }
.preference-control > input:focus, .preference-control > textarea:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.preference-control textarea { resize: vertical; min-height: 76px; }
.preference-save { flex-shrink: 0; min-height: 44px; padding: 10px 15px; }
@media (max-width: 1050px) { .preferences-grid { grid-template-columns: minmax(0, 1fr); } .preference-group:first-child { grid-row: auto; } }
@media (max-width: 480px) { .preference-group { padding: 18px; } .preference-save { padding: 10px 12px; } .preference-save > span { display: none; } }
.settings-panel .card-header { padding-block: 20px; }
.settings-panel .table td { padding-block: 14px; }
.variant-qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.variant-qr-card > div:first-of-type { color: var(--ink) !important; }
@media (max-width: 1024px) {
  .header-clock { gap: 8px; font-size: 11px; }
}
@media (max-width: 700px) {
  .page-heading { grid-template-columns: 1fr; }
  .page-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; margin-top: 18px; }
  .header-clock { flex-direction: column; align-items: flex-start; gap: 2px; font-size: 9px; }
  .utility-controls { gap: 8px; }
  .top-bar .account-name { max-width: 85px; }
  .top-bar .account-avatar { width: 25px; height: 25px; }
  .top-bar .account-trigger { gap: 5px; }
  .top-bar .account-chevron { display: none; }
  .custom-select, .custom-date { min-width: 0; }
}
@media (max-width: 480px) {
}
@media print {
  @page { size: A4; margin: 12mm; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .top-bar, .btn, .form-actions, .quick-actions,
  .hamburger, .sidebar-overlay { display: none !important; }
  .app-shell .main-content { margin-left: 0 !important; padding: 0 !important; }
  body { padding-top: 0 !important; background: #fff !important; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
}


.input-dialog label { display: block; margin: 16px 0 10px; font-size: 13px; color: var(--gray-600); }
.dialog-field { position: relative; }
.dialog-field input { width: 100%; min-height: 46px; border: 1px solid var(--gray-300); border-radius: 12px; padding: 12px 46px 12px 14px; font: inherit; color: var(--ink); background: var(--surface); }
.dialog-field input:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.dialog-reveal { position: absolute; right: 8px; top: 6px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--gray-600); cursor: pointer; }
.dialog-reveal:hover { background: var(--gray-100); }

/* Metric cards share the same label, value and leading-icon layout. */
.stat-card { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; row-gap: 6px; min-height: 112px; }
.stat-card::before { display: none; }
.stat-card:has(.stat-ico) { grid-template-columns: 44px minmax(0, 1fr); column-gap: 14px; }
.stat-card .stat-ico { position: static; width: 44px; height: 44px; grid-column: 1; grid-row: 1 / span 2; align-self: center; border-radius: 13px; }
.stat-card .stat-label { grid-column: 1; grid-row: 1; margin: 0; font-size: 12px; line-height: 1.45; }
.stat-card .stat-value { grid-column: 1; grid-row: 2; font-size: clamp(22px, 2vw, 28px); line-height: 1.2; overflow-wrap: anywhere; }
.stat-card:has(.stat-ico) .stat-label, .stat-card:has(.stat-ico) .stat-value { grid-column: 2; }
.scanner-idle { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 36px 20px; border: 1px dashed var(--gray-300); border-radius: var(--r-md); background: var(--gray-50); text-align: center; }
.scanner-idle > .icon { color: var(--primary); }
.scanner-idle p { max-width: 360px; font-size: 13px; line-height: 1.6; color: var(--gray-600); }
.scanner-idle[hidden], .video-container[hidden] { display: none; }
.video-container { overflow: hidden; border-radius: var(--r-md); isolation: isolate; }
.video-container video { aspect-ratio: 4 / 3; object-fit: cover; }
.scan-overlay { pointer-events: none; }
.scan-frame { width: min(200px, 60%); height: auto; aspect-ratio: 1; position: relative; }
.scan-hint { bottom: 16px; padding: 0 12px; }
@media (prefers-reduced-motion: reduce) { .scan-frame::after { animation: none; } }

.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1200px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .stats-grid { grid-template-columns: minmax(0, 1fr); } }

.quick-action-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.quick-action-card { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 22px; border: 1px solid var(--gray-200); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-sm); color: var(--ink); text-decoration: none; transition: border-color var(--speed), box-shadow var(--speed); }
.quick-action-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.quick-action-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.quick-action-card .stat-ico { position: static; grid-column: 1; width: 44px; height: 44px; }
.quick-action-card strong { grid-column: 1; font-size: 15px; }
.quick-action-card > span:not(.stat-ico) { grid-column: 1 / -1; font-size: 12px; line-height: 1.6; color: var(--gray-600); }
.quick-action-card > .icon { grid-column: 2; grid-row: 1; align-self: center; color: var(--gray-500); }
.table-scroll { max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.table-scroll:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.table-scroll > .table { display: table; width: 100%; margin: 0; }
.card, .card-body, .dashboard-grid > *, .settings-panel { min-width: 0; }
.card-body:has(> .table-scroll:first-child) { padding-top: 0; }
.empty-state::before { content: ''; display: block; width: 156px; max-width: 100%; height: 156px; margin: 0 auto 10px; background: url('../images/nodata-yet.png') center / contain no-repeat; }
.empty-state:has(strong) strong { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.table .empty-state { width: min(100%, var(--table-viewport, 100vw)); max-width: var(--table-viewport, 100%); box-sizing: border-box; position: sticky; left: 0; }
@media (max-width: 1200px) { .quick-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .quick-action-grid { grid-template-columns: minmax(0, 1fr); } .empty-state::before { width: 132px; height: 132px; } }

.qr-detail-dialog > img { display: block; max-width: 100%; height: auto; margin: 20px auto; }
.scan-loading { padding: 28px; text-align: center; color: var(--gray-600); }

/* Tables meet the card edges; only cell contents carry horizontal padding. */
.dashboard-grid { align-items: start; }
.dashboard-grid > .card { margin-bottom: 0; }
.card-body:has(> .table-scroll:only-child), .card-body:has(> .table:only-child), .card-body:has(> .table-wrap:only-child) { padding: 0; }
.table-scroll > .table th:first-child, .table-scroll > .table td:first-child { padding-left: 22px; }
.table-scroll > .table th:last-child, .table-scroll > .table td:last-child { padding-right: 22px; }
.table-scroll:has(.empty-state) > .table td { padding-block: 0; }
.table .empty-state { padding: 22px 16px 26px; }
.table .empty-state::before { width: 120px; height: 120px; margin-bottom: 6px; }
.icon-action { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0 !important; flex-shrink: 0; vertical-align: middle; }
.icon-action:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#settings-system .table th:last-child { width: 90px; }
.settings-panel .table td:last-child, .settings-panel .table th:last-child { text-align: center; }
.alert-badge > .icon { width: 23px; height: 23px; color: var(--ink); }
.qr-print-dialog { width: min(760px, calc(100vw - 24px)); padding: 24px; }
.qr-modal-header { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.qr-print-dialog > p { margin: 0 0 18px; font-size: 13px; }
.qr-selection-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.qr-selection-tools > span { margin-left: auto; font-size: 12px; color: var(--gray-600); }
.qr-options-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.qr-print-option { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px; border: 1px solid var(--gray-200); border-radius: 14px; cursor: pointer; background: var(--surface); }
.qr-print-option:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.qr-print-option input { grid-column: 2; accent-color: var(--primary); width: 18px; height: 18px; }
.qr-print-option img { grid-column: 1 / -1; justify-self: center; width: 96px; height: 96px; }
.qr-print-option strong { grid-column: 1 / -1; font-size: 12px; text-align: center; }
#qrPrintOutput { display: none; }
@media (max-width: 540px) { .qr-options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .qr-print-dialog { padding: 18px; } }
@media print {
  body.qr-printing > :not(#qrPrintOutput) { display: none !important; }
  body.qr-printing dialog::backdrop { display: none; }
  body.qr-printing #qrPrintOutput { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5mm; padding: 0; }
  .qr-print-label { break-inside: avoid; display: flex; flex-direction: column; align-items: center; gap: 3mm; border: 1px solid #999; padding: 5mm; text-align: center; color: #000; background: #fff; }
  .qr-print-label img { display: block; width: 40mm; height: 40mm; }
  .qr-print-label strong { font-size: 12pt; }
}

.card-body { --card-body-padding: 22px; }
.card-body > .table-scroll { width: calc(100% + 2 * var(--card-body-padding)); max-width: none; margin-inline: calc(-1 * var(--card-body-padding)); }
.card-body:has(> .table-scroll:only-child) { --card-body-padding: 0px; }
@media (max-width: 768px) { .card-body { --card-body-padding: 15px; } .card-body:has(> .table-scroll:only-child) { --card-body-padding: 0px; } }
.qr-print-dialog[open] { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; overflow: hidden; }
.qr-print-dialog .qr-options-grid { min-height: 0; max-height: min(52dvh, 480px); overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.qr-print-dialog .confirmation-actions { margin-top: 18px; }

/* Independent panels keep payment and FIFO compact as sale items grow. */
.sale-workspace { margin: 0 0 24px; }
.sale-mode-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.sale-mode-option { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 10px; border: 1px solid var(--gray-200); border-radius: 13px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.sale-mode-option:hover { border-color: var(--primary); }
.sale-mode-option.is-active { border-color: var(--primary); background: var(--primary-light); box-shadow: inset 0 0 0 1px var(--primary); }
.sale-mode-icon { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px; background: var(--gray-100); color: var(--primary-dark); }
.sale-mode-option.is-active .sale-mode-icon { background: var(--primary); color: #fff; }
.sale-mode-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sale-mode-copy strong { font-size: 12px; font-weight: 800; line-height: 1.3; }
.sale-mode-copy small { font-size: 10px; line-height: 1.35; color: var(--gray-500); }
.sale-wholesale-note { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 9px 12px; border-radius: 11px; background: #EDF7F1; color: var(--success); font-size: 12px; line-height: 1.4; }
.sale-wholesale-note[hidden] { display: none; }
.sale-wholesale-note strong { font-weight: 800; }
.price-stack { display: flex; flex-direction: column; gap: 1px; white-space: nowrap; }
.price-stack small { color: var(--gray-500); font-size: 11px; font-weight: 600; }
.size-weight-note { display: block; margin-top: 3px; color: var(--gray-500); font-size: 11px; font-weight: 600; }
.sale-layout { display: grid; grid-template-columns: minmax(340px, 1.2fr) repeat(2, minmax(260px, 1fr)); gap: 20px; align-items: start; }
.sale-layout > .card { min-width: 0; margin-bottom: 0; }
.sale-form { min-width: 0; container-type: inline-size; }
.sale-tips { display: block; min-width: 0; }
.sale-tips .card-body { max-height: min(70vh, 600px); overflow-y: auto; }
.sale-tips .alert { font-size: 12px; line-height: 1.65; }
.sale-customer-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 12px; }
.sale-customer-fields .form-group { min-width: 0; }
.sale-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sale-section-heading h4 { font-size: 15px; font-weight: 800; }
.sale-section-heading > span { font-size: 12px; color: var(--gray-500); }
.sale-item-row { display: grid; grid-template-columns: minmax(0, 1fr) 132px 34px; gap: 10px; align-items: start; padding: 12px; margin-bottom: 12px; border: 1px solid var(--gray-200); border-radius: 14px; background: var(--gray-50); }
.sale-item-row:first-child { grid-template-columns: minmax(0, 1fr) 132px; }
.sale-item-row:first-child > .btn-danger { display: none; }
.sale-item-row > .sale-size-control { display: flex; flex-direction: column; align-items: stretch; gap: 6px; grid-column: 1; grid-row: 1; min-width: 0; }
.sale-size-control::before { content: 'Egg size'; color: var(--gray-600); font-size: 11px; font-weight: 700; line-height: 16px; }
.sale-size-control .custom-select-trigger { width: 100%; gap: 8px; }
.sale-quantity-field { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.sale-quantity-field > span { font-size: 11px; line-height: 16px; font-weight: 700; color: var(--gray-600); }
.sale-quantity-field > .qty-input { width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box; padding: 10px 12px; font-size: 14px; }
.sale-item-row > .btn-danger { grid-column: 3; grid-row: 1; align-self: end; width: 34px; height: 44px; padding: 0; display: grid; place-items: center; color: var(--gray-600); background: var(--surface); border: 1px solid var(--gray-200); box-shadow: none; }
.sale-item-row > .btn-danger:hover { color: var(--danger); border-color: var(--danger); }
.sale-item-subtotal { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--gray-500); }
.sale-item-subtotal strong { color: var(--ink); font-size: 12px; }
.sale-payment-panel { min-width: 0; }
.sale-payment-panel .sale-total { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; padding: 0 0 20px; border-bottom: 1px solid var(--gray-200); }
.sale-payment-panel .sale-total > span:first-child { font-size: 12px; color: var(--gray-600); font-weight: 500; }
.sale-payment-panel #saleTotalDisplay { font-size: clamp(28px, 2.5vw, 38px); line-height: 1.2; }
.sale-payment-panel .sale-change { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; padding: 12px 0; }
.sale-payment-panel .form-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 20px; }
.sale-payment-panel .form-actions .btn { width: 100%; }
@container (max-width: 460px) {
 .sale-mode-picker { grid-template-columns: minmax(0, 1fr); }
 .sale-customer-fields { grid-template-columns: minmax(0, 1fr); gap: 0; }
 .sale-item-row, .sale-item-row:first-child { grid-template-columns: minmax(0, 1fr) 34px; }
 .sale-item-row > .sale-size-control { grid-column: 1 / -1; grid-row: 1; }
 .sale-quantity-field { grid-column: 1; grid-row: 2; }
 .sale-item-row > .btn-danger { grid-column: 2; grid-row: 2; }
 .sale-item-row:first-child > .sale-quantity-field { grid-column: 1 / -1; }
}
@media (max-width: 1250px) {
 .sale-layout { grid-template-columns: minmax(0, 1.2fr) minmax(260px, 1fr); }
 .sale-tips { grid-column: 1 / -1; }
 .sale-tips .card-body { max-height: 340px; }
}
@media (max-width: 760px) {
 .sale-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
 .sale-tips { grid-column: auto; }
}

.metric-table { min-width: 720px; }
.metric-table thead th { padding-block: 12px; }
.metric-table .mt-group td, .metric-table .mt-group:first-child td { padding-block: 10px; }
.metric-table .mt-term { white-space: normal; }
.login-logo h1 { overflow: visible; line-height: normal; }
.login-brand-logo { height: auto; max-height: 100px; object-fit: contain; object-position: center; }

.row-action-menu { position: fixed; z-index: 450; padding: 6px; border: 1px solid var(--gray-200); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); }
.row-action-menu[hidden] { display: none; }
.row-action-menu .row-action-item { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 40px; margin: 0; padding: 10px 12px; border: 0; border-radius: 9px; box-shadow: none; background: transparent; color: var(--ink); text-align: left; text-decoration: none; font-size: 13px; }
.row-action-menu .row-action-item:hover, .row-action-menu .row-action-item:focus-visible { background: var(--gray-100); outline: none; }
.row-action-menu .row-action-item.btn-danger { color: var(--danger); }

button.account-logout { border: 0; background: transparent; font-family: inherit; cursor: pointer; text-align: left; }

.expiry-report .card-header { flex-wrap: wrap; gap: 12px; }
.report-date-range { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.report-date-range .form-group { width: 190px; margin: 0; }
.report-date-range > span { font-size: 12px; color: var(--gray-500); }
.expiry-report .card-header p { color: var(--gray-500); font-size: 12px; font-weight: 400; margin-top: 6px; }
.expiry-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.expiry-totals > div { padding: 20px; border: 1px solid var(--gray-200); border-radius: 14px; background: var(--gray-50); }
.expiry-totals span { display: block; color: var(--gray-600); font-size: 12px; }
.expiry-totals strong { display: block; margin-top: 8px; font-size: 28px; color: var(--primary-deep); }
.expiry-basis { color: var(--gray-500); font-size: 12px; line-height: 1.7; margin-bottom: 18px; max-width: 95ch; }
@media (max-width: 560px) { .expiry-totals { grid-template-columns: 1fr; } }
