/* ==========================================================================
   Smart Cleaner — Design System  v3
   --------------------------------------------------------------------------
   One stylesheet for the whole product. Mobile-first for the counter and the
   workshop floor, then widened for the back office. Every surface, every
   control and every state is defined once here.

   Contents
     01  Tokens (colour, type, space, elevation)
     02  Reset & base
     03  App shell (sidebar, topbar, mobile tab bar)
     04  Typography & utilities
     05  Cards & surfaces
     06  Buttons
     07  Forms
     08  Tables
     09  Badges, pills & status
     10  Stat tiles & metrics
     11  Modals, drawers & popovers
     12  Toasts & progress
     13  Tabs & segmented controls
     14  Workshop board
     15  Point of sale
     16  Lists, empty states & skeletons
     17  Charts
     18  Public site & auth
     19  Receipts & tags
     20  Print
     21  Motion & accessibility
   ========================================================================== */

/* ==========================================================================
   01 · TOKENS
   ========================================================================== */
:root {
  /* --------------------------------------------------------------------
     Brand — sampled from the Smart Cleaner hanger logo:
       amber #F5A407 → #E8850B → #CE6A03  on charcoal #2F3335.
     The accent stays overridable at runtime from Settings → Appearance.
     -------------------------------------------------------------------- */
  --brand-amber:    #F5A407;
  --brand-orange:   #E8850B;
  --brand-deep:     #CE6A03;
  --brand-gold:     #E09206;
  --brand-charcoal: #2F3335;
  --brand-ink:      #1A1D1F;
  --accent-grad:    linear-gradient(135deg, #F7AE1A 0%, #E8850B 52%, #CE6A03 100%);

  --accent:          #E8850B;
  --accent-600:      #D9780A;
  --accent-500:      #F5A407;
  --accent-400:      #FFB833;
  --accent-soft:     rgba(232, 133, 11, 0.12);
  --accent-softer:   rgba(232, 133, 11, 0.06);
  --accent-contrast: #1A1206;
  --accent-ring:     rgba(232, 133, 11, 0.30);

  /* Semantic */
  --good:          #0F8A4D;
  --good-soft:     rgba(15, 138, 77, 0.12);
  --warn:          #B9700A;
  --warn-soft:     rgba(185, 112, 10, 0.14);
  --danger:        #CF2E2E;
  --danger-soft:   rgba(207, 46, 46, 0.12);
  --info:          #2563EB;
  --info-soft:     rgba(37, 99, 235, 0.12);
  --progress:      #7C3AED;
  --progress-soft: rgba(124, 58, 237, 0.12);

  /* Neutral ramp — light theme */
  --bg:            #F4F5F7;
  --bg-sunken:     #EBEDF0;
  --surface:       #FFFFFF;
  --surface-2:     #FAFBFC;
  --surface-3:     #F1F3F5;
  --border:        #E3E6EA;
  --border-strong: #C8CDD3;
  --text:          #1A1D21;
  --text-muted:    #5C636D;
  --text-faint:    #878F9A;
  --overlay:       rgba(20, 23, 28, 0.55);
  --glass:         rgba(255, 255, 255, 0.78);
  --rail:          #FFFFFF;
  --rail-text:     #1A1D21;

  /* Type */
  --font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono",
               Menlo, Consolas, monospace;

  --fs-xs:   0.6875rem;  /* 11 */
  --fs-sm:   0.8125rem;  /* 13 */
  --fs-base: 0.875rem;   /* 14 */
  --fs-md:   0.9375rem;  /* 15 */
  --fs-lg:   1.0625rem;  /* 17 */
  --fs-xl:   1.3125rem;  /* 21 */
  --fs-2xl:  1.625rem;   /* 26 */
  --fs-3xl:  2.125rem;   /* 34 */

  /* Space */
  --s-1:  0.25rem;
  --s-2:  0.5rem;
  --s-3:  0.75rem;
  --s-4:  1rem;
  --s-5:  1.25rem;
  --s-6:  1.5rem;
  --s-8:  2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;

  /* Shape */
  --r-sm:   10px;
  --r:      14px;
  --r-lg:   18px;
  --r-xl:   26px;
  --r-full: 999px;

  /* Elevation — layered so cards lift rather than smudge */
  --sh-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --sh:    0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --sh-md: 0 10px 24px -6px rgba(16, 24, 40, 0.12), 0 4px 8px -4px rgba(16, 24, 40, 0.06);
  --sh-lg: 0 28px 56px -12px rgba(16, 24, 40, 0.22), 0 8px 20px -8px rgba(16, 24, 40, 0.10);

  /* Layout */
  --sidebar-w:           268px;
  --sidebar-collapsed-w: 78px;
  --topbar-h:            64px;
  --tabbar-h:            64px;
  --page-max:            1680px;

  --speed: 180ms;
  --ease:  cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);

  color-scheme: light;
}

/* ----- Dark theme values, shared by the media query and the manual switch -- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #16191C;
    --bg-sunken:     #101214;
    --surface:       #1E2226;
    --surface-2:     #252A2F;
    --surface-3:     #2D333A;
    --border:        #333940;
    --border-strong: #4A525A;
    --text:          #F2F4F6;
    --text-muted:    #A3ACB6;
    --text-faint:    #79828C;
    --overlay:       rgba(6, 8, 10, 0.74);
    --glass:         rgba(30, 34, 38, 0.78);
    --rail:          #14171A;
    --rail-text:     #F2F4F6;

    --accent:          #F5A407;
    --accent-600:      #E8850B;
    --accent-500:      #FFB01F;
    --accent-400:      #FFC352;
    --accent-contrast: #1A1206;
    --accent-soft:     rgba(245, 164, 7, 0.16);
    --accent-softer:   rgba(245, 164, 7, 0.08);
    --accent-ring:     rgba(245, 164, 7, 0.34);

    --good:          #2DBE78;
    --good-soft:     rgba(45, 190, 120, 0.16);
    --warn:          #F5A407;
    --warn-soft:     rgba(245, 164, 7, 0.16);
    --danger:        #F47171;
    --danger-soft:   rgba(244, 113, 113, 0.16);
    --info:          #60A5FA;
    --info-soft:     rgba(96, 165, 250, 0.16);
    --progress:      #A78BFA;
    --progress-soft: rgba(167, 139, 250, 0.16);

    --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.34);
    --sh:    0 2px 6px rgba(0, 0, 0, 0.38);
    --sh-md: 0 12px 28px -8px rgba(0, 0, 0, 0.55);
    --sh-lg: 0 30px 64px -16px rgba(0, 0, 0, 0.70);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg:            #16191C;
  --bg-sunken:     #101214;
  --surface:       #1E2226;
  --surface-2:     #252A2F;
  --surface-3:     #2D333A;
  --border:        #333940;
  --border-strong: #4A525A;
  --text:          #F2F4F6;
  --text-muted:    #A3ACB6;
  --text-faint:    #79828C;
  --overlay:       rgba(6, 8, 10, 0.74);
  --glass:         rgba(30, 34, 38, 0.78);
  --rail:          #14171A;
  --rail-text:     #F2F4F6;

  --accent:          #F5A407;
  --accent-600:      #E8850B;
  --accent-500:      #FFB01F;
  --accent-400:      #FFC352;
  --accent-contrast: #1A1206;
  --accent-soft:     rgba(245, 164, 7, 0.16);
  --accent-softer:   rgba(245, 164, 7, 0.08);
  --accent-ring:     rgba(245, 164, 7, 0.34);

  --good:          #2DBE78;
  --good-soft:     rgba(45, 190, 120, 0.16);
  --warn:          #F5A407;
  --warn-soft:     rgba(245, 164, 7, 0.16);
  --danger:        #F47171;
  --danger-soft:   rgba(244, 113, 113, 0.16);
  --info:          #60A5FA;
  --info-soft:     rgba(96, 165, 250, 0.16);
  --progress:      #A78BFA;
  --progress-soft: rgba(167, 139, 250, 0.16);

  --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.34);
  --sh:    0 2px 6px rgba(0, 0, 0, 0.38);
  --sh-md: 0 12px 28px -8px rgba(0, 0, 0, 0.55);
  --sh-lg: 0 30px 64px -16px rgba(0, 0, 0, 0.70);

  color-scheme: dark;
}

/* Compact density — Settings → Appearance */
:root[data-density="compact"] {
  --fs-base: 0.8125rem;
  --s-4: 0.75rem;
  --s-5: 1rem;
  --s-6: 1.125rem;
  --topbar-h: 56px;
  --r: 12px;
  --r-lg: 15px;
}

