/* ==========================================================================
   GERMAN KRAFT — THE SYSTEM
   Design system v2: "brewhouse"

   - Stout-dark by default (bars are dim at night), a clean light theme, and
     a switch under your name in the navbar to force either one (stored per device).
   - One accent: Helles gold. Copper is kept for warnings, hop green for done.
   - Barlow for everything, Barlow Condensed for titles and big numbers: a
     DIN-style signage face, like the stencilled labels on the tanks. Numbers
     are tabular everywhere, so counts line up in columns.
   - Fonts and icons live in web/static, so phones on venue Wi-Fi without
     internet still get them.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Fonts (SIL Open Font License, see fonts/OFL-Barlow.txt)
   -------------------------------------------------------------------------- */
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap;
             src: url(../fonts/barlow-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: italic; font-weight: 400; font-display: swap;
             src: url(../fonts/barlow-latin-400-italic.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap;
             src: url(../fonts/barlow-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap;
             src: url(../fonts/barlow-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 700; font-display: swap;
             src: url(../fonts/barlow-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap;
             src: url(../fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap;
             src: url(../fonts/barlow-condensed-latin-700-normal.woff2) format('woff2'); }

/* --------------------------------------------------------------------------
   1. Design tokens — dark ("stout") is the default
   -------------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  --bg:             #15110d;   /* stout */
  --surface:        #1e1914;   /* porter */
  --surface-2:      #27211b;
  --surface-hover:  #2f2821;
  --border:         #393027;
  --border-light:   #4b4035;

  --accent:         #edb23c;   /* Helles gold: links, active nav, focus */
  --accent-hover:   #f6c762;
  --accent-fill:    #edb23c;   /* primary buttons */
  --accent-fill-hover: #f6c762;
  --on-accent:      #1d1405;
  --accent-dim:     rgba(237, 178, 60, 0.13);
  --accent-glow:    rgba(237, 178, 60, 0.30);

  --success:        #93c572;   /* hops */
  --success-dim:    rgba(147, 197, 114, 0.14);
  --danger:         #f07c66;
  --danger-dim:     rgba(240, 124, 102, 0.14);
  --warning:        #f2945a;   /* copper */
  --warning-dim:    rgba(242, 148, 90, 0.14);
  --info:           #8db4da;
  --info-dim:       rgba(141, 180, 218, 0.14);

  --text:           #f3ece0;   /* foam */
  --text-muted:     #bcb09f;
  --text-dim:       #95897a;

  --scrim:          rgba(8, 6, 4, 0.66);
  --select-arrow:   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23bcb09f'/%3E%3C/svg%3E");

  --font:           'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display:   'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --font-code:      ui-monospace, 'SF Mono', Menlo, monospace;

  --navbar-h:       60px;
  --page-max:       1320px;
  --radius:         8px;
  --radius-sm:      5px;
  --radius-lg:      12px;
  --gap:            1.25rem;

  --shadow-sm:      none;
  --shadow-md:      0 6px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg:      0 12px 40px rgba(0, 0, 0, 0.55);
  --shadow-accent:  0 4px 18px rgba(237, 178, 60, 0.18);

  --transition:     140ms ease;
}

/* Light ("foam"): follows the phone or Mac, unless the theme switch says dark */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg:             #eceae6;
    --surface:        #ffffff;
    --surface-2:      #f6f5f2;
    --surface-hover:  #efede8;
    --border:         #dbd7cf;
    --border-light:   #c8c1b5;
    --accent:         #8a5e00;
    --accent-hover:   #6b4800;
    --accent-fill:    #e9ab35;
    --accent-fill-hover: #f2bd55;
    --on-accent:      #1d1405;
    --accent-dim:     rgba(233, 171, 53, 0.18);
    --accent-glow:    rgba(201, 140, 20, 0.30);
    --success:        #3b7526;
    --success-dim:    rgba(59, 117, 38, 0.11);
    --danger:         #b23a26;
    --danger-dim:     rgba(178, 58, 38, 0.10);
    --warning:        #ab5214;
    --warning-dim:    rgba(171, 82, 20, 0.11);
    --info:           #2d6091;
    --info-dim:       rgba(45, 96, 145, 0.10);
    --text:           #1d1813;
    --text-muted:     #554c42;
    --text-dim:       #766c60;
    --scrim:          rgba(40, 32, 24, 0.42);
    --select-arrow:   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23554c42'/%3E%3C/svg%3E");
    --shadow-sm:      0 1px 2px rgba(45, 35, 20, 0.06);
    --shadow-md:      0 6px 20px rgba(45, 35, 20, 0.10);
    --shadow-lg:      0 12px 40px rgba(45, 35, 20, 0.16);
    --shadow-accent:  0 4px 18px rgba(201, 140, 20, 0.22);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg:             #eceae6;
  --surface:        #ffffff;
  --surface-2:      #f6f5f2;
  --surface-hover:  #efede8;
  --border:         #dbd7cf;
  --border-light:   #c8c1b5;
  --accent:         #8a5e00;
  --accent-hover:   #6b4800;
  --accent-fill:    #e9ab35;
  --accent-fill-hover: #f2bd55;
  --on-accent:      #1d1405;
  --accent-dim:     rgba(233, 171, 53, 0.18);
  --accent-glow:    rgba(201, 140, 20, 0.30);
  --success:        #3b7526;
  --success-dim:    rgba(59, 117, 38, 0.11);
  --danger:         #b23a26;
  --danger-dim:     rgba(178, 58, 38, 0.10);
  --warning:        #ab5214;
  --warning-dim:    rgba(171, 82, 20, 0.11);
  --info:           #2d6091;
  --info-dim:       rgba(45, 96, 145, 0.10);
  --text:           #1d1813;
  --text-muted:     #554c42;
  --text-dim:       #766c60;
  --scrim:          rgba(40, 32, 24, 0.42);
  --select-arrow:   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23554c42'/%3E%3C/svg%3E");
  --shadow-sm:      0 1px 2px rgba(45, 35, 20, 0.06);
  --shadow-md:      0 6px 20px rgba(45, 35, 20, 0.10);
  --shadow-lg:      0 12px 40px rgba(45, 35, 20, 0.16);
  --shadow-accent:  0 4px 18px rgba(201, 140, 20, 0.22);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15.5px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  scroll-padding-top: 4.5rem;   /* a link to #somewhere lands clear of the header that stays at the top */
}

body {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
a:not([class]):hover { text-decoration: underline; text-underline-offset: 0.18em; }

strong, b { font-weight: 600; }
code { font-family: var(--font-code); font-size: 0.88em; }
details > summary { cursor: pointer; }

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

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

.icon {
  width: 1.15em; height: 1.15em; flex-shrink: 0;
  vertical-align: -0.2em;
  fill: none; stroke: currentColor; stroke-width: 1.85;
  stroke-linecap: round; stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   3. Layout: the navbar across the top, and under it the page, centred
   -------------------------------------------------------------------------- */
.layout { display: flex; flex-direction: column; min-height: calc(100vh - var(--navbar-h)); }

.main-content {
  flex: 1;
  min-width: 0;                 /* lets wide tables scroll inside it instead of widening the page */
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.page-body {
  flex: 1;
  width: 100%;
  padding: 1.25rem 2.5rem 3rem;
}

/* --------------------------------------------------------------------------
   4. The navbar (ADR 0028): on every page, and it stays at the top as you
      scroll. Each section's button opens a menu of its pages; the current
      section is highlighted. Your name on the right opens your profile,
      Switch user, Lock and the theme. Narrow windows get a menu button
      (section 17).
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 300;
  padding: 0.5rem 0.9rem; border-radius: var(--radius-sm);
  background: var(--accent-fill); color: var(--on-accent); font-weight: 600;
}
.skip-link:focus { top: 0.75rem; color: var(--on-accent); }

.navbar {
  position: sticky; top: 0; z-index: 100;
  padding-top: env(safe-area-inset-top);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  display: flex; align-items: center; gap: 1.5rem;
  height: var(--navbar-h);
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 2.5rem;
}

.navbar-brand { display: flex; flex-direction: column; flex-shrink: 0; line-height: 1; }
.navbar-brand:hover { text-decoration: none; }
.navbar-brand .brand-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}
.navbar-brand .brand-sub { margin-top: 0.25rem; font-size: 0.75rem; color: var(--text-dim); }

.navbar-toggle { display: none; }

.navbar-menu { flex: 1; min-width: 0; }
.navbar-groups { list-style: none; display: flex; align-items: center; gap: 0.2rem; }
.nav-group { position: relative; }

/* A section's button, and Today (a link on its own) */
.nav-group-btn,
.navbar-groups .nav-top-link {
  display: inline-flex; align-items: center; gap: 0.35rem;
  height: 2.4rem; margin: 0; padding: 0 0.75rem;
  border: none; border-radius: 6px; background: none;
  font: inherit; font-size: 0.97rem; font-weight: 600; white-space: nowrap;
  color: var(--text-muted); cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.navbar-groups .nav-top-link .icon { display: none; }
.nav-group-btn:hover, .nav-group.open > .nav-group-btn,
.navbar-groups .nav-top-link:hover { background: var(--surface-hover); color: var(--text); }
.nav-group.is-current > .nav-group-btn,
.navbar-groups .nav-top-link.active { background: var(--accent-dim); color: var(--text); }
.nav-caret { width: 0.95rem; height: 0.95rem; color: var(--text-dim); transition: transform var(--transition); }
.nav-group.open .nav-caret { transform: rotate(180deg); }
.nav-group-btn .nav-count { margin-left: 0.15rem; }

/* A section's menu of pages */
.nav-panel {
  display: none;
  position: absolute; top: calc(100% + 0.45rem); left: 0; z-index: 110;
  min-width: 15rem;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.nav-group.open > .nav-panel { display: block; animation: slideDown 0.14s ease; }
.nav-panel-end { left: auto; right: 0; min-width: 16.5rem; }
.nav-panel-label { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: none;
  border-radius: 6px;
  background: none;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item .icon { width: 1.15rem; height: 1.15rem; color: var(--text-dim); transition: color var(--transition); }
.nav-item:hover .icon { color: var(--text-muted); }
.nav-item.active { background: var(--accent-dim); color: var(--text); font-weight: 600; }
.nav-item.active .icon { color: var(--accent); }
.nav-item-danger, .nav-item-danger .icon { color: var(--danger); }
.nav-item-danger:hover { background: var(--danger-dim); color: var(--danger); }

.nav-count {
  margin-left: auto;
  min-width: 1.5rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--warning-dim);
  color: var(--warning);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

/* The right-hand end: Count, and you */
.navbar-end { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; flex-shrink: 0; }

.navbar-count {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.95rem; border-radius: 999px;
  background: var(--accent-fill); color: var(--on-accent);
  font-weight: 700; font-size: 0.93rem; white-space: nowrap;
}
.navbar-count:hover { background: var(--accent-fill-hover); color: var(--on-accent); text-decoration: none; }

.nav-user-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.2rem 0.55rem 0.2rem 0.2rem;
  border: 1px solid transparent; border-radius: 999px; background: none;
  font: inherit; font-size: 0.95rem; font-weight: 600; color: var(--text); cursor: pointer;
}
.nav-user-btn:hover, .nav-user.open .nav-user-btn { background: var(--surface-hover); }
.nav-user.is-current .nav-user-btn { border-color: var(--accent-glow); }
.nav-user-btn .user-avatar { width: 32px; height: 32px; font-size: 1rem; }
.nav-user-name { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-user-card {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.5rem 0.7rem 0.75rem; margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.user-info { min-width: 0; }
.user-info .user-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info .user-role { display: block; font-size: 0.8rem; color: var(--text-dim); text-transform: capitalize; line-height: 1.3; }

/* Theme switch: Auto / Light / Dark, remembered on this device */
.theme-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  margin-top: 0.35rem; padding: 0.65rem 0.7rem 0.3rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem; color: var(--text-dim);
}
.theme-options {
  display: inline-flex; padding: 2px; gap: 2px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
}
.theme-options button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 28px; border: none; border-radius: 999px;
  background: transparent; color: var(--text-dim); cursor: pointer;
}
.theme-options button:hover { color: var(--text); }
.theme-options button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 0 0 1px var(--border-light); }
.theme-options .icon { width: 15px; height: 15px; }

.nav-scrim { display: none; }

/* --------------------------------------------------------------------------
   4b. Under the navbar, where you are (Stock › Stock count › 4 Oct) with a
       link back up at each step; at the bottom of every page, the footer
       with quick links, who's signed in, Switch user and Lock.
   -------------------------------------------------------------------------- */
.topbar { padding: 1rem 2.5rem 0; }

.trail { min-width: 0; }
.trail ol {
  list-style: none;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.45rem;
  font-size: 0.92rem; color: var(--text-dim);
}
.trail li { display: inline-flex; align-items: center; gap: 0.45rem; min-width: 0; }
.trail li + li::before { content: "›"; color: var(--text-dim); }
.trail a { color: var(--text-muted); font-weight: 500; }
.trail a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 0.18em; }
.trail [aria-current="page"] { color: var(--text); font-weight: 600; }
.trail-section { color: var(--text-dim); }

.app-footer {
  display: flex; flex-direction: column; gap: 0.55rem;
  margin: 0 2.5rem;
  padding: 1.25rem 0 1.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem; color: var(--text-dim);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 0.35rem 1.4rem; }
.footer-links a { color: var(--text-muted); font-weight: 500; }
.footer-links a:hover { color: var(--accent); }
.footer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 1rem; }
.footer-meta strong { color: var(--text-muted); }
.footer-meta .link-btn { margin: 0; padding: 0; font-size: 0.88rem; }
.footer-top { margin-left: auto; display: inline-flex; align-items: center; gap: 0.3rem; color: var(--text-muted); }
.icon-up { transform: rotate(90deg); }
.footer-brand { font-size: 0.82rem; }

/* --------------------------------------------------------------------------
   5. Page header
   -------------------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1.25rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: 2.15rem;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0.005em;
  color: var(--text);
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  max-width: 68ch;
}

.page-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* --------------------------------------------------------------------------
   6. Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--gap);
}
.card:last-child { margin-bottom: 0; }
.card-warning { border-color: var(--warning); }
.card-danger  { border-color: var(--danger); }
.card-narrow  { max-width: 560px; }
.card-text p + p, .card-text p + ul, .card-text ul + p { margin-top: 0.6rem; }
.card-text { line-height: 1.65; }
.card-text ul, .card-text ol { padding-left: 1.25rem; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text);
}
.card-title .count, .card-title-count { color: var(--text-dim); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.grid-2 > .card { margin-bottom: 0; }

/* Stat cards (kept for any page that still uses them) */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
}
.stat-icon { display: block; margin-bottom: 0.5rem; color: var(--text-dim); }
.stat-value {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.3rem;
}
.stat-label { font-size: 0.9rem; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   7. Tables. Inside a card, a table runs to the card's edges: no box in a box.
   -------------------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.card .table-wrap {
  margin: 0 -1.5rem;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}
.card .table-wrap:last-child { margin-bottom: -1.5rem; }
.card .table-wrap:last-child tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }
.card .table-wrap:last-child tbody tr:last-child td:last-child  { border-bottom-right-radius: var(--radius); }
.card .table-wrap th:first-child, .card .table-wrap td:first-child { padding-left: 1.5rem; }
.card .table-wrap th:last-child,  .card .table-wrap td:last-child  { padding-right: 1.5rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

thead th {
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.7rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
}
.card thead th { background: transparent; }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }

tbody td {
  padding: 0.7rem 0.9rem;
  color: var(--text-muted);
  vertical-align: middle;
}

tbody td.td-bold, td.td-bold { color: var(--text); font-weight: 600; }
td.td-top { vertical-align: top; }
td.td-mono, .td-mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  font-size: 0.9rem;
}
td.num, th.num { text-align: right; }

.td-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.3;
}
.btn .icon { width: 1.05em; height: 1.05em; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent-fill); }
.btn-primary:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); color: var(--on-accent); box-shadow: var(--shadow-accent); }

