:root {
  --graphite: #15171C;
  --steel: #23272F;
  --steel-2: #2E333D;
  --sidebar-text: #C9CDD6;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --primary: #F25C05;
  --primary-hover: #D94F00;
  --primary-text: #B84400;
  --primary-soft: #FFF1E8;
  --on-primary: #15171C;
  --on-primary-hover: #000000;
  --amber: #FFB020;
  --amber-soft: #FFF6E0;
  --text: #15171C;
  --muted: #5B6270;
  --line: #E3E5EA;
  --line-strong: #C9CDD6;
  --field: #FFFFFF;
  --hover: #F0F1F4;
  --focus: #2563EB;
  --danger: #C62828;
  --danger-soft: #FDECEC;
  --danger-line: #F3B4B4;
  --success: #15803D;
  --success-soft: #E8F6EE;
  --info-soft: #EEF3FF;
  --whatsapp: #15803D;
  --overlay: rgba(21, 23, 28, 0.5);
  --shadow: rgba(21, 23, 28, 0.08);
  --print-ink: #000000;
  --print-paper: #FFFFFF;
  --print-grey: #555555;
  --print-line: #BBBBBB;
  --status-received: #3B82F6;
  --status-in-progress: #F59E0B;
  --status-waiting-parts: #8B5CF6;
  --status-ready: #16A34A;
  --status-delivered: #6B7280;
  --status-received-text: #1D4ED8;
  --status-in-progress-text: #92400E;
  --status-waiting-parts-text: #6D28D9;
  --status-ready-text: #166534;
  --status-delivered-text: #4B5563;
}
/* Garage app — the only stylesheet. Colors come ONLY from the :root block generated from config/brand.json
   (prepended at build time). No color values in this file. Mobile-first, RTL-first (logical properties). */