/* ==========================================================================
   02 · RESET & BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  font-weight: 450;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02", "cv03", "cv04";
  overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.018em;
  color: var(--text);
}
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
h4, h5, h6 { font-size: var(--fs-base); }

p { margin: 0 0 var(--s-3); }
p:last-child { margin-bottom: 0; }

a { color: var(--accent-600); text-decoration: none; transition: color var(--speed) var(--ease); }
a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

img, svg, video, canvas { max-width: 100%; height: auto; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-5) 0; }

::placeholder { color: var(--text-faint); opacity: 1; }

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

::selection { background: var(--accent-soft); color: var(--text); }

/* Scrollbars — thin and unobtrusive, visible enough to grab */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0;
  z-index: 100;
  padding: var(--s-3) var(--s-5);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
  border-radius: 0 0 var(--r) 0;
}
.skip-link:focus { inset-inline-start: 0; }

/* ==========================================================================
   03 · APP SHELL
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100dvh;
}

@media (min-width: 1024px) {
  .app { grid-template-columns: var(--sidebar-w) 1fr; }
  .app.is-collapsed { grid-template-columns: var(--sidebar-collapsed-w) 1fr; }
}

/* ----------------------------- Sidebar ---------------------------------- */
.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 60;
  width: min(86vw, 300px);
  display: flex;
  flex-direction: column;
  background: var(--rail);
  border-inline-end: 1px solid var(--border);
  transform: translateX(-102%);
  transition: transform 260ms var(--ease), width var(--speed) var(--ease);
  will-change: transform;
}
[dir="rtl"] .sidebar { transform: translateX(102%); }
.sidebar.is-open { transform: translateX(0); box-shadow: var(--sh-lg); }

@media (min-width: 1024px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    width: auto;
    transform: none;
    box-shadow: none;
  }
}

.sidebar__backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms var(--ease), visibility 220ms;
}
.sidebar__backdrop.is-open { opacity: 1; visibility: visible; }
@media (min-width: 1024px) { .sidebar__backdrop { display: none; } }

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-4);
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar__logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}
.sidebar__name {
  font-weight: 750;
  font-size: var(--fs-md);
  letter-spacing: -0.02em;
  color: var(--rail-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__tagline {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s-4) var(--s-3) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section {
  font-size: var(--fs-xs);
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: var(--s-5) var(--s-3) var(--s-2);
}
.sidebar__nav > .nav-section:first-child { padding-top: var(--s-1); }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-3);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-weight: 550;
  font-size: var(--fs-base);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.nav-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-item:active { transform: scale(0.985); }

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-600);
  font-weight: 700;
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(var(--s-3) * -1 + 2px);
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: var(--r-full);
  background: var(--accent);
}

.nav-item__icon {
  width: 24px;
  font-size: 16px;
  line-height: 1;
  text-align: center;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
}
.nav-item__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item__count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: var(--fs-xs);
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.nav-item.is-active .nav-item__count { background: var(--accent-600); }

.sidebar__footer {
  padding: var(--s-3);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.user-chip {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  text-align: start;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.user-chip:hover { background: var(--surface-3); border-color: var(--border); }
.user-chip__meta { min-width: 0; flex: 1; display: block; }
.user-chip__name {
  display: block;
  font-weight: 650;
  font-size: var(--fs-base);
  color: var(--rail-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip__role {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Collapsed rail — icons only, labels revealed on hover as a tooltip */
@media (min-width: 1024px) {
  .app.is-collapsed .sidebar__name,
  .app.is-collapsed .sidebar__tagline,
  .app.is-collapsed .nav-item__label,
  .app.is-collapsed .nav-section,
  .app.is-collapsed .user-chip__meta { display: none; }

  .app.is-collapsed .sidebar__brand { justify-content: center; padding-inline: var(--s-2); }
  .app.is-collapsed .nav-item { justify-content: center; padding-inline: 0; }
  .app.is-collapsed .nav-item.is-active::before { display: none; }
  .app.is-collapsed .user-chip { justify-content: center; }
  .app.is-collapsed .nav-item__count {
    position: absolute;
    top: 2px;
    inset-inline-end: 6px;
    min-width: 16px;
    height: 16px;
    font-size: 9px;
    padding: 0 4px;
  }
  .app.is-collapsed .nav-item::after {
    content: attr(data-tip);
    position: absolute;
    inset-inline-start: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) scale(0.96);
    background: var(--brand-ink);
    color: #fff;
    padding: 5px 10px;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--speed) var(--ease), transform var(--speed) var(--ease);
    z-index: 70;
    box-shadow: var(--sh-md);
  }
  .app.is-collapsed .nav-item:hover::after { opacity: 1; transform: translateY(-50%) scale(1); }
}

/* ------------------------------- Main ------------------------------------ */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--topbar-h);
  padding: var(--s-2) var(--s-4);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 768px) { .topbar { padding-inline: var(--s-6); } }

.topbar__title { min-width: 0; flex: 1; }
.topbar__title h1 {
  font-size: var(--fs-lg);
  font-weight: 750;
  letter-spacing: -0.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 768px) { .topbar__title h1 { font-size: var(--fs-xl); } }
.topbar__subtitle {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
}

.page {
  flex: 1;
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding: var(--s-5) var(--s-4);
  padding-bottom: calc(var(--tabbar-h) + var(--s-8) + env(safe-area-inset-bottom));
}
@media (min-width: 768px) { .page { padding: var(--s-6); } }
@media (min-width: 1024px) { .page { padding: var(--s-6) var(--s-8) var(--s-10); } }

/* --------------------------- Mobile tab bar ------------------------------ */
.tabbar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 45;
  display: flex;
  align-items: stretch;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--border);
}
@media (min-width: 1024px) { .tabbar { display: none; } }

.tabbar__item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  font-size: 10px;
  font-weight: 650;
  color: var(--text-faint);
  text-decoration: none;
  text-align: center;
  transition: color var(--speed) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.tabbar__item:hover { text-decoration: none; color: var(--text-muted); }
