/* Поверх ui.css макетов: только то, что нужно живому приложению (ширина экрана, настоящие поля, фото, диалоги). */
body.m, body.d { width: auto; }
body.m .app { max-width: 480px; margin: 0 auto; min-height: 100vh; }
body.m .tabbar, body.m .actionbar { width: 100%; max-width: 480px; left: 50%; transform: translateX(-50%); }
.side { height: 100vh; }
.shell { min-height: 100vh; }
[hidden] { display: none !important; }
.is-invisible { visibility: hidden; }
#errors:empty { display: none; }
.message { white-space: pre-wrap; }
.appbar { position: sticky; top: 0; z-index: 5; background: var(--bg); }
.appbar__right { gap: 4px; }
.appbar__right .btn-text { font-size: 13px; min-height: 36px; }
.side nav { flex: 1; }
.side nav a.nav:last-child { margin-top: auto; }
.crumbs a { color: var(--ink-2); }
.d .cap, .d .sub, .d .cap-strong, .d .event__who, .d .event__time, .d .board__empty, .d .brand__org, .d .crumbs { font-size: 14px; }

/* Поля ввода как .input макетов */
input.input, textarea.input, select.input { width: 100%; border: 0; outline: 0; appearance: none; }
input.input:focus, textarea.input:focus, select.input:focus { box-shadow: inset 0 0 0 2px var(--accent); background: var(--card); }
.card input.input, .card textarea.input, .card select.input { background: var(--bg); }
select.input { background-image: none; cursor: pointer; }
textarea.input { resize: vertical; }
.check input[type=checkbox] { width: 28px; height: 28px; flex: none; accent-color: var(--accent); margin: 0; }
label.check { cursor: pointer; }
input[type=file] { font-size: 14px; max-width: 100%; }

