/* AuditNOW design tokens – taken from auditnow.ai */
:root {
  --text: #271353;
  --text-2: #6e677e;
  --brand: #6941c6;
  --brand-dark: #53389e;
  --brand-light: #f7f4fa;
  --border: #e7e5eb;
  --border-2: #d8d4e4;
  --bg: #ffffff;
  --bg-2: #fafafa;
  --success: #027a48;
  --success-bg: #ecfdf3;
  --error: #b42318;
  --error-bg: #fef3f2;
  --warn-bg: #fffaeb;
  --warn: #b54708;
  --radius: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(120% 60% at 50% -10%, #efe8fb 0%, rgba(239, 232, 251, 0) 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 30px; line-height: 1.15; font-weight: 600; letter-spacing: -0.03em; margin: 14px 0 10px; }
h2 { font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.025em; margin: 12px 0 6px; }
.muted { color: var(--text-2); margin: 0 0 20px; line-height: 1.5; }
.center { text-align: center; }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.logo { height: 26px; margin-right: auto; }
#backBtn + .logo { margin-left: 0; }

main { max-width: 560px; margin: 0 auto; padding: 20px 16px calc(32px + var(--safe-bottom)); }
.hero { padding-top: 6vh; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  background: var(--brand-light); color: var(--brand);
  font-size: 13px; font-weight: 500; border: 1px solid #eeeaf7;
}

/* Buttons – same as auditnow.ai: 12px radius, 500 weight */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 500 16px/1 Inter, sans-serif; text-decoration: none; cursor: pointer;
  padding: 14px 24px; border-radius: var(--radius); border: 1px solid var(--border);
  background: #fff; color: var(--text);
  transition: background .15s, transform .05s, opacity .15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost:hover { background: var(--bg-2); }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-block { width: 100%; margin-top: 12px; }

.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; flex: none;
  border-radius: var(--radius); border: 1px solid var(--border); background: #fff; color: var(--text); cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.dark { background: rgba(0, 0, 0, .45); border-color: rgba(255, 255, 255, .2); color: #fff; }

.input, .form select, .form input, .form textarea {
  width: 100%; font: 400 16px Inter, sans-serif; color: var(--text);
  padding: 12px 14px; border: 1px solid var(--border-2); border-radius: var(--radius); background: #fff;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .form :is(select, input, textarea):focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(105, 65, 198, .12); }
#searchInput { margin: 16px 0 8px; }

/* Item list */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; margin-top: 8px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.list li:active { background: var(--brand-light); }
.list .name { font-weight: 600; }
.list .sub { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.list .chev { margin-left: auto; color: var(--text-2); }
.list .empty { justify-content: center; color: var(--text-2); cursor: default; }

/* Photo tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  position: relative; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; cursor: pointer;
  border: 1.5px dashed var(--border-2); background: var(--brand-light);
  display: grid; place-items: center; padding: 0; color: var(--brand);
  font: inherit;
}
.tile svg { width: 72%; height: 60%; fill: none; stroke: currentColor; stroke-width: 4; opacity: .55; }
.tile .label {
  position: absolute; left: 10px; bottom: 10px; padding: 4px 10px; border-radius: 999px;
  background: #fff; color: var(--text); font-size: 13px; font-weight: 600; border: 1px solid var(--border);
}
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile.done { border-style: solid; border-color: var(--brand); }
.tile.done .label::before { content: '✓ '; color: var(--success); }

/* Review form */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: 14px; font-weight: 500; }
.form textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
.stars { display: flex; gap: 6px; }
.stars button { font-size: 28px; background: none; border: none; padding: 0; cursor: pointer; color: var(--border-2); }
.stars button.on { color: #fdab3d; }
.toggle.field { display: flex; flex-direction: row; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--border-2); border-radius: var(--radius); }
.toggle input { width: 22px; height: 22px; accent-color: var(--brand); }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.seg div { display: flex; border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; padding: 8px 0; background: #fff; border: none; font-size: 18px; cursor: pointer; filter: grayscale(1); opacity: .5; }
.seg button + button { border-left: 1px solid var(--border-2); }
.seg button.on { background: var(--brand-light); filter: none; opacity: 1; }

.notice { padding: 12px 14px; margin-bottom: 16px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); font-size: 14px; line-height: 1.45; }
.error { color: var(--error); background: var(--error-bg); padding: 10px 14px; border-radius: var(--radius); font-size: 14px; }

.success-icon { width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; background: var(--success-bg); display: grid; place-items: center; }
.success-icon svg { width: 36px; height: 36px; fill: none; stroke: var(--success); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* Camera */
.camera { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-guide { position: absolute; inset: 0; display: grid; place-items: center; padding: 90px 6% 170px; pointer-events: none; }
.camera-guide svg {
  width: 100%; height: 100%; fill: rgba(255, 255, 255, .06); stroke: #fff; stroke-width: 2.5;
  stroke-dasharray: 8 6; stroke-linejoin: round; stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(105, 65, 198, .9));
}
.camera-guide svg .d { stroke-width: 1.4; stroke-dasharray: none; opacity: .8; }
.tile svg .d { stroke-width: 2; opacity: .8; }
.camera-top, .camera-bottom { position: absolute; left: 0; right: 0; display: flex; align-items: center; padding: 0 16px; }
.camera-top { top: 0; padding-top: calc(16px + var(--safe-top)); justify-content: space-between; background: linear-gradient(rgba(0,0,0,.55), transparent); padding-bottom: 24px; }
.camera-title { font-weight: 600; font-size: 17px; }
.camera-bottom { bottom: 0; flex-direction: column; gap: 14px; padding-bottom: calc(24px + var(--safe-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.65)); padding-top: 40px; }
.camera-hint { margin: 0; text-align: center; font-size: 14px; line-height: 1.4; max-width: 420px; opacity: .95; }
.camera-actions { width: 100%; max-width: 420px; display: flex; align-items: center; justify-content: space-between; }
.shutter { width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; background: var(--brand); box-shadow: inset 0 0 0 4px #000; cursor: pointer; }
.shutter:active { transform: scale(.94); }

/* Landscape phone (side photos): controls on the right, outline fills the screen */
@media (orientation: landscape) and (max-height: 520px) {
  .camera-guide { padding: 48px calc(118px + env(safe-area-inset-right, 0px)) 16px calc(20px + env(safe-area-inset-left, 0px)); }
  .camera-top { padding-top: 10px; padding-bottom: 12px; }
  .camera-bottom {
    top: 0; bottom: 0; left: auto; right: 0; width: calc(110px + env(safe-area-inset-right, 0px));
    justify-content: center; padding: 16px env(safe-area-inset-right, 0px) 16px 16px;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .6));
  }
  .camera-hint { display: none; }
  .camera-actions { flex-direction: column-reverse; gap: 20px; width: auto; }
  .camera-actions > span { display: none; }
}

/* Loading + toast */
.loading { position: fixed; inset: 0; z-index: 60; background: rgba(255, 255, 255, .92); display: grid; place-content: center; justify-items: center; gap: 16px; text-align: center; padding: 24px; }
.loading p { margin: 0; font-weight: 500; }
.spinner { width: 48px; height: 48px; border-radius: 50%; border: 4px solid var(--brand-light); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(20px + var(--safe-bottom)); z-index: 70; max-width: 528px; margin: 0 auto; padding: 14px 16px; border-radius: var(--radius); background: var(--text); color: #fff; font-size: 14px; box-shadow: 0 12px 24px rgba(39, 19, 83, .25); }

/* Phone sign-in steps + QR modal */
.small { font-size: 14px; }
.steps { margin: 0 0 16px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.steps li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; line-height: 1.45; }
.steps li::before { content: counter(step); flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-light); color: var(--brand); font-weight: 600; font-size: 14px; display: grid; place-items: center; }
.modal { position: fixed; inset: 0; z-index: 65; background: rgba(39, 19, 83, .45); display: grid; place-items: center; padding: 16px; }
.modal-card { width: 100%; max-width: 380px; max-height: 100%; overflow-y: auto; background: #fff; border-radius: 16px; padding: 24px; text-align: center; box-shadow: 0 24px 48px rgba(39, 19, 83, .25); }
.modal-card h2 { margin-top: 0; }
.qr { width: min(240px, 60vw, 40vh); height: min(240px, 60vw, 40vh); box-sizing: content-box; margin: 4px auto 12px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.qr svg { width: 100%; height: 100%; display: block; }

/* Submitted vehicles */
.badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--success-bg); color: var(--success); }
.pill-done { background: var(--success-bg); color: var(--success); border-color: #d1fadf; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.thumbs a { aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-2); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.summary { margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; overflow: hidden; }
.summary div { display: grid; grid-template-columns: 40% 1fr; gap: 12px; padding: 11px 14px; font-size: 15px; }
.summary div + div { border-top: 1px solid var(--border); }
.summary dt { color: var(--text-2); }
.summary dd { margin: 0; font-weight: 500; word-break: break-word; }
.note-field textarea { min-height: 90px; resize: vertical; }

/* Home-screen install hint */
.install-card { display: flex; align-items: center; gap: 12px; padding: 14px; margin-bottom: 8px; border-radius: var(--radius); background: var(--brand-light); border: 1px solid #eeeaf7; }
.install-card p { margin: 4px 0 0; color: var(--text-2); }
.install-card .btn { flex: none; }

/* Van outlines (transparent PNG line art) */
.outline { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; }
.outline.flip { transform: scaleX(-1); }
.tile .outline { position: absolute; inset: auto; left: 8%; top: 8%; width: 84%; height: 58%; object-fit: contain; opacity: .8; }
.camera-guide { display: flex; }
.camera-guide .outline { min-width: 0; min-height: 0; filter: drop-shadow(0 0 1.5px rgba(105, 65, 198, .9)) drop-shadow(0 0 .5px rgba(0, 0, 0, .5)); }

/* Location status */
.loc { margin: -8px 0 16px; padding: 10px 14px; border-radius: var(--radius); background: var(--success-bg); color: var(--success); font-size: 14px; }
.loc.off { background: var(--bg-2); color: var(--text-2); }
.loc-value { padding: 12px 14px; border: 1px solid var(--border-2); border-radius: var(--radius); font-size: 15px; }
.loc-value a { color: var(--brand); }

/* Analysing + year wheel */
h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 24px 0 4px; }
.analysing { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--brand-light); border: 1px solid #eeeaf7; }
.analysing h2 { margin: 0; font-size: 18px; }
.analysing .spinner { width: 28px; height: 28px; border-width: 3px; flex: none; }
.wheel { position: relative; height: 220px; border: 1px solid var(--border-2); border-radius: 16px; background: #fff; overflow: hidden; }
.wheel::before, .wheel::after { content: ''; position: absolute; left: 0; right: 0; height: 88px; z-index: 2; pointer-events: none; }
.wheel::before { top: 0; background: linear-gradient(#fff, rgba(255, 255, 255, 0)); }
.wheel::after { bottom: 0; background: linear-gradient(rgba(255, 255, 255, 0), #fff); }
.wheel-highlight { position: absolute; left: 12px; right: 12px; top: 88px; height: 44px; border-radius: 10px; background: var(--brand-light); border: 1px solid #e4dcf5; z-index: 0; }
.wheel-list { position: relative; z-index: 1; height: 100%; margin: 0; padding: 88px 0; list-style: none; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; outline: none; }
.wheel-list::-webkit-scrollbar { display: none; }
.wheel-list li { height: 44px; display: grid; place-items: center; scroll-snap-align: center; font-size: 20px; color: var(--text-2); cursor: pointer; transition: color .15s, font-weight .15s; }
.wheel-list li.on { color: var(--text); font-weight: 600; font-size: 24px; }
.ai-hint { margin: 10px 0 0; font-size: 14px; color: var(--brand); text-align: center; }

/* Build id, to check which version a phone is showing */
.build { margin: 28px 0 0; text-align: center; font-size: 12px; color: var(--border-2); }

/* Inside monday the board header is already shown – keep it compact */
body.in-monday .topbar { position: static; padding-top: 12px; }
body.in-monday .hero { padding-top: 0; }
