/* ТПАС Менеджер AI — стили экранов Mini App поверх tokens.css */
:root { color-scheme: dark; }
* { box-sizing: border-box; }
html, body { font-size: 15px; line-height: 1.4; overflow-x: hidden; }
body { min-height: 100vh; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font: inherit; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { margin-left: var(--gutter); margin-right: var(--gutter); }

/* шапка */
.topbar { gap: 12px; }
.brand > div:last-child { display: flex; flex-direction: column; gap: 2px; }
.price-badge { flex: none; white-space: nowrap; }
.dot-live.is-stale { background: var(--faint); }
.snap-line { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: space-between; align-items: center; margin: 10px var(--gutter) 0; font-size: 12px; color: var(--muted); }
.role:empty { display: none; }
.role { padding: 3px 10px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--text-2); font-size: 11px; font-weight: 600; }

/* экраны */
.screen { display: none; }
.screen.active { display: block; }
.screen-title { margin-top: 18px; margin-bottom: 0; }

/* строка «Спросить» */
.ask-spark { flex: none; color: var(--live); }
.ask input { font-size: 16px; }
.ask input::-webkit-search-cancel-button { filter: invert(.6); }
.mic { width: 44px; height: 44px; }
.mic:disabled { opacity: .5; }

/* поле поиска в разделах */
.field { margin: 12px var(--gutter) 0; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.field input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); font-size: 16px; }
.field input::placeholder { color: var(--muted); }

/* фильтры и подсказки */
.chips.filters, .chips.examples { margin-top: 12px; }
.chips::-webkit-scrollbar { display: none; }
select.chip { appearance: none; -webkit-appearance: none; padding-right: 32px; max-width: 78vw; text-overflow: ellipsis; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238B97A8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.chip-input { width: 120px; outline: none; }
.chip-input::placeholder { color: var(--muted); }
.chip-toggle { cursor: pointer; }
.chip-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.chip-toggle:has(input:checked) { border-color: var(--accent); color: var(--text); }
.suggest { cursor: pointer; white-space: nowrap; height: 44px; }

/* результаты и списки */
.result, .list { margin: 12px var(--gutter) 0; display: flex; flex-direction: column; gap: 8px; }
.result:empty { display: none; }
.card { padding: 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); overflow-wrap: anywhere; }
#uploadBox, .rules-note { margin: 12px var(--gutter) 0; }
.rules-note { margin-bottom: 16px; line-height: 1.5; }
.card-title { font-weight: 700; font-size: 15px; margin: 0 0 6px; }
.section, .result .section-label { margin: 10px 0 0; font-family: var(--font-display); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.summary .big { font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1.3; }
.counts { display: flex; flex-wrap: wrap; gap: 6px; }
#stockCounts { margin-top: 12px; }
#stockCounts:empty { display: none; }
.counts-in { margin-top: 10px; }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.warn { padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px dashed var(--line-strong); color: var(--text); font-size: 13px; line-height: 1.5; }
.warn ul { margin: 8px 0 0; padding-left: 18px; }
.src { color: var(--faint); font-size: 12px; }
.src a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.loading { color: var(--muted); }

/* статусы машин: без цвета-светофора, различаются надписью и контрастом */
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 10px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; }
.b-free { border-color: var(--line-strong); color: var(--text); }
.b-reserved, .b-other { color: var(--muted); }
.machine { display: flex; flex-direction: column; gap: 4px; }
.machine-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.machine-head { flex-wrap: nowrap; align-items: flex-start; justify-content: space-between; }
.machine .eq { font-family: var(--font-body); font-weight: 700; font-size: 16px; line-height: 1.3; color: var(--text); margin: 0; min-width: 0; }
.machine-head .badge { flex: none; }
.machine .serial { font-family: var(--font-mono); font-weight: 500; font-size: 12px; color: var(--muted); }
.machine .meta { color: var(--muted); font-size: 13px; line-height: 1.45; }
.machine.g-free { border-color: var(--line-strong); }
.promo { margin-top: 6px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--accent); font-family: var(--font-mono); font-weight: 600; font-size: 13px; color: var(--accent); }

