/* Aravan PTI - interstate-sign look: highway green, safety amber, Overpass (Highway Gothic family) */

:root {
  --bg: #EDF1EF;
  --surface: #FFFFFF;
  --ink: #0F1D17;
  --muted: #56665E;
  --line: #D3DCD8;
  --sign: #00674A;
  --sign-ink: #FFFFFF;
  --sign-soft: #E0EFE9;
  --amber: #B97A00;
  --amber-soft: #FFF3D6;
  --red: #C22D2D;
  --red-soft: #FCE4E4;
  --ok: #1C7D46;
  --radius: 14px;
  --font: "Overpass", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0B1310;
  --surface: #15201B;
  --ink: #E8F0EC;
  --muted: #92A59B;
  --line: #273730;
  --sign: #0B7A57;
  --sign-soft: #173A2D;
  --amber: #F2B632;
  --amber-soft: #3A2E10;
  --red: #F06363;
  --red-soft: #3D1A1A;
  --ok: #4CC47F;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--sign); color: var(--sign-ink);
  font-weight: 800; box-shadow: inset 0 0 0 2px var(--sign), inset 0 0 0 4px var(--sign-ink);
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: 0.01em; }
.topbar-tools { display: flex; gap: 8px; align-items: center; }

.lang { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lang button {
  border: 0; background: transparent; padding: 6px 10px;
  font-size: 14px; font-weight: 700; color: var(--muted);
}
.lang button.on { background: var(--sign); color: var(--sign-ink); }
.theme-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: transparent; font-size: 18px;
}

/* ---------- layout ---------- */

main { max-width: 560px; margin: 0 auto; padding: 16px 16px 120px; }

h1 { font-size: 28px; line-height: 1.15; margin: 8px 0 4px; font-weight: 800; }
h2 { font-size: 18px; margin: 24px 0 10px; font-weight: 700; }
.sub { color: var(--muted); margin: 0 0 8px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

/* ---------- unit sign (start screen) ---------- */

.unit-sign {
  display: inline-flex; flex-direction: column;
  background: var(--sign); color: var(--sign-ink);
  border-radius: 12px; padding: 10px 18px;
  box-shadow: inset 0 0 0 3px var(--sign), inset 0 0 0 5px var(--sign-ink);
  margin: 4px 0 8px;
}
.unit-sign small { font-size: 13px; opacity: 0.85; }
.unit-sign b { font-size: 30px; line-height: 1; font-weight: 800; }

/* ---------- choice cards ---------- */

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  text-align: left;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 104px;
  display: flex; flex-direction: column; gap: 4px;
}
.choice .ico { font-size: 24px; line-height: 1; }
.choice b { font-size: 18px; }
.choice span { color: var(--muted); font-size: 14px; line-height: 1.3; }
.choice.on { border-color: var(--sign); background: var(--sign-soft); }

/* ---------- fields ---------- */

.fields { display: grid; gap: 10px; }
.fields .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label.field { display: grid; gap: 4px; font-size: 14px; color: var(--muted); font-weight: 600; }
.field input, textarea {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 17px; color: var(--ink);
}
.field input:focus, textarea:focus { border-color: var(--sign); outline: none; }
textarea { min-height: 96px; resize: vertical; }

/* ---------- buttons ---------- */

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 56px;
  border-radius: 12px; border: 2px solid transparent;
  font-weight: 700; font-size: 18px;
  padding: 0 18px;
}
.btn-primary { background: var(--sign); color: var(--sign-ink); }
.btn-primary:disabled { opacity: 0.45; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-link {
  background: none; border: 0; color: var(--muted);
  text-decoration: underline; padding: 12px; width: 100%; font-size: 16px;
}

.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.actionbar .inner { max-width: 560px; margin: 0 auto; display: flex; gap: 10px; }
.actionbar .btn-ghost { width: auto; min-width: 64px; }

/* ---------- step sign (the signature element) ---------- */

.step-sign {
  background: var(--sign); color: var(--sign-ink);
  border-radius: 16px;
  padding: 16px 18px 18px;
  box-shadow: inset 0 0 0 4px var(--sign), inset 0 0 0 6px var(--sign-ink);
  display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: center;
}
.step-num { font-size: 56px; line-height: 0.9; font-weight: 800; grid-row: span 2; }
.step-num small { font-size: 20px; font-weight: 700; opacity: 0.8; }
.step-title { font-size: 22px; font-weight: 800; line-height: 1.15; }
.step-hint { font-size: 15px; opacity: 0.92; line-height: 1.35; }

.miles { display: grid; grid-auto-flow: column; gap: 4px; margin: 12px 0 16px; }
.miles i { height: 6px; border-radius: 3px; background: var(--line); }
.miles i.done { background: var(--sign); }
.miles i.skip { background: var(--amber); }
.miles i.now { background: var(--ink); }

.example {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 10px; background: var(--surface);
}
.example p { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.example img { width: 100%; border-radius: 10px; display: block; }
.example .ph {
  aspect-ratio: 4 / 3; border-radius: 10px; background: var(--bg);
  display: grid; place-items: center; color: var(--muted); font-size: 14px; text-align: center; padding: 16px;
}

/* ---------- photos ---------- */

.shots { display: grid; gap: 12px; margin-top: 12px; }
.shot {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.shot img { width: 100%; display: block; max-height: 360px; object-fit: cover; }
.shot-bar { padding: 10px 12px; display: grid; gap: 6px; }
.shot-bar .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.shot-bar .retake { background: none; border: 0; color: var(--muted); font-weight: 700; text-decoration: underline; padding: 4px; }

.status { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.status.ok .dot { background: var(--ok); }
.status.ok { color: var(--ok); }
.status.retake, .status.defect { color: var(--amber); }
.status.retake .dot, .status.defect .dot { background: var(--amber); }
.status.failed { color: var(--red); }
.status.failed .dot { background: var(--red); }
.status.busy .dot { animation: pulse 1s infinite; }
.ai-msg { font-size: 14px; color: var(--muted); margin: 0; }

.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--sign); transition: width 0.2s; }

@keyframes pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .status.busy .dot { animation: none; } }

/* ---------- location ---------- */

.center-card { text-align: center; padding: 28px 20px; }
.center-card .big { font-size: 44px; line-height: 1; margin-bottom: 8px; }

/* ---------- review ---------- */

.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 15px; }
.facts dd { margin: 0; font-weight: 700; text-align: right; }

