:root {
  --ink: #15191E; --ink2: #3E4752; --muted: #5A6470; --line: #D5DAE0; --line2: #C5CCD4;
  --ground: #EEF0F2; --surface: #FFFFFF; --head: #15191E; --head2: #20262D; --head-muted: #B9C1CA;
  --accent: #1F4E9E; --accent-2: #2F66C4; --accent-bg: #E3EAF7;
  --yes: #0E6E55; --yes-bg: #E6F3EE; --no: #C2410C; --no-ink: #9A3412; --no-bg: #FDE8DC; --na: #5A6470;
  --warn-bg: #F6EBD7; --warn-line: #E7D9C3; --warn-ink: #6B4A12;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-size: 15px; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
a { color: var(--accent); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.hidden { display: none !important; }

/* --- каркас --- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.head { position: sticky; top: 0; z-index: 20; background: var(--head); color: #fff; padding-top: env(safe-area-inset-top); }
.head-row { min-height: 60px; display: flex; align-items: center; gap: 4px; padding: 6px 10px 6px 6px; max-width: 980px; margin: 0 auto; }
.head-title { flex: 1; min-width: 0; }
.head-title h1 { margin: 0; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-title .sub { font-size: 12px; color: var(--head-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; flex-shrink: 0; border: 0; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
.icon-btn:hover { background: rgba(255,255,255,.08); }
.head-btn { height: 40px; padding: 0 12px; border: 1px solid #3A424C; border-radius: 10px; background: var(--head2); color: #fff; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.syncbar { width: 100%; border: 0; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 28px; padding: 4px 12px; font-size: 12px; font-weight: 600; background: var(--head2); color: var(--head-muted); }
.syncbar.off { background: var(--warn-bg); color: var(--warn-ink); }
.syncbar.busy { background: #1C2A40; color: #CFE0FF; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #5FD1A8; }
.syncbar.off .dot { background: var(--no); }
.syncbar.busy .dot { background: #7FB0FF; }
.progress-line { height: 4px; background: #2A3139; }
.progress-line > div { height: 100%; background: #5FD1A8; }

.main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 14px 14px 120px; display: flex; flex-direction: column; gap: 14px; }
.main.narrow { max-width: 640px; }
.bottombar { position: sticky; bottom: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); }
.bottombar-in { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }

/* --- элементы --- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card.click { cursor: pointer; text-align: left; width: 100%; }
.card.warn { background: var(--warn-bg); border-color: var(--warn-line); color: #4A3209; }
.card.ok { background: var(--yes-bg); border-color: #A9D5C4; }
.card.accent { border: 1.5px solid var(--accent); }
.card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.label { font-size: 13px; font-weight: 600; color: var(--ink2); display: flex; flex-direction: column; gap: 6px; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 2px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.input, .textarea, .select { width: 100%; border-radius: 10px; border: 1px solid var(--line2); background: #fff; padding: 0 12px; font-size: 16px; }
.input, .select { height: 48px; }
.textarea { padding: 10px 12px; line-height: 1.45; resize: vertical; min-height: 64px; }
.textarea.no { border-color: #E5B79B; }
.btn { height: 50px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 600; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.sm { height: 40px; font-size: 14px; border-radius: 10px; padding: 0 14px; }
.btn.xs { height: 32px; font-size: 13px; border-radius: 8px; padding: 0 10px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line2); }
.btn.soft { background: var(--accent-bg); color: var(--accent); border: 1px solid #B8C7E3; }
.btn.green { background: var(--yes); }
.btn.danger { background: #fff; color: var(--no-ink); border: 1px solid #E5B79B; }
.btn.dashed { background: transparent; color: var(--accent); border: 1.5px dashed #9AA4AF; }
.btn.block { width: 100%; }
.link-btn { border: 0; background: transparent; color: var(--accent); font-weight: 600; font-size: 14px; padding: 6px 8px; min-height: 36px; }
.seg { display: flex; padding: 4px; border-radius: 12px; background: #DDE1E6; gap: 4px; }
.seg button { flex: 1; min-height: 40px; white-space: nowrap; border: 0; border-radius: 9px; font-size: 14px; font-weight: 600; background: transparent; color: #4A535E; padding: 0 8px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(21,25,30,.18); }
.choice { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; width: 100%; }
.choice.on { border: 2px solid var(--accent); background: var(--accent-bg); }
.choice .t { font-size: 15px; font-weight: 600; }
.choice .h { font-size: 12px; color: var(--muted); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 5px; white-space: nowrap; }
.tag.crit-Критично { background: var(--no-bg); color: var(--no-ink); }
.tag.crit-Важно { background: var(--accent-bg); color: var(--accent); }
.tag.crit-Рекомендуется { background: #ECEEF0; color: #4A535E; }
.tag.st-work { background: var(--accent-bg); color: var(--accent); }
.tag.st-review { background: var(--warn-bg); color: var(--warn-ink); }
.tag.st-done { background: var(--yes-bg); color: #0B5644; }
.bar { height: 6px; border-radius: 3px; background: #E4E7EB; overflow: hidden; }
.bar > div { height: 100%; border-radius: 3px; background: var(--accent-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 9px; border-radius: 999px; background: #262D35; color: #DCE1E6; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 10px 12px; max-width: 980px; margin: 0 auto; }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; border: 1.5px dashed var(--line2); border-radius: var(--radius); }

/* --- помещение --- */
.room-row { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.room-row .name { font-size: 16px; font-weight: 600; }
.room-row .st { font-size: 12px; font-weight: 600; flex-shrink: 0; }
.item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; display: flex; flex-direction: column; gap: 9px; }
.item.no { border: 1.5px solid #E5B79B; }
.item .param { font-size: 15px; font-weight: 600; line-height: 1.3; }
.item .req { font-size: 13px; color: #4A535E; line-height: 1.4; }
.ans { display: flex; gap: 6px; }
.ans button { flex: 1; height: 46px; border-radius: 10px; font-size: 15px; font-weight: 600; border: 1.5px solid var(--line2); background: #fff; }
.ans button.on.yes { background: var(--yes); border-color: var(--yes); color: #fff; }
.ans button.on.no { background: var(--no); border-color: var(--no); color: #fff; }
.ans button.on.na { background: var(--na); border-color: var(--na); color: #fff; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; border: 0; padding: 0; background: #DDE1E6; display: block; }
.thumb-wrap { position: relative; border: 0; padding: 0; background: none; }
.thumb-wrap .q { position: absolute; right: 3px; bottom: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--no); border: 2px solid #fff; }
.cam { width: 72px; height: 72px; border: 1.5px dashed #8C96A1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; position: relative; background: #fff; }
.cam.no { border-color: var(--no); color: var(--no-ink); }
.cam input, .gal input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.gal { position: relative; font-size: 12px; color: var(--accent); font-weight: 600; padding: 4px 0; cursor: pointer; display: inline-block; }
.warn-text { font-size: 12px; font-weight: 600; color: var(--no-ink); }

/* --- модальные окна, справка --- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(21,25,30,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--ground); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 18px; } }
.sheet h2 { margin: 0; font-size: 18px; }
.menu { display: flex; flex-direction: column; gap: 6px; }
.menu button { text-align: left; min-height: 48px; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 0 14px; font-size: 15px; font-weight: 600; }
.menu button.danger { color: var(--no-ink); }
.help { position: fixed; inset: 0; z-index: 60; background: var(--ground); display: flex; flex-direction: column; }
.help .body { flex: 1; overflow-y: auto; padding: 14px 14px 40px; max-width: 760px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.faq { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.faq > button { width: 100%; text-align: left; border: 0; background: transparent; padding: 13px 14px; display: flex; gap: 10px; align-items: center; font-size: 15px; font-weight: 600; line-height: 1.35; }
.faq .a { padding: 0 14px 14px; font-size: 14px; line-height: 1.55; color: #2E353D; white-space: pre-line; }
.fab { position: fixed; right: 14px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 30; width: 52px; height: 52px; border-radius: 50%; border: 2px solid #fff; background: var(--head); color: #fff; font-size: 22px; font-weight: 700; box-shadow: 0 4px 14px rgba(21,25,30,.28); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(160px + env(safe-area-inset-bottom)); z-index: 70; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.viewer img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; background: #000; }

/* --- вход --- */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px; gap: 26px; background: var(--head); color: #fff; }
.login-in { width: 100%; max-width: 380px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.login .input { background: var(--head2); border-color: #3A424C; color: #fff; }
.login .label { color: var(--head-muted); }
.login h1 { margin: 0; font-size: 30px; line-height: 1.15; }
.logo { width: 52px; height: 52px; border-radius: 14px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.err { background: #3A1E14; color: #FFD9C7; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.err.light { background: var(--no-bg); color: var(--no-ink); }

/* --- кабинет --- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi .v { font-size: 28px; font-weight: 700; margin-top: 2px; }
.tablebox { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
table.tb { border-collapse: collapse; width: 100%; min-width: 720px; }
.tb th { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #F7F8F9; }
.tb td { padding: 11px 12px; border-bottom: 1px solid #E4E7EB; font-size: 14px; vertical-align: middle; }
.tb td.n, .tb th.n { text-align: right; font-variant-numeric: tabular-nums; }
.otp { font-size: 26px; font-weight: 700; letter-spacing: .08em; background: #fff; border: 1px dashed var(--line2); border-radius: 10px; padding: 12px; text-align: center; }

/* --- предпросмотр отчёта --- */
.rep { background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 2px 12px rgba(21,25,30,.08); padding: clamp(18px, 5vw, 56px); font-size: 14px; line-height: 1.5; }
.rep h1 { font-size: 22px; line-height: 1.25; margin: 4px 0 10px; }
.rep h2 { font-size: 17px; margin: 26px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--ink); }
.rep h3 { font-size: 15px; margin: 18px 0 6px; padding-bottom: 3px; border-bottom: 1px solid #B9C1CA; }
.rep h3 small { font-weight: 400; color: var(--muted); font-size: 13px; }
.rep-kicker { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.rep-interim { color: var(--warn-ink); font-style: italic; font-size: 13px; }
.rep-meta { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; font-size: 13px; margin-top: 8px; }
.rep-meta span { color: var(--muted); } .rep-meta b { font-weight: 500; }
.rep-tw { overflow-x: auto; }
.rep table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.rep th, .rep td { border: 1px solid #B9C1CA; padding: 5px 7px; text-align: left; vertical-align: top; }
.rep th { background: #EEF0F2; }
.rep td.warn { color: var(--warn-ink); font-weight: 700; }
.rep .crit-Критично { color: var(--no-ink); font-weight: 700; } .rep .crit-Важно { color: var(--accent); } .rep .crit-Рекомендуется { color: var(--muted); }
.rep-floor { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 18px; }
.rep-sub { font-weight: 700; font-size: 13px; margin: 6px 0 4px; }
.rep-hint { font-size: 12px; color: var(--muted); margin: 4px 0; }
.rep-field { width: 100%; border: 1.5px dashed #9AA4AF; border-radius: 6px; padding: 6px 8px; font-size: 13px; line-height: 1.4; resize: vertical; background: #FBFCFD; }
.rep-field:focus { border-style: solid; border-color: var(--accent); background: #fff; outline: none; }
.rep-field.empty { border-color: var(--no); background: var(--no-bg); }
.rep-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 10px 0; }
.rep-photos figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.rep-photos img { width: 100%; height: 160px; object-fit: cover; border-radius: 4px; background: #DDE1E6; }
.rep-photos figcaption { font-size: 12px; color: #3E4752; }
.rep-photos figure.off img { opacity: .35; filter: grayscale(1); }
.rep-photos figure.off figcaption { color: var(--muted); text-decoration: line-through; }
.rep-check { font-size: 12px; display: flex; gap: 6px; align-items: center; min-height: 32px; cursor: pointer; }
.rep-check input { width: 18px; height: 18px; }
.rep-sum { background: #F4F5F7; border-radius: 6px; padding: 8px 10px; margin: 8px 0; }
.rep ol, .rep ul { margin: 4px 0; padding-left: 20px; }
.rep-edit { display: flex; flex-direction: column; gap: 8px; }

.rep-h2 { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.rep-h2 .rep-check { font-size: 13px; font-weight: 500; }
.rep-h2.off { color: #9AA4AF; border-bottom-color: #C5CCD4; }
.rep-hidden { font-size: 13px; color: var(--muted); background: #F4F5F7; border: 1px dashed #C5CCD4; border-radius: 6px; padding: 10px 12px; }