/* цена: блок в янтарной рамке и строки прайса */
.price-card { margin: 0; align-items: flex-start; gap: 12px; }
.price-card .price { font-size: 20px; }
.price-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.price-row .lbl { flex: 1; min-width: 0; }
.price-row .lbl b { font-family: var(--font-mono); font-weight: 600; font-size: 15px; }
.price-row .num { flex: none; text-align: right; white-space: nowrap; font-family: var(--font-mono); font-weight: 600; color: var(--accent); font-size: 16px; }
.price-row .num small { display: block; font-family: var(--font-mono); font-weight: 500; font-size: 12px; color: var(--text-2); margin-top: 2px; }
.price-row .num small + small { color: var(--muted); }

/* характеристики */
details.card summary { cursor: pointer; font-weight: 700; min-height: 24px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after, .spec-more summary::after { content: "Показать ▾"; flex: none; font-size: 13px; font-weight: 600; color: var(--accent); }
details.card[open] summary::after, .spec-more[open] summary::after { content: "Свернуть ▴"; }
.result .specs, .card .specs { margin: 12px 0 0; }
.spec { min-width: 0; }
.spec-value { font-size: 14px; overflow-wrap: anywhere; }
.spec .src { margin-top: 4px; }
.facts { margin: 8px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.facts li { margin: 4px 0; }

/* кнопки внутри карточек */
.row-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.row-actions button { min-height: 44px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: transparent; color: var(--text); font-size: 13px; font-weight: 700; }
.row-actions button.on { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; margin-top: 12px; }
.current { color: var(--text); font-weight: 700; font-size: 13px; }

/* загрузка файла */
.file-pick { display: block; margin-top: 10px; }
.file-pick input { width: 100%; color: var(--text-2); font-size: 13px; }
.file-pick input::file-selector-button { height: 44px; margin-right: 12px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: transparent; color: var(--text); font: inherit; font-weight: 700; }

/* плитки: подписи блоками */
.tile { width: 100%; cursor: pointer; }
.tile-title, .tile-sub { display: block; }
.tiles { margin-bottom: 20px; }

/* нижнее меню */
.tab { min-height: 44px; cursor: pointer; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 2 * var(--gutter)); padding: 12px 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); font-size: 14px; z-index: 9; }

@media (max-width: 370px) {
  :root { --gutter: 16px; }
  .brand-name { font-size: 14px; }
  .price-badge { padding: 7px 10px; }
}
.price-card .price-row { width: 100%; }
.ask input, .field input { align-self: stretch; min-height: 44px; }

/* PWA: вырез экрана iPhone при запуске с экрана «Домой» (в Telegram и браузере отступ = 0) */
.topbar { padding-top: calc(18px + env(safe-area-inset-top)); }

/* Вход по коду вне Telegram */
.login { padding-top: calc(12px + env(safe-area-inset-top)); padding-bottom: 24px; }
.login-card { margin: 16px var(--gutter) 0; }
.login-hint { margin: 12px 0; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--accent); background: var(--surface-2); font-size: 14px; }
.login-hint ol { margin: 8px 0 6px; padding-left: 20px; line-height: 1.5; }
.login-code { width: 100%; box-sizing: border-box; height: 60px; margin-top: 8px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-family: var(--font-mono); font-size: 28px; letter-spacing: .3em; text-align: center; }
.login-code:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.dev-list { margin-top: 8px; display: grid; gap: 6px; }
.dev-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-soft); }
.dev-item.off { opacity: .55; }
.dev-item button { flex: none; min-height: 44px; }