.steplist { display: grid; gap: 0; }
.stepitem {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.stepitem:last-child { border-bottom: 0; }
.stepitem .thumb {
  width: 56px; height: 56px; border-radius: 10px; background: var(--bg);
  object-fit: cover; display: grid; place-items: center; color: var(--muted); font-size: 20px;
}
.stepitem b { display: block; font-size: 16px; line-height: 1.2; }
.stepitem small { color: var(--muted); font-size: 13px; }
.stepitem small.warn { color: var(--amber); font-weight: 700; }
.stepitem button {
  border: 1px solid var(--line); background: transparent; border-radius: 10px;
  padding: 8px 12px; font-weight: 700; font-size: 14px;
}

.ai-box {
  background: var(--amber-soft); border-radius: var(--radius);
  padding: 14px 16px; margin-top: 16px;
}
.ai-box b { display: block; margin-bottom: 6px; }
.ai-box ul { margin: 0; padding-left: 20px; }
.sev { font-size: 12px; font-weight: 800; padding: 2px 6px; border-radius: 6px; margin-left: 6px; }
.sev.out_of_service, .sev.major { background: var(--red-soft); color: var(--red); }
.sev.minor { background: var(--surface); color: var(--muted); }

.choice.good.on { border-color: var(--ok); }
.choice.bad.on { border-color: var(--red); background: var(--red-soft); }

/* ---------- video ---------- */

.checks { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; }
.checks li::before {
  content: ""; width: 20px; height: 20px; border-radius: 6px; flex: none; margin-top: 2px;
  border: 2px solid var(--sign);
}
video { width: 100%; border-radius: var(--radius); background: #000; display: block; }

/* ---------- sent ---------- */

.done-mark {
  width: 88px; height: 88px; margin: 24px auto 12px; border-radius: 50%;
  background: var(--sign); color: var(--sign-ink);
  display: grid; place-items: center; font-size: 44px; font-weight: 800;
  box-shadow: inset 0 0 0 4px var(--sign), inset 0 0 0 7px var(--sign-ink);
}
.report-id { font-weight: 800; font-size: 20px; letter-spacing: 0.02em; }

/* ---------- toast + sheet ---------- */

.toast {
  position: fixed; left: 16px; right: 16px; bottom: 96px; z-index: 40;
  max-width: 528px; margin: 0 auto;
  background: var(--ink); color: var(--bg);
  border-radius: 12px; padding: 12px 16px; font-weight: 600;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: none; }

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,0.45);
  display: none; align-items: flex-end;
}
.sheet-backdrop.show { display: flex; }
.sheet {
  width: 100%; max-width: 560px; margin: 0 auto;
  background: var(--surface); border-radius: 18px 18px 0 0;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 10px;
}
.sheet h2 { margin: 0 0 4px; }

/* ---------- language ---------- */

.lang-btn {
  height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; padding: 0 12px; font-weight: 700; font-size: 14px;
}
.langs { display: grid; gap: 10px; margin-top: 16px; }
.langpick {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; padding: 0 18px;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  font-size: 20px; font-weight: 700; text-align: left;
}
.langpick small { color: var(--muted); font-size: 14px; font-weight: 700; }
.langpick.on { border-color: var(--sign); background: var(--sign-soft); }
.lang-head { font-size: 26px; line-height: 1.3; margin: 16px 0 0; font-weight: 800; }
.lang-head span { display: block; color: var(--muted); font-size: 18px; font-weight: 600; }

/* ---------- signature ---------- */

.sigbox { position: relative; margin-top: 8px; }
.sigbox canvas {
  display: block; width: 100%; height: 170px;
  background: #FFFFFF; border: 2px dashed var(--line); border-radius: 12px;
  touch-action: none;
}
.sigbox .sigline {
  position: absolute; left: 16px; right: 16px; bottom: 36px; border-bottom: 1px solid #C9D1CD; pointer-events: none;
}
.sigbox .clear {
  position: absolute; top: 6px; right: 8px; background: #FFFFFF; border: 1px solid #D3DCD8;
  border-radius: 8px; padding: 4px 10px; font-size: 14px; font-weight: 700; color: #56665E;
}
