/*
 * XRAW™ Lite — lite.xraw.ai
 * Copyright © 2026 Rajiv Sharma, Proprietor, Rockstar Autoworks™. All rights reserved.
 * Proprietary and confidential. Unauthorised copying, reproduction or
 * redistribution of this source, in whole or in part, is prohibited without
 * prior written permission from Rockstar Autoworks™.
 *
 * File: public/assets/css/lite.css — the whole stylesheet. Mobile-first.
 * Colour tokens mirror xraw_app (src/index.css --color-xraw-*).
 */

:root {
  --bg: #14151a;
  --surface: #1c1e24;
  --surface-2: #24262e;
  --border: #2e303a;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #e11d2e;
  --accent-hover: #f43f4a;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --gutter: 16px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f1f3fc;
    --surface: #ffffff;
    --surface-2: #f5f3ff;
    --border: #e1e2f0;
    --text: #1d1f2c;
    --muted: #666b85;
    --accent: #e11d2e;
    --accent-hover: #c4121f;
    --success: #159a49;
    --warning: #c2740a;
    --danger: #dc2626;
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
}

sup { font-size: 0.55em; vertical-align: super; line-height: 0; }

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 4px; }

.muted { color: var(--muted); margin: 0; }
.small { font-size: 0.875rem; }

/* ---- Top bar ------------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand img { border-radius: 7px; }
.brand strong { color: var(--accent); }

.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-name { color: var(--muted); font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }

.avatar {
  position: relative;
  overflow: hidden;
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
}

.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }

/* ---- Page --------------------------------------------------------------- */

.page {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px var(--gutter) 24px;
}