.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-light); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--text-dim); color: var(--text); }

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

.btn-success { background: var(--success-dim); color: var(--success); border-color: var(--success); }
.btn-success:hover { background: var(--success); color: #fff; }

.btn-ghost { background: transparent; color: var(--accent); border-color: transparent; }
.btn-ghost:hover { background: var(--accent-dim); color: var(--accent-hover); }

.btn-sm { min-height: 1.95rem; padding: 0.25rem 0.7rem; font-size: 0.85rem; }
.btn-icon { padding: 0.35rem 0.5rem; font-size: 0.9rem; }
.btn-block { width: 100%; }

/* --------------------------------------------------------------------------
   9. Badges: statuses and roles
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.55rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
}

.badge-admin    { background: var(--accent-dim);   color: var(--accent); }
.badge-manager  { background: var(--info-dim);     color: var(--info); }
.badge-readonly,
.badge-neutral  { background: var(--surface-2);    color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border); }
.badge-staff    { background: var(--success-dim);  color: var(--success); }
.badge-supervisor { background: transparent; color: var(--info); box-shadow: inset 0 0 0 1px var(--info); }

.badge-active   { background: var(--success-dim);  color: var(--success); }
.badge-inactive { background: transparent;         color: var(--text-dim); box-shadow: inset 0 0 0 1px var(--border-light); }  /* off, retired: not an error */
.badge-system   { background: var(--warning-dim);  color: var(--warning); }   /* needs a look */
.badge-danger   { background: var(--danger-dim);   color: var(--danger); }
.badge-info     { background: var(--info-dim);     color: var(--info); }

.badge-drink    { background: var(--info-dim);     color: var(--info); }
.badge-food     { background: var(--success-dim);  color: var(--success); }
.badge-other    { background: var(--surface-2);    color: var(--text-dim); }

/* --------------------------------------------------------------------------
   10. Flash messages
   -------------------------------------------------------------------------- */
.flash-container { padding: 0 2.5rem; margin-top: 1.25rem; max-width: 1320px; }

.flash {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  animation: slideDown 0.2s ease;
  border: 1px solid transparent;
}
.flash-success { background: var(--success-dim); border-color: var(--success); color: var(--success); }
.flash-error   { background: var(--danger-dim);  border-color: var(--danger);  color: var(--danger); }
.flash-info, .flash-message { background: var(--info-dim); border-color: var(--info); color: var(--info); }

.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  padding: 0.15rem;
  line-height: 0;
  border-radius: 4px;
}
.flash-close:hover { opacity: 1; }