.tabbar__item.is-active { color: var(--accent-600); }
.tabbar__item.is-active::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline: 22%;
  height: 3px;
  border-radius: 0 0 var(--r-full) var(--r-full);
  background: var(--accent);
}
.tabbar__icon { font-size: 19px; line-height: 1; }
.tabbar__item .nav-item__count {
  position: absolute;
  top: 4px;
  inset-inline-end: 22%;
  min-width: 16px;
  height: 16px;
  font-size: 9px;
  padding: 0 4px;
}

/* Floating action button — the counter's "new order" shortcut */
.fab {
  position: fixed;
  inset-inline-end: var(--s-4);
  bottom: calc(var(--tabbar-h) + var(--s-4) + env(safe-area-inset-bottom));
  z-index: 44;
  width: 56px;
  height: 56px;
  border-radius: var(--r-full);
  border: 0;
  display: grid;
  place-items: center;
  font-size: 24px;
  color: var(--accent-contrast);
  background: var(--accent-grad);
  box-shadow: 0 10px 26px -6px rgba(232, 133, 11, 0.55), var(--sh-md);
  transition: transform var(--speed) var(--ease-spring), box-shadow var(--speed) var(--ease);
  text-decoration: none;
}
.fab:hover { transform: scale(1.06); text-decoration: none; color: var(--accent-contrast); }
.fab:active { transform: scale(0.95); }
@media (min-width: 1024px) { .fab { display: none; } }

/* Icon button — the small square controls in the topbar */
.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  text-decoration: none;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease),
              border-color var(--speed) var(--ease), transform var(--speed) var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--text);
  text-decoration: none;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn__dot {
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--r-full);
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
  font-variant-numeric: tabular-nums;
}

/* Offline ribbon */
.offline-bar {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 90;
  padding: 7px var(--s-4);
  background: var(--brand-ink);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 650;
  text-align: center;
  transform: translateY(-100%);
  transition: transform 260ms var(--ease);
}
.offline-bar.is-visible { transform: translateY(0); }

/* ==========================================================================
   04 · TYPOGRAPHY & UTILITIES
   ========================================================================== */
.t-xs { font-size: var(--fs-xs); }
.t-sm { font-size: var(--fs-sm); }
.t-lg { font-size: var(--fs-lg); }
.t-xl { font-size: var(--fs-xl); }

.muted  { color: var(--text-muted); }
.faint  { color: var(--text-faint); }
.strong { font-weight: 700; color: var(--text); }
.mono   { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: -0.01em; }
.num    { font-variant-numeric: tabular-nums; }

.tone-good   { color: var(--good); }
.tone-warn   { color: var(--warn); }
.tone-danger { color: var(--danger); }

.truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-center { text-align: center; }
.text-end, .ta-right { text-align: end; }

.mb-0 { margin-bottom: 0 !important; }

.hide { display: none !important; }
@media (max-width: 1023px) { .hide-sm { display: none !important; } }
@media (min-width: 1024px) { .only-sm { display: none !important; } }
@media (max-width: 639px)  { .hide-xs { display: none !important; } }

.grow   { flex: 1; min-width: 0; }
.spacer { flex: 1; }

/* Flow rows and stacks — the two layout primitives used everywhere */
.row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}
.row--tight   { gap: var(--s-2); }
.row--wrap    { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end     { justify-content: flex-end; }

.stack { display: flex; flex-direction: column; gap: var(--s-4); }

.grid { display: grid; gap: var(--s-4); }
.grid--2 { grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid--2 { grid-template-columns: 1fr 1fr; } }

.col { min-width: 0; }

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-5);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: var(--s-4) 0;
  border: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--accent-soft);
  color: var(--accent-600);
  font-weight: 750;
  font-size: var(--fs-sm);
  letter-spacing: -0.02em;
  line-height: 1;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 30px; height: 30px; font-size: var(--fs-xs); }
.avatar--lg { width: 56px; height: 56px; font-size: var(--fs-lg); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--text-faint);
  display: inline-block;
  flex-shrink: 0;
}
.dot--live {
  background: var(--good);
  box-shadow: 0 0 0 0 var(--good-soft);
  animation: pulse-dot 2s var(--ease) infinite;
}
@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0 rgba(15, 138, 77, 0.45); }
  70%  { box-shadow: 0 0 0 8px rgba(15, 138, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(15, 138, 77, 0); }
}

.pulse { animation: soft-pulse 1.8s var(--ease) infinite; }
@keyframes soft-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.req { color: var(--danger); font-weight: 700; }

/* ==========================================================================
   05 · CARDS & SURFACES
   ========================================================================== */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  overflow: hidden;
  transition: box-shadow var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.card--flat { box-shadow: none; background: var(--surface-2); }

.card__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.card__head h2,
.card__head h3 {
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
}
.card__body { padding: var(--s-5); }
.card__body > :last-child { margin-bottom: 0; }

.panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--s-4);
}

.sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--sh);
}

/* ==========================================================================
   06 · BUTTONS
   ========================================================================== */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 40px;
  padding: 0 var(--s-4);
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-base);
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: var(--sh-sm);
  transition: transform 120ms var(--ease), box-shadow var(--speed) var(--ease),
              background var(--speed) var(--ease), border-color var(--speed) var(--ease),
              opacity var(--speed) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; box-shadow: var(--sh-md); transform: translateY(-1px); color: var(--btn-fg); }
.btn:active { transform: translateY(0) scale(0.985); box-shadow: var(--sh-sm); }
.btn:disabled,
.btn.is-disabled {
  opacity: 0.5;
  pointer-events: none;
  box-shadow: none;
  transform: none;
}

.btn--primary {
  --btn-bg: var(--accent-grad);
  --btn-fg: var(--accent-contrast);
  --btn-bd: transparent;
  box-shadow: 0 2px 10px -2px var(--accent-ring);
  font-weight: 700;
}
.btn--primary:hover { box-shadow: 0 8px 22px -6px var(--accent-ring); filter: brightness(1.04); }

.btn--good   { --btn-bg: var(--good);   --btn-fg: #fff; --btn-bd: transparent; }
.btn--danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: transparent; }
.btn--warn   { --btn-bg: var(--warn);   --btn-fg: #fff; --btn-bd: transparent; }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text-muted);
  --btn-bd: transparent;
  box-shadow: none;
}
.btn--ghost:hover {
  --btn-bg: var(--surface-3);
  --btn-fg: var(--text);
  box-shadow: none;
  transform: none;
}

.btn--soft {
  --btn-bg: var(--accent-soft);
  --btn-fg: var(--accent-600);
  --btn-bd: transparent;
  box-shadow: none;
}
.btn--soft:hover { --btn-bg: var(--accent-softer); box-shadow: none; }

.btn--sm { min-height: 32px; padding: 0 var(--s-3); font-size: var(--fs-sm); border-radius: 8px; }
.btn--lg { min-height: 48px; padding: 0 var(--s-6); font-size: var(--fs-md); border-radius: var(--r); }
.btn--xl { min-height: 56px; padding: 0 var(--s-8); font-size: var(--fs-lg); border-radius: var(--r); font-weight: 700; }