.footer {
  padding: 16px var(--gutter) calc(16px + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.center { text-align: center; }
.center .btn { margin-top: 16px; }

.detail {
  margin-top: 16px;
  text-align: left;
  font-size: 0.75rem;
  white-space: pre-wrap;
  overflow-x: auto;
  color: var(--muted);
}

/* ---- Flash messages ----------------------------------------------------- */

.flash {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.925rem;
}
.flash-error { border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.flash-success { border-color: color-mix(in srgb, var(--success) 55%, transparent); background: color-mix(in srgb, var(--success) 12%, var(--surface)); }
.flash-info { border-color: color-mix(in srgb, var(--warning) 45%, transparent); }

/* ---- Forms & buttons ---------------------------------------------------- */

.form { display: grid; gap: 16px; }

.field { display: grid; gap: 6px; }
.field > span:first-child { font-size: 0.875rem; color: var(--muted); font-weight: 600; }

input[type="text"], input[type="password"], input[type="tel"], input[type="number"], select, textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 1.05rem; /* ≥16px stops iOS zooming on focus */
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.pin-wrap { position: relative; display: block; }
.pin-wrap input { padding-right: 72px; letter-spacing: 0.2em; }
.pin-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn[disabled] { opacity: 0.6; cursor: progress; }

/* ---- Login -------------------------------------------------------------- */

.login { padding-top: 6vh; }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand img { border-radius: 18px; }
.login-brand h1 { font-size: 1.9rem; margin-top: 12px; }
.login-brand h1 span { color: var(--accent); }
.login-brand p { color: var(--muted); margin: 0; }

.hint { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 20px; }

/* ---- Home --------------------------------------------------------------- */

.hello { margin-bottom: 20px; }

.tiles { display: grid; gap: 12px; }

.tile {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}
a.tile:active { transform: scale(0.99); }
.tile.is-soon { opacity: 0.7; }

.tile-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
  color: var(--accent);
}
.tile-text { display: grid; flex: 1; min-width: 0; }
.tile-text span { color: var(--muted); font-size: 0.875rem; }

.badge {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-go { border-color: transparent; background: var(--accent); color: #fff; }
.badge-ok { border-color: transparent; background: color-mix(in srgb, var(--success) 18%, var(--surface-2)); color: var(--success); }

.signout { margin-top: 28px; }

h2 { font-size: 1.1rem; margin: 0 0 12px; }

.back {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.hint.small { font-size: 0.8rem; margin: 12px 0 0; }

/* ---- Attendance --------------------------------------------------------- */

.today { display: grid; gap: 10px; margin-bottom: 16px; }

.today-row { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.today-label { flex: 1; color: var(--muted); }
.today-time { font-weight: 700; font-variant-numeric: tabular-nums; }

.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); flex: none; }
.dot-on { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent); }

.thumb { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }

.today-total { margin: 4px 0 0; padding-top: 10px; border-top: 1px solid var(--border); font-weight: 600; }
.today-total.warn { color: var(--warning); font-weight: 500; font-size: 0.9rem; }

.done-note {
  text-align: center;
  padding: 18px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
  color: var(--success);
  font-weight: 600;
}

.camera { display: grid; gap: 14px; }
.camera h2 { margin: 0; }

.cam-frame {
  position: relative;
  aspect-ratio: 3 / 4;
  max-height: 60vh;
  width: 100%;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}
.cam-frame video, .cam-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-frame video, .cam-frame img.mirror { transform: scaleX(-1); }

.cam-guide {
  position: absolute;
  inset: 12% 20% 22%;
  border: 2px dashed rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  pointer-events: none;
}
.cam-frame img:not([hidden]) ~ .cam-guide { display: none; }

.cam-msg { margin: 0; min-height: 1.2em; color: var(--muted); font-size: 0.9rem; text-align: center; }
.cam-msg.is-error { color: var(--danger); }
.cam-msg:empty { display: none; }

.cam-actions { display: flex; gap: 10px; }
.cam-actions .btn-block { flex: 1; }

.file-field input[type="file"] {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

.history { margin-top: 24px; }
.history-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.history-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.history-list li + li { border-top: 1px solid var(--border); }
.h-date { color: var(--muted); }
.h-total { min-width: 62px; text-align: right; font-weight: 600; }

/* ---- Job cards ---------------------------------------------------------- */

.tile-slim { min-height: 60px; }
.chev { color: var(--muted); font-size: 1.6rem; line-height: 1; }
[data-queue-count]:not([hidden]) { margin-left: 6px; color: var(--warning); font-weight: 600; }

.jobcard { display: grid; gap: 14px; counter-reset: step; }
.step:not([hidden]) { counter-increment: step; }
.step-no::before { content: counter(step); }

.step { margin: 0; display: grid; gap: 14px; min-width: 0; }
.step legend {
  float: left;            /* keeps the legend inside the card's padding */
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  font-weight: 700;
  font-size: 1.05rem;
}
.step legend + * { clear: both; }
.step-no {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
}

.opt { font-style: normal; font-weight: 400; color: var(--muted); font-size: 0.8rem; }

.input-action { display: flex; gap: 8px; }
.input-action input { flex: 1; min-width: 0; }
.input-action .btn { flex: none; padding: 0 16px; }
input[name="plate"] { text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }

textarea { resize: vertical; min-height: 88px; line-height: 1.4; }

.field-group { display: grid; gap: 14px; }

.match {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.925rem;
}
.match strong { font-size: 1rem; }
.match .muted { font-size: 0.85rem; }
.match.is-known { border-color: color-mix(in srgb, var(--success) 50%, transparent); background: color-mix(in srgb, var(--success) 10%, var(--surface)); }
.match.is-new { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.match.is-warn { border-color: color-mix(in srgb, var(--warning) 50%, transparent); }

.svc-cat { margin: 6px 0 2px; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.9rem;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.slot {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1.5px dashed var(--border);
  background: var(--surface-2);
  overflow: hidden;
  cursor: pointer;
}
.slot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot-label {
  position: relative;
  z-index: 1;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  padding: 0 4px;
}
.slot-label::before { content: '+'; display: block; font-size: 1.6rem; line-height: 1; color: var(--accent); }
.slot.has-photo { border-style: solid; border-color: var(--success); }
.slot.has-photo .slot-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
}
.slot.has-photo .slot-label::before { content: none; }
.slot.has-error { border-color: var(--danger); }

.form-msg { margin: 0; text-align: center; font-size: 0.925rem; color: var(--muted); }
.form-msg.is-error { color: var(--danger); }
.form-msg:empty { display: none; }
.field.has-error input, .field.has-error textarea { border-color: var(--danger); }

.queue { margin-top: 20px; }
.empty { text-align: center; color: var(--muted); margin-top: 28px; }

.card-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.jc {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.jc-thumb { flex: none; width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.jc-text { flex: 1; min-width: 0; display: grid; }
.jc-text strong { letter-spacing: 0.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jc-text > span { color: var(--muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jc-meta { font-size: 0.78rem !important; }
.urgent { color: var(--warning); font-weight: 600; }
.jc-actions { display: flex; gap: 6px; flex: none; }
.jc-actions .btn { min-height: 36px; padding: 0 10px; font-size: 0.8rem; }
.jc.is-error { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }

.hello-row { display: flex; align-items: center; gap: 14px; }
.hello-row > div { min-width: 0; }

.subhead { margin: 6px 0 -4px; font-size: 0.95rem; font-weight: 700; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-note { min-height: 1.1em; color: var(--muted); font-size: 0.8rem; }
.field-note.is-error { color: var(--warning); }
.field-note:empty { display: none; }

/* Expenses */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.pager .btn { min-height: 40px; }
.slots-single { grid-template-columns: minmax(0, 160px); }