@font-face { font-family: "Plex Arabic"; src: url(/static/fonts-plex-arabic-400-woff2.6010e7fd0d.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Plex Arabic"; src: url(/static/fonts-plex-arabic-600-woff2.16734a5adb.woff2) format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Plex Arabic"; src: url(/static/fonts-plex-arabic-700-woff2.04c730b429.woff2) format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Plex Arabic"; src: url(/static/fonts-plex-latin-400-woff2.9ed8dcb02e.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+2013-2014, U+2018-201E, U+2022, U+20AC, U+2122; }
@font-face { font-family: "Plex Arabic"; src: url(/static/fonts-plex-latin-600-woff2.63f4757271.woff2) format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+2013-2014, U+2018-201E, U+2022, U+20AC, U+2122; }
@font-face { font-family: "Plex Arabic"; src: url(/static/fonts-plex-latin-700-woff2.ae2d59f91e.woff2) format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+2013-2014, U+2018-201E, U+2022, U+20AC, U+2122; }

:root {
  --radius: 12px;
  --radius-sm: 8px;
  --gap: 16px;
  --touch: 44px;
  --sidebar-w: 240px;
  --topbar-h: 64px;
  --tabbar-h: 64px;
  --shadow-1: 0 1px 2px var(--shadow), 0 1px 1px var(--shadow);
  --shadow-2: 0 8px 24px var(--shadow);
  font-family: "Plex Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.55; overflow-x: hidden; }
img, svg { display: inline-block; vertical-align: middle; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; line-height: 1.3; margin: 0; font-weight: 700; }
h2 { font-size: 1.1rem; margin: 0; font-weight: 700; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 1rem; margin: 0 0 6px; font-weight: 600; }
p { margin: 0 0 8px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; z-index: 100; background: var(--card); color: var(--text); padding: 8px 12px; border-radius: var(--radius-sm); }
.skip:focus { top: 8px; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic.big { width: 44px; height: 44px; stroke-width: 1.5; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 700; color: var(--text); }
.danger-text { color: var(--danger); }
.push { margin-inline-start: auto; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link { font-weight: 600; font-size: .9rem; }
.hint { color: var(--muted); font-size: .85rem; margin: 2px 0 8px; }
.empty { color: var(--muted); padding: 10px 0; }

/* ---------- app shell ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: var(--graphite); color: var(--card); }
.top-brand { display: flex; align-items: center; gap: 8px; color: var(--card); font-weight: 700; white-space: nowrap; }
.top-brand:hover { text-decoration: none; }
.top-brand img { border-radius: 8px; }
.top-brand span { display: none; }
.top-lang { display: none; }
.global-search { position: relative; flex: 1; max-width: 640px; }
.global-search .search-ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.global-search input { width: 100%; height: 44px; border-radius: 22px; border: 1px solid var(--steel-2); background: var(--card); color: var(--text);
  padding-inline: 42px 14px; font: inherit; }
.search-pop { position: absolute; top: calc(100% + 6px); inset-inline: 0; background: var(--card); color: var(--text); border-radius: var(--radius);
  box-shadow: var(--shadow-2); border: 1px solid var(--line); overflow: hidden; max-height: 70vh; overflow-y: auto; z-index: 40; }
.sr-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.sr-item:last-child { border-bottom: 0; }
.sr-item.active, .sr-item:hover { background: var(--hover); }
.sr-main { flex: 1; min-width: 0; color: var(--text); display: flex; flex-direction: column; padding: 4px 0; min-height: var(--touch); justify-content: center; }
.sr-main:hover { text-decoration: none; }
.sr-sub { color: var(--muted); font-size: .85rem; }
.sr-empty { padding: 14px; display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; color: var(--muted); }

.sidebar { display: none; }
.main { padding: 16px 16px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); max-width: 1280px; margin: 0 auto; }

.tabbar { position: fixed; bottom: 0; inset-inline: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--graphite); border-top: 1px solid var(--steel-2); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--sidebar-text); font-size: .75rem; min-height: var(--touch); }
.tabbar a:hover { text-decoration: none; }
.tabbar a.active { color: var(--primary); }
.tabbar .ic { width: 24px; height: 24px; }

.sheet { position: fixed; inset: 0; z-index: 50; background: var(--overlay); display: flex; align-items: flex-end; }
.sheet-panel { width: 100%; background: var(--graphite); border-radius: 16px 16px 0 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); display: grid; gap: 4px; }
.sheet-panel a, .sheet-panel button, .side-nav a, .side-foot a, .side-foot button {
  display: flex; align-items: center; gap: 12px; min-height: var(--touch); padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font: inherit; background: none; border: 0; cursor: pointer; text-align: start; width: 100%; }
.sheet-panel a:hover, .sheet-panel button:hover, .side-nav a:hover, .side-foot a:hover, .side-foot button:hover { background: var(--steel); color: var(--card); text-decoration: none; }

@media (min-width: 640px) {
  .top-brand span { display: inline; }
}
@media (min-width: 1024px) {
  .sidebar { display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: var(--sidebar-w);
    background: var(--graphite); color: var(--sidebar-text); padding: 16px 12px; z-index: 35; overflow-y: auto; }
  .side-brand { display: flex; align-items: center; gap: 10px; color: var(--card); font-weight: 700; font-size: 1.1rem; padding: 4px 8px 20px; }
  .side-brand:hover { text-decoration: none; }
  .side-brand img { border-radius: 10px; }
  .side-nav { display: grid; gap: 2px; }
  .side-nav a.active { background: var(--steel); color: var(--card); box-shadow: inset 3px 0 0 var(--primary); }
  [dir="rtl"] .side-nav a.active { box-shadow: inset -3px 0 0 var(--primary); }
  .side-nav a.active .ic { color: var(--primary); }
  .side-foot { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid var(--steel-2); padding-top: 10px; }
  .topbar, .main { margin-inline-start: var(--sidebar-w); }
  .topbar { padding: 0 24px; }
  .top-brand { display: none; }
  .top-lang { display: block; }
  .top-lang .lang-link { color: var(--sidebar-text); display: flex; gap: 6px; align-items: center; min-height: var(--touch); }
  .tabbar { display: none; }
  .main { padding: 24px 24px 48px; max-width: calc(1280px + var(--sidebar-w)); }
}

/* ---------- page structure ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 16px; min-height: var(--touch); }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section { margin-bottom: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 20px 0 10px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-1); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; gap: 0 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.toc { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.toc a { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 8px 14px; color: var(--text); min-height: var(--touch); display: inline-flex; align-items: center; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--touch); padding: 8px 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; position: relative; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--card); }
.btn.wa { background: var(--whatsapp); border-color: var(--whatsapp); color: var(--card); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--hover); }
.btn.small { min-height: var(--touch); padding: 4px 12px; font-size: .9rem; }
.btn.big { min-height: 52px; padding: 10px 22px; font-size: 1.05rem; }
.btn.block { width: 100%; }
.btn.icon-only { padding: 4px; min-width: var(--touch); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; min-width: var(--touch); min-height: var(--touch); border: 0; background: none;
  color: var(--muted); border-radius: var(--radius-sm); cursor: pointer; }
.icon-btn:hover { background: var(--danger-soft); color: var(--danger); }
/* busy: spinner replaces the icon, clicks ignored */
.is-busy { pointer-events: none; }
.is-busy > .ic { visibility: hidden; }
.is-busy::after { content: ""; position: absolute; inset-inline-start: 12px; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .6s linear infinite; }
.btn.small.is-busy::after { inset-inline-start: 8px; width: 14px; height: 14px; }
.is-busy:not(:has(> .ic)) { color: transparent !important; }
.is-busy:not(:has(> .ic))::after { inset-inline-start: calc(50% - 8px); border-color: var(--text); border-inline-end-color: transparent; }
.btn.primary.is-busy:not(:has(> .ic))::after { border-color: var(--on-primary); border-inline-end-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Tap feedback on everything tappable (phones show no hover). */
a, button, .pick, .chip, label.check { -webkit-tap-highlight-color: transparent; }
.pick:active, .chip:active, .sr-item:active, .tabbar a:active, .sheet-panel a:active, .toc a:active { background: var(--hover); }
.icon-btn:active { background: var(--danger-soft); }

/* ---------- in-page dialog (confirm / message) ---------- */
.dlg { border: 0; border-radius: var(--radius); padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--card); color: var(--text);
  box-shadow: var(--shadow-2); }
.dlg::backdrop { background: var(--overlay); }
.dlg-body { padding: 20px; display: grid; gap: 12px; }
.dlg-body p { margin: 0; font-size: 1.05rem; line-height: 1.6; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dlg-actions .btn { flex: 1 1 140px; min-height: 48px; }
@media (max-width: 719px) { .dlg { margin-bottom: max(16px, env(safe-area-inset-bottom)); margin-top: auto; } }

/* ---------- forms ---------- */
.form-section { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.form-section legend { font-weight: 700; font-size: 1.05rem; padding: 0; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.form-section + .form-section { border-top: 1px solid var(--line); padding-top: 16px; }
.form-grid { display: grid; gap: 0 16px; }
@media (min-width: 720px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
.field { margin-bottom: 14px; min-width: 0; }
label, .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.big-label { font-size: 1rem; margin-bottom: 8px; }
.req { color: var(--danger); }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--field); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 9px 12px; min-height: var(--touch); }
textarea { resize: vertical; min-height: 64px; }
select.auto { width: auto; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); margin: 0; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 400; min-height: var(--touch); margin: 0; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); background: var(--danger-soft); }
.field .err { color: var(--danger); font-size: .85rem; margin-top: 4px; }
.field .err:empty { display: none; }
/* 16px+ in every field: iPhone does not zoom in when a field is tapped. Focused fields stay clear of the
   sticky header and the keyboard when the browser scrolls them into view. */
input, select, textarea { font-size: max(16px, 1em); scroll-margin-block: calc(var(--topbar-h) + 16px) 96px; }
.hint.warn-text { color: var(--danger); font-weight: 600; }
/* Kuwait mobile: "+965" shown in front of the 8 digits (typed as "XXXX XXXX"). */
.phone-field { display: flex; align-items: stretch; width: 100%; }
.phone-prefix { display: flex; align-items: center; padding-inline: 10px; background: var(--bg); border: 1px solid var(--line-strong);
  border-inline-end: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); font-weight: 600; white-space: nowrap; }
.phone-field input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; min-width: 0; }
.draft-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px;
  padding: 8px 12px; border-radius: var(--radius-sm); background: var(--amber-soft); border: 1px solid var(--amber); font-size: .9rem; }
#offline-bar { position: fixed; top: 0; inset-inline: 0; z-index: 70; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px calc(8px); padding-top: calc(8px + env(safe-area-inset-top)); background: var(--danger); color: var(--card);
  font-weight: 600; font-size: .9rem; text-align: center; }
#offline-bar[hidden] { display: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.form-actions .btn.primary { min-height: 52px; padding-inline: 28px; font-size: 1.05rem; }
.sticky-actions { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px); z-index: 5; }
.sticky-actions { background: inherit; padding-block: 8px; margin-bottom: -8px; }
@media (min-width: 1024px) { .sticky-actions { bottom: 0; } }
/* Keyboard open (phones/tablets): no tab bar or floating messages; Save sits right above the keyboard. */
.kb-open .tabbar, .kb-open #toast, .kb-open .fab { display: none; }
.kb-open .main { padding-bottom: calc(var(--kb-inset, 0px) + 96px); }
.kb-open .sticky-actions { bottom: calc(var(--kb-inset, 0px) + 4px); }
.search-field { position: relative; }
.search-field .ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-field input { padding-inline-start: 42px; font-size: 1.1rem; min-height: 52px; }
.line-form { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; align-items: end; margin-top: 16px; }
.line-form .desc, .line-form .full { grid-column: 1 / -1; }
.line-form > .btn { margin-bottom: 14px; }
@media (min-width: 900px) { .line-form { grid-template-columns: 3fr 1.3fr .8fr 1.2fr auto; } .line-form .desc { grid-column: auto; } }
.inline-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.inline-add input { flex: 1 1 200px; width: auto; }
.logo-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.logo-row img { border-radius: 12px; border: 1px solid var(--line); background: var(--card); object-fit: contain; }
.logo-row input { width: auto; max-width: 100%; }
.range-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.range-form .field { margin: 0; }
.range-form .chips { margin: 0; }

