:root {
  --ink: #1a2332;
  --ink-soft: #4a5568;
  --paper: #f6f1e8;
  --paper-2: #efe6d6;
  --gold: #b08d3e;
  --gold-dark: #8c6d28;
  --navy: #1c2b4a;
  --navy-2: #24365c;
  --white: #fffdf8;
  --ok: #2f6b4f;
  --danger: #9b2c2c;
  --line: rgba(28, 43, 74, 0.12);
  --shadow: 0 10px 30px rgba(28, 43, 74, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(180deg, #e9e0d0 0%, var(--paper) 28%, #f8f4ee 100%);
  color: var(--ink);
  min-height: 100dvh;
}

.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--white);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.topbar {
  background: var(--navy);
  color: #f7efe0;
  padding: 16px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; gap: 10px; align-items: center; }
.seal {
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid var(--gold);
  display: grid; place-items: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700; color: var(--gold); font-size: 13px;
}
.brand h1 { margin: 0; font-size: 15px; letter-spacing: .04em; font-weight: 600; }
.brand p { margin: 0; font-size: 11px; opacity: .75; }
.folio-chip {
  font-size: 11px; background: rgba(176,141,62,.18);
  border: 1px solid rgba(176,141,62,.45);
  color: #e8d7a8; padding: 4px 8px; border-radius: 999px;
}

.progress {
  display: flex; gap: 6px; padding: 12px 18px 0;
}
.dot {
  flex: 1; height: 4px; border-radius: 99px; background: #e4d9c6;
}
.dot.on { background: var(--gold); }

.screen { display: none; padding: 16px 18px 110px; }
.screen.active { display: block; }

h2 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 28px; margin: 8px 0 6px; line-height: 1.15;
}
.lead { color: var(--ink-soft); font-size: 14px; margin: 0 0 18px; line-height: 1.45; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card h3 { margin: 0 0 8px; font-size: 14px; }

label { display: block; font-size: 12px; font-weight: 600; margin: 10px 0 5px; color: var(--navy); }
input, select, textarea {
  width: 100%; border: 1px solid #d7ccb8; border-radius: 12px;
  padding: 12px 12px; font-size: 16px; background: #fffdf9; color: var(--ink);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check {
  display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-soft);
  margin: 12px 0;
}
.check input { width: auto; margin-top: 3px; }

.guide {
  background: #f4ead6; border-left: 3px solid var(--gold); padding: 10px 12px; border-radius: 8px;
  font-size: 13px; color: #4a3d22;
}
.guide ul { margin: 6px 0 0; padding-left: 18px; }

.photo-box {
  border: 1.5px dashed #c9b48a; border-radius: 16px; min-height: 180px;
  display: grid; place-items: center; text-align: center; padding: 16px; background: #faf6ee;
  position: relative; overflow: hidden;
}
.photo-box img { width: 100%; height: 220px; object-fit: cover; border-radius: 12px; display: block; }
.photo-box .hint { font-size: 13px; color: var(--ink-soft); }
.actions-inline { display: flex; gap: 8px; margin-top: 10px; }

.btn {
  appearance: none; border: 0; border-radius: 14px; padding: 13px 16px;
  font-size: 15px; font-weight: 650; cursor: pointer; width: 100%;
}
.btn-primary { background: var(--navy); color: #f7efe0; }
.btn-gold { background: var(--gold); color: #1c1608; }
.btn-ghost { background: transparent; border: 1px solid #cfc3ab; color: var(--navy); }
.btn:disabled { opacity: .45; }

.bottom {
  position: sticky; bottom: 0; left: 0; right: 0;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255,253,248,0), #fffdf8 28%);
}

.summary dt { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.summary dd { margin: 0 0 10px; font-size: 15px; }
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.thumbs img { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; }

.ok-seal {
  width: 72px; height: 72px; border-radius: 50%; margin: 10px auto 8px;
  border: 3px solid var(--ok); color: var(--ok); display: grid; place-items: center; font-size: 28px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.status { font-size: 11px; padding: 3px 8px; border-radius: 99px; background: #e8f3ec; color: var(--ok); }

.ia-box { border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin: 12px 0; background: #fbf8f1; }
.ia-box h3 { margin: 0 0 8px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.score {
  font-variant-numeric: tabular-nums; font-size: 12px; padding: 3px 8px; border-radius: 99px;
  background: #e8f3ec; color: var(--ok);
}
.score.warn { background: #f8edd3; color: #8a5a12; }
.score.bad { background: #f8e0e0; color: var(--danger); }
.ia-list { list-style: none; margin: 0; padding: 0; }
.ia-list li {
  font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start;
}
.ia-list li:last-child { border-bottom: 0; }
.flag-ok { color: var(--ok); }
.flag-warn { color: #8a5a12; }
.flag-bad { color: var(--danger); }
.field-error { border-color: #c98585 !important; background: #fff6f6; }
.ia-loading { font-size: 13px; color: var(--ink-soft); }

#live-wrap {
  position: relative; border-radius: 16px; overflow: hidden; background: #111;
  aspect-ratio: 3/4; max-height: 360px;
}
#live-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#live-wrap::after {
  content: ""; position: absolute; inset: 12% 18%;
  border: 2px dashed rgba(232, 215, 168, .75); border-radius: 50% / 42%; pointer-events: none;
}
#live-wrap[data-state="ok"]::after { border-color: #6ecf9a; }
.live-status {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  background: rgba(16, 22, 36, .72); color: #f7efe0; font-size: 13px;
  padding: 8px 10px; border-radius: 10px; text-align: center;
}
.chal { display: flex; gap: 6px; margin: 10px 0 0; }
.chal span {
  flex: 1; font-size: 10px; text-align: center; padding: 6px 4px; border-radius: 8px;
  background: #efe6d6; color: #5c5346;
}
.chal span.on { background: #e8f3ec; color: var(--ok); font-weight: 700; }

@media (min-width: 900px) {
  body { padding: 24px 0; }
  .app { border-radius: 24px; min-height: calc(100dvh - 48px); }
}
