/* ==========================================================================
   CARTHICK BRAND & UI DESIGN SYSTEM · V1
   Auto detailing expert. Black, white and one ember accent.
   Typefaces: Saira (display/headings) & Inter (UI/body)
   ========================================================================== */

:root {
  /* --- Colour Tokens (Page 3) --- */
  --badge: #0B0B0B;
  /* The logo's badge black. Brand blocks, top bars, hero bands. */
  --ember: #E2400B;
  /* Graphic accents, stripes, active indicators, progress bars. */
  --ember-strong: #B8320A;
  /* Text, links and filled primary buttons (6.0:1 on white). */
  --on-ember: #FFFFFF;
  /* Text and icons on ember-strong fills. */
  --surface-100: #FFFFFF;
  /* Page background. */
  --surface-200: #F4F4F2;
  /* Cards, panels, table headers. */
  --surface-300: #E4E4E1;
  /* Hover rows, input fills, selected tabs. */
  --line: #D4D4D0;
  /* Dividers and card borders (decorative). */
  --line-strong: #8A8A86;
  /* Input and control borders (3:1 contrast against surfaces). */
  --ink: #0B0B0B;
  /* Primary text on surface-100 and surface-200. */
  --ink-muted: #5C5C5C;
  /* Secondary text, captions, timestamps. */
  --on-badge: #FFFFFF;
  /* Text on badge-black blocks and bars. */
  --success: #1E7D3A;
  /* Paid, completed, in stock. */
  --warning: #A15C00;
  /* Due soon, low stock, partial payment. */
  --danger: #B42318;
  /* Overdue, errors, failed payments. */

  /* --- Spacing Tokens (Page 6) --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* --- Radius Tokens (Page 6) --- */
  --radius-sm: 4px;
  /* Badges, chips, inputs. */
  --radius-md: 8px;
  /* Buttons, cards. */
  --radius-lg: 16px;
  /* Large panels, photo frames, sheet top corners. */

  /* --- Backward-Compatible Aliases --- */
  --bg: var(--surface-100);
  --card: var(--surface-200);
  --sunk: var(--surface-300);
  --ink2: var(--ink-muted);
  --ink3: var(--line-strong);
  --pri: var(--ember-strong);
  --pri-ink: var(--on-ember);
  --pri-soft: #FDE8E1;
  --pri-mid: #F0632F;
  --ok: var(--success);
  --ok-soft: #E8F5EC;
  --warn: var(--warning);
  --warn-soft: #FEF3DE;
  --bad: var(--danger);
  --bad-soft: #FDECEC;
  --nav: var(--surface-100);
  --scrim: rgba(11, 11, 11, 0.65);
  --shadow: none;
  /* Prefer borders (line) over shadows per Page 6 */
  --grad: var(--ember-strong);
  --glass: none;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --badge: #262626;
    --ember: #E2400B;
    --ember-strong: #F0632F;
    --on-ember: #0B0B0B;
    --surface-100: #0B0B0B;
    --surface-200: #171717;
    --surface-300: #262626;
    --line: #333333;
    --line-strong: #7A7A7A;
    --ink: #F5F5F3;
    --ink-muted: #A3A3A3;
    --on-badge: #FFFFFF;
    --success: #4CC27A;
    --warning: #F0A43A;
    --danger: #F2665C;

    --bg: var(--surface-100);
    --card: var(--surface-200);
    --sunk: var(--surface-300);
    --ink2: var(--ink-muted);
    --ink3: var(--line-strong);
    --pri: var(--ember-strong);
    --pri-ink: var(--on-ember);
    --pri-soft: #2D1A15;
    --pri-mid: #E2400B;
    --ok: var(--success);
    --ok-soft: #14281B;
    --warn: var(--warning);
    --warn-soft: #2D2213;
    --bad: var(--danger);
    --bad-soft: #2D1516;
    --nav: #121212;

    color-scheme: dark;
  }
}

/* Base reset & typography setup */
/* Base reset & layout */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  background: var(--surface-100);
  color-scheme: light dark;
  scroll-padding-top: env(safe-area-inset-top, 0px);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--surface-100);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--badge);
}

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

button {
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}

a {
  color: var(--ember-strong);
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--ember-strong);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.num {
  font-variant-numeric: tabular-nums;
}

svg.i {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: none;
}

svg.s {
  fill: currentColor;
  flex: none;
  display: block;
}

/* App container layout */
/* App container */
/* Shell layout lives in the "APP SHELL" section at the end of this file. */

/* --------------------------------------------------------------------------
   TYPOGRAPHY (Page 5)
   -------------------------------------------------------------------------- */
.display {
  font-family: 'Saira', sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: 48px;
  line-height: 52px;
  letter-spacing: -0.02em;
}

h1,
.heading-1 {
  font-family: 'Saira', sans-serif;
  font-weight: 700;
  font-style: italic;
  font-size: 32px;
  line-height: 38px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 14px 0 6px;
}

h2,
.heading-2 {
  font-family: 'Saira', sans-serif;
  font-weight: 700;
  font-style: normal;
  font-size: 24px;
  line-height: 30px;
  color: var(--ink);
  margin: 20px 0 10px;
}

h3,
.heading-3 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 18px;
  line-height: 24px;
  color: var(--ink);
}

.tagline,
.top-tagline .tag-text {
  font-family: 'Saira', sans-serif;
  font-weight: 600;
  font-style: italic;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.lede,
.small-meta,
small {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-muted);
}

.lede {
  margin-bottom: 16px;
}