/* Нажимаемые карточки модели и карточка модели (лист снизу) */
.js-model { cursor: pointer; }
.js-model:active { border-color: var(--line-strong); background: var(--surface-2); }
.is-hl { border-color: var(--accent) !important; }
.model-name { font-family: var(--font-body) !important; font-weight: 700 !important; font-size: 16px !important; }
body.sheet-open { overflow: hidden; }
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 90vh; max-height: 90dvh; display: flex; flex-direction: column; background: var(--bg); border-top: 1px solid var(--line-strong); border-radius: 20px 20px 0 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px var(--gutter) 8px; border-bottom: 1px solid var(--line-soft); }
.sheet-head .screen-title { margin: 0; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px var(--gutter) calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.sheet-body .specs { margin: 8px 0 0; }
.ms-actions { margin-top: 8px; }
.ms-specs summary { min-height: 44px; align-items: center; }
.ms-spec-group { margin-top: 12px; }
.ms-web { margin-top: 12px; }
.ms-web summary { cursor: pointer; font-size: 13px; color: var(--text-2); min-height: 44px; display: flex; align-items: center; }

/* Статус машины: цветной бейдж; место A и статус заметнее */
.badge.b-free { color: #4ADE80; border-color: rgba(74, 222, 128, .45); background: rgba(74, 222, 128, .10); }
.badge.b-reserved { color: #FF8A65; border-color: rgba(255, 138, 101, .45); background: rgba(255, 138, 101, .10); }
.badge.b-demo, .badge.b-exhibition { color: #7CB8FF; border-color: rgba(124, 184, 255, .45); background: rgba(124, 184, 255, .10); }
.badge.b-transit { color: #C4A5FF; border-color: rgba(196, 165, 255, .45); background: rgba(196, 165, 255, .10); }
.badge.b-other { color: var(--text-2); }
.machine .loc, .machine .st { font-size: 14px; line-height: 1.45; color: var(--text); }
.machine .k { display: inline-block; min-width: 58px; font-size: 12px; color: var(--muted); }
.machine .row-n { font-size: 12px; color: var(--muted); }
.machine .st-meta { color: var(--text-2); }
.machine .st-reserved { color: #FFB59E; }

/* Чипы-фильтры статусов */
.fchip { min-height: 36px; padding: 4px 12px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; }
.fchip.b-all { color: var(--text); }
.fchip.on { outline: 2px solid currentColor; outline-offset: 1px; font-weight: 800; }
.ms-machines { display: flex; flex-direction: column; gap: 8px; }

/* Приглашения */
.inv-steps { display: grid; gap: 10px; margin: 12px 0; }
.inv-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); font-size: 15px; line-height: 1.45; }
.inv-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; }
.inv-ico { width: 20px; height: 20px; vertical-align: -4px; color: var(--accent); }
.inv-code { margin-top: 8px; }
.inv-code summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--text-2); }
.inv-code-val { display: grid; place-items: center; }
.inv-form { display: grid; gap: 6px; margin-top: 4px; }
.inv-input { height: 48px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); padding: 0 12px; font: inherit; font-size: 16px; }
.inv-link { margin: 8px 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; user-select: all; }
.file-btn { cursor: pointer; }
#fileName { margin-top: 8px; color: var(--text-2); overflow-wrap: anywhere; }