/* chips & filters */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.tight { margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: var(--touch); padding: 6px 14px; border-radius: 20px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; font-weight: 400; margin: 0; }
.chip:hover { border-color: var(--primary); }
.chip.on, .chip:has(input:checked) { background: var(--graphite); color: var(--card); border-color: var(--graphite); }
.chip input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.chip:focus-within { outline: 3px solid var(--focus); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter { min-height: var(--touch); padding: 6px 14px; border-radius: 20px; border: 1px solid var(--line-strong); background: var(--card); font: inherit; cursor: pointer; color: var(--text);
  border-inline-start-width: 4px; }
.filter.on { background: var(--graphite); color: var(--card); border-color: var(--graphite); }
.tag-list { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 4px; }
.tag-list li { display: flex; align-items: center; gap: 8px; padding: 2px 0 2px 0; border-bottom: 1px dashed var(--line); }
.tag-list li .icon-btn { margin-inline-start: auto; }

/* ---------- status colors (one place) ---------- */
.st-received { --st: var(--status-received); --st-text: var(--status-received-text); }
.st-in_progress { --st: var(--status-in-progress); --st-text: var(--status-in-progress-text); }
.st-waiting_parts { --st: var(--status-waiting-parts); --st-text: var(--status-waiting-parts-text); }
.st-ready { --st: var(--status-ready); --st-text: var(--status-ready-text); }
.st-delivered { --st: var(--status-delivered); --st-text: var(--status-delivered-text); }
.filter[class*="st-"] { border-inline-start-color: var(--st); }

/* ---------- badges ---------- */
.badge { display: inline-flex; max-width: 100%; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  white-space: nowrap; background: var(--hover); color: var(--text); border: 1px solid var(--line); line-height: 1.6; }
.badge.wrap { white-space: normal; border-radius: 12px; }
.badge[class*="st-"] { background: color-mix(in srgb, var(--st) 14%, var(--card)); color: var(--st-text); border-color: color-mix(in srgb, var(--st) 40%, var(--card)); }
.badge.pay-paid, .badge.rem-sent { background: var(--success-soft); color: var(--success); border-color: var(--success-soft); }
.badge.pay-partial, .badge.sev-soon, .badge.rem-scheduled, .badge.oil { background: var(--amber-soft); color: var(--status-in-progress-text); border-color: var(--amber-soft); }
.badge.pay-unpaid, .badge.sev-urgent, .badge.rem-failed { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.badge.sev-note, .badge.rem-skipped, .badge.rem-cancelled { background: var(--hover); color: var(--muted); }
.plate { display: inline-block; font-weight: 700; direction: ltr; unicode-bidi: isolate; letter-spacing: .5px; border: 2px solid var(--text);
  border-radius: 6px; padding: 0 8px; background: var(--card); color: var(--text); line-height: 1.5; font-variant-numeric: tabular-nums; }
.plate.big { font-size: 1.15rem; padding: 2px 10px; }

/* ---------- alerts ---------- */
.alert { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; border: 1px solid; }
.alert.danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--text); border-inline-start: 5px solid var(--danger); }
.alert.danger h3 { color: var(--danger); display: flex; align-items: center; gap: 8px; }
.alert.info { background: var(--card); border-color: var(--line-strong); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.alert.info .btn { margin-inline-start: auto; }
.alert.warn { background: var(--amber-soft); border-color: var(--amber); color: var(--text); }
.alert.ok { background: var(--success-soft); border-color: var(--success-soft); color: var(--success); display: flex; gap: 8px; align-items: center; }
.alert ul { margin: 6px 0 0; padding-inline-start: 18px; }
.alert li { margin: 8px 0; }
.declined-box li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.declined-box li .btn { margin-inline-start: auto; }

/* ---------- stats (dashboard / reports) ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .stats { grid-template-columns: repeat(5, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; grid-template-columns: auto 1fr;
  grid-template-areas: "ic label" "val val"; gap: 6px 10px; align-items: center; color: var(--text); box-shadow: var(--shadow-1);
  border-top: 4px solid var(--graphite); min-height: 104px; }
a.stat:hover { text-decoration: none; border-color: var(--line-strong); }
.stat-ic { grid-area: ic; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--hover); }
.stat-label { grid-area: label; color: var(--muted); font-size: .88rem; font-weight: 600; }
.stat-value { grid-area: val; font-size: 1.6rem; line-height: 1.1; font-weight: 700; text-align: start; }
.stat-ready { border-top-color: var(--status-ready); }
.stat-amber { border-top-color: var(--amber); }
.stat-danger { border-top-color: var(--danger); }
.stats > .stat:first-child { border-top-color: var(--primary); }

/* ---------- board (cars by status) ---------- */
.board { display: grid; gap: 12px; }
@media (min-width: 720px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .board { grid-template-columns: repeat(4, 1fr); } }
.board.filtered { grid-template-columns: 1fr; }
.board-col { background: color-mix(in srgb, var(--st) 6%, var(--bg)); border-radius: var(--radius); padding: 10px; border-top: 4px solid var(--st); min-height: 120px; }
.board-col h3 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.board-col .count { font-weight: 700; color: var(--muted); }
.car-card { background: var(--card); border: 1px solid var(--line); border-inline-start: 4px solid var(--st); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 8px; display: grid; gap: 4px; }
.car-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.car-card .days { font-size: .78rem; color: var(--muted); }
.car-card-model { font-weight: 600; }
.car-card .btn { margin-top: 4px; }
.board.filtered .board-col { display: block; }
.board.filtered .board-col > article { display: inline-grid; width: 100%; }
@media (min-width: 720px) { .board.filtered .board-col { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
  .board.filtered .board-col h3, .board.filtered .board-col > p { grid-column: 1 / -1; } }

/* ---------- lists ---------- */
.rows { list-style: none; padding: 0; margin: 0; }
.row-item { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: 0; }
.row-main { min-width: 0; }
.row-side { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pick-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.pick { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; width: 100%; min-height: 52px; padding: 8px 12px; text-align: start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); font: inherit; cursor: pointer; }
.pick:hover { border-color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.top-list { margin: 0; padding-inline-start: 22px; }
.top-list li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 12px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; } /* contains .sr labels */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; background: var(--bg); white-space: nowrap; }
td.num, th.num { text-align: end; }
td.actions { white-space: nowrap; }
input.cell { width: 5.5rem; min-height: var(--touch); padding: 4px 8px; text-align: end; }
input.cell.wide { width: 7.5rem; }
input.cell-wide { min-width: 14rem; }
/* Phones: every table becomes a list of cards (label from the column header on each value). */
@media (max-width: 719px) {
  .table-wrap { overflow: visible; }
  .table-wrap table, .table-wrap tbody { display: block; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-wrap tr { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .table-wrap td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 0; border: 0; text-align: start; min-width: 0; }
  .table-wrap td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; flex: none; }
  .table-wrap td[data-label=""]::before, .table-wrap td:not([data-label])::before { display: none; }
  .table-wrap td:first-child { font-weight: 600; font-size: 1rem; }
  .table-wrap td:first-child::before { display: none; }
  .table-wrap td.empty, .table-wrap td[colspan] { display: block; text-align: center; }
  .table-wrap td[data-label=""]:last-child:has(button, a.btn) { justify-content: flex-end; }
  .table-wrap input.cell-wide { min-width: 0; width: 100%; }
}
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; max-width: 360px; margin-inline-start: auto; margin-top: 16px; }
.totals .grand { font-weight: 700; font-size: 1.2rem; border-top: 2px solid var(--text); padding-top: 6px; }