label,
.lbl,
.field>span,
th,
.jr-foot,
.money span,
.kpi span {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

main {
  padding: 4px 16px 0;
}

.sec {
  margin: 20px 0 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.sec a,
.link {
  color: var(--ember-strong);
  font-weight: 600;
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   HEADER & BRAND BAR (Page 3 & 4)
   -------------------------------------------------------------------------- */
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--badge);
  color: var(--on-badge);
  border-bottom: 1px solid #1c1c1c;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--ember);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  flex: none;
}

.mark.logo {
  background: #FFFFFF;
  border: 1px solid var(--line);
  overflow: hidden;
}

.mark.logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text {
  min-width: 0;
}

.brand b {
  display: block;
  font-family: 'Saira', sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: 21px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}

.brand small {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.65);
}

.top-tagline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.75);
}

.top-tagline .tag-rule {
  display: inline-block;
  width: 14px;
  height: 2px;
  background: var(--ember);
}

@media (max-width: 480px) {
  .top-tagline {
    display: none;
  }
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.iconbtn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  color: #FFFFFF;
  position: relative;
}

.iconbtn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.iconbtn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ember);
  border: 1.5px solid var(--badge);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--surface-300);
  color: var(--badge);
  font-family: 'Saira', sans-serif;
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex: none;
}