/* Офлайн: плашка «Нет связи» */
.offline-bar { position: sticky; top: 0; z-index: 8; margin: 10px var(--gutter) 0; padding: 10px 14px; border-radius: var(--r-md); background: #2A1F0B; border: 1px solid var(--accent); color: #FFD27A; font-size: 13px; font-weight: 600; }

/* Характеристики: вложенные свёрнутые блоки */
.spec-more { margin-top: 12px; }
.spec-more summary { cursor: pointer; list-style: none; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--text-2); }
.spec-more summary::-webkit-details-marker { display: none; }
/* Нижний отступ: последний ряд главной полностью над нижним меню */
.app { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); }
.spec-check { border-color: rgba(255, 138, 101, .55); }
.spec-check .spec-value { color: var(--text-2); }
.spec-warn { margin-top: 4px; font-size: 11px; font-weight: 600; color: #FF8A65; }
.spec-variant { font-size: 11px; color: var(--text-2); margin: 2px 0; }
.spec-kp { margin-top: 4px; font-size: 11px; color: var(--text-2); }
.spec-vars { margin-top: 4px; font-size: 12px; }
details.card .spec-vars summary, .spec-vars summary { cursor: pointer; color: var(--accent); font-size: 12px; font-weight: 600; min-height: 32px; display: flex; align-items: center; justify-content: flex-start; }
details.card .spec-vars summary::after, details.card[open] .spec-vars summary::after { content: none; }
.spec-vars ul { margin: 4px 0 0; padding-left: 16px; color: var(--text-2); }
.spec-vars li { margin: 2px 0; overflow-wrap: anywhere; }

/* Вход: подключение через телефон (shell-v29) */
.pair-box { margin-top: 12px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface-2); }
.pair-box summary { cursor: pointer; list-style: none; min-height: 48px; padding: 12px 14px; display: flex; align-items: center; font-weight: 700; font-size: 14px; }
.pair-box summary::-webkit-details-marker { display: none; }
.pair-box[open] summary { border-bottom: 1px solid var(--line); }
.pair-body { padding: 12px 14px 14px; }
.pair-qr { display: grid; place-items: center; margin: 4px auto 8px; width: max-content; max-width: 100%; padding: 8px; border-radius: var(--r-sm); background: #FFFFFF; }
.pair-qr svg { display: block; max-width: 100%; height: auto; }
.pair-code { display: grid; place-items: center; margin-top: 0; }
.pair-steps { margin: 10px 0 6px; padding-left: 20px; line-height: 1.5; }
#codeBox { margin-top: 12px; }
#codeBox form { margin-top: 4px; }
.pair-row { display: flex; gap: 8px; margin-top: 8px; }
.pair-row .inv-input { flex: 1; min-width: 0; font-family: var(--font-mono); letter-spacing: .15em; }
.pair-row .btn { flex: none; height: 48px; padding: 0 16px; }
#pairApprove { margin: 0 var(--gutter); }
#pairConfirm p { margin: 10px 0 0; }

/* История: архив прайсов — свёрнутый блок в самом низу (shell-v33) */
.snap-box { margin: 0 var(--gutter) 16px; }
.snap-box summary { min-height: 44px; align-items: center; }
.snap-box #snapList { margin: 10px 0 0; }
.snap-box #snapList .card { background: var(--surface-2); }

/* «Техника» (shell-v36): меню из трёх пунктов, переключатель «Модели / Все машины», выборки в карточке модели */
.tabbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg { display: flex; gap: 4px; margin-top: 12px; padding: 4px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.ms-sel { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ms-sel select.chip { flex: 1 1 140px; min-width: 0; max-width: 100%; }

/* ПК в браузере (shell-v28): от 1024 px — меню слева, контент ограничен по ширине, карточка модели — панель справа.
   До 1024 px (телефон, Mini App в Telegram) ничего не меняется. */
@media (min-width: 1024px) {
  :root { --rail-w: 92px; --maxw: 1240px; --panel-w: clamp(460px, 36vw, 640px); --gutter: 24px; }
  body { padding-left: var(--rail-w); }
  body:has(> .tabbar.hidden) { padding-left: 0; }
  .topbar, main.app, .login { max-width: var(--maxw); margin-left: auto; margin-right: auto; box-sizing: border-box; }
  .snap-line { max-width: var(--maxw); margin: 10px auto 0; padding: 0 var(--gutter); box-sizing: border-box; }
  .offline-bar { max-width: calc(var(--maxw) - 2 * var(--gutter)); margin: 10px auto 0; }
  .app { padding-bottom: 40px; }
  .login { max-width: 560px; }

  /* нижнее меню → вертикальная панель слева */
  .tabbar { top: 0; right: auto; width: var(--rail-w); height: auto; padding: 18px 8px; grid-template-columns: 1fr; grid-auto-rows: 72px; align-content: start; gap: 6px; border-top: 0; border-right: 1px solid var(--line-soft); z-index: 10; }
  .tab { border-radius: var(--r-md); font-size: 12px; }
  .tab:hover { background: var(--surface); color: var(--text); }
  .tab[aria-current="page"]:hover { color: var(--accent); }
  .toast { bottom: 24px; }

  /* главная: поиск шире, фильтры переносятся, плитки в одну строку */
  .ask { margin-top: 26px; min-height: 60px; }
  .ask input { font-size: 17px; }
  .chips { flex-wrap: wrap; overflow: visible; }
  select.chip { max-width: 360px; }
  .chip-input { width: 160px; }
  .tiles { display: flex; gap: 12px; }
  .tile { flex: 1 1 0; min-height: 88px; flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; }
  .tile svg { flex: none; }
  .tile:hover { border-color: var(--line-strong); background: var(--surface-2); }

  /* списки: машины и строки прайса — сеткой; заголовки, сводка и пояснения — на всю ширину */
  #priceList, #stockList, .result { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); align-items: start; gap: 10px; }
  #priceList > :not(.js-model), #stockList > :not(.machine), .result > :not(.machine) { grid-column: 1 / -1; }
  .js-model:hover { border-color: var(--line-strong); background: var(--surface-2); }
  .js-model.is-sel { border-color: var(--accent); }
  #tab-files { max-width: 980px; }
  #stUpload { margin: 0 var(--gutter); }

  /* карточка модели: панель справа, список слева остаётся доступным */
  .sheet { left: auto; width: var(--panel-w); }
  .sheet-backdrop { display: none; }
  .sheet-panel { top: 0; max-height: none; border-radius: 0; border-top: 0; border-left: 1px solid var(--line-strong); background: var(--bg-deep); }
  .sheet-head { padding-top: 18px; }
  body.sheet-open { overflow: visible; padding-right: var(--panel-w); }
}

/* Светлая тема (shell-v34): заливки — фирменный янтарный, статусы — тёмные оттенки тех же цветов */
:root[data-theme="light"] { color-scheme: light; }
[data-theme="light"] .brand-mark, [data-theme="light"] .mic, [data-theme="light"] .btn-primary,
[data-theme="light"] .inv-n, [data-theme="light"] .chip[aria-pressed="true"] { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
[data-theme="light"] .chip-toggle input { accent-color: var(--accent-fill); }
[data-theme="light"] .badge.b-free { color: #116B32; border-color: rgba(21, 128, 61, .40); background: rgba(21, 128, 61, .08); }
[data-theme="light"] .badge.b-reserved { color: #A8380A; border-color: rgba(194, 65, 12, .40); background: rgba(194, 65, 12, .07); }
[data-theme="light"] .badge.b-demo, [data-theme="light"] .badge.b-exhibition { color: #1D4ED8; border-color: rgba(29, 78, 216, .35); background: rgba(29, 78, 216, .07); }
[data-theme="light"] .badge.b-transit { color: #6D28D9; border-color: rgba(109, 40, 217, .35); background: rgba(109, 40, 217, .07); }
[data-theme="light"] .machine .st-reserved, [data-theme="light"] .spec-warn { color: #C2410C; }
[data-theme="light"] .spec-check { border-color: rgba(194, 65, 12, .45); }
[data-theme="light"] .offline-bar { background: #FFF4DD; color: #7A4A00; }
[data-theme="light"] .sheet-backdrop { background: rgba(18, 23, 34, .35); }
[data-theme="light"] .tabbar { background: var(--surface); }
/* тумблер темы в шапке «Истории» */
.files-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.files-head .screen-title { margin: 0; }
.theme-toggle { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.tt-ico { width: 18px; height: 18px; }
.tt-track { position: relative; width: 44px; height: 26px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line-strong); }
.tt-knob { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-fill, var(--accent)); transition: transform .18s; transform: translateX(18px); }
.theme-toggle[aria-checked="true"] .tt-knob { transform: translateX(0); }
.theme-toggle[aria-checked="true"] .tt-sun, .theme-toggle[aria-checked="false"] .tt-moon { color: var(--accent); }
#deviceBox, #inviteBox { margin-left: var(--gutter); margin-right: var(--gutter); } /* v34: поля как у остальных карточек */

/* Расчёт по сделке (shell-v38): форма в листе снизу (телефон) / в панели справа (ПК), блок в «Истории» */
.deal-sheet { z-index: 21; }
.deal-form { display: flex; flex-direction: column; gap: 10px; }
.deal-form .section { margin-top: 8px; }
.deal-form .seg { margin-top: 0; }
.df { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 0; }
.df-l { font-size: 12px; color: var(--muted); }
.df-l-block { margin-top: 2px; }
.df-h { font-size: 11px; color: var(--faint, var(--muted)); }
.df .inv-input { width: 100%; min-width: 0; }
.df select.inv-input { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238B97A8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.df input[type="date"].inv-input { -webkit-appearance: none; appearance: none; display: flex; align-items: center; min-height: 48px; }
.df-ta { height: auto; min-height: 88px; padding: 12px; line-height: 1.4; resize: vertical; }
.df-row { display: flex; gap: 10px; }
.df-extra { display: grid; grid-template-columns: minmax(0, 1fr) 118px 44px; gap: 6px; align-items: center; margin-bottom: 6px; }
.df-extra .inv-input { width: 100%; min-width: 0; }
.dx-del { width: 44px; height: 44px; color: var(--muted); }
.dx-add { margin-top: 0; }
.deal-mrc { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; background: var(--surface-2); }
.deal-mrc .src { flex-basis: 100%; }
.deal-preview { position: sticky; bottom: 0; margin-top: 6px; border-color: var(--line-strong); box-shadow: 0 -8px 24px rgba(0, 0, 0, .25), 0 30px 0 22px var(--bg); }
.deal-preview { padding: 10px 12px; }
.dp-line { line-height: 1.35; }
.dp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.dp-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dp-stat span { font-size: 11px; color: var(--muted); }
.dp-stat b { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-stat.neg b { color: #FF8A65; }
.deal-preview .btn-block { margin-top: 8px; }
.dp-miss { margin-top: 6px; }
.dp-warn { color: #FF8A65; }
[data-theme="light"] .dp-warn { color: #A8380A; }
.deal-preview .btn:disabled { opacity: .45; }
.deal-done { border-color: var(--accent); }
.row-actions button.deal-btn { border-color: var(--accent); color: var(--accent); }
.deal-mrc .k { font-size: 12px; color: var(--muted); }
.deal-box { margin: 12px var(--gutter) 0; }
.deal-box #dealList { margin: 10px 0 0; }
.deal-box #dealList .card { background: var(--surface-2); }
.deal-item-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
@media (max-width: 370px) {
  .df-row { flex-wrap: wrap; }
  .df-extra { grid-template-columns: minmax(0, 1fr) 96px 44px; }
}
@media (min-width: 1024px) {
  .deal-sheet .sheet-panel { box-shadow: -16px 0 40px rgba(0, 0, 0, .35); }
}
[data-theme="light"] .deal-preview { box-shadow: 0 -8px 24px rgba(18, 23, 34, .10), 0 30px 0 22px var(--bg); }
@media (min-width: 1024px) { .deal-preview { box-shadow: 0 -8px 24px rgba(0, 0, 0, .25), 0 30px 0 22px var(--bg-deep); } [data-theme="light"] .deal-preview { box-shadow: 0 -8px 24px rgba(18, 23, 34, .10), 0 30px 0 22px var(--bg-deep); } }
[data-theme="light"] .dp-stat.neg b { color: #A8380A; }