/* ---------- summary cards, facts, cars, timeline ---------- */
.summary-card { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; border-inline-start: 5px solid var(--primary); }
.summary-main { display: grid; gap: 4px; min-width: 0; }
.summary-title { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 1.1rem; }
.summary-side { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.contact { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px 16px; margin: 0; }
.facts div { min-width: 0; }
.facts .wide { grid-column: 1 / -1; }
.facts dt { color: var(--muted); font-size: .8rem; font-weight: 600; }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.facts.compact { grid-template-columns: 1fr; gap: 6px; margin: 8px 0; }
.facts.compact div { display: flex; justify-content: space-between; gap: 8px; }
.cars-grid { display: grid; gap: 12px; margin-bottom: 16px; }
@media (min-width: 720px) { .cars-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .cars-grid { grid-template-columns: repeat(3, 1fr); } }
.car-tile { margin: 0; display: grid; gap: 6px; }
.car-tile-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.open-visit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.tl-item { position: relative; padding: 4px 0 14px; padding-inline-start: 24px; display: grid; gap: 4px; }
.tl-item::before { content: ""; position: absolute; inset-inline-start: 5px; top: 10px; bottom: -4px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-item::after { content: ""; position: absolute; inset-inline-start: 0; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--st); border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--st); }
.tl-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tl-item .ic { width: 16px; height: 16px; }

