/* Vandok — shared components, built strictly on design/tokens.css.
   Colour never carries meaning alone: status uses colour + shape + word.
   Driver contrast ≥7:1; touch targets ≥56px; nothing below 15px in app content. */

/* Self-hosted (VD-R001: no CDN). Variable woff2, split latin / latin-ext so Romanian ă ș ț (in the
   ext range; â î are already in latin) render from the same family instead of falling back. */
@font-face {
  font-family: 'Space Grotesk';
  src: url('/assets/fonts/SpaceGrotesk-latin.woff2') format('woff2');
  font-weight: 400 700; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('/assets/fonts/SpaceGrotesk-latinext.woff2') format('woff2');
  font-weight: 400 700; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/Inter-latin.woff2') format('woff2');
  font-weight: 400 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/Inter-latinext.woff2') format('woff2');
  font-weight: 400 800; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--vd-font);
  background: var(--vd-field);
  color: var(--vd-ink);
  font-size: var(--vd-fs-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.vd-num { font-variant-numeric: tabular-nums; }
button { font-family: inherit; }

/* ---- the identity thread: 3px orange under the status bar ---- */
.vd-identity-thread { height: 3px; background: var(--vd-identity); flex: none; }

/* ---- cards ---- */
/* Glassmorphism (all surfaces): translucent card + backdrop blur over the app's gradient-mesh
   atmosphere. Alpha kept high enough that a number stays legible while scrolling. */
.vd-card {
  background: var(--vd-glass-card);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  backdrop-filter: blur(22px) saturate(1.35);
  border: 1px solid var(--vd-glass-edge);
  box-shadow: var(--vd-glass-shadow), inset 0 1px 0 var(--vd-glass-hi);
  border-radius: 16px;
  padding: var(--vd-space-4);
}
/* status accents: colour + a shape (the border) + a word live in the content */
.vd-card--ok   { border-left: 3px solid var(--vd-ok); }
.vd-card--warn { border-top: 2px solid var(--vd-attention); }
.vd-card--fail { border-top: 2px solid var(--vd-fail); }
/* high-emphasis slab stays solid so the big figure/name pops */
.vd-card--next { background: var(--vd-invert-bg); color: var(--vd-invert-ink); border-color: var(--vd-invert-bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
.vd-card--next .vd-muted { color: var(--vd-invert-soft); }
/* The section label on the inverted "next" card must use the inverted-soft colour too, or it's
   light-on-light (unreadable "URMĂTOAREA LIVRARE" at night). */
.vd-card--next .vd-section-label { color: var(--vd-invert-soft); }
/* Forced light "paper" surface (fișă cards, sheets that stay white in BOTH themes) — pin the text to
   dark values so it never becomes light-on-light in the night theme. */
.vd-paper { color: #101826; }
.vd-paper .vd-muted, .vd-paper label, .vd-paper .vd-section-label { color: #48566a; }
.vd-paper .vd-input, .vd-paper .vd-select, .vd-paper .vd-textarea { color: #101826; background: #fff; border-color: rgba(16,24,38,.28); }
.vd-paper .vd-input::placeholder, .vd-paper .vd-textarea::placeholder { color: #8a97a8; }
.vd-paper .vd-btn--ghost { color: #101826; border-color: rgba(16,24,38,.28); }
.vd-paper .vd-nav-chevron { color: #48566a; }
/* opaque fallback where the platform can't blur, so text never sits on a busy background */
@media (prefers-reduced-transparency: reduce) {
  .vd-card { background: var(--vd-surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  /* keep the inverted "next" card its own solid colour (already opaque) so its ink stays readable */
  .vd-card--next { background: var(--vd-invert-bg); border-color: var(--vd-invert-bg); }
}
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .vd-card { background: var(--vd-surface); }
  .vd-card--next { background: var(--vd-invert-bg); border-color: var(--vd-invert-bg); }
}

.vd-section-label {
  font-size: var(--vd-fs-sm); font-weight: 700; letter-spacing: var(--vd-track-label);
  color: var(--vd-ink-soft); text-transform: uppercase;
}
/* NO text-outline halo (the old white-stroke hack the design never had — d1–d14 mockups use plain
   ink on a flat bg). Section labels that float DIRECTLY on the background photo (a bare `.vd-body`
   child, no surface behind them) are painted in the identity ORANGE: it's the one brand accent, it
   reads over BOTH the light day photo and the dark night photo, and it visually ties these dividers
   to the orange identity thread. Labels INSIDE a card keep the muted secondary ink (they sit on a
   surface, so no accent is needed). PO-approved direction, 25 Aug. */
/* Any section label that floats on the photo (at ANY nesting depth under the body, e.g. wrapped in a
   results container) is painted big + identity-orange so it reads over the photo in both themes and
   matches a client-name heading in size. Labels INSIDE a card sit on a surface, so they revert to the
   muted, small on-surface style. Applies app-wide (driver/admin/portal share these classes) — one
   rule, every screen. Inline colours on specific labels (the inverted "next" card) still win. */
.vd-body .vd-section-label {
  color: var(--vd-identity); font-weight: 800; letter-spacing: .01em;
  font-size: var(--vd-fs-h1); line-height: 1.15; text-transform: uppercase;
  margin-top: 8px;
}
.vd-body .vd-card .vd-section-label {
  color: var(--vd-ink-soft); font-weight: 700; letter-spacing: var(--vd-track-label);
  font-size: var(--vd-fs-sm); line-height: normal; margin-top: 0;
}
.vd-muted { color: var(--vd-ink-soft); }
.vd-h1 { font-size: var(--vd-fs-h1); font-weight: 700; letter-spacing: var(--vd-track-tight); line-height: 1.15; }
.vd-h2 { font-size: var(--vd-fs-h2); font-weight: 700; letter-spacing: -.02em; }
.vd-hero { font-size: var(--vd-fs-hero); font-weight: 500; letter-spacing: -.04em; line-height: 1; }
.vd-qty  { font-size: var(--vd-fs-qty); font-weight: 500; letter-spacing: -.04em; }

/* ---- stepper: 58px square controls, tabular readout ---- */
.vd-stepper { display: flex; align-items: center; gap: var(--vd-space-2); }
.vd-step {
  flex: none; width: var(--vd-stepper); height: var(--vd-stepper);
  border-radius: var(--vd-radius); background: var(--vd-field);
  border: 1px solid rgba(16,24,38,.28); color: var(--vd-ink);
  font-size: 26px; line-height: 1; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--vd-dur-press);
}
[data-theme="night"] .vd-step { border-color: var(--vd-hairline); }
.vd-step:active { background: rgba(16,24,38,.10); }
/* Editable quantity field: a bordered box that matches the − / + squares (same height, radius,
   surface and border), centred and sized for 3 digits. Tap opens the numeric keypad; +/- still
   step by one. Fixed width keeps every stepper's − and + aligned across rows and never overflows
   the card at 360px. */
.vd-stepper-val {
  flex: none; box-sizing: content-box;
  /* Width in ch (not px) so the space around the digits stays even on phones with a larger
     system font size, where the WebView scales the text up but a fixed-px box would not. */
  width: 4.4ch; height: var(--vd-stepper);
  text-align: center; font-size: 30px; line-height: normal;
  font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  color: var(--vd-ink); background: var(--vd-field);
  border: 1px solid rgba(16,24,38,.28); border-radius: var(--vd-radius);
  padding: 0; margin: 0; -webkit-appearance: none; appearance: none; outline: none;
}
[data-theme="night"] .vd-stepper-val { border-color: var(--vd-hairline); }
.vd-stepper-val:focus { border-color: var(--vd-ink); }
/* Selection highlight on the active field: Vandok identity orange (the wordmark/status thread),
   not the browser's electric blue. Dark digits keep it legible on the orange in both themes. */
.vd-stepper-val::selection { background: var(--vd-identity); color: #0B1220; }
.vd-stepper-val::-moz-selection { background: var(--vd-identity); color: #0B1220; }
.vd-stepper-val::-webkit-outer-spin-button,
.vd-stepper-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.vd-stepper-row { display: flex; align-items: center; gap: var(--vd-space-3); }
.vd-stepper-row > .vd-label { flex: 1; min-width: 0; font-size: var(--vd-fs-body); overflow-wrap: anywhere; }

/* ---- buttons; touch targets ---- */
.vd-btn {
  height: var(--vd-touch-min); min-height: var(--vd-touch-min);
  border-radius: var(--vd-radius); border: none; cursor: pointer;
  font-family: inherit;   /* <a class="vd-btn"> must use the app font too, not the UA default */
  font-size: var(--vd-fs-body); font-weight: 700; padding: 0 var(--vd-space-5);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background var(--vd-dur-press);
}
/* Primary action: a CLEAN SOLID emerald — NOT translucent glass. Dark-green glass over the dark mesh
   washed out (same grayscale value as the field) and the big inset highlight read as "foam". A single
   solid mid-emerald with white text stays legible (white ≈3.7:1 on #12925A for the 22px bold label) and
   clearly stands off both the light day field and the dark night field. Glass stays for cards/bars only. */
.vd-btn--primary {
  height: var(--vd-touch-primary); width: 100%;
  background: #12925A; color: #FFFFFF;
  font-size: var(--vd-fs-h2);
  border: none; text-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.vd-btn--primary:active { background: #0C6E43; }
/* Ghost = the glass button: a translucent fill + blur + edge, so it clearly reads AS a button on the
   mesh (a bare border on a same-colour background was invisible). */
.vd-btn--ghost {
  background: var(--vd-glass-card-2); color: var(--vd-ink);
  border: 1px solid var(--vd-glass-edge);
  -webkit-backdrop-filter: blur(12px) saturate(1.3); backdrop-filter: blur(12px) saturate(1.3);
  box-shadow: inset 0 1px 0 var(--vd-glass-hi);
}
.vd-btn--ghost:active { background: var(--vd-glass-card); }
.vd-btn--dark { background: var(--vd-invert-bg); color: var(--vd-invert-ink); }
.vd-btn--danger-link {
  background: transparent; color: var(--vd-ink-soft);
  text-decoration: underline; text-underline-offset: 4px;
}
/* Disabled/complete buttons: a solid, legible muted state (NOT a faded translucent one that washes
   out and loses contrast — worst in night). Uniform across the whole app, adapts to both themes. */
.vd-btn:disabled, .vd-btn[disabled] {
  cursor: default; opacity: 1;
  background: var(--vd-surface-2); color: var(--vd-ink-soft);
  border: 1px solid var(--vd-edge); box-shadow: none;
}

/* ---- glass: allowed on exactly two layers — header and action bar. Never behind a figure. ---- */
.vd-glass-header {
  background: var(--vd-glass); backdrop-filter: var(--vd-glass-blur);
  -webkit-backdrop-filter: var(--vd-glass-blur);
  border-bottom: 1px solid var(--vd-hairline);
}
.vd-glass-foot {
  background: var(--vd-glass-foot); backdrop-filter: var(--vd-glass-blur);
  -webkit-backdrop-filter: var(--vd-glass-blur);
  border-top: 1px solid var(--vd-hairline);
}
@media (prefers-reduced-transparency: reduce) {
  .vd-glass-header { background: var(--vd-surface); }
  .vd-glass-foot { background: var(--vd-surface); }
}

/* ---- deviation rule (attention) — a rule, plus a word in the content ---- */
.vd-rule-attn { border-top: 2px solid var(--vd-attention); }
.vd-hairline { border-top: 1px solid var(--vd-hairline); }

/* ---- pills / badges ---- */
.vd-pill {
  font-size: var(--vd-fs-sm); font-weight: 700; padding: 4px 10px;
  border-radius: var(--vd-radius); border: 1px solid var(--vd-edge);
}
.vd-pill--ok { border-color: var(--vd-ok); }
.vd-pill--cash { border-color: var(--vd-attention); letter-spacing: var(--vd-track-label); }

/* ---- inputs ---- */
.vd-field { display: block; margin-bottom: var(--vd-space-4); }
.vd-field > label {
  display: block; font-size: var(--vd-fs-sm); font-weight: 600;
  color: var(--vd-ink-soft); margin-bottom: 6px;
}
.vd-input, .vd-select, .vd-textarea {
  width: 100%; font-family: inherit; font-size: var(--vd-fs-body);
  color: var(--vd-ink); background: var(--vd-surface);
  border: 1px solid var(--vd-edge); border-radius: var(--vd-radius);
  padding: 0 var(--vd-space-4); height: var(--vd-touch-min);
}
.vd-textarea { height: auto; min-height: 88px; padding: var(--vd-space-3) var(--vd-space-4); resize: vertical; }
/* Strip the browser's native search chrome (rounded "pill" + clear button) so search fields render as
   canonical .vd-input boxes — same radius (--vd-radius), colour and height as every other field. */
.vd-input[type="search"] { -webkit-appearance: none; appearance: none; height: var(--vd-touch-min); min-height: var(--vd-touch-min); box-sizing: border-box; line-height: normal; }
.vd-input[type="search"]::-webkit-search-decoration,
.vd-input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

/* ---- tables (admin) ---- */
.vd-table { width: 100%; border-collapse: collapse; font-size: var(--vd-fs-admin); }
.vd-table th {
  text-align: left; font-size: 11px; letter-spacing: var(--vd-track-label);
  text-transform: uppercase; color: var(--vd-ink-soft);
  padding: 8px 10px; border-bottom: 1px solid var(--vd-edge); font-weight: 700;
}
.vd-table td { padding: 8px 10px; border-bottom: 1px solid var(--vd-hairline); }
.vd-table tr:hover td { background: rgba(16,24,38,.03); }
.vd-flag-warn { color: var(--vd-attention); font-weight: 700; }
.vd-flag-fail { color: var(--vd-fail); font-weight: 700; }
.vd-flag-ok { color: var(--vd-ok); font-weight: 700; }

/* ---- toasts ---- */
.vd-toasts { position: fixed; left: 0; right: 0; bottom: 88px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 90; pointer-events: none; }
.vd-toast {
  background: var(--vd-invert-bg); color: var(--vd-invert-ink);
  padding: 12px 18px; border-radius: var(--vd-radius); font-size: var(--vd-fs-sm);
  max-width: 340px; box-shadow: 0 6px 24px rgba(0,0,0,.25);
  animation: vd-toast-in 200ms var(--vd-ease);
}
.vd-toast.out { opacity: 0; transition: opacity 300ms; }
@keyframes vd-toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- toggle switch (shared: driver + portal) ---- */
.vd-toggle { width: 56px; height: 32px; border-radius: 16px; background: transparent; border: 2px solid var(--vd-edge); position: relative; cursor: pointer; flex: none; transition: background var(--vd-dur-press), border-color var(--vd-dur-press); }
.vd-toggle.on { background: var(--vd-action); border-color: var(--vd-action); }
.vd-toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--vd-ink-soft); transition: transform var(--vd-dur-press), background var(--vd-dur-press); }
.vd-toggle.on::after { transform: translateX(24px); background: var(--vd-action-ink); }

/* ---- settings rows (shared: driver + portal) ---- */
.vd-set-row { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-top: 1px solid var(--vd-glass-edge); }
.vd-set-row:first-child { border-top: none; }
.vd-set-main { flex: 1; min-width: 0; }
.vd-set-label { font-size: 16px; font-weight: 600; color: var(--vd-ink); }
.vd-set-desc { font-size: 14px; color: var(--vd-ink-soft); margin-top: 3px; line-height: 1.45; }
.vd-set-val { flex: none; font-size: 15px; font-weight: 600; color: var(--vd-ink-soft); font-variant-numeric: tabular-nums; }
.vd-set-chev { flex: none; font-size: 22px; line-height: 1; color: var(--vd-ink-soft); margin-left: 2px; }
.vd-set-row--nav { cursor: pointer; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 10px; }
.vd-set-row--nav:active { background: var(--vd-glass-card-2); }
.vd-set-row--danger .vd-set-label { color: #C0342B; }

/* ---- bottom sheet (service-request, confirmations) ---- */
.vd-sheet-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(6,14,28,.52); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: vd-fade-in 160ms var(--vd-ease);
}
.vd-sheet {
  width: 100%; max-width: 520px; box-sizing: border-box;
  background: #fff; border-radius: 20px 20px 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -18px 60px rgba(9,20,40,.42);
  animation: vd-sheet-up 220ms var(--vd-ease);
}
@media (min-width: 560px) { .vd-sheet-overlay { align-items: center; } .vd-sheet { border-radius: 20px; margin: 16px; } }
@keyframes vd-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes vd-sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ---- theme three-position control ---- */
.vd-theme-seg { display: inline-flex; border: 1px solid var(--vd-edge); border-radius: var(--vd-radius); overflow: hidden; }
.vd-theme-seg button { background: transparent; border: none; color: var(--vd-ink-soft); font-size: var(--vd-fs-sm); padding: 8px 14px; cursor: pointer; }
.vd-theme-seg button[aria-pressed="true"] { background: var(--vd-invert-bg); color: var(--vd-invert-ink); font-weight: 700; }

/* update-available banner (admin/portal single-page apps) */
.vd-update-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; background: var(--vd-invert-bg); color: var(--vd-invert-ink);
  font-size: 16px; font-weight: 600; box-shadow: 0 -4px 20px rgba(0,0,0,.25);
}
.vd-update-bar button { flex: none; height: 44px; padding: 0 18px; border: none; border-radius: var(--vd-radius); background: var(--vd-action); color: var(--vd-action-ink); font-weight: 700; font-size: 16px; cursor: pointer; }