.btn--block { display: flex; width: 100%; }
.btn--icon  { width: 40px; padding: 0; flex-shrink: 0; }
.btn--icon.btn--sm { width: 32px; }

/* Loading state — the label is swapped for a spinner by app.js */
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--btn-fg);
  animation: spin 620ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 620ms linear infinite;
  flex-shrink: 0;
}

/* Pill — language switch, filter chips */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transition: all var(--speed) var(--ease);
}
.pill:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.pill.is-active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-600);
  font-weight: 700;
}

/* ==========================================================================
   07 · FORMS
   ========================================================================== */
.field { margin-bottom: var(--s-4); }
.field:last-child { margin-bottom: 0; }

.label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--text);
}
.label__hint { font-weight: 500; color: var(--text-faint); margin-inline-start: 4px; }

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px var(--s-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: 1.45;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease),
              background var(--speed) var(--ease);
  appearance: none;
  -webkit-appearance: none;
}
.textarea { min-height: 96px; resize: vertical; padding-block: var(--s-3); }

.input:hover:not(:disabled),
.select:hover:not(:disabled),
.textarea:hover:not(:disabled) { border-color: var(--text-faint); }

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

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--surface-3);
  color: var(--text-faint);
  cursor: not-allowed;
}

.input[readonly] { background: var(--surface-3); }

.select {
  padding-inline-end: var(--s-8);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23878F9A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-3) center;
  background-size: 12px 8px;
}
[dir="rtl"] .select { background-position: left var(--s-3) center; }

/* Invalid states set by the front-end validator */
.input--invalid,
.select--invalid,
.textarea--invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.field__error {
  margin-top: 5px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--danger);
}
.field__help,
.hint {
  margin-top: 5px;
  font-size: var(--fs-sm);
  color: var(--text-faint);
}

/* Input with a trailing unit — "kWh", "RWF" */
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .input { padding-inline-end: 3.4rem; }
.input-affix__text {
  position: absolute;
  inset-inline-end: var(--s-3);
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--text-faint);
  pointer-events: none;
}

/* Search box */
.search { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }
.search .input { padding-inline-start: 2.4rem; }
.search__icon {
  position: absolute;
  inset-inline-start: var(--s-3);
  font-size: 14px;
  color: var(--text-faint);
  pointer-events: none;
  line-height: 1;
}

/* Password reveal */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-inline-end: 2.8rem; }
.pw-toggle {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--text-faint);
  padding: 6px 8px;
  font-size: 15px;
  border-radius: 8px;
  line-height: 1;
  transition: background var(--speed) var(--ease);
}
.pw-toggle:hover { background: var(--surface-3); }

/* Checkbox / radio row */
.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease);
}
.check:hover { border-color: var(--border-strong); background: var(--surface-2); }
.check input[type="checkbox"],
.check input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}
.check__text { font-weight: 600; display: block; }
.check__sub { font-size: var(--fs-sm); color: var(--text-muted); display: block; margin-top: 2px; }

/* Switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: var(--r-full);
  background: var(--border-strong);
  flex-shrink: 0;
  transition: background var(--speed) var(--ease);
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--sh-sm);
  transition: transform 220ms var(--ease-spring);
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
[dir="rtl"] .switch input:checked + .switch__track::after { transform: translateX(-18px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px var(--accent-ring); }
.switch input:disabled + .switch__track { opacity: 0.45; cursor: not-allowed; }

/* Option cards — the picker used for roles, methods, presets */
.option-grid {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--s-4) var(--s-3);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: all var(--speed) var(--ease);
}
.option:hover { border-color: var(--accent-400); transform: translateY(-2px); box-shadow: var(--sh-md); }
.option input { position: absolute; opacity: 0; width: 0; height: 0; }
.option.is-selected,
.option:has(input:checked),
.option.is-active {
  border-color: var(--accent);
  background: var(--accent-softer);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.option__icon  { font-size: 22px; line-height: 1; }
.option__label { font-size: var(--fs-sm); font-weight: 650; }

/* Quantity stepper */
.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
}
.qty__btn {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.qty__btn:hover { background: var(--surface-3); color: var(--accent-600); }
.qty__btn:disabled { opacity: 0.35; pointer-events: none; }
.qty__value {
  min-width: 38px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border-inline: 1px solid var(--border);
  align-self: stretch;
  display: grid;
  place-items: center;
}

.settings-form { max-width: 620px; }

/* ==========================================================================
   08 · TABLES
   ========================================================================== */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-lg);
}
.card .table-wrap { border-radius: 0; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}
.table th,
.table td {
  padding: var(--s-3) var(--s-4);
  text-align: start;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th {
  font-size: var(--fs-xs);
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table tbody tr { transition: background var(--speed) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table--compact th,
.table--compact td { padding: var(--s-2) var(--s-3); }

.table td.num,
.table th.num { text-align: end; font-variant-numeric: tabular-nums; }
.table tbody tr.is-selected { background: var(--accent-softer); }
.table tfoot td {
  font-weight: 750;
  background: var(--surface-2);
  border-top: 2px solid var(--border);
}

.cell-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  white-space: nowrap;
}

/* Responsive tables collapse into labelled cards on a phone */
@media (max-width: 767px) {
  .table--responsive thead { display: none; }
  .table--responsive tbody tr {
    display: block;
    padding: var(--s-3) var(--s-4);
    border-bottom: 1px solid var(--border);
  }
  .table--responsive tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-4);
    padding: 4px 0;
    border: 0;
    text-align: end;
  }
  .table--responsive tbody td::before {
    content: attr(data-label);
    font-size: var(--fs-xs);
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-faint);
    text-align: start;
    flex-shrink: 0;
  }
  .table--responsive .cell-actions { justify-content: flex-end; }
}

/* Pagination */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.pager__pages { display: flex; align-items: center; gap: 4px; }
.pager__page {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 650;
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: all var(--speed) var(--ease);
}
.pager__page:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.pager__page.is-active {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-contrast);
  font-weight: 750;
}
.pager__page.is-disabled { opacity: 0.4; pointer-events: none; }

/* ==========================================================================
   09 · BADGES, PILLS & STATUS
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
  letter-spacing: 0.012em;
}
.badge--good     { background: var(--good-soft);     color: var(--good); }
.badge--warn     { background: var(--warn-soft);     color: var(--warn); }
.badge--danger,
.badge--bad      { background: var(--danger-soft);   color: var(--danger); }
.badge--info     { background: var(--info-soft);     color: var(--info); }
.badge--progress { background: var(--progress-soft); color: var(--progress); }
.badge--ready    { background: var(--accent-soft);   color: var(--accent-600); }
.badge--muted    { background: var(--surface-3);     color: var(--text-faint); }
.badge--solid    { background: var(--accent);        color: var(--accent-contrast); }
.badge--plain    { background: transparent; border: 1px solid var(--border); }
.badge--lg       { padding: 5px var(--s-3); font-size: var(--fs-sm); }

/* Status dot inside a badge */
.badge::before { content: none; }

/* ==========================================================================
   10 · STAT TILES & METRICS
   ========================================================================== */
.stats {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: var(--s-5);
}
@media (min-width: 768px) {
  .stats { gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); }
}

