/* AutoInspect - tablet first. One accent, calm surfaces, big touch targets. */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --ink: #111827; --muted: #5b6472; --line: #dfe3e8;
  --accent: #0f5c6e; --accent-ink: #ffffff; --accent-soft: #e2f1f4;
  --green: #1f8a4c; --yellow: #b97a00; --red: #c0392b; --violet: #7c3aed;
  --green-soft: #e4f4ea; --yellow-soft: #fbf0d8; --red-soft: #fbe6e3; --violet-soft: #efe7fd;
  --radius: 10px; --tap: 46px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.45; }
h1 { font-size: 1.45rem; margin: 0 0 .4rem; } h2 { font-size: 1.15rem; margin: 0 0 .5rem; } h3 { font-size: 1rem; margin: .9rem 0 .35rem; }
p { margin: .35rem 0; } a { color: var(--accent); }
.boot { padding: 3rem; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: .86rem; } .mono { font-family: ui-monospace, Consolas, monospace; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; } .grow { flex: 1 1 auto; } .right { margin-left: auto; }
.stack > * + * { margin-top: .7rem; } .gap { height: .6rem; }
.hidden { display: none !important; }

/* shell */
.topbar { position: sticky; top: 0; z-index: 20; background: #0d2a33; color: #fff; display: flex; align-items: center; gap: .4rem; padding: .35rem .8rem; }
.brand { font-weight: 700; letter-spacing: .02em; margin-right: .6rem; font-size: 1.05rem; }
.brand span { color: #7fd1e0; }
.nav { display: flex; gap: .2rem; flex-wrap: wrap; }
.nav a { color: #d6e6ea; text-decoration: none; padding: .55rem .8rem; border-radius: 8px; min-height: 40px; display: inline-flex; align-items: center; }
.nav a.on { background: #1b4753; color: #fff; }
.topbar .who .btn, .topbar .who button { background: transparent; color: #d6e6ea; border-color: #3b6672; }
.topbar .who { margin-left: auto; font-size: .85rem; color: #b8cdd3; display: flex; gap: .5rem; align-items: center; }
.page { max-width: 1280px; margin: 0 auto; padding: 1rem .9rem 4rem; }
.banner { background: var(--yellow-soft); border: 1px solid #ecd08a; color: #6b4a00; padding: .5rem .8rem; border-radius: var(--radius); font-size: .9rem; }

/* controls */
button, .btn { font: inherit; min-height: var(--tap); padding: .5rem 1rem; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
button:hover, .btn:hover { border-color: #b9c2cc; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { color: var(--red); border-color: #e6b8b2; }
button.ghost { background: transparent; }
button.small, .btn.small { min-height: 36px; padding: .25rem .65rem; font-size: .9rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
input, select, textarea { font: inherit; min-height: var(--tap); padding: .45rem .6rem; border: 1px solid #c3cad3; border-radius: 9px; background: #fff; color: var(--ink); max-width: 100%; }
textarea { min-height: 5rem; width: 100%; }
input[type=checkbox] { min-height: 0; width: 22px; height: 22px; }
input[type=file] { border: 1px dashed #b9c2cc; background: #fafbfc; }
label.field { display: flex; flex-direction: column; gap: .2rem; font-size: .88rem; color: var(--muted); }
label.field > input, label.field > select, label.field > textarea { color: var(--ink); }
.field-error { color: var(--red); font-size: .85rem; }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }

/* cards and tables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.card.tight { padding: .6rem .75rem; }
.grid { display: grid; gap: .8rem; } .grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); } .grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.tablewrap { overflow-x: auto; }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.pill.green { background: var(--green-soft); color: var(--green); } .pill.yellow { background: var(--yellow-soft); color: var(--yellow); }
.pill.red { background: var(--red-soft); color: var(--red); } .pill.grey { background: #eceff2; color: var(--muted); }
.pill.both { background: var(--red-soft); color: var(--red); } .pill.history { background: var(--violet-soft); color: var(--violet); } .pill.simulation { background: var(--yellow-soft); color: var(--yellow); }
.pill.synthetic { background: #fff; border-color: #ecd08a; color: #8a6200; }
.verdict-big { font-size: 1.6rem; font-weight: 800; letter-spacing: .04em; }
.verdict-big.green { color: var(--green); } .verdict-big.yellow { color: var(--yellow); } .verdict-big.red { color: var(--red); }

/* workflow stepper */
.stepper { display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .3rem; }
.step { flex: 1 0 104px; min-height: 62px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); padding: .35rem .5rem; text-align: left; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 0; font-size: .82rem; }
.step .n { font-size: .72rem; color: var(--muted); } .step .t { font-weight: 600; line-height: 1.2; }
.step.done { background: var(--green-soft); border-color: #a9d8ba; } .step.done .n::after { content: "  done"; color: var(--green); }
.step.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.step.locked { opacity: .55; }
.step.shown { outline: 3px solid #7fd1e0; outline-offset: 1px; }
.progress { height: 8px; background: #e3e7eb; border-radius: 99px; overflow: hidden; } .progress > div { height: 100%; background: var(--accent); transition: width .3s; }
.missing { background: #fff8e6; border: 1px solid #ecd08a; border-radius: 9px; padding: .5rem .75rem; font-size: .92rem; }
.missing ul { margin: .2rem 0 0 1.1rem; padding: 0; }
.donebox { background: var(--green-soft); border: 1px solid #a9d8ba; border-radius: 9px; padding: .5rem .75rem; font-size: .92rem; color: #14532d; }

/* part view */
.pv-tools { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; margin-bottom: .4rem; }
.pv-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfd; max-height: 62vh; }
.pv-scroll svg { display: block; }
.pv-scroll svg.drawing { touch-action: none; cursor: crosshair; }
.legend { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: .35rem; }
.legend i { display: inline-block; width: 14px; height: 10px; border: 2px solid; vertical-align: middle; margin-right: .25rem; }
.thumb { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }
.photo-wrap { position: relative; display: inline-block; max-width: 100%; }
.photo-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

/* coverage grid for calibration */
.cov { display: grid; grid-template-columns: repeat(3, 34px); gap: 3px; }
.cov div { height: 26px; border-radius: 4px; background: #e3e7eb; } .cov div.on { background: var(--green); }
.chips { display: flex; gap: .3rem; flex-wrap: wrap; } .chip { padding: .15rem .55rem; border-radius: 99px; background: #e3e7eb; font-size: .8rem; } .chip.on { background: var(--green-soft); color: var(--green); }

/* recording */
.rec { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--red); }
.rec::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.question { font-size: 1.25rem; font-weight: 600; background: var(--accent-soft); border-radius: var(--radius); padding: .8rem 1rem; }
.transcript { max-height: 240px; overflow: auto; font-size: .92rem; } .transcript button { min-height: 0; padding: 0 .3rem; border: 0; background: none; color: var(--accent); }

/* toasts and dialogs (never browser pop-ups) */
#toasts { position: fixed; right: 12px; bottom: 12px; z-index: 60; display: flex; flex-direction: column; gap: .5rem; max-width: min(460px, 92vw); }
.toast { background: #10242b; color: #fff; padding: .7rem .9rem; border-radius: 10px; box-shadow: 0 6px 22px rgba(0,0,0,.25); display: flex; gap: .7rem; align-items: flex-start; font-size: .95rem; }
.toast.ok { background: #14532d; } .toast.warn { background: #7a5200; } .toast.error { background: #8f2419; }
.toast button { min-height: 0; padding: 0 .3rem; background: none; border: 0; color: #fff; font-size: 1.1rem; }
.overlay { position: fixed; inset: 0; background: rgba(8, 20, 26, .55); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.dialog { background: #fff; border-radius: 14px; padding: 1.1rem 1.2rem; max-width: 620px; width: 100%; max-height: 92vh; overflow: auto; }
.login { max-width: 420px; margin: 9vh auto; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: .8rem; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; }
.tabs button.on { border-bottom-color: var(--accent); color: var(--accent); background: none; font-weight: 700; }
.ladder .lvl { font-size: 1.6rem; font-weight: 800; color: var(--accent); width: 2.2rem; }
ul.clean { margin: .2rem 0 .2rem 1.1rem; padding: 0; }
@media (max-width: 640px) { .page { padding: .7rem .5rem 4rem; } th, td { padding: .35rem .3rem; } }
@media print { .topbar, #toasts { display: none; } }