/* --------------------------------------------------------------------------
   MORE PAGE TILES (2-Column Grid)
   -------------------------------------------------------------------------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0 24px;
}

.tile {
  background: var(--surface-200);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 114px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  box-shadow: none;
}

.tile:hover,
.tile:active {
  background: var(--surface-300);
  border-color: var(--line-strong);
}

.tile:active {
  transform: scale(0.98);
}

.tile .ic {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--surface-300);
  color: var(--ember-strong);
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  flex: none;
}

.tile b {
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  color: var(--ink);
}

.tile small {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink-muted);
  margin-top: 4px;
}

@media (max-width: 360px) {
  .tiles {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   CARDS, PANELS & GROUPS (Page 4 & 6)
   Flat surfaces, 1px border, no heavy drop shadows
   -------------------------------------------------------------------------- */
  .group,
  .jrow,
  .feature,
  .kpi,
  .box,
  .stock-card,
  .estimate,
  .chart {
    background: var(--surface-200);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: none;
  }

  .jrow {
    display: block;
    width: 100%;
    padding: var(--space-4);
    margin-bottom: 12px;
  }

  .jr-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .jr-mid {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: baseline;
  }

  .jr-mid b {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 16px;
  }

  .jr-mid span {
    color: var(--ink-muted);
    font-size: 13px;
    text-align: right;
  }

  .jr-foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--ink-muted);
  }

  .jr-foot .owe {
    color: var(--warning);
    font-weight: 700;
  }

  .group {
    overflow: hidden;
    margin-bottom: 16px;
  }

  .row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    width: 100%;
    border-top: 1px solid var(--line);
    background: transparent;
    transition: background 0.1s ease;
  }

  .row:first-child {
    border-top: 0;
  }

  .row:hover,
  .row:active {
    background: var(--surface-300);
  }

  .row .tx {
    flex: 1;
    min-width: 0;
  }

  .row .tx b {
    display: block;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .row .tx small {
    display: block;
    color: var(--ink-muted);
    font-size: 12.5px;
    margin-top: 2px;
  }

  .row .rt {
    text-align: right;
    font-weight: 700;
    font-size: 14px;
  }

  .row .rt small {
    display: block;
    font-weight: 500;
    font-size: 11.5px;
    color: var(--ink-muted);
  }

  .dotc {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
  }

  .ini {
    width: 36px;
    height: 36px;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--surface-300);
    color: var(--ink);
    display: grid;
    place-items: center;
    font-family: 'Saira', sans-serif;
    font-weight: 700;
    font-size: 13px;
    flex: none;
  }

  .chev {
    color: var(--line-strong);
  }

  /* --------------------------------------------------------------------------
   BUTTONS (Page 4 & 6)
   One primary (ember-strong) button per screen; outline for secondary
   -------------------------------------------------------------------------- */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    padding: 0 16px;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid transparent;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
    transition: filter 0.15s ease, background 0.15s ease;
  }

  /* Primary Button: ember-strong filled (Page 4) */
  .btn,
  .btn.pri,
  .inventory-add-btn,
  .po-create-btn {
    background: var(--ember-strong);
    color: var(--on-ember);
    border-color: transparent;
  }

  .btn:hover,
  .inventory-add-btn:hover,
  .po-create-btn:hover {
    filter: brightness(1.1);
  }

  .btn:active,
  .inventory-add-btn:active,
  .po-create-btn:active {
    filter: brightness(0.95);
  }

  /* Secondary Button: outline / surface-100 (Page 4 "View invoice") */
  .btn.line,
  .btn.ghost {
    background: var(--surface-100);
    border: 1px solid var(--line-strong);
    color: var(--ink);
  }

  .btn.line:hover,
  .btn.ghost:hover {
    background: var(--surface-300);
  }

  .btn.ok {
    background: var(--success);
    color: #FFFFFF;
  }

  .btn.sm {
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
  }

  .btn.block {
    width: 100%;
  }

  .btn[disabled],
  .btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
  }

  .btnrow {
    display: flex;
    gap: 8px;
  }

  .btnrow>* {
    flex: 1;
  }

  /* --------------------------------------------------------------------------
   STATUS BADGES & CHIPS (Page 3 & 4)
   ✓ PAID, ⚠ DUE SOON, ✕ OVERDUE
   -------------------------------------------------------------------------- */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 11.5px;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    padding: 3px 7px;
    white-space: nowrap;
    background: transparent;
    border: 1px solid transparent;
  }

  .b-ok {
    border-color: var(--success);
    color: var(--success);
    background: transparent;
  }

  .b-warn {
    border-color: var(--warning);
    color: var(--warning);
    background: transparent;
  }

  .b-bad {
    border-color: var(--danger);
    color: var(--danger);
    background: transparent;
  }

  .b-pri {
    border-color: var(--ember-strong);
    color: var(--ember-strong);
    background: transparent;
  }

  .b-mute {
    border-color: var(--line);
    color: var(--ink-muted);
    background: var(--surface-300);
  }

  .chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 6px;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    scrollbar-width: none;
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    height: 32px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    background: var(--surface-100);
    flex: none;
  }

  .chip.on {
    background: var(--badge);
    color: var(--on-badge);
    border-color: var(--badge);
  }

  .chip .n {
    opacity: 0.65;
    margin-left: 4px;
  }

  /* --------------------------------------------------------------------------
   CONTROLS & FORMS (Page 6)
   border: line-strong (3:1 contrast against surface), radius-sm (4px)
   -------------------------------------------------------------------------- */
  .field {
    display: block;
    margin-bottom: 14px;
  }

  .field>span {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
  }

  .inp {
    width: 100%;
    height: 42px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface-100);
    color: var(--ink);
    padding: 0 12px;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: border-color 0.15s ease;
  }

  .inp:focus {
    border-color: var(--ember-strong);
    outline: 2px solid var(--ember-strong);
    outline-offset: 1px;
  }

  .inp.ta {
    height: auto;
    min-height: 80px;
    padding: 10px 12px;
    line-height: 1.5;
    resize: vertical;
  }

  .search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--surface-100);
    border: 1px solid var(--line-strong);
    padding: 0 12px;
    color: var(--line-strong);
    margin-bottom: 12px;
  }

  .search input {
    border: 0;
    background: none;
    outline: none;
    flex: 1;
    height: 100%;
    color: var(--ink);
  }

  .seg {
    display: flex;
    background: var(--surface-300);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
  }

  .seg button {
    flex: 1;
    height: 34px;
    border-radius: 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-muted);
    text-align: center;
  }

  .seg button.on {
    background: var(--surface-100);
    color: var(--ink);
    box-shadow: none;
    border: 1px solid var(--line);
  }

  .toggle {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: var(--line-strong);
    position: relative;
    flex: none;
    transition: background 0.15s ease;
  }

  .toggle::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FFFFFF;
    transition: transform 0.15s ease;
  }

  .toggle.on {
    background: var(--ember-strong);
  }

  .toggle.on::after {
    transform: translateX(20px);
  }

  .tick {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--line-strong);
    display: grid;
    place-items: center;
    flex: none;
    color: transparent;
  }

  .on>.tick,
  .tick.on {
    background: var(--ember-strong);
    border-color: var(--ember-strong);
    color: #FFFFFF;
  }

  /* --------------------------------------------------------------------------
   PROGRESS BARS & RAILS (Page 4)
   Active bar uses ember (#E2400B)
   -------------------------------------------------------------------------- */
  .meter,
  .pbar,
  .rail {
    background: var(--surface-300);
    border-radius: 2px;
    overflow: hidden;
  }

  .meter {
    height: 5px;
    margin-top: 6px;
  }

  .meter i {
    display: block;
    height: 100%;
    border-radius: 2px;
    background: var(--ember);
  }

  .rail {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
    margin: 12px 0 8px;
    height: 5px;
    background: transparent;
  }

  .rail i {
    height: 5px;
    border-radius: 2px;
    background: var(--surface-300);
  }

  .rail i.on {
    background: var(--ember);
  }

  .rail i.cur {
    background: var(--ember);
  }

  .rail.done i {
    background: var(--success);
  }

  .raillbl {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
    font-size: 11px;
    color: var(--ink-muted);
    font-weight: 500;
    margin-top: 2px;
  }

  .raillbl span.on {
    color: var(--ink);
    font-weight: 600;
  }

  /* --------------------------------------------------------------------------
   HERO METRIC & KPIS
   -------------------------------------------------------------------------- */
  .hero {
    background: var(--badge);
    color: var(--on-badge);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    position: relative;
    overflow: hidden;
    border: 1px solid #1a1a1a;
  }

  .hero small {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .hero .big {
    font-family: 'Saira', sans-serif;
    font-size: 36px;
    font-weight: 800;
    font-style: italic;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 4px 0 6px;
    color: #FFFFFF;
  }

  .hero .delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.12);
    color: var(--ember);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
  }

  .kpis {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
  }

  .kpi {
    background: var(--surface-200);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: block;
    width: 100%;
  }

  .kpi b {
    display: block;
    font-family: 'Saira', sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-top: 2px;
    color: var(--ink);
  }

  /* --------------------------------------------------------------------------
   NUMBER PLATE
   -------------------------------------------------------------------------- */
  .plate {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #FFFFFF;
    color: #0B0B0B;
    border: 1.5px solid #0B0B0B;
    border-radius: var(--radius-sm);
    padding: 2px 7px 2px 3px;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    line-height: 1.3;
  }

  .plate i {
    font-style: normal;
    background: #1E4FD6;
    color: #FFFFFF;
    font-size: 8px;
    line-height: 1;
    padding: 3px 2px;
    border-radius: 2px;
    letter-spacing: 0;
  }

  .plate.lg {
    font-size: 19px;
    padding: 4px 10px 4px 4px;
    border-width: 2px;
    border-radius: var(--radius-sm);
  }

  .plate.lg i {
    font-size: 10px;
    padding: 4px 3px;
  }

  /* --------------------------------------------------------------------------
   CARTHICK SPEED STRIPES GRAPHIC (Page 1 & 4)
   -------------------------------------------------------------------------- */
  .carthick-stripes {
    display: inline-flex;
    gap: 3px;
    height: 14px;
    vertical-align: middle;
  }

  .carthick-stripes i {
    display: inline-block;
    width: 4px;
    height: 100%;
    background: var(--ember);
    transform: skewX(-20deg);
    border-radius: 1px;
  }

  /* --------------------------------------------------------------------------
   WORK STEPS & TECHNICIAN CONTROLS
   -------------------------------------------------------------------------- */
  .step {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
  }

  .step:first-child {
    border-top: 0;
  }

  .st-n {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--surface-300);
    color: var(--ink-muted);
    display: grid;
    place-items: center;
    font-family: 'Saira', sans-serif;
    font-weight: 700;
    font-size: 12.5px;
    flex: none;
  }

  .st-done .st-n {
    background: var(--success);
    color: #FFFFFF;
  }

  .st-run .st-n {
    background: var(--ember-strong);
    color: #FFFFFF;
  }

  .st-pause .st-n {
    background: var(--warning);
    color: #FFFFFF;
  }

  .st-b {
    flex: 1;
    min-width: 0;
  }

  .st-name {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14.5px;
  }

  .st-meta {
    display: flex;
    gap: 10px;
    font-size: 12.5px;
    color: var(--ink-muted);
    margin-top: 2px;
    flex-wrap: wrap;
  }

  .st-meta .tm {
    font-weight: 700;
    color: var(--ink);
  }

  .st-run .tm {
    color: var(--ember-strong);
  }

  .st-act {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
  }

  .now {
    background: var(--surface-200);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    text-align: center;
  }

  .now .timer {
    font-family: 'Saira', sans-serif;
    font-size: 52px;
    font-weight: 800;
    font-style: italic;
    letter-spacing: -0.02em;
    line-height: 1;
    margin: 12px 0 4px;
    color: var(--ink);
  }

  .now .st {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 600;
  }

  .bigbtns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
  }

  .bigbtns .btn {
    height: 58px;
    font-size: 16px;
    border-radius: var(--radius-md);
  }

  /* --------------------------------------------------------------------------
   STOCK MANAGEMENT & INVENTORY CONTROLS
   -------------------------------------------------------------------------- */
  .stock-hub {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 16px 0 24px;
  }

  .stock-card {
    position: relative;
    display: grid;
    grid-template-columns: 46px 1fr 22px;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 3px 12px;
    width: 100%;
    min-height: 88px;
    padding: var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-200);
    text-align: left;
  }

  .stock-card:hover,
  .stock-card:active {
    background: var(--surface-300);
  }

  .stock-card .stock-icon {
    grid-row: 1/3;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--surface-300);
    color: var(--ember-strong);
    display: grid;
    place-items: center;
  }

  .stock-card>b {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    align-self: end;
  }

  .stock-card>small {
    font-size: 12.5px;
    color: var(--ink-muted);
    align-self: start;
    line-height: 1.4;
  }

  .stock-card .stock-arrow {
    grid-column: 3;
    grid-row: 1/3;
    color: var(--line-strong);
  }

  .inventory-heading,
  .po-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .inventory-add-btn,
  .po-create-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 9px 14px;
    margin: 2px 0 0;
    border-radius: var(--radius-md);
  }

  .stock-filter-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    margin: 8px 0 14px;
  }

  .stock-filter {
    display: block;
    width: 32%;
    min-width: 140px;
    max-width: 210px;
    margin: 0;
  }

  .stock-filter .inp {
    height: 40px;
    min-height: 40px;
    padding: 6px 10px;
  }

  /* --------------------------------------------------------------------------
   PHOTO PREVIEWS & FRAMES (Page 6)
   radius-lg (16px) frames labelled with label style
   -------------------------------------------------------------------------- */
  .photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .ph {
    aspect-ratio: 4/3;
    border-radius: var(--radius-md);
    border: 1.5px dashed var(--line-strong);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
    text-align: center;
    width: 100%;
    background: var(--surface-200);
  }

  .ph.on {
    border-style: solid;
    border-color: var(--success);
    background: var(--surface-100);
    color: var(--success);
  }

  .ph.has-img {
    position: relative;
    overflow: hidden;
    border-style: solid;
    border-color: var(--line);
    padding: 0;
  }

  .ph-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
    display: block;
  }

  .ph-tag {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(11, 11, 11, 0.75);
    color: #FFFFFF;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    padding: 3px 0;
  }

  .ci-gal {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .ci-gal-item {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--line);
    aspect-ratio: 4/3;
  }

  .ci-gal-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .ci-gal-item span {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(11, 11, 11, 0.75);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    padding: 3px 0;
  }

  /* --------------------------------------------------------------------------
   BOTTOM TABS NAVIGATION
   -------------------------------------------------------------------------- */
  nav.tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    background: var(--surface-100);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  nav .inner {
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 60px;
  }

  nav .t {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    text-align: center;
    padding: 6px 0;
    transition: color 0.15s ease;
  }

  nav .t.on {
    color: var(--ink);
  }

  nav .t svg.s {
    opacity: 0.6;
  }

  nav .t.on svg.s {
    color: var(--ember);
    opacity: 1;
  }

  nav .t.plus .pc {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--ember-strong);
    color: #FFFFFF;
    display: grid;
    place-items: center;
    margin-top: -18px;
    box-shadow: none;
  }

  /* --------------------------------------------------------------------------
   SHEETS, SCRIM & TOASTS
   -------------------------------------------------------------------------- */
  .scrim {
    position: fixed;
    inset: 0;
    background: var(--scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 25;
  }

  .sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 520px;
    margin: 0 auto;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface-100);
    border-top: 1px solid var(--line);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(105%);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 26;
    padding: 8px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  }

  .sheet .grab {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--line-strong);
    margin: 6px auto 14px;
  }

  body.sheet-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }

  body.sheet-open .sheet {
    transform: none;
  }

  .sh-h {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 6px;
  }

  .sh-h h3 {
    font-family: 'Saira', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
  }

  .toast {
    position: fixed;
    left: 50%;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    transform: translate(-50%, 20px);
    background: var(--badge);
    color: var(--on-badge);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: 0.2s ease;
    z-index: 35;
    border: 1px solid #222;
  }

  .toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  /* --------------------------------------------------------------------------
   LOGIN SCREEN
   -------------------------------------------------------------------------- */
  .login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background: var(--surface-100);
  }

  .login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface-200);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
  }

  .login-card h1 {
    font-family: 'Saira', sans-serif;
    font-weight: 800;
    font-style: italic;
    font-size: 34px;
    color: var(--ink);
    margin-bottom: 2px;
  }

  .login-card .tagline {
    color: var(--ember-strong);
    margin-bottom: 20px;
  }

  .login-card form {
    text-align: left;
    margin-top: 16px;
  }

  /* --------------------------------------------------------------------------
   INSPECTION, ESTIMATES & QUOTATIONS
   -------------------------------------------------------------------------- */
  .insp {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .insp .tx b {
    font-weight: 600;
  }

  .insp .tx small {
    color: var(--ink-muted);
  }

  .seg button.s-ok {
    background: var(--success);
    color: #FFFFFF;
  }

  .seg button.s-advise {
    background: var(--warning);
    color: #FFFFFF;
  }

  .seg button.s-urgent {
    background: var(--danger);
    color: #FFFFFF;
  }

  .totals {
    padding: 8px 0;
  }

  .totals div {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 14px;
    color: var(--ink-muted);
  }

  .totals div.grand {
    color: var(--ink);
    font-family: 'Saira', sans-serif;
    font-weight: 700;
    font-size: 20px;
    border-top: 1px solid var(--line);
    margin-top: 8px;
    padding-top: 12px;
  }

  /* --------------------------------------------------------------------------
   LETTERHEAD & DOCUMENT PREVIEWS (Always crisp white background)
   -------------------------------------------------------------------------- */
  .paper {
    background: #FFFFFF;
    color: #0B0B0B;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 18px 16px;
    font-size: 12px;
    line-height: 1.5;
    margin: 8px 0 16px;
  }

  .lh {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border-bottom: 2px solid #0B0B0B;
    padding-bottom: 12px;
    margin-bottom: 12px;
  }

  .lh .lg {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: #0B0B0B;
    color: #FFFFFF;
    font-family: 'Saira', sans-serif;
    font-weight: 800;
    font-style: italic;
    display: grid;
    place-items: center;
  }

  .lh .qh b {
    font-family: 'Saira', sans-serif;
    font-weight: 800;
    font-style: italic;
    font-size: 22px;
    color: #0B0B0B;
  }

  /* --------------------------------------------------------------------------
   APP STATE & SYSTEM CLASSES
   -------------------------------------------------------------------------- */
  body.busy {
    cursor: progress;
  }

  body.busy #main,
  body.busy #sheet {
    pointer-events: none;
  }

  body.busy::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    z-index: 99;
    background: var(--ember);
    animation: busybar 1s linear infinite;
  }

  @keyframes busybar {
    from {
      background-position: -50% 0;
    }

    to {
      background-position: 150% 0;
    }
  }

  body.signed-out header,
  body.signed-out nav,
  body.signed-out #fab {
    display: none;
  }

  /* Floating Action Button (Bea) */
  /* --------------------------------------------------------------------------
   FLOATING ACTION BUTTON (BEA)
   Positioned in bottom-right corner of the app frame with speech bubble
   -------------------------------------------------------------------------- */
  .fab {
    position: fixed;
    z-index: 14;
    right: max(12px, calc(50% - 240px));
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    z-index: 18;
    right: max(16px, calc(50% - 245px));
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .bav {
    width: 48px;
    height: 48px;
  }

    .fab .bav {
      width: 52px;
      height: 52px;
      flex: none;
      filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.18));
    }

    .fab .live {
      position: absolute;
      right: 2px;
      bottom: 2px;
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: var(--success);
      border: 2px solid var(--surface-100);
    }

    .fab .hint {
      position: absolute;
      right: 64px;
      bottom: 10px;
      white-space: nowrap;
      background: var(--badge);
      border: 1.5px solid var(--line);
      display: grid;
      place-items: center;
      color: #FFFFFF;
      color: var(--on-badge);
      font-family: 'Inter', sans-serif;
      font-size: 12px;
      font-weight: 600;
      padding: 7px 12px;
      border-radius: var(--radius-md) var(--radius-md) 2px var(--radius-md);
      border: 1px solid #262626;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.35s ease, transform 0.2s ease;
      transform: translateX(6px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    }

    .fab .hint.show {
      opacity: 1;
      transform: translateX(0);
    }

    body.sheet-open .fab {
      opacity: 0;
      pointer-events: none;
      transform: scale(0.9);
    }

    /* --------------------------------------------------------------------------
   BEA MASCOT ANIMATIONS & CHAT (Page 2)
   -------------------------------------------------------------------------- */
    .bav {
      position: relative;
      width: var(--sz, 48px);
      height: var(--sz, 48px);
      display: inline-block;
      vertical-align: middle;
    }

    .bav .bw {
      position: relative;
      width: 100%;
      height: 100%;
      display: block;
    }

    .bav .bw img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      display: block;
    }

    .bav .lid {
      position: absolute;
      top: 36%;
      width: 13%;
      height: 15%;
      background: var(--surface-100);
      border-radius: 50%;
      transform: scaleY(0);
      transform-origin: 50% 0;
    }

    .bav .lid.l {
      left: 24%;
    }

    .bav .lid.r {
      right: 24%;
    }

    .bav .hap {
      opacity: 0;
      transition: opacity 0.15s;
    }

    .bav .hap::after {
      content: "";
      position: absolute;
      left: 22%;
      right: 22%;
      top: 42%;
      height: 42%;
      border: calc(var(--sz, 48px) * 0.03) solid #172238;
      border-color: #172238 transparent transparent transparent;
      border-radius: 50%;
    }

    .bav .mo {
      position: absolute;
      left: 46.3%;
      top: 65.4%;
      width: 8.4%;
      height: 5.6%;
      border-radius: 45% 45% 50% 50%;
      background: #1a1f33;
      transform: scaleY(0);
      transform-origin: 50% 25%;
    }

    .bav .drop {
      position: absolute;
      right: 13%;
      top: 28%;
      width: 7.5%;
      height: 10.5%;
      background: #79c6f4;
      border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
      opacity: 0;
    }

    .bav .dots {
      position: absolute;
      right: -6%;
      top: 2%;
      display: flex;
      gap: 3px;
      padding: 4px 6px;
      background: var(--surface-200);
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
      opacity: 0;
      transition: opacity 0.2s;
    }

    .bav .dots b {
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: var(--ember);
      animation: bdot 1s infinite;
    }

    .bav .dots b:nth-child(2) {
      animation-delay: 0.15s;
    }

    .bav .dots b:nth-child(3) {
      animation-delay: 0.3s;
    }

    @keyframes bfloat {

      0%,
      100% {
        transform: translateY(0);
      }

      50% {
        transform: translateY(-4%);
      }
    }

    @keyframes bblink {

      0%,
      93%,
      100% {
        transform: scaleY(0);
      }

      96% {
        transform: scaleY(1);
      }
    }

    @keyframes bdot {

      0%,
      100% {
        opacity: 0.3;
      }

      50% {
        opacity: 1;
      }
    }

    .s-idle .bw {
      animation: bfloat 3.2s ease-in-out infinite;
    }

    .s-idle .lid {
      animation: bblink 5s infinite;
    }

    .s-think .dots {
      opacity: 1;
    }

    .composer {
      display: flex;
      gap: 8px;
      align-items: center;
      padding: 10px 0;
      background: var(--surface-100);
    }

    .composer .inp {
      flex: 1;
    }

    .msg {
      max-width: 85%;
      padding: 10px 14px;
      border-radius: var(--radius-md);
      margin-bottom: 8px;
      font-size: 14px;
      line-height: 1.45;
    }

    .msg.u {
      margin-left: auto;
      background: var(--ember-strong);
      color: var(--on-ember);
    }

    .msg.a {
      margin-right: auto;
      background: var(--surface-200);
      border: 1px solid var(--line);
      color: var(--ink);
    }

    /* --------------------------------------------------------------------------
   BAYS & SERVICE CARDS
   -------------------------------------------------------------------------- */
    .bays {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
    }

    .bay {
      border-radius: var(--radius-md);
      padding: 10px;
      background: var(--surface-200);
      border: 1px solid var(--line);
      min-height: 74px;
      display: block;
      width: 100%;
    }

    .bay.busy {
      border-color: var(--ember);
      background: var(--surface-300);
    }

    .bay span {
      font-size: 11px;
      font-weight: 700;
      color: var(--ink-muted);
    }

    .bay b {
      display: block;
      font-family: 'Inter', sans-serif;
      font-size: 13px;
      font-weight: 600;
      margin-top: 3px;
    }

    .bay small {
      display: block;
      font-size: 11px;
      color: var(--ink-muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .bay.busy span {
      color: var(--ember-strong);
    }

    .svc {
      display: flex;
      gap: 12px;
      align-items: center;
      padding: 13px 14px;
      border-top: 1px solid var(--line);
      width: 100%;
    }

    .svc:first-child {
      border-top: 0;
    }

    .svc .tx {
      flex: 1;
    }

    .svc .tx b {
      display: block;
      font-family: 'Inter', sans-serif;
      font-weight: 600;
    }

    .svc .tx small {
      color: var(--ink-muted);
      font-size: 12.5px;
    }

    .svc .pr {
      font-weight: 700;
      font-variant-numeric: tabular-nums;
    }

    .sig {
      width: 100%;
      height: 120px;
      border: 1.5px dashed var(--line-strong);
      border-radius: var(--radius-md);
      background: #FFFFFF;
      touch-action: none;
      display: block;
    }

    .rhead {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px;
      border-radius: var(--radius-md);
      background: var(--surface-200);
      border: 1px solid var(--line);
    }

    .rlist {
      margin: 6px 0 0;
      padding-left: 18px;
      font-size: 14px;
      line-height: 1.5;
    }

    /* Photo previews, checkin gallery & lightbox */
    .mini-thumb {
      width: 48px;
      height: 36px;
      object-fit: cover;
      border-radius: var(--radius-sm);
      cursor: pointer;
      border: 1.5px solid var(--line-strong);
    }

    .thumb-link {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      color: var(--ember-strong);
      font-size: 12.5px;
      font-weight: 600;
      border: 0;
      background: none;
      cursor: pointer;
      padding: 0;
    }

    .thumb-link img {
      width: 36px;
      height: 28px;
      object-fit: cover;
      border-radius: var(--radius-sm);
    }

    .sig-thumb {
      max-width: 100%;
      height: 60px;
      object-fit: contain;
      border-radius: var(--radius-sm);
      border: 1px solid var(--line);
      background: #FFFFFF;
    }

    /* Service Brand Pricing Chips */
    .sf-brands-list .chip {
      transition: background 0.15s ease;
    }

    .sf-brands-list .chip:hover {
      border-color: var(--ember-strong);
    }
/* ==========================================================================
   APP SHELL
   Desktop: black sidebar + white top bar. Tablet: icon rail.
   Phone: black top bar, slide-out drawer and bottom tabs.
   ========================================================================== */
:root {
  --side-w: 248px;
}

.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--surface-100);
}