.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4);
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh);
  overflow: hidden;
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.stat::after {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 3px;
  background: var(--border);
  opacity: 0;
  transition: opacity var(--speed) var(--ease);
}
.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
  text-decoration: none;
  color: var(--text);
}
.stat:hover::after { opacity: 1; }
a.stat:hover .stat__value { color: var(--accent-600); }

/* A toned tile keeps its colour bar; a neutral one only lifts one on hover. */
.stat--good::after,
.stat--warn::after,
.stat--danger::after,
.stat--info::after { opacity: 1; }
@media (min-width: 768px) { .stat { padding: var(--s-5); } }

.stat__head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.stat__icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}
.stat__label {
  font-size: var(--fs-xs);
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat__value {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
@media (min-width: 768px) { .stat__value { font-size: var(--fs-2xl); } }
.stat__value--sm { font-size: var(--fs-lg); }
@media (min-width: 768px) { .stat__value--sm { font-size: var(--fs-xl); } }
.stat__meta {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  min-width: 0;
}

/* Toned variants — the tile picks up the meaning of its number */
.stat--brand {
  background: var(--accent-grad);
  border-color: transparent;
  color: var(--accent-contrast);
  box-shadow: 0 10px 26px -10px var(--accent-ring), var(--sh);
}
.stat--brand .stat__label { color: rgba(26, 18, 6, 0.72); }
.stat--brand .stat__value { color: var(--accent-contrast); }
.stat--brand .stat__meta  { color: rgba(26, 18, 6, 0.72); }
.stat--brand .stat__icon  { background: rgba(255, 255, 255, 0.28); color: var(--accent-contrast); }

.stat--good   .stat__icon { background: var(--good-soft);   color: var(--good); }
.stat--good::after        { background: var(--good); }
.stat--warn   .stat__icon { background: var(--warn-soft);   color: var(--warn); }
.stat--warn::after        { background: var(--warn); }
.stat--danger .stat__icon { background: var(--danger-soft); color: var(--danger); }
.stat--danger::after      { background: var(--danger); }
.stat--info   .stat__icon { background: var(--info-soft);   color: var(--info); }
.stat--info::after        { background: var(--info); }

/* Tile — the richer card used for products, machines, services */
.tile {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease),
              border-color var(--speed) var(--ease);
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--border-strong); }
.tile__thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-600);
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}
.tile__thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile__body  { flex: 1; min-width: 0; }
.tile__title { font-weight: 700; letter-spacing: -0.012em; }
.tile__meta  { font-size: var(--fs-sm); color: var(--text-muted); }
.tile__tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.tile__check { flex-shrink: 0; }

/* Meter — a single proportion */
.meter {
  height: 7px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  overflow: hidden;
}
.meter__fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--accent);
  transition: width 420ms var(--ease);
}
.meter__fill--good   { background: var(--good); }
.meter__fill--warn   { background: var(--warn); }
.meter__fill--danger { background: var(--danger); }

/* Horizontal bar list — "busiest people", "top services" */
.hbar { display: flex; flex-direction: column; gap: var(--s-3); }
.hbar__row { display: grid; grid-template-columns: minmax(80px, 1fr) 2fr auto; gap: var(--s-3); align-items: center; }
.hbar__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hbar__track { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.hbar__fill  { height: 100%; border-radius: var(--r-full); background: var(--accent-grad); transition: width 420ms var(--ease); }
.hbar__value {
  font-size: var(--fs-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  min-width: 2.5rem;
  text-align: end;
}

/* ==========================================================================
   11 · MODALS, MENUS & ALERTS
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal.is-open { display: flex; }
@media (min-width: 640px) { .modal { align-items: center; padding: var(--s-5); } }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  animation: fade-in 200ms var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--sh-lg);
  overflow: hidden;
  animation: sheet-up 280ms var(--ease);
}
@media (min-width: 640px) {
  .modal__panel { border-radius: var(--r-lg); max-height: 88dvh; animation: pop-in 220ms var(--ease-spring); }
}
@keyframes sheet-up { from { transform: translateY(14%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pop-in   { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal__panel--sm { max-width: 420px; }
.modal__panel--lg { max-width: 880px; }

.modal__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal__head h2,
.modal__head h3 { font-size: var(--fs-md); font-weight: 700; margin: 0; }

.modal__body {
  padding: var(--s-5);
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
}
.modal__foot {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
  flex-wrap: wrap;
  padding-bottom: calc(var(--s-4) + env(safe-area-inset-bottom));
}
@media (min-width: 640px) { .modal__foot { padding-bottom: var(--s-4); } }

/* Dropdown menu */
.dropdown { position: relative; }

.menu {
  position: absolute;
  z-index: 70;
  min-width: 200px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-lg);
  display: none;
  inset-inline-end: 0;
  top: calc(100% + 6px);
}
.menu.is-open { display: block; animation: pop-in 160ms var(--ease); }

.menu__label {
  padding: 6px var(--s-3) 4px;
  font-size: var(--fs-xs);
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.menu__item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: 9px var(--s-3);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 550;
  text-align: start;
  text-decoration: none;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.menu__item:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.menu__item--danger { color: var(--danger); }
.menu__item--danger:hover { background: var(--danger-soft); color: var(--danger); }
.menu__sep { height: 1px; background: var(--border); margin: 5px 0; }

/* Alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--text-faint);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--fs-base);
}
.alert__icon { font-size: 16px; line-height: 1.4; flex-shrink: 0; }
.alert__title { font-weight: 700; display: block; margin-bottom: 2px; }
.alert__body { flex: 1; min-width: 0; }

.alert--good   { background: var(--good-soft);   border-color: transparent; border-inline-start-color: var(--good);   color: var(--good); }
.alert--warn   { background: var(--warn-soft);   border-color: transparent; border-inline-start-color: var(--warn);   color: var(--warn); }
.alert--danger { background: var(--danger-soft); border-color: transparent; border-inline-start-color: var(--danger); color: var(--danger); }
.alert--info   { background: var(--info-soft);   border-color: transparent; border-inline-start-color: var(--info);   color: var(--info); }
.alert--good .alert__body,
.alert--warn .alert__body,
.alert--danger .alert__body,
.alert--info .alert__body { color: inherit; }

/* ==========================================================================
   12 · TOASTS & PROGRESS
   ========================================================================== */
.toasts {
  position: fixed;
  z-index: 95;
  inset-inline-end: var(--s-4);
  bottom: calc(var(--tabbar-h) + var(--s-4) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  pointer-events: none;
  max-width: min(92vw, 400px);
}
@media (min-width: 1024px) { .toasts { bottom: var(--s-5); } }

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--sh-lg);
  pointer-events: auto;
  animation: toast-in 260ms var(--ease-spring);
  font-size: var(--fs-base);
}
@keyframes toast-in { from { transform: translateY(14px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.is-leaving { animation: toast-out 200ms var(--ease) forwards; }
@keyframes toast-out { to { transform: translateY(8px) scale(0.97); opacity: 0; } }

.toast__icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  background: var(--info-soft);
  color: var(--info);
}
.toast__msg { flex: 1; min-width: 0; }
.toast__close {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: 17px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
}
.toast__close:hover { color: var(--text); }

.toast--good   .toast__icon { background: var(--good-soft);   color: var(--good); }
.toast--warn   .toast__icon { background: var(--warn-soft);   color: var(--warn); }
.toast--danger .toast__icon { background: var(--danger-soft); color: var(--danger); }

.nprogress {
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  z-index: 99;
  height: 3px;
  width: 0;
  background: var(--accent-grad);
  box-shadow: 0 0 10px var(--accent-ring);
  transition: width 260ms var(--ease), opacity 320ms var(--ease);
}

/* ==========================================================================
   13 · TABS & SEGMENTED CONTROLS
   ========================================================================== */
.tabs {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s-5);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--fs-base);
  font-weight: 650;
  white-space: nowrap;
  text-decoration: none;
  transition: color var(--speed) var(--ease);
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--accent-600); }
.tab.is-active::after {
  content: "";
  position: absolute;
  inset-inline: var(--s-3);
  bottom: -1px;
  height: 2.5px;
  border-radius: var(--r-full) var(--r-full) 0 0;
  background: var(--accent);
}
.tab__count {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 750;
  display: inline-grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.tab.is-active .tab__count { background: var(--accent-soft); color: var(--accent-600); }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fade-in 220ms var(--ease); }

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-3);
  gap: 2px;
}
.segmented__btn {
  padding: 6px var(--s-3);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 650;
  white-space: nowrap;
  text-decoration: none;
  transition: all var(--speed) var(--ease);
}
.segmented__btn:hover { color: var(--text); text-decoration: none; }
.segmented__btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--sh-sm);
}

