/* ФотоОбъект — стили кабинета. Цвета бренда — в :root */
:root {
  --brand: #1E5AA8;
  --brand-600: #184B8C;
  --brand-50: #EEF4FB;
  --brand-100: #D6E4F7;
  --ink: #1B2733;
  --ink-2: #3D4B5C;
  --muted: #66768A;
  --line: #E2E7EE;
  --line-2: #EEF1F5;
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --ok: #2B8A3E;
  --ok-50: #EAF6EC;
  --warn: #D9480F;
  --warn-50: #FFF1E8;
  --bad: #C92A2A;
  --bad-50: #FDECEC;
  --info-50: #EEF4FB;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 56, .06), 0 1px 1px rgba(16, 32, 56, .04);
  --shadow-lg: 0 12px 32px rgba(16, 32, 56, .18);
  --sidebar: 232px;
  font-family: var(--font, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: calc(14px * var(--fs, 1)); line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--ink); }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.boot { display: grid; place-items: center; height: 100vh; }

/* ---------- каркас ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--side, #10243F); color: #C9D6E8; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; font-weight: 700; font-size: 17px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand span b { color: #9CC1F0; font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #C9D6E8;
  font-weight: 500; text-decoration: none;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--brand); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .badge { margin-left: auto; }
.sidebar .spacer { flex: 1; }
.userbox { border-top: 1px solid rgba(255,255,255,.08); padding: 12px 8px 0; font-size: 13px; }
.userbox .name { color: #fff; font-weight: 600; }
.userbox button { margin-top: 8px; }
.main { min-width: 0; padding: 22px 28px 48px; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { margin-top: 4px; color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ---------- элементы ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.grid { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--line-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.warn { background: var(--surface); border-color: #F3B38F; color: var(--warn); }
.btn.warn:hover { background: var(--warn-50); }
.btn.danger { color: var(--bad); border-color: #F1B5B5; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.sidebar .btn { background: transparent; color: #C9D6E8; border-color: rgba(255,255,255,.14); }
select { max-width: 260px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px;
  height: 36px; padding: 0 11px; min-width: 0;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 80px; width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand-100); border-color: var(--brand); }
label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 550; font-size: 13px; }
label.field input, label.field select { width: 100%; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field-grid .wide { grid-column: 1 / -1; }
.search { position: relative; }
.search input { padding-left: 34px; width: 280px; }
.search svg { position: absolute; left: 10px; top: 10px; width: 16px; height: 16px; color: var(--muted); }
.check { display: inline-flex; gap: 7px; align-items: center; font-weight: 500; cursor: pointer; }
.check input { height: auto; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.badge.brand { background: var(--brand-50); color: var(--brand); }
.badge.ok { background: var(--ok-50); color: var(--ok); }
.badge.warn { background: var(--warn-50); color: var(--warn); }
.badge.bad { background: var(--bad-50); color: var(--bad); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.nav .badge { background: #C92A2A; color: #fff; height: 19px; padding: 0 7px; }
.chip { display: inline-flex; padding: 2px 8px; border-radius: 6px; background: var(--brand-50); color: var(--brand-600); font-size: 12px; font-weight: 550; }

/* таблицы */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FAFBFC; white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #F8FAFD; }
.tbl tr:last-child td { border-bottom: 0; }
.code { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }

/* прогресс полноты */
.progress { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.progress .bar { flex: 1; height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.progress.full .bar i { background: var(--ok); }
.progress .lbl { font-size: 12px; color: var(--muted); min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.work-line { display: grid; grid-template-columns: 1fr; gap: 4px; }
.work-line .t { font-size: 12px; color: var(--ink-2); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.kpi { padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .l { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.kpi.alert .v { color: var(--bad); }
.kpi.attn .v { color: var(--warn); }
a.kpi { color: inherit; text-decoration: none; }
a.kpi:hover { border-color: var(--brand-100); }

.dash { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.chart { padding: 8px 18px 14px; }
.chart svg { width: 100%; height: 150px; display: block; }
.chart .bar-rect { fill: var(--brand); }
.chart .bar-rect:hover { fill: var(--brand-600); }
.chart text { font-size: 10px; fill: var(--muted); }

/* карточки отчётов */
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.rcard { overflow: hidden; cursor: pointer; display: flex; flex-direction: column; }
.rcard:hover { border-color: var(--brand-100); box-shadow: var(--shadow-lg); }
.rcard .cover { aspect-ratio: 4 / 3; background: var(--line-2) center/cover no-repeat; position: relative; }
.rcard .cover .badge { position: absolute; left: 8px; top: 8px; }
.rcard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.rcard .t { font-weight: 650; }
.list-rows .item { display: flex; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.list-rows .item:last-child { border-bottom: 0; }
.list-rows .item:hover { background: #F8FAFD; }
.thumb { width: 56px; height: 42px; border-radius: 6px; object-fit: cover; background: var(--line-2); flex: none; }

/* объект */
.obj-head { display: grid; grid-template-columns: 240px 1fr; gap: 0; overflow: hidden; }
.obj-head .pic { background: var(--line-2) center/cover no-repeat; min-height: 170px; cursor: zoom-in; }
.obj-head .pic.empty { display: grid; place-items: center; color: var(--muted); cursor: default; }
.obj-head .info { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 20px 0 16px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); padding: 10px 14px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.stage { margin-bottom: 18px; }
.stage-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stage-head .cnt { font-size: 12px; color: var(--muted); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.slot { border-radius: 10px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; }
.slot .img { aspect-ratio: 4 / 3; background: var(--line-2) center/cover no-repeat; cursor: zoom-in; position: relative; }
.slot .img .more { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 99px; }
.slot .img .rm { position: absolute; left: 6px; top: 6px; }
.slot.empty .img { cursor: default; display: grid; place-items: center; border-bottom: 1px dashed var(--line); background: repeating-linear-gradient(135deg, #FAFBFC 0 10px, #F3F5F8 10px 20px); color: var(--muted); font-size: 12px; font-weight: 600; }
.slot.empty.req .img { color: var(--bad); background: repeating-linear-gradient(135deg, #FFF8F8 0 10px, #FDF0F0 10px 20px); }
.slot .cap { padding: 7px 9px 9px; font-size: 12.5px; line-height: 1.35; }
.slot .cap .n { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 4px; }
.slot .cap .opt { color: var(--muted); font-size: 11.5px; }

/* отчёт */
.report-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.values { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.values .v { font-weight: 650; font-variant-numeric: tabular-nums; }
.comment { background: #FFFBEA; border: 1px solid #F5E3A3; border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; }

/* замечания */
.remark { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.remark:last-child { border-bottom: 0; }
.remark .txt { white-space: pre-wrap; }
.remark .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.remark .acts { margin-left: auto; display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.remark.st-closed .txt { color: var(--muted); text-decoration: line-through; }

/* лайтбокс */
.lb { position: fixed; inset: 0; background: rgba(8, 14, 24, .92); z-index: 50; display: grid; grid-template-columns: 1fr 360px; }
.lb .stage-img { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; padding: 20px 64px; }
.lb .stage-img img { max-width: 100%; max-height: calc(100vh - 40px); object-fit: contain; border-radius: 4px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.lb .navbtn { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; display: grid; place-items: center; }
.lb .navbtn:hover { background: rgba(255,255,255,.22); }
.lb .navbtn.l { left: 12px; } .lb .navbtn.r { right: 12px; }
.lb .close { position: absolute; top: 12px; left: 12px; }
.lb .side { background: var(--surface); overflow-y: auto; display: flex; flex-direction: column; }
.lb .side .sec { padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.lb .counter { color: #fff; position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); font-size: 13px; opacity: .8; }

/* модальные окна */
.modal-bg { position: fixed; inset: 0; background: rgba(16, 32, 56, .45); z-index: 40; display: grid; place-items: center; padding: 16px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line-2); }
.qr { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.qr img { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 8px; image-rendering: pixelated; }
.qr ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }

/* уведомления */
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 60; background: #10243F; color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); max-width: 420px; }
.toast.err { background: var(--bad); }
.empty-state { padding: 36px 18px; text-align: center; color: var(--muted); }
.empty-state b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.alert-line { padding: 10px 14px; border-radius: 8px; background: var(--bad-50); color: var(--bad); font-weight: 550; }
.info-line { padding: 10px 14px; border-radius: 8px; background: var(--info-50); color: var(--brand-600); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ok); }
.sync-dot.bad { background: var(--bad); }
.sync-dot.idle { background: #ADB5BD; }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #10243F 0%, #1E5AA8 100%); }
.login .card { width: min(380px, 100%); padding: 28px; }
.login-col { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; }
.adbox { display: flex; flex-direction: column; gap: 2px; margin: 8px 4px; padding: 10px 12px; border-radius: 10px;
  border: 1px dashed rgba(255,255,255,.28); background: rgba(255,255,255,.05); font-size: 13px; color: #E8EEF6; }
.adbox span { font-size: 12px; opacity: .7; }
.adbox.light { margin: 0; }
.author-line { color: rgba(255,255,255,.75); font-size: 12px; text-align: center; }
.author-side { padding: 4px 8px 10px; font-size: 12px; color: #8FA3BF; line-height: 1.45; }
.login .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; font-size: 20px; font-weight: 750; }
.login .logo img { width: 44px; height: 44px; border-radius: 10px; }
.login .logo b { color: var(--brand); }

/* ---------- мобильная версия ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash, .report-grid { grid-template-columns: 1fr; }
  .lb { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .lb .side { max-height: 42vh; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--side, #10243F); color: #fff; position: sticky; top: 0; z-index: 20; }
  .topbar .brand { padding: 0; font-size: 16px; }
  .topbar button { background: none; border: 0; color: #fff; padding: 6px; cursor: pointer; display: grid; place-items: center; }
  .topbar button svg { width: 24px; height: 24px; }
  .main { padding: 16px 16px 40px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .obj-head { grid-template-columns: 1fr; }
  .obj-head .pic { min-height: 180px; }
  .search input { width: 100%; }
  .search { flex: 1 1 100%; }
  .field-grid { grid-template-columns: 1fr; }
  .qr { grid-template-columns: 1fr; justify-items: center; }
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lb .stage-img { padding: 12px 8px 40px; }
  .lb .navbtn { top: auto; bottom: 6px; transform: none; width: 38px; height: 38px; }
  .hide-sm { display: none; }
  .tbl td, .tbl th { padding: 9px 10px; }
}
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }

/* ---------- шаблоны отчётов ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.tpl-card { display: flex; flex-direction: column; border-top: 3px solid var(--line); }
.tpl-card.st-published { border-top-color: var(--ok); }
.tpl-card.st-changed { border-top-color: var(--warn); }
.tpl-main { display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 12px; color: inherit; flex: 1; }
.tpl-main:hover .tpl-title { color: var(--brand); }
.tpl-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.tpl-meta { color: var(--ink-2); font-size: 13px; }
.tpl-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 16px 14px; border-top: 1px solid var(--line-2); }
.tpl-head .row { flex-wrap: nowrap; }
.tpl-h1 { overflow-wrap: anywhere; }
.tpl-head .sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.unsaved { color: var(--warn); font-weight: 600; }
.tpl-cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.tpl-stage { overflow: hidden; }
.tpl-stage-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; cursor: pointer; user-select: none; }
.tpl-stage-head:hover { background: var(--line-2); }
.tpl-stage.open .tpl-stage-head { border-bottom: 1px solid var(--line-2); }
.tpl-stage-head .chev svg { width: 16px; height: 16px; transform: rotate(0); color: var(--muted); }
.tpl-stage.open .chev svg { transform: rotate(-90deg); }
.tpl-stage-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tpl-stage-head .spacer { flex: 1; }
.tpl-stage-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.tpl-items { display: flex; flex-direction: column; gap: 6px; }
.tpl-item { display: grid; grid-template-columns: 150px 60px minmax(0, 1fr) 140px 52px 96px; grid-template-areas: "kind num label label req act" "kind hint hint sub sub act"; gap: 6px 8px; align-items: center; padding: 8px; border: 1px solid var(--line-2); border-radius: 8px; background: #FBFCFD; }
.tpl-item .c-kind { grid-area: kind; align-self: start; } .tpl-item .c-num { grid-area: num; align-self: start; } .tpl-item .c-label { grid-area: label; }
.tpl-item .c-sub { grid-area: sub; } .tpl-item .c-req { grid-area: req; } .tpl-item .c-act { grid-area: act; align-self: start; text-align: right; } .tpl-item .c-hint { grid-area: hint; }
.tpl-item-head { background: none; border: 0; padding: 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; grid-template-areas: none; }
label.field input, label.field select, label.field textarea { font-weight: 400; }
.tpl-item.ask { grid-template-columns: 1fr; background: var(--line-2); }
.tpl-item input, .tpl-item select { width: 100%; }
.stack-xs { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hint-in { font-size: 13px; height: 32px; color: var(--ink-2); }
.req-cell { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; cursor: pointer; }
.req-cell input { width: 18px !important; height: 18px; }
.show-sm { display: none; }
.tpl-help { line-height: 1.55; padding: 4px 2px; }
.tpl-preview { position: sticky; top: 16px; }
.sm-select { height: 28px; font-size: 12px; max-width: 200px; padding: 0 6px; }
.phone { width: 100%; max-width: 340px; border: 10px solid #1B2733; border-radius: 28px; background: #fff; overflow: hidden; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; height: min(640px, calc(100vh - 90px)); }
.phone-bar { background: var(--brand); color: #fff; padding: 12px 14px; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone-body { flex: 1; overflow-y: auto; background: #F6F8FB; }
.phone-screen { background: #fff; margin-bottom: 10px; padding-bottom: 6px; }
.phone-head { padding: 10px 14px; font-size: 13px; font-weight: 700; color: var(--brand-600); background: var(--brand-50); }
.phone-q { padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.phone-label { font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; }
.phone-opt { font-weight: 400; color: var(--muted); }
.phone-hint { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.phone-btn { margin-top: 8px; display: inline-block; padding: 8px 14px; border-radius: 20px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 600; }
.phone-input { margin-top: 8px; border-bottom: 2px solid var(--brand); width: 120px; color: var(--muted); font-size: 14px; padding: 2px 0; }
.phone-more { margin-top: 6px; font-size: 12px; color: var(--brand); }
.phone-nav { display: flex; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--line); font-weight: 600; color: var(--brand); font-size: 14px; }
@media (max-width: 1200px) {
  .tpl-cols { grid-template-columns: minmax(0, 1fr); }
  .tpl-preview { position: static; }
  .phone { height: 520px; margin: 0 auto; }
}
@media (max-width: 820px) {
  .tpl-grid { grid-template-columns: 1fr; }
  .tpl-head .row { width: 100%; }
  .tpl-head .row .btn { flex: 1; justify-content: center; }

  .tpl-stage-head .btn.sm { padding: 0 7px; }
}
@media (max-width: 640px) {
  .tpl-item { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "kind num" "label label" "hint hint" "sub sub" "req act"; }
  .tpl-item .c-num { width: 76px; }
  .tpl-item .c-req { justify-content: flex-start; height: auto; }
  .show-sm { display: inline; font-size: 13px; }
  .tpl-item-head.hide-sm { display: none; }
}
@media (min-width: 641px) and (max-width: 820px) {
  .tpl-item-head.hide-sm { display: grid; }
}

/* ---------- компания / филиал ---------- */
.scope-box { margin: -6px 4px 14px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.05); display: flex; flex-direction: column; gap: 4px; }
.scope-l { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #8FA3BF; margin-top: 2px; }
.scope-sel { width: 100%; max-width: none; height: 34px; background: #1A3355; color: #fff; border-color: rgba(255,255,255,.16); font-size: 13px; }
.scope-sel option { color: #1B2733; background: #fff; }
.scope-company { color: #fff; font-weight: 650; font-size: 14px; line-height: 1.3; }
.scope-branch { color: #C9D6E8; font-size: 13px; }
.topbar-scope { margin-left: auto; font-size: 12px; color: #C9D6E8; background: rgba(255,255,255,.1); padding: 3px 8px; border-radius: 6px; max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.branch-stats > div { background: var(--line-2); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; }
.branch-stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.branch-stats span { font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.branch-stats .attn { background: var(--warn-50); color: var(--warn); }
.bchip { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--brand-50); color: var(--brand-600); margin-right: 6px; vertical-align: 1px; }
.check-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; }
@media (max-width: 520px) { .branch-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tpl-item.is-done { border-color: #B7E1C1; background: var(--ok-50); }
.tpl-item.is-done .c-label { border-color: #B7E1C1; }
.tpl-item.is-done .c-label::placeholder { color: var(--ok); }

/* ---------- заказы, роли ---------- */
.order-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; color: inherit; border-top: 3px solid var(--line); }
.order-card:hover { box-shadow: var(--shadow-lg); }
.order-card.st-active { border-top-color: var(--ok); }
.order-card .small svg { width: 14px; height: 14px; vertical-align: -2px; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oprog { display: flex; flex-direction: column; gap: 6px; }
.oprog-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-size: 13px; }
.oprog.big .oprog-top b { font-size: 22px; }
.oprog .progress { height: 8px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.oprog .progress i { display: block; height: 100%; background: var(--warn); border-radius: 6px; }
.oprog .progress i.full { background: var(--ok); }
.oprog.big .progress { height: 12px; }
.order-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; margin-bottom: 16px; }
.olist { display: flex; flex-direction: column; }
.oitem { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line-2); }
.oitem.req .otext b { color: var(--warn); }
.oitem.done { background: #F6FBF7; }
.ostate { width: 22px; text-align: center; flex: none; }
.otext { flex: 1; min-width: 0; }
.othumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.othumbs img { width: 52px; height: 40px; object-fit: cover; border-radius: 6px; cursor: zoom-in; }
.assign { margin-top: 6px; }
.chips-pick { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 4px 24px; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 16px; font-size: 13px; cursor: pointer; font-weight: 500; }
.chip-check:has(input:checked) { border-color: var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 12%, white); }
.chip-check input { height: auto; }
.role-chip { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 12px; font-weight: 600; margin: 0 4px 4px 0;
  color: var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 13%, white); }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--ink); }
.obj-list { height: auto; padding: 4px; width: 100%; max-width: none; }
@media (max-width: 900px) { .order-top { grid-template-columns: 1fr; } }

/* ---------- оформление компании (владелец сервиса) ---------- */
.adbox a { color: inherit; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 14px; }
.color-field { display: flex; align-items: center; gap: 8px; }
.color-field input[type=color] { width: 44px; height: 36px; padding: 2px; }
.theme-preview { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: grid; grid-template-columns: 110px 1fr; min-height: 120px; }
.theme-preview .tp-side { padding: 10px; color: #fff; font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.theme-preview .tp-side i { display: block; height: 8px; border-radius: 4px; background: rgba(255,255,255,.25); }
.theme-preview .tp-main { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.theme-preview .tp-btn { align-self: flex-start; color: #fff; padding: 5px 12px; border-radius: 8px; font-weight: 600; }
.theme-preview .tp-ad { border: 1px dashed var(--line); border-radius: 8px; padding: 6px 8px; font-size: .9em; }
.order-top { align-items: start; }
label.field select, .modal select { max-width: none; }
@media (max-width: 820px) { .tpl-head .row { flex-wrap: wrap; } }
@media (max-width: 640px) { .list-rows .item { flex-wrap: wrap; } }

/* реестр заказов: поиск при создании заказа */
.reg-hits { display: grid; gap: 6px; max-height: 340px; overflow-y: auto; padding: 2px; }
.reg-hit { display: grid; gap: 3px; text-align: left; width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit; font: inherit; cursor: pointer; }
.reg-hit:hover, .reg-hit:focus-visible { border-color: var(--brand); background: var(--brand-50); outline: none; }
.reg-hit.closed { opacity: .6; }
.reg-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.reg-chosen { padding: 12px 14px; border-radius: 10px; background: var(--brand-50); border: 1px solid var(--line); }
.reg-hit .ellip, .reg-chosen .small { overflow-wrap: anywhere; }