/* Saves that update the page in place (save.js, ADR 0037): their messages show at the
   bottom of the screen, over the page, so they need a solid background under the tint. */
.toast-stack {
  position: fixed; z-index: 150;
  left: 50%; transform: translateX(-50%);
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  width: min(560px, calc(100vw - 2rem));
  display: flex; flex-direction: column; gap: 0.5rem;
  pointer-events: none;
}
.toast-stack .flash {
  margin: 0; pointer-events: auto;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.2s ease;
  transition: opacity 0.4s;
}
.toast-stack .flash-success { background: linear-gradient(var(--success-dim), var(--success-dim)), var(--surface); }
.toast-stack .flash-error   { background: linear-gradient(var(--danger-dim), var(--danger-dim)), var(--surface); }
.toast-stack .flash-info,
.toast-stack .flash-message { background: linear-gradient(var(--info-dim), var(--info-dim)), var(--surface); }
.toast-stack .flash.is-leaving { opacity: 0; }

/* The sign on the button: Saving… (it can't be pressed twice), then Saved ✓ */
.btn.is-saving { cursor: progress; }
.btn.is-saved, .link-btn.is-saved { color: var(--success); }

/* --------------------------------------------------------------------------
   11. Forms
   -------------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.25rem; }
.form-grid.single { grid-template-columns: 1fr; }

/* Nightly sales and saved history */
.sales-review-form { display: grid; gap: 1rem; margin-top: 1rem; }
.sales-review-form > button { justify-self: start; }
.sales-allocation { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.sales-allocation input { max-width: 8rem; }
.sales-history > summary { padding: .35rem 0; line-height: 1.7; }
.sales-history-body { margin-top: 1.25rem; }
.sales-history-body > .card { margin-bottom: 1rem; }
.sales-review-item { padding: 1rem 0; }
.sales-review-item + .sales-review-item { border-top: 1px solid var(--border); }
.sales-search input[type="search"] { font-size: max(1rem, 16px); }
.sales-fitting-mixes { padding: 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow-wrap: anywhere; }
.sales-fitting-mixes li + li { margin-top: .5rem; }

.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group.span-2 { grid-column: span 2; }

label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="search"],
select,
textarea {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  padding: 0.5rem 0.75rem;
  min-height: 2.35rem;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input[type="file"] { font: inherit; font-size: 0.9rem; color: var(--text-muted); max-width: 100%; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; margin-right: 0.75rem; padding: 0.4rem 0.8rem; cursor: pointer;
  border-radius: var(--radius-sm); border: 1px solid var(--border-light); background: var(--surface-2); color: var(--text);
}

input::placeholder, textarea::placeholder { color: var(--text-dim); }

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select {
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2rem;
}

textarea { resize: vertical; min-height: 90px; }

input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-fill); }

.form-hint { font-size: 0.85rem; color: var(--text-dim); line-height: 1.5; }