/* ==========================================================================
   14 · WORKSHOP BOARD
   ========================================================================== */
.board {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 768px)  { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .board { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.board__col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.board__head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  border-top: 3px solid var(--border-strong);
}
.board__col:nth-child(1) .board__head { border-top-color: var(--text-faint); }
.board__col:nth-child(2) .board__head { border-top-color: var(--info); }
.board__col:nth-child(3) .board__head { border-top-color: var(--accent); }
.board__col:nth-child(4) .board__head { border-top-color: var(--good); }

.board__title {
  font-size: var(--fs-base);
  font-weight: 750;
  letter-spacing: -0.012em;
  flex: 1;
  min-width: 0;
}
.board__count {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 800;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.board__body {
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-height: 120px;
  max-height: min(70vh, 760px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Selection bar that rises when garments are ticked */
.selbar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 46;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  padding: var(--s-3) var(--s-5);
  padding-bottom: calc(var(--s-3) + env(safe-area-inset-bottom));
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 30px -10px rgba(16, 24, 40, 0.18);
  transform: translateY(115%);
  transition: transform 260ms var(--ease);
}
.selbar.is-open { transform: none; }
@media (max-width: 1023px) { .selbar { bottom: var(--tabbar-h); } }

/* ==========================================================================
   15 · POINT OF SALE
   ========================================================================== */
.pos {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 1100px) { .pos { grid-template-columns: 1fr 380px; } }

.pos__menu {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}

.pos-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: var(--s-4);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  text-align: start;
  cursor: pointer;
  transition: all var(--speed) var(--ease);
  min-height: 104px;
  justify-content: space-between;
}
.pos-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}
.pos-item:active { transform: translateY(0) scale(0.98); }
.pos-item.is-selected { border-color: var(--accent); background: var(--accent-softer); }
.pos-item__icon  { font-size: 24px; line-height: 1; }
.pos-item__name  { font-weight: 650; font-size: var(--fs-sm); line-height: 1.35; }
.pos-item__price {
  font-weight: 800;
  font-size: var(--fs-base);
  color: var(--accent-600);
  font-variant-numeric: tabular-nums;
}

.cart {
  position: sticky;
  top: calc(var(--topbar-h) + var(--s-4));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  overflow: hidden;
  max-height: calc(100dvh - var(--topbar-h) - var(--s-8));
}
.cart__items {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 90px;
}

.cart-line {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
}
.cart-line:last-child { border-bottom: 0; }
.cart-line__body { flex: 1; min-width: 0; }
.cart-line__name { font-weight: 650; font-size: var(--fs-sm); }
.cart-line__meta { font-size: var(--fs-xs); color: var(--text-faint); }
.cart-line__total {
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.totals {
  padding: var(--s-4);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.totals__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.totals__row span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.totals__row--grand {
  padding-top: var(--s-2);
  margin-top: 2px;
  border-top: 1px dashed var(--border-strong);
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}
.totals__row--grand span:last-child { font-weight: 800; }
.totals__row--balance { color: var(--danger); font-weight: 700; }
.totals__row--balance span:last-child { font-weight: 800; }
.totals__row--settled { color: var(--good); font-weight: 700; }

/* ==========================================================================
   16 · LISTS, EMPTY STATES & SKELETONS
   ========================================================================== */
.list { display: flex; flex-direction: column; }
.list__item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--border);
  transition: background var(--speed) var(--ease);
  text-decoration: none;
  color: inherit;
}
.list__item:last-child { border-bottom: 0; }
.list__item:hover { background: var(--surface-2); text-decoration: none; }
.list__main  { flex: 1; min-width: 0; }
.list__title {
  font-weight: 650;
  font-size: var(--fs-base);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.list__sub { font-size: var(--fs-sm); color: var(--text-muted); }
.list__end { text-align: end; flex-shrink: 0; white-space: nowrap; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-10) var(--s-5);
  text-align: center;
}
.empty__icon {
  width: 60px;
  height: 60px;
  border-radius: var(--r-lg);
  display: grid;
  place-items: center;
  background: var(--surface-3);
  font-size: 26px;
  margin-bottom: var(--s-2);
  opacity: 0.9;
}
.empty__title { font-weight: 700; font-size: var(--fs-md); }
.empty__text  { font-size: var(--fs-sm); color: var(--text-muted); max-width: 42ch; }
.empty__action { margin-top: var(--s-3); }

.off { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4); color: var(--text-muted); }
.off__icon { font-size: 20px; }

.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton--title { height: 20px; width: 40%; margin-bottom: var(--s-3); }
.skeleton--row   { height: 44px; margin-bottom: var(--s-2); }

/* ==========================================================================
   17 · CHARTS
   ========================================================================== */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 160px;
  padding: var(--s-2) 0;
}
.chart__bar {
  position: relative;
  flex: 1;
  min-width: 3px;
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  height: 100%;
  border-radius: 4px 4px 2px 2px;
  background: var(--accent-softer);
  transition: background var(--speed) var(--ease);
}
.chart__bar:hover { background: var(--accent-soft); }

/* The label inside each bar is a tooltip, shown only on hover. */
.chart__bar span {
  position: absolute;
  bottom: 100%;
  inset-inline-start: 50%;
  transform: translateX(-50%) translateY(-4px);
  margin-bottom: 4px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--brand-ink);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 650;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
  box-shadow: var(--sh-md);
  transition: opacity var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.chart__bar:hover span { opacity: 1; transform: translateX(-50%) translateY(0); }