/* ---------- job card: stages & ready ---------- */
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; counter-reset: st; }
.stage button, .stage .stage-inner { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; background: none; border: 0; font: inherit;
  color: var(--muted); padding: 6px 2px; min-height: 64px; border-radius: var(--radius-sm); cursor: default; text-align: center; }
.stage button { cursor: pointer; }
.stage button:hover { background: var(--hover); }
.stage .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  border: 2px solid var(--line-strong); background: var(--card); color: var(--muted); }
.stage .dot .ic { width: 16px; height: 16px; }
.stage .lbl { font-size: .72rem; line-height: 1.25; }
.stage.done .dot { background: var(--st); border-color: var(--st); color: var(--card); }
.stage.current .dot { background: var(--st); border-color: var(--st); color: var(--card); box-shadow: 0 0 0 4px color-mix(in srgb, var(--st) 25%, var(--card)); }
.stage.current .lbl { color: var(--text); font-weight: 700; }
@media (min-width: 720px) { .stage .lbl { font-size: .85rem; } }
.stage-card { padding-bottom: 8px; }
.ready-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- reports ---------- */
.split-bar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--hover); margin: 4px 0 12px; }
.split-parts { background: var(--graphite); }
.split-labour { background: var(--primary); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 6px; }
.key-parts { background: var(--graphite); }
.key-labour { background: var(--primary); }

