:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #16202c;
  --muted: #667085;
  --line: #dde2ea;
  --accent: #b50d12;
  --accent-soft: #fbe9e9;
  --ok: #17864a;
  --ok-soft: #e3f4ea;
  --bad: #c2362b;
  --bad-soft: #fbe7e5;
  --warn-soft: #fff4d6;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --card: #19202a;
    --text: #e8edf3;
    --muted: #93a0b2;
    --line: #2b3542;
    --accent: #e8453c;
    --accent-soft: #3a1b1b;
    --ok: #4cc27f;
    --ok-soft: #173325;
    --bad: #ef6b60;
    --bad-soft: #3a1c1a;
    --warn-soft: #3a3016;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
main { max-width: 560px; margin: 0 auto; padding: 16px; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.top-title { font-weight: 700; font-size: 17px; flex: 1; }
.top-user { color: var(--muted); font-size: 13px; text-align: right; }
.icon-btn {
  border: 0; background: none; color: var(--accent);
  font-size: 30px; line-height: 1; padding: 0 8px 4px 0; cursor: pointer;
}

h1 { font-size: 24px; margin: 24px 0 6px; }
h2 { font-size: 18px; margin: 22px 0 10px; }
p.sub { color: var(--muted); margin: 0 0 20px; }

.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line); padding: 16px; margin-bottom: 12px;
}
.field { margin-bottom: 18px; }
.field > label, .label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 15px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

input, select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; min-height: 48px; appearance: none; -webkit-appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 10px 14px; font: inherit; font-size: 15px; cursor: pointer; min-height: 44px;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.num { min-width: 52px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg .chip { border-radius: 12px; font-weight: 600; padding: 14px; }
.seg .chip.on.ok { background: var(--ok); border-color: var(--ok); }
.seg .chip.on.bad { background: var(--bad); border-color: var(--bad); }

.btn {
  display: block; width: 100%; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-weight: 700;
  padding: 15px; min-height: 52px; text-align: center; text-decoration: none;
}
.btn:disabled { opacity: .55; }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: none; color: var(--muted); font-weight: 500; }
.btn + .btn { margin-top: 10px; }
.btn.small { display: inline-block; width: auto; padding: 8px 12px; min-height: 36px; font-size: 14px; }
.btn.small + .btn.small { margin-top: 0; margin-left: 6px; }
.btn.danger { background: var(--bad-soft); color: var(--bad); }

.menu { display: grid; gap: 12px; margin-top: 8px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; font: inherit; color: var(--text); cursor: pointer;
}
.menu-item .ico { font-size: 26px; width: 36px; text-align: center; }
.menu-item b { display: block; font-size: 17px; }
.menu-item span { color: var(--muted); font-size: 14px; }
.badge { background: var(--bad); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 13px; font-weight: 700; margin-left: 6px; }

.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 15px; }
.alert.err { background: var(--bad-soft); color: var(--bad); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); }

.report { font-size: 15px; }
.report .head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.report .st { font-weight: 700; }
.report .st.ok { color: var(--ok); }
.report .st.bad { color: var(--bad); }
.report .meta { color: var(--muted); font-size: 13px; }

.user-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-row .nm { font-weight: 600; }
.user-row .ph { color: var(--muted); font-size: 13px; }
.user-row .acts { flex-shrink: 0; text-align: right; }
.tag { display: inline-block; font-size: 12px; border-radius: 6px; padding: 2px 7px; background: var(--accent-soft); color: var(--accent); }
.tag.pending { background: var(--warn-soft); color: var(--text); }
.tag.blocked { background: var(--bad-soft); color: var(--bad); }
.tag.none { background: none; color: var(--muted); border: 1px solid var(--line); }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 528px; margin: 0 auto; z-index: 20;
  background: #16202c; color: #fff; border-radius: 12px; padding: 14px 16px; font-size: 15px;
}
.success { text-align: center; padding: 30px 0 10px; }
.success .big { font-size: 56px; }
.install-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin: 4px 0 8px; position: relative;
}
.install-banner img { width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; }
.install-banner .ib-text { flex: 1; min-width: 0; }
.install-banner .ib-text b { display: block; font-size: 15px; }
.install-banner .ib-text span { display: block; color: var(--muted); font-size: 13px; line-height: 1.3; }
.install-banner .btn.small { flex-shrink: 0; }
.ib-close {
  position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0;
}

.sheet-bg {
  position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease-out;
}
.sheet {
  width: 100%; max-width: 560px; background: var(--card);
  border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  animation: up .2s ease-out; position: relative;
}
.sheet-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.sheet-head img { width: 52px; height: 52px; border-radius: 12px; }
.sheet-head b { display: block; font-size: 18px; }
.sheet-head span { color: var(--muted); font-size: 14px; }
.steps { list-style: none; padding: 0; margin: 0 0 12px; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.steps li:last-child { border-bottom: 0; }
.step-n {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.step-ico { color: var(--accent); display: flex; flex-shrink: 0; }
.sheet .hint { margin: 0 0 14px; }
.sheet-arrow { text-align: center; font-size: 28px; color: #fff; position: absolute; left: 0; right: 0; bottom: -40px; animation: bob 1s infinite alternate; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
@keyframes bob { to { transform: translateY(6px); } }

/* как у нативного приложения: без подсветки текста и «резинки» на iOS */
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; -webkit-user-select: none; user-select: none; }
  input, textarea { -webkit-user-select: text; user-select: text; }
}

.brand { text-align: center; margin-top: 18px; }
.brand img { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 6px 18px rgba(120,0,0,.25); }

.seg3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.seg3 .chip { border-radius: 12px; font-weight: 600; padding: 12px 6px; }
.picks { display: grid; gap: 8px; }
.pick {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%;
  text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; min-height: 50px;
}
.pick small { color: var(--muted); font-size: 12px; text-align: right; }
.pick.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.pick.busy:not(.on) { opacity: .6; }
.pick.busy small { color: var(--bad); }

.shot {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; cursor: pointer;
}
.shot.done { border-style: solid; border-color: var(--ok); }
.shot-preview {
  width: 64px; height: 64px; flex-shrink: 0; border-radius: 10px; overflow: hidden;
  background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.shot-preview img { width: 100%; height: 100%; object-fit: cover; }
.shot-text b { display: block; font-size: 15px; }
.shot-text span { color: var(--muted); font-size: 13px; }
.report .thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.report .thumbs a { flex: 1; }
.report .thumbs img { width: 100%; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

.help-img { display: block; width: 100%; border-radius: 12px; border: 1px solid var(--line); margin: 12px 0 14px; background: #fff; }

.verdict { border-radius: 10px; padding: 9px 12px; margin: 6px 0; font-size: 14px; }
.verdict b { display: block; font-size: 15px; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.bad { background: var(--bad-soft); color: var(--bad); }
.verdict.warn { background: var(--warn-soft); color: var(--text); }
.verdict.wait { background: var(--bg); color: var(--muted); }