.chart__fill {
  width: 100%;
  border-radius: 4px 4px 2px 2px;
  background: var(--accent-grad);
  transition: height 520ms var(--ease);
  min-height: 2px;
}
.chart-axis {
  display: flex;
  justify-content: space-between;
  gap: 3px;
  font-size: var(--fs-xs);
  color: var(--text-faint);
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.chart-axis > * { flex: 1; text-align: center; min-width: 0; overflow: hidden; }

/* ==========================================================================
   18 · PUBLIC SITE & AUTH
   ========================================================================== */
.topnav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-5);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.topnav__brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-weight: 750;
  letter-spacing: -0.02em;
  color: inherit;
  text-decoration: none;
}
.topnav__brand:hover { text-decoration: none; color: inherit; }

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3.5rem, 10vw, 7rem) var(--s-5);
  color: #fff;
  background:
    radial-gradient(900px 460px at 14% -10%, rgba(245, 164, 7, 0.30), transparent 62%),
    radial-gradient(760px 420px at 92% 108%, rgba(232, 133, 11, 0.24), transparent 64%),
    linear-gradient(158deg, #3A4043 0%, #2F3335 46%, #1C1F21 100%);
}
.hero__inner { max-width: 1140px; margin-inline: auto; position: relative; z-index: 1; }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: var(--s-4);
}
.hero p {
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.65;
  opacity: 0.9;
  max-width: 48ch;
  margin-bottom: var(--s-6);
}
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px var(--s-4);
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: var(--fs-sm);
  font-weight: 650;
  margin-bottom: var(--s-5);
  backdrop-filter: blur(8px);
}
.hero__bubbles { position: absolute; inset: 0; opacity: 0.26; pointer-events: none; }
.hero__bubbles span {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(245, 164, 7, 0.55);
  animation: drift 16s ease-in-out infinite;
}
@keyframes drift {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-30px) scale(1.05); }
}

.section { padding: clamp(3rem, 7vw, 5.5rem) var(--s-5); }
.section__inner { max-width: 1140px; margin-inline: auto; }
.section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.6vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: var(--s-3);
}
.section__lead {
  color: var(--text-muted);
  font-size: var(--fs-md);
  max-width: 56ch;
  margin-bottom: var(--s-8);
}

.steps-grid {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.step {
  padding: var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.step:hover { transform: translateY(-4px); box-shadow: var(--sh-md); }
.step__n {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-600);
  font-weight: 800;
  font-size: var(--fs-md);
  margin-bottom: var(--s-4);
}

.price-grid {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.price {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease),
              border-color var(--speed) var(--ease);
}
.price:hover { transform: translateY(-2px); border-color: var(--accent-400); box-shadow: var(--sh-md); }
.price__icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  font-size: 20px;
  flex-shrink: 0;
}
.price__name { font-weight: 650; }
.price__amount {
  margin-inline-start: auto;
  font-weight: 800;
  color: var(--accent-600);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.contact { background: var(--surface-3); }
.contact-grid {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.footer {
  padding: var(--s-8) var(--s-5);
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-faint);
  font-size: var(--fs-sm);
  background: var(--surface);
}

/* ------------------------------- Auth ------------------------------------ */
.auth { display: grid; grid-template-columns: 1fr; min-height: 100dvh; }
@media (min-width: 900px) { .auth { grid-template-columns: 1.05fr 1fr; } }

.auth__brand {
  display: none;
  position: relative;
  padding: var(--s-12) var(--s-10);
  color: #fff;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(900px 520px at 14% -6%, rgba(245, 164, 7, 0.30), transparent 62%),
    radial-gradient(760px 440px at 96% 108%, rgba(232, 133, 11, 0.22), transparent 64%),
    linear-gradient(158deg, #3A4043 0%, #2F3335 48%, #1C1F21 100%);
}
@media (min-width: 900px) { .auth__brand { display: flex; } }

.auth__bubbles { position: absolute; inset: 0; pointer-events: none; opacity: 0.22; }
.auth__bubbles span {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(245, 164, 7, 0.5);
  animation: drift 15s ease-in-out infinite;
}

.auth__mark {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  position: relative;
  z-index: 1;
}
.auth__mark-img {
  width: auto;
  height: 104px;
  max-width: 100%;
  filter: drop-shadow(0 14px 34px rgba(0, 0, 0, 0.45));
}
.auth__pitch { position: relative; z-index: 1; max-width: 32rem; }
.auth__pitch h2 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3vw, 2.5rem);
  line-height: 1.14;
  letter-spacing: -0.015em;
  color: #fff;
  margin-bottom: var(--s-4);
}
.auth__pitch p { opacity: 0.88; font-size: var(--fs-md); line-height: 1.65; }
.auth__points { display: grid; gap: var(--s-4); margin-top: var(--s-8); }
.auth__point { display: flex; gap: var(--s-3); align-items: flex-start; font-size: var(--fs-base); opacity: 0.92; }
.auth__point b { display: block; font-weight: 700; margin-bottom: 1px; }
.auth__point > span:first-child {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(245, 164, 7, 0.16);
  border: 1px solid rgba(245, 164, 7, 0.28);
  font-size: 16px;
  flex-shrink: 0;
}
.auth__foot { position: relative; z-index: 1; font-size: var(--fs-sm); opacity: 0.72; }

.auth__form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--s-8) var(--s-5);
  background: var(--surface);
}
.auth__inner { width: 100%; max-width: 400px; margin-inline: auto; }
.auth__logo-sm {
  width: 60px;
  height: 60px;
  border-radius: var(--r);
  display: block;
  object-fit: cover;
  margin-bottom: var(--s-5);
  box-shadow: var(--sh-md);
}
.auth__lang { display: flex; gap: var(--s-2); justify-content: center; flex-wrap: wrap; margin-top: var(--s-6); }

/* ==========================================================================
   19 · RECEIPTS & TAGS
   ========================================================================== */
.receipt h1 { font-size: var(--fs-lg); text-align: center; margin-bottom: var(--s-1); }
.receipt table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.receipt table td { padding: 3px 0; vertical-align: top; }
.receipt__center { text-align: center; }
.receipt__logo { max-width: 140px; margin: 0 auto var(--s-2); }
.receipt__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 2px 0;
  font-size: var(--fs-sm);
}
.receipt__row--big { font-size: var(--fs-md); font-weight: 800; }
.receipt__rule { border-top: 1px dashed var(--border-strong); margin: var(--s-2) 0; }