.checkbox-group { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0; }
.checkbox-group input[type="checkbox"] { width: 1.05rem; height: 1.05rem; cursor: pointer; }
.checkbox-group label { font-size: 0.93rem; font-weight: 500; color: var(--text); cursor: pointer; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 1.1rem;
  margin-top: 1.1rem;
  border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   12. Modal
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 460px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px);
  transition: transform 0.18s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.75rem; color: var(--danger); }
.modal-head .icon { width: 1.4rem; height: 1.4rem; }
.modal-title { font-family: var(--font-display); font-size: 1.45rem; font-weight: 600; color: var(--text); margin-bottom: 0.75rem; }
.modal-head .modal-title { margin: 0; }
.modal-body { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; line-height: 1.6; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   13. Misc components
   -------------------------------------------------------------------------- */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.4rem 0; }

.empty-state { text-align: center; padding: 2.75rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon { display: block; margin: 0 auto 0.75rem; font-size: 1.6rem; line-height: 1; color: var(--text-dim); }
.empty-state .empty-icon .icon { width: 2rem; height: 2rem; stroke-width: 1.5; }
.empty-state p { font-size: 0.95rem; }

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--text-dim); }
.breadcrumb .current { color: var(--text); }

.inline-form { display: inline; }

/* Stock list: one unit's size on a row (T21). Dropdowns wrap on a phone. */
.unit-row {
  display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.3rem; flex-wrap: wrap;
}
.unit-row-label { min-width: 4.5rem; }
.unit-row .inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; max-width: 100%; }
.unit-row select { width: auto; min-width: 7rem; max-width: 12rem; }
.unit-row .size-other { width: 5.5rem; }
.unit-row .size-weight { width: 6.5rem; }
.unit-flag { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

/* Category tree indentation */
.cat-depth-1 { padding-left: 0; }
.cat-depth-2 { padding-left: 1.5rem; }
.cat-depth-3 { padding-left: 3rem; }
.cat-indent { display: inline-block; color: var(--text-dim); font-size: 0.85em; }

/* Filter bar */
.filter-bar { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filter-bar input[type="checkbox"] { width: 1rem; min-width: 0; }   /* not stretched like the boxes */
.filter-bar select,
.filter-bar input:not([type="checkbox"]) { width: auto; min-width: 180px; }

/* Inline price form */
.price-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.price-form input { width: 100px; }
.price-date { display: inline-flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; }
.price-date input[type="date"] { width: 10rem; }

/* Detail grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.detail-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-dim); margin-bottom: 0.15rem; }
.detail-field .detail-value { font-size: 1rem; color: var(--text); }

/* A radio choice on its own line, big enough to tap (import pairs, bar sheets).
   A hanging indent keeps a long wrapped label clear of its radio button. */
.choice {
  display: block;
  padding: 0.3rem 0 0.3rem 1.6rem;
  text-indent: -1.6rem;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text);
  cursor: pointer;
}
.choice input[type="radio"], .choice input[type="checkbox"] { width: 1rem; margin: 0 0.6rem 0 0; vertical-align: -0.1rem; }
.choice select { text-indent: 0; max-width: 100%; margin-top: 0.25rem; }

/* Bar sheet: product ticks in columns, and a Save bar that stays in reach */
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 1.25rem; }
.sheet-save {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;
  padding: 0.85rem 0; background: var(--bg);
}

/* A small text button inside a line of text (link actions on the item page) */
.link-line .inline-form { display: inline; }
.link-btn {
  background: none; border: none; padding: 0 0.2rem; margin-left: 0.25rem;
  font: inherit; font-size: 0.85rem; color: var(--accent); text-decoration: underline; cursor: pointer;
}

/* A short line of related controls */
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.row-sm { gap: 0.5rem; }
.row-end { justify-content: flex-end; }

/* Notes beside or under things */
.text-muted   { color: var(--text-muted); }
.text-dim     { color: var(--text-dim); }
.text-strong  { color: var(--text); font-weight: 600; }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.small        { font-size: 0.85rem; }
.nowrap       { white-space: nowrap; }
.fw-bold      { font-weight: 600; }
.prose        { line-height: 1.65; max-width: 75ch; }
.prose p + p  { margin-top: 0.6rem; }
.list         { padding-left: 1.25rem; line-height: 1.7; }
.list.small   { line-height: 1.6; }
.cols-2       { columns: 2; column-gap: 2rem; }
.list li::marker { color: var(--text-dim); }

/* Spacing: 1 = 0.5rem, 2 = 0.75rem, 3 = 1rem, 4 = 1.25rem, 5 = 1.5rem */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 0.75rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.25rem; }
.mt-5 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 0.75rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.25rem; }
.mb-5 { margin-bottom: 1.5rem; }
.ml-auto { margin-left: auto; }

.text-center { text-align: center; }

.w-lg { min-width: 260px; width: auto; }

/* --------------------------------------------------------------------------
   14. Today: the open count's bars, what needs a look, recent activity
   -------------------------------------------------------------------------- */
.today-count-summary { color: var(--text-muted); margin: -0.4rem 0 1.1rem; }

.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

/* One bar in the count. The strip at the bottom fills like a sight glass on a
   tank: up to the bar's sheet when it has one, all the way once it's in. */
.bar-tile {
  position: relative;
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 0.85rem 0.95rem 1.05rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  color: inherit;
}
a.bar-tile:hover { border-color: var(--border-light); background: var(--surface-hover); text-decoration: none; color: inherit; }
.bar-tile-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-tile-num { font-family: var(--font-display); font-size: 2.2rem; font-weight: 600; line-height: 1; color: var(--text); margin-top: 0.35rem; }
.bar-tile-num small { font-size: 1.05rem; color: var(--text-dim); font-weight: 600; margin-left: 0.15rem; }
.bar-tile-note { font-size: 0.82rem; color: var(--text-dim); }
.bar-tile-status { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; font-weight: 600; margin-top: 0.35rem; }
.bar-tile-status .icon { width: 0.95rem; height: 0.95rem; }
.bar-tile-level { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--border); }
.bar-tile-level span { display: block; height: 100%; background: var(--accent-fill); }

.bar-tile.is-not_started .bar-tile-num { color: var(--text-dim); }
.bar-tile.is-not_started .bar-tile-status { color: var(--text-dim); }
.bar-tile.is-in_progress .bar-tile-status { color: var(--warning); }
.bar-tile.is-submitted .bar-tile-status { color: var(--success); }
.bar-tile.is-submitted .bar-tile-level span { background: var(--success); }
.bar-tile.is-skipped { background: transparent; border-style: dashed; }
.bar-tile.is-skipped .bar-tile-status, .bar-tile.is-skipped .bar-tile-num { color: var(--text-dim); }

/* Status in words with a small mark, for tables (stock take bars) */
.state { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.88rem; white-space: nowrap; }
.state .icon { width: 0.95rem; height: 0.95rem; }
.state-not_started { color: var(--text-dim); }
.state-in_progress { color: var(--warning); }
.state-submitted   { color: var(--success); }
.state-skipped     { color: var(--text-dim); }