/* ---------- empty / skeleton / toast ---------- */
.empty-state { text-align: center; color: var(--muted); padding: 28px 12px; display: grid; justify-items: center; gap: 10px; }
.empty-state p { margin: 0; }
.skeleton-lines, .skeleton-board, .skeleton-row, .skeleton-doc { background: linear-gradient(90deg, var(--hover) 25%, var(--line) 50%, var(--hover) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: var(--radius-sm); }
.skeleton-lines { min-height: 88px; }
.skeleton-board { min-height: 240px; }
.skeleton-row { height: 44px; }
.skeleton-doc { min-height: 60vh; }
.skeleton-text { min-width: 6ch; color: transparent; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
#toast { position: fixed; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); inset-inline: 16px; margin: 0 auto; max-width: 440px; z-index: 60;
  background: var(--graphite); color: var(--card); padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow-2); text-align: center;
  opacity: 0; transform: translateY(8px); transition: opacity .15s, transform .15s; pointer-events: none; }
#toast.show { opacity: 1; transform: none; }
#toast.error { background: var(--danger); }
@media (min-width: 1024px) { #toast { bottom: 24px; } }

/* ---------- login / setup ---------- */
.bare-main { min-height: 100vh; }
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; background: var(--graphite); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 16px; padding: 32px 24px 20px; box-shadow: var(--shadow-2); text-align: center; }
.login-logo { border-radius: 18px; margin-bottom: 8px; }
.login-card h1 { margin-bottom: 4px; }
.error-card { display: grid; gap: 10px; }
.forgot-link { display: block; text-align: center; margin-top: 14px; font-weight: 600; }
.login-card .btn.ghost.block { margin-top: 12px; }
.pw-meter { font-size: .85rem; margin-top: 4px; min-height: 1.2em; }
.pw-meter.weak { color: var(--danger); }
.pw-meter.strong { color: var(--success); font-weight: 600; }
.error-card .login-logo { margin: 0 auto; }
.error-code { font-size: 2.4rem; font-weight: 700; color: var(--primary-text); margin: 0; line-height: 1; }
.error-code .ic { width: 44px; height: 44px; color: var(--danger); }
.login-card .alert { text-align: start; margin: 16px 0 0; }
.login-card form { text-align: start; margin-top: 20px; }
.login-lang { margin-top: 12px; }
.login-lang .lang-link, .setup-lang .lang-link { display: inline-flex; gap: 6px; align-items: center; min-height: var(--touch); color: var(--muted); }
.powered { color: var(--sidebar-text); font-size: .8rem; margin-top: 16px; }
.setup { max-width: 860px; margin: 0 auto; padding: 24px 16px 48px; }
.setup-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.setup-head img { border-radius: 14px; }
.setup-lang { margin-inline-start: auto; }