.tags { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.tag {
  padding: var(--s-3);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  text-align: center;
}
.tag__shop { font-size: var(--fs-xs); font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.tag__code { font-family: var(--font-mono); font-size: var(--fs-lg); font-weight: 700; letter-spacing: 0.04em; }
.tag__line { font-size: var(--fs-xs); color: var(--text-muted); }
.tag__rule { border-top: 1px dashed var(--border); margin: 6px 0; }

/* ==========================================================================
   20 · PRINT
   ========================================================================== */
@media print {
  .sidebar,
  .sidebar__backdrop,
  .topbar,
  .tabbar,
  .fab,
  .toasts,
  .menu,
  .no-print,
  .btn,
  .offline-bar,
  .nprogress { display: none !important; }

  body { background: #fff; color: #000; font-size: 11pt; }
  .app { display: block; }
  .page { padding: 0; max-width: none; }
  .card {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .card__head { background: transparent; }
  .table th { background: transparent; color: #000; }
  a { color: #000; text-decoration: none; }
  .tag { break-inside: avoid; page-break-inside: avoid; }
}

/* ==========================================================================
   21 · MOTION & ACCESSIBILITY
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  :root { --border: #999; --border-strong: #555; --text-muted: #333; }
  .card, .btn, .input, .select, .textarea { border-width: 1.5px; }
}

/* Touch targets stay comfortable on a phone */
@media (max-width: 767px) and (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn--sm { min-height: 36px; }
  .input, .select, .textarea { min-height: 46px; font-size: 16px; }
  .icon-btn { width: 42px; height: 42px; }
}

[hidden] { display: none !important; }

/* ==========================================================================
   Press feedback
   --------------------------------------------------------------------------
   `:active` only lasts while the pointer is held down, which on a quick tap is
   too brief to see — the counter reported "you click something and it does not
   show you it clicked". `.is-pressed` is applied by app.js for a fixed 220ms on
   every press, so every tap has a visible answer on every device.
   ========================================================================== */
.is-pressed {
  transform: scale(0.97) !important;
  filter: brightness(0.94);
  transition: transform 90ms var(--ease), filter 90ms var(--ease) !important;
}

.btn.is-pressed,
.icon-btn.is-pressed,
.qty__btn.is-pressed {
  box-shadow: inset 0 2px 6px rgb(0 0 0 / 0.18) !important;
}

.pos-item.is-pressed,
.tile.is-pressed,
.list__item.is-pressed,
.menu__item.is-pressed,
.nav-item.is-pressed,
.tabbar__item.is-pressed,
.segmented__btn.is-pressed,
.pill.is-pressed,
.user-chip.is-pressed {
  background: color-mix(in srgb, var(--accent-600) 16%, transparent) !important;
  box-shadow: inset 0 0 0 2px var(--accent-600) !important;
}

/* A tile that has just been added to the cart gives a short confirming pulse. */
@keyframes sc-added {
  0%   { transform: scale(1);    box-shadow: inset 0 0 0 0 var(--accent-600); }
  35%  { transform: scale(1.04); box-shadow: inset 0 0 0 3px var(--accent-600); }
  100% { transform: scale(1);    box-shadow: inset 0 0 0 0 var(--accent-600); }
}
.pos-item.is-added { animation: sc-added 420ms var(--ease); }

/* A link that is taking the user somewhere says so while the page loads. */
a.is-navigating { opacity: 0.6; cursor: progress; }

/* A control mid-request must look unavailable, not merely faded. */
.btn[aria-busy="true"],
.is-loading { cursor: progress !important; }

@media (prefers-reduced-motion: reduce) {
  .is-pressed { transform: none !important; }
  .pos-item.is-added { animation: none; outline: 3px solid var(--accent-600); }
}

/* ==========================================================================
   Modals that contain a form
   --------------------------------------------------------------------------
   .modal__panel is a flex column: the head and foot keep their size and the
   body scrolls between them. Three modals (add customer, new customer, correct
   attendance) wrap the body AND the foot in a <form>, which put an ordinary
   block box in the middle of that chain. The body's `flex: 1; overflow-y: auto`
   then applied to nothing, the form grew to its full content height, and
   .modal__panel's `overflow: hidden` simply cut the bottom off — taking the
   submit button with it. That is the "the button to finish adding is not
   appearing and there is no scroll" report: the form was not too long, it was
   unscrollable and its footer was clipped.

   Making the form carry the column through fixes every such modal at once.
   `min-height: 0` is the part that matters: without it a flex item refuses to
   shrink below its content, and the body still will not scroll.
   ========================================================================== */
.modal__panel > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.modal__body {
  min-height: 0;
}

/* Older engines without dvh must still cap the panel, or it grows past the
   screen and the footer is lost again. */
@supports not (max-height: 92dvh) {
  .modal__panel { max-height: 92vh; }
}

/* A long form should look scrollable, not merely be scrollable. */
.modal__body { scrollbar-gutter: stable; }

/* ==========================================================================
   Analysis charts
   --------------------------------------------------------------------------
   Drawn with CSS and inline SVG, rendered by the server. No chart library and
   no CDN, so every chart still works at a counter with no internet.

   The five categorical colours below are a fixed order, never cycled: a sixth
   series folds into "Other" rather than inventing a new hue. Each set was
   checked against its own surface for colour-blind separation and contrast.
   Every chart carries direct labels as well as colour, so identity never rests
   on colour alone.
   ========================================================================== */
:root {
  --cat-1: #E8850B;
  --cat-2: #7C3AED;
  --cat-3: #0F8A4D;
  --cat-4: #2563EB;
  --cat-5: #CF2E2E;
  --chart-grid: rgb(0 0 0 / 0.07);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cat-1: #F5A407;
    --cat-2: #A78BFA;
    --cat-3: #2DBE78;
    --cat-4: #60A5FA;
    --cat-5: #F47171;
    --chart-grid: rgb(255 255 255 / 0.09);
  }
}
:root[data-theme="dark"] {
  --cat-1: #F5A407;
  --cat-2: #A78BFA;
  --cat-3: #2DBE78;
  --cat-4: #60A5FA;
  --cat-5: #F47171;
  --chart-grid: rgb(255 255 255 / 0.09);
}

/* ---- Legend: always present for two or more series ---------------------- */
.legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); margin-bottom: var(--s-3); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-muted); }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ---- Stacked bar: one row per period ------------------------------------ */
.sbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--chart-grid); gap: 2px; }
.sbar__seg { min-width: 2px; }
.sbar__seg:first-child { border-radius: 6px 0 0 6px; }
.sbar__seg:last-child  { border-radius: 0 6px 6px 0; }

/* ---- Grouped rows ------------------------------------------------------- */
.mini-row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: var(--s-3); align-items: center; padding: 7px 0; }
.mini-row + .mini-row { border-top: 1px solid var(--border); }
.mini-row__label { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row__track { height: 10px; border-radius: 5px; background: var(--chart-grid); overflow: hidden; }
.mini-row__fill { height: 100%; border-radius: 5px; min-width: 3px; background: var(--cat-1); }
.mini-row__value { font-size: var(--fs-sm); font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- Line / area chart, drawn as inline SVG ----------------------------- */
.linechart { width: 100%; height: auto; display: block; overflow: visible; }
.linechart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.linechart .area { fill: var(--accent); opacity: 0.12; }
.linechart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.linechart .dot  { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.linechart .axis-label { fill: var(--text-faint); font-size: 9px; }

/* ---- Donut -------------------------------------------------------------- */
.donut { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.donut svg { flex: none; }
.donut__hole { fill: var(--surface); }
.donut__total { font-size: var(--fs-lg); font-weight: 750; fill: var(--text); }
.donut__caption { font-size: 9px; fill: var(--text-faint); }
/* The segment colour is set inline by Charts::donut (a style attribute, so the
   CSS variable actually resolves). This class must NOT set `stroke`, or it
   would override every segment and paint the whole ring one colour. */
.donut__seg { transition: opacity var(--speed) var(--ease); }
.donut__seg:hover { opacity: 0.82; }

/* ---- Heat strip: one cell per hour or day ------------------------------- */
.heatstrip { display: grid; gap: 2px; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.heatcell { aspect-ratio: 1; border-radius: 3px; background: var(--chart-grid); min-height: 14px; }

/* A chart must never push the page sideways on a phone. */
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