.attention-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.attention {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 1.1rem 1.25rem 1.2rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: inherit;
}
a.attention:hover { border-color: var(--border-light); background: var(--surface-hover); color: inherit; }
.attention-label { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; color: var(--text-muted); }
.attention-label .icon { color: var(--text-dim); }
.attention-num { font-family: var(--font-display); font-size: 2.4rem; font-weight: 600; line-height: 1.05; color: var(--text); margin-top: 0.4rem; }
.attention-num.is-zero { color: var(--text-dim); }
.attention-note { font-size: 0.88rem; color: var(--text-dim); }
.attention-go { margin-top: auto; padding-top: 0.6rem; font-size: 0.9rem; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 0.3rem; }
.attention.is-alert .attention-num { color: var(--warning); }

.activity { list-style: none; margin: 0 -1.5rem -1.5rem; border-top: 1px solid var(--border); }
.activity li {
  display: flex; align-items: baseline; gap: 1rem;
  padding: 0.7rem 1.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.activity li:last-child { border-bottom: none; }
.activity-what { flex: 1; min-width: 0; }
.activity-what strong { color: var(--text); font-weight: 600; }
.activity-times { color: var(--text-dim); font-weight: 600; font-size: 0.85rem; }
.activity-when { flex-shrink: 0; font-size: 0.88rem; color: var(--text-dim); white-space: nowrap; }

/* --------------------------------------------------------------------------
   15. Unlock (login) and PIN pages
   -------------------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1.25rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-logo { margin-bottom: 1.75rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.login-logo .brand {
  font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent);
}
.login-logo .sub { margin-top: 0.35rem; font-size: 0.88rem; color: var(--text-dim); }

.login-card h1 { font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; line-height: 1.1; margin-bottom: 0.4rem; }
.login-card .login-sub { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 1.5rem; }

.login-error {
  background: var(--danger-dim);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.93rem;
  margin-bottom: 1.1rem;
}

.login-card .form-group { margin-bottom: 1rem; }
.login-card .form-group:last-of-type { margin-bottom: 1.5rem; }
.login-card .btn { width: 100%; min-height: 2.9rem; font-size: 1rem; }

/* The PIN pad (ADR 0019): big keys, four dots, no text box */
.pin-card { max-width: 380px; text-align: center; }
.pin-card .login-logo { text-align: center; }
.pin-card .login-sub { margin-bottom: 1.25rem; }
.pin-note { margin-bottom: 1rem; padding: 0.6rem 0.8rem; border-radius: var(--radius-sm);
            background: var(--info-dim); color: var(--info); font-size: 0.9rem; text-align: left; }
.pin-dots { display: flex; justify-content: center; gap: 1rem; margin: 0.5rem 0 0.6rem; }
.pin-dots span {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border-light); background: transparent; transition: background 0.1s, border-color 0.1s;
}
.pin-dots span.is-filled { background: var(--accent-fill); border-color: var(--accent-fill); }
.pin-dots.is-wrong { animation: pin-shake 0.4s; }
.pin-dots.is-wrong span { border-color: var(--danger); }
@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.pin-message { min-height: 1.3rem; font-size: 0.92rem; color: var(--text-muted); margin-bottom: 0.9rem; }
.pin-message.is-error { color: var(--danger); }
.pin-message.is-ok { color: var(--success); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; max-width: 280px; margin: 0 auto; }
.pin-key {
  height: 64px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font-family: var(--font-display); font-size: 1.8rem; font-weight: 600;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.pin-key:active { background: var(--accent-dim); border-color: var(--accent); }
.pin-key:disabled { opacity: 0.4; cursor: default; }
.pin-key-back { font-family: var(--font); font-size: 1.3rem; color: var(--text-muted); }
.pin-foot { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 1.5rem; font-size: 0.85rem; color: var(--text-dim); }
.pin-link { background: none; border: none; color: var(--accent); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; margin-top: 0.3rem; }
.pin-shown { font-family: var(--font-display); font-size: 3.4rem; font-weight: 700; letter-spacing: 0.35em; color: var(--accent);
             margin: 1rem 0 0.5rem; padding-left: 0.35em; }

/* --------------------------------------------------------------------------
   16. Motion: small and only where something changed
   -------------------------------------------------------------------------- */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

/* --------------------------------------------------------------------------
   17. Phones and small screens
   In a narrow window the navbar keeps the name, Count and you, and a menu
   button opens every section at once, under the bar. On a phone, tables
   turn into labelled rows (app.js adds the labels from each table's
   headings), and headers, buttons and forms stack to fit.
   -------------------------------------------------------------------------- */
@media (max-width: 1240px) {
  .navbar-inner { gap: 1rem; padding: 0 1.5rem; }
  .navbar-brand .brand-sub { display: none; }
  .nav-user-name { display: none; }
  .nav-user-btn { padding-right: 0.4rem; }
  .nav-group-btn, .navbar-groups .nav-top-link { padding: 0 0.6rem; }
}

@media (max-width: 999.98px) {
  .navbar-inner { gap: 0.6rem; padding: 0 1rem; }
  .navbar-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; margin-left: -10px;
    background: none; border: none; cursor: pointer; color: var(--text); border-radius: 6px;
  }
  .navbar-toggle .icon { width: 24px; height: 24px; }
  .navbar-toggle .icon-close, body.nav-open .navbar-toggle .icon-open { display: none; }
  body.nav-open .navbar-toggle .icon-close { display: inline-block; }
  .navbar-brand .brand-name { font-size: 1.3rem; }

  /* The menu button opens every section, under the bar */
  .navbar-menu {
    display: none;
    position: fixed; left: 0; right: 0; top: calc(var(--navbar-h) + env(safe-area-inset-top) + 1px);
    max-height: calc(100vh - var(--navbar-h) - env(safe-area-inset-top));
    max-height: calc(100dvh - var(--navbar-h) - env(safe-area-inset-top));
    overflow-y: auto; overscroll-behavior: contain;
    padding: 0.75rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
  }
  body.nav-open .navbar-menu { display: block; }
  body.nav-open { overflow: hidden; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 90; background: var(--scrim); }
  .navbar-groups {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0.6rem 1.25rem; align-items: start;
  }
  .nav-group-link { grid-column: 1 / -1; }
  .navbar-groups .nav-top-link {
    display: flex; gap: 0.7rem; width: 100%; height: auto; padding: 0.6rem 0.7rem;
    font-size: 1rem; font-weight: 500; color: var(--text-muted);
  }
  .navbar-groups .nav-top-link .icon { display: inline-block; }
  .navbar-groups .nav-top-link.active { font-weight: 600; }
  .nav-group-btn { display: none; }
  .navbar-menu .nav-panel,
  .navbar-menu .nav-group.open > .nav-panel {
    display: block; position: static; min-width: 0; padding: 0;
    border: none; box-shadow: none; background: none; animation: none;
  }
  .nav-panel-label { display: block; padding: 0.35rem 0.7rem 0.2rem; font-size: 0.78rem; font-weight: 600; color: var(--text-dim); }
  .nav-item { padding: 0.6rem 0.7rem; font-size: 1rem; }
  .nav-panel-end { width: min(18rem, calc(100vw - 1.5rem)); }
}