.col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* --- sidebar --- */
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 12px;
  background: var(--badge);
  color: var(--on-badge);
}

.side .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  min-width: 0;
  color: var(--on-badge);
}

.side .brand .tagline {
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
  letter-spacing: 0.2em;
}

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

.snav .grp {
  padding: 16px 12px 4px;
  font: 600 12px/16px 'Inter', sans-serif;
  color: rgba(255, 255, 255, 0.55);
}

.nv {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  color: #D4D4D0;
  font: 500 15px/22px 'Inter', sans-serif;
  white-space: nowrap;
}

.nv:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.06);
}

.nv.on {
  background: #262626;
  color: #FFFFFF;
  font-weight: 600;
}

.nv.on svg {
  color: var(--ember);
}

.org {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: #262626;
}

.org:empty {
  display: none;
}

.org .ava {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--radius-md);
  background: var(--ember-strong);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  font: italic 800 13px/1 'Saira', sans-serif;
}

.org .who {
  flex: 1;
  min-width: 0;
}

.org .who b,
.org .who small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org .who b {
  font-size: 13px;
  line-height: 18px;
}

.org .who small {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.org .iconbtn {
  width: 36px;
  height: 36px;
  color: #D4D4D0;
}

/* --- top bar --- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 24px;
  background: var(--surface-100);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.top .ctx {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top .menu,
.top .mname {
  display: none;
}

.top .iconbtn {
  color: var(--ink);
}

.top .iconbtn:hover {
  background: var(--surface-300);
}

.top .iconbtn .dot {
  border-color: var(--surface-100);
}

.top .avatar {
  background: var(--badge);
  color: #FFFFFF;
}

main {
  width: 100%;
  max-width: 1180px;
  padding: 12px 24px 96px;
}

.tiles {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* Bottom tabs and drawer exist only on phones */
nav.tabs,
.dscrim {
  display: none;
}

/* Sheets open over the content column, not the sidebar */
.sheet {
  left: var(--side-w);
  max-width: 640px;
}

.fab {
  right: 24px;
  bottom: 24px;
}

.toast {
  left: calc(50% + var(--side-w) / 2);
  bottom: 24px;
}

body.signed-out .app {
  display: block;
}

body.signed-out .side,
body.signed-out .top {
  display: none;
}

/* --- tablet: icon rail --- */
@media (max-width: 1024px) {
  :root {
    --side-w: 72px;
  }

  .side {
    align-items: center;
    padding: 12px;
  }

  .side .brand {
    padding: 0 0 12px;
  }

  .side .brand-text,
  .snav .grp,
  .nv span,
  .org .who,
  .org .iconbtn {
    display: none;
  }

  .nv {
    width: 48px;
    justify-content: center;
    padding: 0;
  }

  .org {
    padding: 6px;
    background: none;
  }

  main {
    padding: 12px 16px 96px;
  }

  .top {
    padding: 10px 16px;
  }
}

/* --- phone: black top bar, drawer, bottom tabs --- */
@media (max-width: 700px) {
  :root {
    --side-w: 0px;
  }

  .app {
    display: block;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }

  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(300px, 86vw);
    height: auto;
    align-items: stretch;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 12px 16px;
    transform: translateX(-102%);
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .side .brand-text,
  .snav .grp,
  .nv span,
  .org .who,
  .org .iconbtn {
    display: block;
  }

  .org .iconbtn {
    display: grid;
  }

  .nv {
    width: auto;
    justify-content: flex-start;
    padding: 0 12px;
  }

  .org {
    padding: 10px;
    background: #262626;
  }

  body.drawer .side {
    transform: none;
  }

  .dscrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 39;
    background: var(--scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.drawer .dscrim {
    opacity: 1;
    pointer-events: auto;
  }

  .top {
    top: env(safe-area-inset-top, 0px);
    gap: 6px;
    min-height: 56px;
    padding: 8px 8px 8px 4px;
    background: var(--badge);
    color: var(--on-badge);
    border-bottom: 1px solid #1c1c1c;
  }

  .top .menu {
    display: grid;
  }

  .top .mname {
    display: block;
    flex: 1;
    min-width: 0;
    font: italic 800 20px/1.1 'Saira', sans-serif;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top .ctx {
    display: none;
  }

  .top .iconbtn {
    color: #FFFFFF;
  }

  .top .iconbtn:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .top .iconbtn .dot {
    border-color: var(--badge);
  }

  .top .avatar {
    background: var(--surface-300);
    color: var(--badge);
  }

  main {
    padding: 4px 16px 24px;
  }

  nav.tabs {
    display: block;
  }

  body.signed-out nav.tabs {
    display: none;
  }

  .sheet {
    left: 0;
    max-width: 520px;
  }

  .fab {
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .toast {
    left: 50%;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
}

body.signed-out main {
  max-width: none;
  padding: 0;
}

/* Shell fixes: brand must not stretch in the vertical sidebar; active and
   footer fills must stay visible when the sidebar is dark grey (dark mode). */
.side .brand {
  flex: none;
}

.nv.on,
.org {
  background: rgba(255, 255, 255, 0.1);
}

.top .avatar,
.org .ava {
  background: var(--ember-strong);
  color: var(--on-ember);
}

/* "Next pickup" feature card (inner styles were missing) */
.feature {
  padding: var(--space-4);
}

.feature .who {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
}

.feature .who b {
  display: block;
  font-size: 16px;
  font-weight: 600;
}

.feature .who small {
  display: block;
}

.feature .money {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
  padding: 12px;
  background: var(--surface-300);
  border-radius: var(--radius-md);
}

.money span {
  display: block;
}

.money b {
  font-size: 15px;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   CAR PHOTO: job card image, picker, jobsheet photo
   -------------------------------------------------------------------------- */
.jrow.has-img {
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.jr-img {
  flex: none;
  align-self: center;
  width: 184px;
  height: 120px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-300);
  border: 1px solid var(--line);
}

.jr-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.jr-img.none {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink-muted);
  border-style: dashed;
  border-color: var(--line-strong);
}

.jr-img.none small {
  font-size: 12px;
  color: var(--ink-muted);
}

.jr-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.carpick {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.carpick img,
.carphoto img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

.carpick-empty {
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 132px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-200);
  color: var(--ink-muted);
  text-align: center;
}

.carpick-empty svg {
  color: var(--ember-strong);
}

.carpick-empty b {
  color: var(--ink);
  font-size: 15px;
  text-transform: none;
  letter-spacing: 0;
}

.carpick-empty small {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.carpick-empty:hover {
  border-color: var(--ember-strong);
}

.carpick-act {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.carphoto {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.carphoto .ph-preview {
  display: block;
  width: 100%;
  padding: 0;
}

@media (max-width: 700px) {
  .jrow.has-img {
    flex-direction: column;
    gap: 12px;
  }

  .jr-img {
    align-self: stretch;
    width: 100%;
    height: 150px;
  }

  .jr-img.none {
    display: none;
  }
}

.carpick-act label.btn {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--ink);
}

/* Key/value rows in the jobsheet details box (were missing) */
.box {
  padding: 12px var(--space-4);
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  font-size: 13.5px;
}

.kv span {
  color: var(--ink-muted);
}

.kv b {
  font-weight: 600;
  text-align: right;
}

/* Car photo on the Today "Next pickup" card */
.feature.has-img {
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.feature .jr-img {
  align-self: stretch;
  width: 300px;
  height: auto;
  min-height: 180px;
  padding: 0;
  cursor: zoom-in;
}

.feature .jr-img.none {
  cursor: default;
}

@media (max-width: 900px) {
  .feature .jr-img {
    width: 200px;
  }
}

@media (max-width: 700px) {
  .feature.has-img {
    flex-direction: column;
    gap: 12px;
  }

  .feature .jr-img {
    width: 100%;
    height: 170px;
    min-height: 0;
  }
}

/* The photo fills the card's height; it never sets it. */
.feature .jr-img {
  position: relative;
}

.feature .jr-img img {
  position: absolute;
  inset: 0;
}

@media (max-width: 700px) {
  .feature .jr-img img {
    position: static;
  }
}

/* ==========================================================================
   PHOTO THUMBNAILS + FULL-SCREEN VIEWER (restored; lost in the design-system rewrite)
   ========================================================================== */
.photos { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; min-width: 0; }
.photo-item { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; min-width: 0; }
.ph-preview { position: relative; display: block; width: 100%; aspect-ratio: 4/3; padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--sunk); cursor: zoom-in; }
.ph-img, .ph-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ph-name { font-size: 12px; font-weight: 600; line-height: 1.1; color: var(--ink2); text-align: center; }
.ph-empty { cursor: pointer; color: var(--ink3); }
.step-photo-item { width: min(112px, 100%); align-items: flex-start; margin-top: 8px; }
.step-photo-item .ph-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carphoto .ph-preview { aspect-ratio: auto; }

.lightbox { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 16px; padding-top: calc(16px + env(safe-area-inset-top, 0px)); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.lightbox.on { display: flex; }
.lb-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .86); backdrop-filter: blur(4px); }
.lb-card { position: relative; z-index: 1; display: flex; flex-direction: column; width: min(100%, 960px); max-height: 100%; overflow: hidden; border: 1px solid rgba(255, 255, 255, .16); border-radius: var(--radius-lg); background: #0B0B0B; box-shadow: 0 24px 80px rgba(0, 0, 0, .5); }
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; min-height: 54px; padding: 8px 12px 8px 16px; color: #fff; }
.lb-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-actions { display: flex; align-items: center; gap: 8px; }
.lb-btn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid rgba(255, 255, 255, .2); border-radius: 10px; background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; text-decoration: none; }
.lb-btn:hover { background: rgba(255, 255, 255, .16); }
.lb-body { display: grid; flex: 1; min-height: 0; place-items: center; overflow: auto; padding: 0 12px 12px; }
.lb-img { display: block; max-width: 100%; max-height: calc(100vh - 160px); width: auto; height: auto; object-fit: contain; border-radius: 8px; }
.lb-foot { display: flex; flex: none; justify-content: center; padding: 10px 12px 12px; border-top: 1px solid rgba(255, 255, 255, .14); }
.lb-replace { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px; background: var(--ember); color: #fff; font-weight: 600; cursor: pointer; }

/* Weekly collections chart (Today screen): fixed-size HTML bars, so text does not scale with screen width */
.chart { padding: 16px 18px 14px; }
.chart-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.chart-h .num { font-size: 20px; }
.chart-h small { color: var(--ink3); }
.wkbars { display: flex; gap: 10px; height: 190px; margin-top: 12px; padding-top: 22px; }
.wkcol { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.wktrack { flex: 1; width: 100%; max-width: 64px; display: flex; align-items: flex-end; }
.wkbar { position: relative; width: 100%; border-radius: 8px; background: var(--pri-mid); }
.wkcol.now .wkbar { background: var(--pri); }
.wkv { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px; font-size: 12px; font-weight: 700; color: var(--ink3); white-space: nowrap; }
.wkcol.now .wkv { color: var(--ink); font-weight: 800; }
.wkd { margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--ink3); }

/* Sidebar: Carthick logo replaces the generic mark and studio name */
.side .brand .mark,
.side .brand .brand-text { display: none; }
.side .brand { justify-content: center; padding: 8px 8px 18px; }
.side .brand-logo { display: block; width: 100%; max-width: 210px; height: auto; }
.side .brand-mini { display: none; width: 40px; height: 40px; }
@media (max-width: 1024px) {
  .side .brand-logo { display: none; }
  .side .brand-mini { display: block; }
}
@media (max-width: 700px) {
  .side .brand-logo { display: block; max-width: 200px; }
  .side .brand-mini { display: none; }
}

/* Login: Carthick logo above the form */
.login-logo { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto 18px; }