/* ---------- print pages (invoice, job card, history) ---------- */
.layout-print { background: var(--bg); }
.print-bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--graphite); color: var(--card); position: sticky; top: 0; z-index: 10; }
.print-bar .btn { color: var(--card); }
.print-bar .btn:hover { background: var(--steel); }
.print-bar-title { font-weight: 700; }
.print-main { padding: 16px; max-width: 900px; margin: 0 auto; }
.print-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.print-tools .hint { width: 100%; margin: 0; }
.doc { background: var(--print-paper); color: var(--print-ink); border: 1px solid var(--line); margin: 0 auto 16px; font-size: 12.5px; line-height: 1.45; }
.doc.a4 { max-width: 210mm; padding: 12mm; }
.doc.receipt { max-width: 80mm; padding: 3mm; font-size: 11px; }
.doc h3 { font-size: 1em; margin: 0 0 4px; }
.doc table { width: 100%; }
.doc th, .doc td { padding: 3px 5px; font-size: 1em; border-bottom: 1px solid var(--print-line); background: none; color: var(--print-ink); }
.doc th { font-weight: 600; }
.doc .muted, .doc .bi-en { color: var(--print-grey); }
.doc .small { font-size: .9em; }
.doc .kv th, .doc .kv td { border: 0; padding: 1px 4px; }
.doc .kv th { white-space: nowrap; width: 1%; font-weight: 500; color: var(--print-grey); }
.doc-draft { text-align: center; font-weight: 700; border: 2px dashed var(--print-ink); padding: 4px; margin-bottom: 8px; }
.doc-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 2px solid var(--primary); }
.doc-garage { display: flex; gap: 10px; align-items: flex-start; }
.doc-logo { width: 64px; height: 64px; object-fit: contain; }
.doc-name { font-size: 1.5em; font-weight: 700; }
.doc-name-en { font-weight: 600; }
.doc-title { font-size: 1.25em; font-weight: 700; margin-bottom: 4px; }
.doc .plate { border-color: var(--print-ink); color: var(--print-ink); background: var(--print-paper); }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.doc-box { border: 1px solid var(--print-line); border-radius: 6px; padding: 6px 8px; }
.doc-lines { margin-bottom: 8px; }
.doc-lines thead th { border-bottom: 1.5px solid var(--print-ink); }
.doc-totals { width: auto !important; min-width: 55%; margin-inline-start: auto; margin-bottom: 10px; }
.doc-totals th { text-align: start; font-weight: 500; }
.doc-totals tr.grand th, .doc-totals tr.grand td { font-weight: 700; font-size: 1.15em; border-top: 1.5px solid var(--print-ink); border-bottom: 1.5px solid var(--print-ink); }
.doc-totals tr.due th, .doc-totals tr.due td { font-weight: 700; }
.doc-declined { border: 1.5px solid var(--print-ink); border-radius: 6px; padding: 6px 8px; margin-bottom: 10px; }
.doc-declined ul { margin: 0; padding-inline-start: 18px; }
.doc-statement { font-weight: 600; margin: 6px 0; }
.doc-oil { border: 1px solid var(--print-line); border-radius: 6px; padding: 6px 8px; margin-bottom: 10px; }
.doc-terms { font-size: .9em; margin-bottom: 10px; }
.doc-terms p { margin: 2px 0; }
.doc-section { margin-bottom: 12px; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px dotted var(--print-line); }
.tick { width: 14px; height: 14px; border: 1.5px solid var(--print-ink); border-radius: 3px; flex: none; }
.write-lines { display: grid; gap: 18px; padding-top: 10px; }
.write-lines span { border-bottom: 1px solid var(--print-line); height: 1px; }
.doc-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 18px; }
.sig { display: flex; align-items: flex-end; gap: 6px; margin-top: 10px; }
.sig-line { flex: 1; border-bottom: 1px solid var(--print-ink); min-width: 60px; height: 22px; }
.doc-foot { text-align: center; margin-top: 12px; color: var(--print-grey); }
.doc.receipt .hide-receipt, .doc.receipt .bi-sep, .doc.receipt .bi-en { display: none; }
html[lang="en"] .doc.receipt .bi-ar { display: none; }
html[lang="en"] .doc.receipt .bi-en { display: inline; color: var(--print-ink); }
.doc.receipt .doc-head { flex-direction: column; text-align: center; }
.doc.receipt .doc-garage { flex-direction: column; align-items: center; }
.doc.receipt .doc-logo { width: 44px; height: 44px; }
.doc.receipt .doc-parties, .doc.receipt .doc-signatures { grid-template-columns: 1fr; gap: 6px; }
.doc.receipt .doc-totals { width: 100% !important; }
@media screen and (max-width: 640px) {
  .doc.a4 { padding: 4mm; font-size: 12px; }
  .doc.a4 .doc-head { flex-direction: column; }
  .doc.a4 .doc-parties, .doc.a4 .doc-signatures { grid-template-columns: 1fr; }
  .doc.a4 .doc-totals { width: 100% !important; }
  .doc .kv th { width: 55%; white-space: normal; }
  .doc .doc-lines { display: block; overflow-x: auto; }
}

@media print {
  body { background: var(--print-paper); }
  .sidebar, .topbar, .tabbar, .sheet, .print-bar, .no-print, #toast, .skip { display: none !important; }
  .main, .print-main { margin: 0; padding: 0; max-width: none; }
  .doc { border: 0; margin: 0; max-width: none; }
  .doc.a4 { padding: 0; }
  .doc.receipt { padding: 0; width: 74mm; }
  .doc tr, .doc-declined, .doc-signatures { break-inside: avoid; }
  .doc-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.inline-add .check { white-space: nowrap; }
.sr-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wa-status { margin-bottom: 12px; }
#wa-test-form { align-items: flex-end; margin-bottom: 4px; }
#wa-test-form .field { flex: 1 1 200px; margin: 0; }