/* Кнопки */
.btn-primary:disabled { background: var(--fill-2); color: var(--mute-ink); cursor: not-allowed; }
.btn-secondary:disabled { opacity: .5; cursor: not-allowed; }
.d .btn-primary { height: 52px; }
.seg button.chosen[data-value=y] { background: var(--ok); color: #fff; }
.seg button.chosen[data-value=n] { background: var(--card); color: var(--bad-ink); box-shadow: inset 0 0 0 2px var(--bad); }
.seg button.chosen[data-value=defer] { background: var(--ink-2); color: #fff; }
.seg button.chosen { background: var(--accent); color: #fff; }
.mech .btn-primary { height: 64px; font-size: 19px; border-radius: 18px; }
.mech .btn-secondary { height: 64px; font-size: 18px; border-radius: 18px; }
.mech .act-grid .btn-secondary { height: 76px; border-radius: 20px; background: var(--card); justify-content: flex-start; padding: 0 14px; text-align: left; }

/* Фото: миниатюры 16:10 сеткой, тап — просмотр */
.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.d .photo-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); max-width: 640px; }
.photo--img { padding: 0; width: 100%; max-width: none; background: var(--fill); }
.photo--img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo--img .photo__badge { left: 6px; bottom: 6px; right: 6px; font-size: 11px; line-height: 14px; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo--img .photo__zoom { width: 28px; height: 28px; border-radius: 9px; right: 6px; top: 6px; }
.thumb--img { padding: 0; overflow: hidden; }
.thumb--img img { width: 100%; height: 100%; object-fit: cover; }
.viewer { max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; border: 0; background: #111; color: #fff; padding: 20px; overflow: auto; }
.viewer img { display: block; max-width: 100%; margin: auto; touch-action: pinch-zoom; }
.viewer img.zoom { max-width: none; width: 200%; }
.viewer::backdrop { background: #111; }
.viewer .btn-secondary { min-height: 56px; margin-bottom: 12px; }
.photo-zoom { display: block; width: 100%; padding: 0; }
.photo-zoom:focus-visible { outline-color: #fff; }
.feedback-preview { max-width: 390px; width: 100%; border-radius: 16px; }

/* Диалоги (БО-03, отмена, цена) */
dialog.dialog { margin: auto; border: 0; color: var(--ink); }
dialog.dialog::backdrop { background: rgba(20, 22, 31, .42); }

/* Липкая панель: распорка под фиксированной панелью; на десктопе — обычный блок */
.actionbar-spacer { display: block; width: 1px; max-width: 1px; align-self: flex-start; pointer-events: none; flex-shrink: 0; }
.d .actionbar { position: static; width: auto; box-shadow: none; border-radius: var(--r-card); transform: none; }
.d .actionbar-spacer { display: none; }
body.m .actionbar { z-index: 21; }

/* Табло: колонки со своими подписями «пусто» */
.d .board { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.board__col .card, .board__col .kcard { min-width: 0; }

/* Боковая колонка сотрудника на узком экране не нужна */
@media (max-width: 1023px) {
  .cols--main-side, .cols--side-main, .cols--2 { grid-template-columns: 1fr; }
  .counters { grid-template-columns: 1fr 1fr; }
  .qrow { grid-template-columns: 1fr; }
}

/* Выбор фото */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.photo-pick { position: relative; cursor: pointer; }
.photo-pick:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.photo-picker .thumbs:empty { display: none; }
.photo-picker .thumbs { flex-wrap: wrap; }

/* staff */
.main__head > .turn-card { padding: 12px 16px; gap: 6px; min-width: 300px; max-width: 420px; }
.main__head > .turn-card .turn-card__label { font-size: 17px; line-height: 22px; }
.main__head { flex-wrap: wrap; }
.side-tile .photo-pick { height: 40px; font-size: 13px; border-radius: 12px; }
.side-tile .chip { align-self: flex-start; }
.table select.input, .table input.input { min-height: 44px; padding: 10px 12px; }
.mini .thumbs { flex-wrap: wrap; }
.qrow .chip { white-space: normal; height: auto; min-height: 28px; }

/* staff: строка оценки БС-02 */
.est-row { gap: 10px; }
.est-row input, .est-row select { border: 0; outline: 0; background: transparent; font: inherit; color: inherit; min-width: 0; }
.est-row input:focus { box-shadow: inset 0 -2px 0 var(--accent); }

.est-row .est-title { font-size: 16px; line-height: 22px; font-weight: 700; width: 100%; }
.est-row .est-why { font-size: 14px; line-height: 20px; color: var(--muted); width: 100%; }
.est-price-box { width: 160px; flex: none; min-height: 52px; padding: 10px 14px; }
.est-row .est-price-box input, .offer-box input { width: 100%; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.est-price-box input::-webkit-inner-spin-button { display: none; }
.est-row .est-urgency { width: auto; flex: none; height: 28px; border-radius: var(--r-chip); padding: 0 10px; font-size: 13px; font-weight: 700; background: var(--accent-soft) !important; color: var(--accent-ink) !important; appearance: none; cursor: pointer; }
.est-row .est-urgency[data-tone=safety] { background: var(--bad-bg) !important; color: var(--bad-ink) !important; }
.est-row .est-package { font-size: 13px; color: var(--muted); flex: 1; }
.invite-row > .field:first-child { flex: 1; }
/* staff: приёмка с телефона (БС-03) — без шапки хода и вкладок этапов, плитки сторон компактные */
.m .intake > .main__head, .m .intake > nav.tabs { display: none; }
.side-tile .photo-picker .thumbs { display: none; }
.side-tile .photo-pick span { display: none; }
.side-tile .photo-pick { height: 36px; }
.side-tile__art svg { width: 88%; height: auto; max-height: 100%; }
.offer-box input { border: 0; outline: 0; background: transparent; color: inherit; min-width: 0; font-family: inherit; }
.offer-box { width: 100%; box-shadow: inset 0 0 0 2px var(--accent); }
.offer-box .input__suffix { white-space: nowrap; font-size: 18px; }

/* client */
.tabs button { flex: 1; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; color: var(--ink-2); white-space: nowrap; padding: 0 14px; }
.tabs__select { height: 44px; border: 0; border-radius: 12px; padding: 0 14px; background: transparent; font: inherit; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.tabs__select.is-active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(18,22,52,.08); }
.tabs button.is-active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(18,22,52,.08); }
.ta-r { text-align: right; }
.mt-4 { margin-top: 4px; }
.tile .tile__obj { position: absolute; }
.event__body .thumbs, .line .thumbs { flex-wrap: wrap; }
.check input[type=checkbox] { margin-top: 1px; }
.input.w-160 { width: 160px; flex: none; }
.input.w-200 { width: 200px; flex: none; }
.inset .input--card { background: var(--card); }
.table td.num, .table td.r { white-space: nowrap; }
.event__time { white-space: nowrap; }
.feed-head { flex-wrap: wrap; row-gap: 2px; }
.feed-head .h2 { white-space: nowrap; }
.cols--2 > .card > .photo-grid { grid-template-columns: 1fr; max-width: none; }
.m .main__head > .stack-4 { display: none; }
.m .main__head > .turn-card { min-width: 0; max-width: none; width: 100%; }
.m .tabs.w-auto { overflow-x: auto; max-width: 100%; }
.side-tile__art svg { max-width: 100%; max-height: 100%; }
.event__body > .photo-grid:has(> :only-child), .item > .photo-grid:has(> :only-child) { grid-template-columns: 1fr; max-width: 520px; }

/* Миниатюры переносятся и не раздвигают экран */
.thumbs { flex-wrap: wrap; min-width: 0; max-width: 100%; }
.thumb--more, .photo--more { font-weight: 800; font-size: 15px; color: var(--ink-2); background: var(--fill); }
body.m .app, body.m main { min-width: 0; overflow-x: clip; }

/* Механик: примечание — строка как в макете БМ-02, растёт при вводе */
textarea.mech-note { min-height: 52px; height: 52px; resize: none; field-sizing: content; }
.banner--dark .cap-strong { color: #fff; }
