:root {
  --bg: #05070b;
  --bg2: #0b1018;
  --panel: #101722;
  --panel2: #151e2c;
  --line: #263242;
  --line2: #334156;
  --txt: #f5f7fb;
  --mut: #94a3b8;
  --soft: #cbd5e1;
  --acc: #ffffff;
  --blue: #4f8cff;
  --cyan: #32d4c2;
  --ok: #2fd17d;
  --warn: #f2b84b;
  --bad: #f06464;
  --rev: #a78bfa;
  --r: 8px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }
body {
  background: var(--bg);
  color: var(--txt);
  font: 16px/1.48 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

#app {
  width: min(100%, 620px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: calc(var(--sat) + 12px) 16px calc(var(--sab) + 18px);
}

.screen { display: none; flex: 1; flex-direction: column; animation: fadeUp .18s ease; }
.screen.active { display: flex; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  padding: 4px 0 14px;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.brand-lockup { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 148px; max-width: 44vw; height: auto; display: block; }
.brand-lockup span { color: var(--soft); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.screen-title { font-size: 15px; font-weight: 850; letter-spacing: .02em; text-transform: uppercase; color: var(--soft); text-align: center; }
.top-spacer { width: 44px; height: 44px; flex: 0 0 44px; }

.svg-icon, .ico { width: 20px; height: 20px; display: inline-flex; flex: none; }
.svg-icon svg, .ico svg { width: 100%; height: 100%; display: block; }
.iconbtn, .navbtn {
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--txt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.iconbtn { width: 44px; padding: 0; }
.navbtn { padding: 0 12px; color: var(--soft); font-size: 13px; font-weight: 750; }
.iconbtn:active, .navbtn:active, .btn:active { transform: scale(.985); }
.iconbtn:focus-visible, .navbtn:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.hero { padding: 8px 0 18px; }
.eyebrow { color: var(--cyan); font-size: 12px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; margin-bottom: 10px; }
h1 { font-size: clamp(34px, 8vw, 52px); line-height: .98; letter-spacing: 0; max-width: 11ch; margin-bottom: 14px; }
h2 { font-size: 22px; line-height: 1.15; letter-spacing: 0; margin-bottom: 8px; }
h3 { font-size: 13px; color: var(--soft); letter-spacing: .08em; text-transform: uppercase; margin: 16px 0 8px; }
.sub { color: var(--mut); font-size: 15px; line-height: 1.5; margin-bottom: 16px; max-width: 58ch; }
.mini { color: var(--mut); font-size: 13px; line-height: 1.45; margin: 6px 0 10px; }
.center { text-align: center; }

.flow-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 2px 0 16px;
}
.flow-grid div {
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.flow-grid b { color: var(--cyan); font-size: 12px; }
.flow-grid span { color: var(--txt); font-size: 13px; font-weight: 800; line-height: 1.15; }
.flow-grid strong { color: var(--mut); font-size: 12px; font-weight: 700; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
}
.btn {
  width: 100%;
  min-height: 54px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--txt);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 850;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .1s ease, opacity .15s ease;
}
.btn.primary { background: var(--acc); color: #05070b; border-color: var(--acc); }
.btn.sec { background: var(--panel); color: var(--txt); }
.btn.ghost { background: transparent; color: var(--soft); border-style: dashed; }
.btn.danger { background: rgba(240,100,100,.14); border-color: rgba(240,100,100,.48); color: #ffc9c9; }
.btn.small { width: auto; min-height: 40px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.admin-link { display: inline-flex; justify-content: center; margin: 12px auto 0; color: var(--mut); font-size: 13px; text-decoration: none; }

.row { display: flex; gap: 10px; align-items: stretch; }
.row > * { flex: 1; }
.spacer { flex: 1; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
label { display: block; color: var(--soft); font-size: 12px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; margin: 0 0 7px; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--txt);
  border-radius: var(--r);
  padding: 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(50,212,194,.14); }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--mut) 50%), linear-gradient(135deg, var(--mut) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 12px) 20px;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
textarea { min-height: 96px; resize: vertical; }
.field { margin-bottom: 14px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button { min-height: 46px; border: 0; background: transparent; color: var(--mut); font-weight: 850; }
.seg button.on { background: var(--txt); color: var(--bg); }

.stepdots { display: flex; justify-content: center; gap: 6px; margin: 0 0 16px; }
.stepdots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line2); }
.stepdots i.on { width: 24px; border-radius: 99px; background: var(--cyan); }
.stepdots i.done { background: var(--ok); }

.photogrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.photoslot {
  aspect-ratio: 1;
  border-radius: var(--r);
  background: var(--panel);
  border: 1px dashed var(--line2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.photoslot.has-photo { border-style: solid; border-color: rgba(47,209,125,.75); background: #000; }
.photoslot .pshot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photoslot .plabel {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  background: rgba(5,7,11,.78);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--txt);
  border-radius: 6px;
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.photoslot .pcheck { position: absolute; right: 8px; top: 8px; z-index: 3; width: 26px; height: 26px; border-radius: 50%; background: var(--ok); color: #03110a; display: grid; place-items: center; }
.photoslot .padd { width: 42px; height: 42px; color: var(--soft); display: grid; place-items: center; }
.photoslot .pdesc { color: var(--mut); font-size: 12px; line-height: 1.25; max-width: 22ch; }

.camwrap { position: relative; aspect-ratio: 3 / 4; background: #000; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 12px; }
.camwrap video, .camwrap img.preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.overlay svg { width: 100%; height: 100%; }
.camhint { position: absolute; left: 10px; right: 10px; bottom: 10px; background: rgba(5,7,11,.78); border: 1px solid rgba(255,255,255,.14); border-radius: var(--r); padding: 10px 12px; color: var(--txt); font-size: 13px; line-height: 1.35; text-align: center; }
.camtools { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 8px; }
.camtools button { width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.16); background: rgba(5,7,11,.72); color: var(--txt); border-radius: 50%; display: grid; place-items: center; }
.shutter { width: 78px; height: 78px; border: 4px solid var(--txt); background: transparent; color: var(--txt); border-radius: 50%; display: grid; place-items: center; margin: 6px auto 0; }

.spin { width: 52px; height: 52px; border: 4px solid var(--line); border-top-color: var(--txt); border-radius: 50%; animation: rot .8s linear infinite; margin: 26px auto 16px; }
@keyframes rot { to { transform: rotate(360deg); } }
.steps { margin: 18px 0; }
.steps .s { min-height: 48px; display: flex; align-items: center; gap: 12px; padding: 10px 0; color: var(--mut); border-bottom: 1px solid var(--line); }
.steps .s:last-child { border-bottom: 0; }
.steps .ic { width: 28px; height: 28px; border: 2px solid var(--line2); border-radius: 50%; flex: 0 0 28px; display: grid; place-items: center; }
.steps .s.run { color: var(--txt); }
.steps .s.run .ic { border-color: var(--cyan); box-shadow: 0 0 0 5px rgba(50,212,194,.12); }
.steps .s.ok { color: var(--ok); }
.steps .s.ok .ic { background: var(--ok); border-color: var(--ok); color: #03110a; }

.verdict { border-radius: var(--r); padding: 20px 16px; text-align: center; margin-bottom: 12px; border: 1px solid; }
.verdict .v { font-size: 24px; line-height: 1.1; font-weight: 950; letter-spacing: .04em; }
.verdict .d { font-size: 14px; margin-top: 6px; opacity: .86; }
.v-QUALIFIED { background: rgba(47,209,125,.12); border-color: rgba(47,209,125,.62); color: #a7f3d0; }
.v-UPGRADE { background: rgba(242,184,75,.12); border-color: rgba(242,184,75,.62); color: #fde68a; }
.v-DQ { background: rgba(240,100,100,.13); border-color: rgba(240,100,100,.66); color: #fecaca; }
.v-REVIEW { background: rgba(167,139,250,.12); border-color: rgba(167,139,250,.62); color: #ddd6fe; }
.dial { display: flex; align-items: center; gap: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.dial svg { flex: none; }
.dial .num { font-size: 46px; font-weight: 950; line-height: 1; letter-spacing: 0; }
.dial .lbl { color: var(--mut); font-size: 12px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; }
.dial .info { flex: 1; min-width: 0; }
.facts { width: 100%; border-collapse: collapse; }
.facts td { padding: 9px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
.facts td:first-child { width: 42%; color: var(--mut); font-size: 12px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.facts tr:last-child td { border-bottom: 0; }
.factedit { width: auto; min-height: 32px; max-width: 120px; padding: 4px 6px; text-align: right; background: transparent; border: 0; border-bottom: 1px dashed var(--line2); border-radius: 0; }
.conf, .chip { display: inline-flex; align-items: center; justify-content: center; border-radius: 99px; font-size: 11px; font-weight: 850; padding: 3px 8px; line-height: 1; }
.conf.hi { background: rgba(47,209,125,.16); color: #a7f3d0; }
.conf.md { background: rgba(242,184,75,.16); color: #fde68a; }
.conf.lo { background: rgba(240,100,100,.16); color: #fecaca; }
.chip { background: var(--bg2); border: 1px solid var(--line); color: var(--soft); }
.chip.on { color: #a7f3d0; border-color: rgba(47,209,125,.5); background: rgba(47,209,125,.12); }
.rule { display: flex; gap: 10px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rule:last-child { border-bottom: 0; }
.rule .tag { min-width: 54px; text-align: center; flex: none; border-radius: 6px; padding: 4px 7px; font-size: 10px; font-weight: 950; letter-spacing: .05em; text-transform: uppercase; }
.tag.dq { background: rgba(240,100,100,.16); color: #fecaca; }
.tag.upgrade { background: rgba(242,184,75,.16); color: #fde68a; }
.tag.deduct { background: rgba(79,140,255,.16); color: #bfdbfe; }
.tag.note { background: rgba(148,163,184,.16); color: var(--soft); }
.rdet, .mut { color: var(--mut); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.evphoto { width: 48px; height: 48px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: var(--bg2); flex: none; }
.evphoto img { width: 100%; height: 100%; object-fit: cover; }

.hist { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.hist .histicon { width: 52px; height: 52px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; color: var(--soft); flex: none; }
.hist .meta { flex: 1; min-width: 0; }
.hist .name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist .sub { font-size: 13px; margin: 0; }
.hist .hv { flex: none; border-radius: 6px; padding: 4px 8px; font-size: 11px; font-weight: 900; letter-spacing: .04em; }

.adm-section { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); margin-bottom: 10px; overflow: hidden; }
.adm-head { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: transparent; border: 0; color: var(--txt); padding: 0 14px; font-weight: 850; text-align: left; }
.adm-body { display: none; padding: 0 14px 14px; }
.adm-section.open .adm-body { display: block; }
.adm-head .car { width: 20px; height: 20px; color: var(--mut); transition: transform .15s ease; }
.adm-section.open .car { transform: rotate(90deg); }
.adm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.logic-list { display: grid; gap: 6px; margin-top: 10px; }
.logic-list div, .admin-row {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px;
}
.admin-row { margin-bottom: 8px; }
.admin-row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.list-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: 99px; padding: 7px 10px; font-size: 13px; color: var(--soft); margin: 0 6px 6px 0; }
.list-pill b { color: var(--bad); cursor: pointer; font-size: 14px; }
.adm-savebar { position: sticky; bottom: 0; z-index: 6; padding: 14px 0 6px; background: linear-gradient(180deg, rgba(5,7,11,0), var(--bg) 45%); margin-top: 12px; }
.pinpad input { text-align: center; font-size: 30px; font-weight: 900; letter-spacing: 12px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--sab) + 24px); transform: translateX(-50%) translateY(6px); max-width: min(90vw, 520px); padding: 12px 18px; border-radius: 99px; background: var(--txt); color: var(--bg); font-weight: 850; font-size: 14px; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 80; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #03110a; }
.footer-note { color: var(--mut); font-size: 12px; line-height: 1.4; text-align: center; margin-top: auto; padding-top: 18px; }
.hl-banner, .err-banner, .notice-banner, .danger-banner, .ok-banner { border-radius: var(--r); padding: 11px 12px; font-size: 13px; line-height: 1.45; margin-bottom: 12px; }
.hl-banner, .notice-banner { color: #ddd6fe; background: rgba(167,139,250,.12); border: 1px solid rgba(167,139,250,.38); }
.err-banner, .danger-banner { color: #fecaca; background: rgba(240,100,100,.12); border: 1px solid rgba(240,100,100,.38); }
.ok-banner { color: #a7f3d0; background: rgba(47,209,125,.12); border: 1px solid rgba(47,209,125,.38); }
.kvline { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--mut); font-size: 14px; padding: 5px 0; }
.kvline b { color: var(--txt); }

@media (max-width: 430px) {
  #app { padding-left: 14px; padding-right: 14px; }
  .brand-logo { width: 126px; }
  .brand-lockup span { display: none; }
  .navbtn > span:last-child { display: none; }
  .navbtn { padding: 0; width: 44px; }
  .flow-grid { grid-template-columns: 1fr; }
  .flow-grid div { min-height: 64px; }
  .row { gap: 8px; }
  .adm-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