@media (max-width: 1100px) {
  .attention-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .navbar-count { padding: 0.45rem 0.85rem; }
  .page-body { padding: 0.85rem 1rem 2rem; max-width: 100%; }
  .topbar { padding: 0.75rem 1rem 0; }
  .trail ol { font-size: 0.88rem; }
  .app-footer { margin: 0 1rem; padding: 1.1rem 0 calc(1.4rem + env(safe-area-inset-bottom)); }
  .footer-top { margin-left: 0; }
  .flash-container { padding: 0 1rem; margin-top: 0.75rem; }

  .page-header { flex-direction: column; align-items: stretch; gap: 0.85rem; margin-bottom: 1.25rem; }
  .page-title { font-size: 1.85rem; }
  .page-actions { justify-content: flex-start; gap: 0.5rem; }
  .page-actions .btn { flex: 1 1 auto; }
  .page-actions form { display: flex; flex: 1 1 auto; }
  .page-actions form .btn { width: 100%; }

  .card { padding: 1rem 1rem 1.1rem; }
  .card .table-wrap { margin: 0 -1rem; }
  .card .table-wrap:last-child { margin-bottom: -1.1rem; }
  .card .table-wrap th:first-child, .card .table-wrap td:first-child { padding-left: 1rem; }
  .card .table-wrap th:last-child,  .card .table-wrap td:last-child  { padding-right: 1rem; }
  .activity { margin: 0 -1rem -1.1rem; }
  .activity li { padding: 0.65rem 1rem; flex-wrap: wrap; gap: 0.15rem 1rem; }
  .card-header { flex-wrap: wrap; gap: 0.5rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; gap: 1rem; }
  .form-group.span-2 { grid-column: auto; }
  .detail-grid, .detail-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
  .stat-card { padding: 1rem; }
  .filter-bar > div { flex: 1 1 100%; }
  .filter-bar select { width: 100%; }
  .modal { padding: 1.25rem; }
  .btn { min-height: 2.6rem; }
  .btn-sm { min-height: 2.25rem; }

  /* 16px stops iPhones zooming into a box when it's tapped */
  input[type="text"], input[type="number"], input[type="password"], input[type="email"],
  input[type="date"], input[type="search"], select, textarea { font-size: 16px; min-height: 2.6rem; }
  .inline-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; max-width: 100%; }
  .inline-form input[type="text"] { flex: 1 1 8rem; min-width: 0; }
  .unit-row { width: 100%; }
  .unit-row select { max-width: 100%; min-width: 0; flex: 1 1 8rem; }
  .unit-row .size-other, .unit-row .size-weight { flex: 1 1 5rem; min-width: 0; width: auto; }
  .w-lg { min-width: 0; width: 100%; }
  .hide-narrow { display: none !important; }   /* phones have the Count button in the navbar */
}

@media (max-width: 700px) {
  .attention-grid { grid-template-columns: 1fr; gap: 0.6rem; }
  .attention { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 0.75rem; padding: 0.85rem 1rem; }
  .attention-label { flex: 1 1 auto; }
  .attention-num { order: 2; font-size: 1.8rem; margin-top: 0; }
  .attention-note { order: 3; flex-basis: 100%; }
  .attention-go { order: 4; padding-top: 0.3rem; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .bar-tile { padding: 0.7rem 0.8rem 0.9rem; }
  .bar-tile-num { font-size: 1.85rem; margin-top: 0.2rem; }

  /* Tables become one block per row, each value with its heading as a label */
  .table-wrap { border: none; overflow: visible; background: transparent; }
  .table-wrap table:not(.no-stack),
  .table-wrap table:not(.no-stack) tbody,
  .table-wrap table:not(.no-stack) tr,
  .table-wrap table:not(.no-stack) td { display: block; width: 100%; }
  .table-wrap table:not(.no-stack) thead { display: none; }
  .table-wrap table:not(.no-stack) tbody tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0.5rem 0; margin-bottom: 0.6rem;
  }
  .table-wrap table:not(.no-stack) tbody tr:last-child { border-bottom: 1px solid var(--border); }
  /* Inside a card the rows are already in a box: just lines between them */
  .card .table-wrap table:not(.no-stack) tbody tr {
    background: transparent; border: none; border-bottom: 1px solid var(--border); border-radius: 0;
    margin: 0; padding: 0.6rem 0;
  }
  .card .table-wrap table:not(.no-stack) tbody tr:last-child { border-bottom: none; }
  .table-wrap table:not(.no-stack) tbody td,
  .card .table-wrap table:not(.no-stack) tbody td { padding: 0.25rem 1rem; text-align: left !important; }
  .table-wrap table:not(.no-stack) tbody td[data-label] {
    display: grid; grid-template-columns: 6.75rem minmax(0, 1fr); column-gap: 0.75rem; align-items: baseline;
  }
  .table-wrap table:not(.no-stack) tbody td[data-label]::before {
    content: attr(data-label);
    font-size: 0.82rem; font-weight: 600; color: var(--text-dim);
  }
  .table-wrap table:not(.no-stack) tbody td:empty { display: none; }
  .table-wrap table:not(.no-stack) tbody td[colspan] { padding: 0.5rem 1rem; }
  .card .table-wrap:last-child tbody tr:last-child td { border-radius: 0; }
  .td-actions { flex-wrap: wrap; }
}

/* --------------------------------------------------------------------------
   18. Printing: a page prints as just its content (the till check's change list)
   -------------------------------------------------------------------------- */
