:root {
  --accent: #005493;
  --accent-soft: #e6eef5;
  --ink: #1e1e1e;
  --muted: #6b6b6b;
  --line: #d6dbe0;
  --bg: #f4f6f8;
  --card: #ffffff;
  --ok: #1b7f3b;
  --warn: #b25e00;
  --bad: #b3261e;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #5aa9e6;
    --accent-soft: #1d2b38;
    --ink: #e8e8e8;
    --muted: #a0a0a0;
    --line: #3a3f45;
    --bg: #121416;
    --card: #1c1f22;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--accent); color: #fff;
}
.bar a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; }
.bar-link { margin-left: auto; font-size: 0.9rem; }
.who { font-size: 0.85rem; opacity: 0.9; }
.net { font-size: 0.75rem; padding: 2px 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.2); }
.net.off { background: #b3261e; }
main { max-width: 820px; margin: 0 auto; padding: 16px 16px calc(env(safe-area-inset-bottom) + 96px); }
h1 { font-size: 1.35rem; margin: 4px 0 12px; }
h2 { font-size: 1.05rem; margin: 20px 0 8px; }
.muted { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
label { display: block; font-size: 0.9rem; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px; min-height: 44px;
}
textarea { min-height: 110px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; margin: 0; flex: none; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 400; margin: 8px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (min-width: 700px) { .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; } }
button, .btn {
  font: inherit; font-weight: 600; min-height: 44px; padding: 10px 16px; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--card); color: var(--accent); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
button.primary, .btn.primary { background: var(--accent); color: #fff; }
button.danger { border-color: var(--bad); color: var(--bad); }
button.small { min-height: 34px; padding: 4px 10px; font-size: 0.85rem; }
button:disabled { opacity: 0.5; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; }
.big { width: 100%; padding: 18px; font-size: 1.1rem; margin-bottom: 10px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.chip { flex: none; font-size: 0.8rem; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--muted); min-height: 0; font-weight: 500; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 auto; border-color: var(--line); color: var(--ink); font-weight: 500; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 12px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.pick { cursor: pointer; }
.pick:hover { background: var(--accent-soft); }
.tag { font-size: 0.75rem; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: #fff1de; color: var(--warn); }
.tag.bad { background: #fde7e6; color: var(--bad); }
.tag.ok { background: #e3f4e8; color: var(--ok); }
.stamp { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .photos { grid-template-columns: repeat(4, 1fr); } }
.slot { border: 1px dashed var(--line); border-radius: var(--radius); padding: 8px; text-align: center; background: var(--card); }
.slot img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; display: block; }
.slot .ph { aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.85rem; }
.slot input { display: none; }
.slot .lbl { font-size: 0.85rem; font-weight: 600; margin-top: 6px; }
.slot .meta { font-size: 0.7rem; color: var(--muted); }
.sig { width: 100%; height: 180px; border: 1px solid var(--line); border-radius: 8px; background: #fff; touch-action: none; display: block; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; gap: 10px; justify-content: space-between;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 10px);
  background: var(--card); border-top: 1px solid var(--line);
}
.nav button { flex: 1; max-width: 400px; }
.problems { color: var(--bad); padding-left: 18px; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 84px); z-index: 10; max-width: 520px; margin: 0 auto; background: var(--ink); color: var(--bg); padding: 12px 14px; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; }
.table-wrap { overflow-x: auto; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.tile b { display: block; font-size: 1.4rem; }
.stepper { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.chip.done { border-color: var(--ok); color: var(--ok); }
.chip.todo { border-color: var(--bad); color: var(--bad); }
.legend { font-size: 0.8rem; margin: 0 0 4px; }
.req { color: var(--bad); font-weight: 700; }
.req-hint { font-size: 0.7rem; font-weight: 500; color: var(--bad); margin-left: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.fld.invalid input, .fld.invalid select, .fld.invalid textarea, .fld.invalid .sig { border: 2px solid var(--bad); }
.fld.invalid .seg { outline: 2px solid var(--bad); outline-offset: 3px; border-radius: 8px; }
.fld.invalid .check { color: var(--bad); }
.err { color: var(--bad); font-size: 0.85rem; margin-top: 4px; }
.card.errors { border-color: var(--bad); }