.print-only, .print-only-cell { display: none; }
@media print {
  .print-only-cell { display: table-cell; font-size: 13pt; text-align: center; }
  .navbar, .nav-scrim, .topbar, .app-footer, .page-actions, .flash-container, .toast-stack, .print-hide,
  form, .btn, .modal-overlay { display: none !important; }
  .print-only { display: block; }
  .layout, .main-content { display: block !important; margin: 0 !important; padding: 0 !important; max-width: none !important; }
  body { background: #fff !important; font-size: 10pt; }
  body, body * { color: #000 !important; }
  .card { border: 1px solid #bbb !important; box-shadow: none !important; background: #fff !important; break-inside: auto; }
  .card .table-wrap { margin: 0 !important; }
  .card-header { break-after: avoid; }
  tr { break-inside: avoid; }
  th, td { padding: 0.3rem 0.5rem !important; }
  a { color: inherit !important; text-decoration: none !important; }
  .detail-grid { display: none !important; }
  .table-wrap { overflow: visible !important; }
}

/* --------------------------------------------------------------------------
   19. Profile
   -------------------------------------------------------------------------- */
.profile-grid { max-width: 900px; }
.profile-id { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.user-avatar-lg { width: 52px; height: 52px; font-size: 1.6rem; }
.profile-name { font-size: 1.1rem; font-weight: 600; color: var(--text); }

/* Reset data: what goes and what stays */
.reset-grid { max-width: 900px; }
.reset-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.reset-list li { display: flex; flex-direction: column; }
.reset-list li > span { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); }

/* Error pages */
.error-page { text-align: center; padding: 4rem 1rem; }
.error-code { font-family: var(--font-display); font-size: 5rem; font-weight: 700; line-height: 1; color: var(--text-dim); margin-bottom: 0.75rem; }

/* A code beside a title: "Poolside Pale Ale  S0001" */
.title-code { font-family: var(--font); font-size: 0.5em; font-weight: 600; color: var(--text-dim); letter-spacing: 0.04em; vertical-align: 0.35em; margin-left: 0.2rem; }
.card-form { max-width: 900px; }
.stock-alias-row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; padding: 0.35rem 0; border-top: 1px solid var(--border); }
.attention-label + .attention-note { margin-top: 0.5rem; }
.inline-choice { display: flex; align-items: center; gap: 0.45rem; font-weight: 500; color: var(--text); cursor: pointer; }

/* The unlock page's footer */
.login-foot { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--text-dim); text-align: center; }

/* --------------------------------------------------------------------------
   20. Recovery (ADR 0027): what's been removed, by kind, with a way back
   -------------------------------------------------------------------------- */
.filter-label { display: block; margin-bottom: 0.3rem; }
.recovery-jump { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.recovery-chip {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.3rem 0.4rem 0.3rem 0.8rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-light);
  font-size: 0.9rem; font-weight: 600; color: var(--text);
}
a.recovery-chip:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.recovery-chip.is-empty { color: var(--text-dim); border-color: var(--border); background: transparent; }
.recovery-chip-n {
  min-width: 1.6rem; padding: 0.05rem 0.45rem; border-radius: 999px; text-align: center;
  background: var(--accent-dim); color: var(--accent); font-size: 0.8rem;
}
.recovery-chip.is-empty .recovery-chip-n { background: var(--surface-2); color: var(--text-dim); }
.recovery-table { table-layout: fixed; }
.recovery-table .col-code { width: 10%; }
.recovery-table .col-name { width: 25%; }
.recovery-table .col-name-wide { width: 35%; }
.recovery-table .col-detail { width: 20%; }
.recovery-table .col-removed { width: 18%; }
.recovery-table .col-action { width: 27%; }
.recovery-table td { overflow-wrap: anywhere; }
.recovery-blocked { display: inline-flex; align-items: flex-start; gap: 0.4rem; max-width: 28rem; font-size: 0.85rem; color: var(--warning); }
.recovery-blocked .icon { margin-top: 0.15rem; }
/* Kept for history (ADR 0040): one more column, the reason */
.recovery-table.is-kept .col-code { width: 9%; }
.recovery-table.is-kept .col-name { width: 20%; }
.recovery-table.is-kept .col-name-wide { width: 29%; }
.recovery-table.is-kept .col-detail { width: 16%; }
.recovery-table.is-kept .col-history { width: 23%; }
.recovery-table.is-kept .col-removed { width: 16%; }
.recovery-table.is-kept .col-action { width: 16%; }
.recovery-kept-title { font-size: 1rem; margin: 1.5rem 0 0.5rem; }
/* Delete for good: a small form that opens on the line */
.recovery-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.5rem; }
.recovery-delete > summary.btn { list-style: none; }
.recovery-delete > summary.btn::-webkit-details-marker { display: none; }
.recovery-delete-form {
  display: grid; gap: 0.4rem; max-width: 18rem; margin-top: 0.5rem; padding: 0.75rem;
  border: 1px solid var(--danger); border-radius: var(--radius); background: var(--surface);
}
.recovery-delete-form > button { justify-self: start; }
.recovery-delete-form input[type="password"] { font-size: max(1rem, 16px); }   /* an iPhone doesn't zoom in */
.recovery-delete-form .form-hint { margin: 0; }
.recovery-delete-what { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.recovery-deleted { margin: 0; padding-left: 1.1rem; }
.recovery-deleted li + li { margin-top: 0.35rem; }

/* Locations page (ADR 0031): the name box is the rename form */
.location-rename input[type="text"] { width: 13rem; max-width: 100%; }
.location-new { flex: 1; min-width: 12rem; }

/* Stock product and unit forms */
.card-narrow { max-width: 760px; }
.unit-label-input { width: 9rem; max-width: 100%; }
.unit-size-input { width: 7rem; max-width: 100%; }
.unit-container-select { min-width: 10rem; }
.form-group-bottom { display: flex; align-items: flex-end; }


/* T28: nightly sales entry sheet, from the approved mock-up. */

/* ---- T28 entry sheet (mock-up). Everything new is prefixed es- ---- */
.es-where { position: sticky; top: var(--navbar-h); z-index: 90; background: var(--surface); border-bottom: 1px solid var(--border); }
.es-bar { display:block; appearance:none; border:0; width:100%; height:4px; background:var(--surface-2); }
.es-bar::-webkit-progress-bar { background:var(--surface-2); }
.es-bar::-webkit-progress-value { background:var(--accent-fill); }
.es-bar::-moz-progress-bar { background:var(--accent-fill); }
.es-where-inner { max-width: var(--page-max); margin: 0 auto; padding: .45rem 2.5rem; display: flex; gap: 1rem; align-items: center; justify-content: space-between; font-size: .92rem; }
.es-where-section { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; color: var(--text); }
.es-where-n { color: var(--text-dim); font-weight: 600; }
.es-where-right { display:flex; gap:1rem; align-items:center; color: var(--text-muted); }
.es-keys { color: var(--text-dim); font-size: .82rem; }
.es-keys kbd { font-family: var(--font-code); font-size: .78rem; border: 1px solid var(--border-light); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3rem; color: var(--text-muted); }
.es-tiles { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.es-tile { display:flex; flex-direction:column; gap:.1rem; background: var(--surface); border:1px solid var(--border); border-radius: var(--radius); padding: .9rem 1.1rem; color: var(--text); text-decoration:none; }
.es-tile:hover { border-color: var(--border-light); background: var(--surface-hover); }
.es-tile-n { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); font-weight: 600; }
.es-tile-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; }
.es-tile-big { font-family: var(--font-display); font-size: 2.3rem; font-weight: 600; line-height: 1; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.es-tile-ticked { font-size: .85rem; color: var(--success); margin-top: .2rem; }
.es-sub { display:block; font-size: .84rem; color: var(--text-dim); line-height: 1.35; }
.es-section { padding: 0; overflow: clip; scroll-margin-top: calc(var(--navbar-h) + 52px); }
.es-section-head { display:flex; justify-content: space-between; align-items: flex-end; gap: 1rem; padding: 1.2rem 1.5rem 1rem; border-bottom: 1px solid var(--border); }
.es-h2 { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; line-height: 1.1; margin-top: .15rem; }
.es-summary { font-size: .95rem; margin-top: .25rem; color: var(--text-muted); }
.es-flagcount { display:inline-flex; gap:.35rem; align-items:center; }
.es-flagcount .icon { width: 14px; height: 14px; }
.es-colhead, .es-row { display: grid; grid-template-columns: 3.25rem minmax(0, 1.5fr) minmax(0, 1.25fr) 6.5rem minmax(9rem, .9fr) 2.5rem; gap: 1rem; align-items: center; padding: 0 1.5rem 0 1rem; }
.es-colhead { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); font-weight: 600; padding-top: .6rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
.es-colhead .r, .es-qty, .es-fig { text-align: right; }
.es-row { min-height: 4.4rem; border-bottom: 1px solid var(--border); scroll-margin-top: calc(var(--navbar-h) + 60px); scroll-margin-bottom: 40vh; }
.es-row:hover { background: var(--surface-hover); }
.es-row:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.es-row.is-current { box-shadow: inset 4px 0 0 var(--accent); background: var(--accent-dim); }
.es-row.is-ticked .es-name, .es-row.is-ticked .es-qty-n, .es-row.is-ticked .es-amount, .es-row.is-ticked .es-plu-code { color: var(--text-dim); }
.es-row.is-ticked .es-name { text-decoration: line-through; text-decoration-color: var(--border-light); }
.es-tick-form { align-self:stretch; display:flex; flex-direction:column; justify-content:center; }
.es-tick { display:flex; align-items:center; justify-content:center; height: 100%; cursor: pointer; }
.es-tick input { position:absolute; opacity:0; width:1px; height:1px; }
.es-box { width: 1.65rem; height: 1.65rem; border: 2px solid var(--border-light); border-radius: 6px; display:grid; place-items:center; color: transparent; background: var(--surface); }
.es-box .icon { width: 1.1rem; height: 1.1rem; stroke-width: 3; }
.es-tick input:checked + .es-box { background: var(--success); border-color: var(--success); color: var(--bg); }
.es-tick input:not(:checked) + .es-box .icon { visibility:hidden; }
.es-tick input:focus-visible + .es-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.es-name { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.es-qty-n { font-family: var(--font-display); font-size: 2.1rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }
.es-qty .es-sub { display:none; }
.es-amount { display:block; font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.es-code { display:block; font-family: var(--font-code); font-size: .82rem; color: var(--text-muted); }
.es-plu { display:flex; flex-direction: column; align-items: flex-start; gap: .1rem; min-width: 0; }
.es-copy { display:inline-flex; align-items:center; gap:.45rem; font: inherit; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .2rem .55rem; color: var(--text); cursor: pointer; }
.es-copy:hover { border-color: var(--accent); }
.es-copy .icon { width: 15px; height: 15px; color: var(--text-dim); }
.es-copy.is-copy-failed::after { content:"Select PLU to copy"; font-size:.8rem; color:var(--warning); }
.es-copy.is-copied { border-color: var(--success); }
.es-copy.is-copied::after { content: "Copied"; font-size: .8rem; color: var(--success); }
.es-plu-code { font-family: var(--font-code); font-size: 1rem; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.es-pname { font-family: var(--font-code); font-size: .78rem; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.es-plu-missing { flex-direction: row; align-items: flex-start; gap: .5rem; color: var(--warning); }
.es-plu-missing .icon { width: 18px; height: 18px; margin-top: .1rem; flex: none; }
.es-plu-missing strong { display:block; font-weight: 600; }
.es-line { font-size: .78rem; color: var(--text-dim); text-align: right; font-variant-numeric: tabular-nums; }
.es-totals { display:flex; gap: 2rem; justify-content: flex-end; align-items: center; padding: 1rem 1.5rem; background: var(--surface-2); }
.es-totals strong { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.es-totals-label { margin-right: auto; font-weight: 600; color: var(--text-muted); }
.es-empty { display:flex; gap: .75rem; align-items:flex-start; padding: 1.4rem 1.5rem; color: var(--text-muted); }
.es-empty .icon { color: var(--success); width: 22px; height: 22px; flex: none; margin-top: .1rem; }
.es-actions-confirm { display:inline-flex; gap:.5rem; align-items:center; }
.es-ready .es-actions-confirm { display:none; }
.es-untick, .es-js-action { display:none; }
.es-ready .es-untick, .es-ready .es-js-action { display:inline-flex; }
.es-ready .es-tick-save { display:none; }
.es-ready .es-confirming .es-actions-confirm { display:inline-flex; }
.es-ready .es-confirming .es-untick { display:none; }
@media (prefers-reduced-motion: no-preference) { .es-row { transition: background-color 120ms ease; } }
@media screen and (max-width: 760px) {
  .es-where-inner { padding: .4rem 1rem; }
  .es-keys { display: none; }
  .es-tiles { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .es-colhead { display: none; }
  .es-section-head { padding: 1rem; flex-direction: column; align-items: flex-start; }
  .es-row { grid-template-columns: 2.6rem minmax(0,1fr) auto; grid-template-areas: "tick prod qty" "tick plu fig"; gap: .35rem .75rem; padding: .7rem 1rem .7rem .5rem; }
  .es-tick-form { grid-area: tick; } .es-prod { grid-area: prod; } .es-qty { grid-area: qty; } .es-plu { grid-area: plu; } .es-fig { grid-area: fig; }
  .es-line { display: none; }
  .es-fig .es-sub { max-width: 8rem; margin-left: auto; }
  .es-plu-code { font-size:.9rem; }
  .es-totals { gap: 1rem; padding: .9rem 1rem; flex-wrap: wrap; }
}
@media print {
  @page sales-entry { size: A4; margin: 12mm; }
  .sales-entry { page:sales-entry; }
  .sales-entry { color-scheme: light; --bg:#fff; --surface:#fff; --surface-2:#f2f2f2; --surface-hover:#fff; --border:#bbb; --border-light:#888; --text:#000; --text-muted:#333; --text-dim:#555; --warning:#000; --accent-dim: transparent; }
  .sales-entry :is(.navbar, .es-where, .page-actions, .es-tiles, .es-copy .icon, .es-line, .app-footer) { display: none !important; }
  .sales-entry .page-body { padding: 0; }
  .es-section { break-before: page; border: none; overflow:visible; }
  .es-section:first-of-type { break-before: auto; }
  .es-row { min-height: 0; padding-top: .25rem; padding-bottom: .25rem; break-inside: avoid; grid-template-columns: 2rem minmax(0,1.6fr) minmax(0,1.2fr) 4rem minmax(7rem,.9fr) 0; }
  .es-qty-n { font-size: 1.35rem; }
  .es-copy { border: none; background: none; padding: 0; }
  .es-box { width: 1.1rem; height: 1.1rem; border-radius: 3px; }
  .es-row.is-ticked .es-name { text-decoration: none; }
}
.es-prod, .es-fig { min-width:0; overflow-wrap:anywhere; }
.es-copy { max-width:100%; }
.es-copy:active { background:var(--surface-hover); }
.es-qty-n { white-space:nowrap; }
.es-downloads { padding:1rem 1.5rem; }
@media print {
  .sales-entry .topbar, .sales-entry .flash-container, .sales-entry .es-downloads, .sales-entry .es-finish, .sales-entry .es-tick-save { display:none !important; }
  .sales-entry .main-content { max-width:none; }
  /* Keep the printed tick cell despite the shared rule that hides forms. */
  .sales-entry .es-tick-form { display:flex !important; }
  .sales-entry .es-colhead { grid-template-columns:2rem minmax(0,1.6fr) minmax(0,1.2fr) 4rem minmax(7rem,.9fr) 0; }
  .sales-entry .es-section-head { break-after:avoid; }
  .sales-entry .es-pname { overflow:visible; white-space:normal; }
  .sales-entry .es-row.is-ticked .es-name, .sales-entry .es-row.is-ticked .es-qty-n, .sales-entry .es-row.is-ticked .es-amount, .sales-entry .es-row.is-ticked .es-plu-code { color:#000; }
}
.es-clipboard { position:fixed; top:0; left:0; width:1px; height:1px; opacity:0; }
