/* ============================================================================
   Оформление программы для телефона (/m/): стили экранов, которые строит m.js. Крупные касаемые элементы (от 44 px),
   один столбец, без горизонтальной прокрутки. Разметка — m.js.
   ============================================================================ */
:root {
  --bg: #eef2f7; --card: #ffffff; --ink: #1d2733; --muted: #6b7785; --line: #d3dce6;
  --brand: #1f4e79; --brand-ink: #ffffff; --accent: #e0a100; --danger: #c62828; --ok: #1e6b33;
  --mine: #e3eefb; --theirs: #ffffff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 16px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, textarea, select { font: inherit; }
#app { min-height: 100%; display: flex; flex-direction: column; }
.m-boot { margin: auto; color: var(--muted); }

.m-top { position: sticky; top: 0; z-index: 5; background: var(--brand); color: var(--brand-ink);
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 52px; }
.m-top h1 { font-size: 18px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-top button { background: transparent; border: 0; color: inherit; font-size: 22px; min-width: 40px; min-height: 40px; }
.m-net { font-size: 12px; background: var(--danger); color: #fff; padding: 4px 12px; text-align: center; }

.m-tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); }
.m-tabs button { flex: 1; border: 0; background: none; padding: 12px 6px; font-weight: 600; color: var(--muted);
  border-bottom: 3px solid transparent; }
.m-tabs button.is-on { color: var(--brand); border-bottom-color: var(--brand); }

.m-list { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.m-item { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: block;
  width: 100%; text-align: left; position: relative; }
.m-item.is-unread { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(224, 161, 0, .35); }
.m-item .t { font-weight: 700; font-size: 17px; }
.m-item .s { color: var(--muted); font-size: 14px; margin-top: 2px; }
.m-dot { position: absolute; top: 12px; right: 12px; background: var(--danger); color: #fff; border-radius: 10px;
  font-size: 12px; padding: 1px 8px; }
.m-empty { color: var(--muted); text-align: center; padding: 40px 16px; }

.m-sec { background: var(--card); margin: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.m-sec h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 6px; }
.m-kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 15px; }
.m-kv b { font-weight: 600; }
.m-row { padding: 6px 0; border-top: 1px solid var(--line); }
.m-row:first-of-type { border-top: 0; }
.m-row .n { font-weight: 600; }
.m-row .d { color: var(--muted); font-size: 14px; }
/* изменения товаров открытого наряда (Ф-548): новое — зелёным, изменённое — жёлтым, убранное — зачёркнуто */
.m-row--new { background: #e6f4ea; }
.m-row--chg { background: #fff4d6; }
.m-row--gone .n { text-decoration: line-through; color: var(--muted); }
.m-parts tr.m-parts--gone td:first-child > div:first-child { text-decoration: line-through; color: var(--muted); }
.m-warn { color: var(--danger); }

.m-feed { display: flex; flex-direction: column; gap: 8px; }
.m-msg { max-width: 88%; background: var(--theirs); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; align-self: flex-start; }
.m-msg.is-mine { align-self: flex-end; background: var(--mine); }
.m-msg .h { display: flex; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 2px; flex-wrap: wrap; }
.m-msg .h b { color: var(--ink); }
.m-msg .k { text-transform: uppercase; font-size: 11px; padding: 0 6px; border-radius: 4px; background: #e8edf3; }
.m-msg .k.diagnosis { background: #fde7c7; } .m-msg .k.question { background: #e3dcf7; } .m-msg .k.parts { background: #d7f0dc; }
.m-msg .b { white-space: pre-wrap; word-wrap: break-word; }
.m-msg .f { font-size: 11px; color: var(--muted); margin-top: 4px; }
.m-msg .ph { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.m-msg .ph img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.m-msg.is-flash { animation: m-flash 2.4s ease-out; }   /* сообщение, на которое открыли оповещение */
@keyframes m-flash { 0%, 40% { box-shadow: 0 0 0 3px #f5a623; } 100% { box-shadow: 0 0 0 0 transparent; } }
.m-msg .ph .ph-btn { border: 0; padding: 0; margin: 0; background: none; line-height: 0; }   /* миниатюра открывает свой просмотр */
.m-sys { align-self: center; font-size: 12px; color: var(--muted); background: #e2e8ef; border-radius: 10px; padding: 2px 10px; }
.m-parts { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 4px; }
.m-parts td { border-top: 1px solid var(--line); padding: 4px 2px; vertical-align: top; }
.m-parts td.q { text-align: right; white-space: nowrap; font-weight: 600; }

.m-compose { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; }
.m-compose textarea { width: 100%; min-height: 64px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; resize: vertical; }
.m-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.m-thumbs .t { position: relative; width: 64px; height: 64px; }
.m-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.m-thumbs .t.is-loading img { opacity: .4; }
.m-thumbs .x { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: var(--danger); color: #fff; font-weight: 700; }
.m-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.m-btn { flex: 1 1 auto; min-height: 46px; border-radius: 8px; border: 1px solid var(--line); background: #f4f6f9; font-weight: 600; padding: 0 12px; }
.m-btn.main { background: var(--brand); color: #fff; border-color: var(--brand); }
.m-btn:disabled { opacity: .5; }

.m-login { margin: 40px 16px; background: #fff; border-radius: 12px; border: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.m-login h1 { margin: 0; font-size: 22px; color: var(--brand); }
.m-login__sel { min-height: 48px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fff; }
.m-login__chk { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.m-login__chk input { width: 22px; height: 22px; }
.m-login input { min-height: 48px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; }
.m-login .err { color: var(--danger); min-height: 1.2em; }
.m-toast { position: fixed; left: 12px; right: 12px; bottom: 90px; background: #263545; color: #fff; padding: 12px 14px;
  border-radius: 10px; z-index: 50; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.m-login__apk { text-align: center; color: var(--brand); padding: 8px; }
.m-tabs--order { position: sticky; top: 52px; z-index: 4; }
.m-carline { padding: 6px 12px; color: var(--muted); font-size: 14px; background: #fff; border-bottom: 1px solid var(--line); }

/* «Кому» у менеджера (несколько исполнителей, 02.10.2026) и адресат у сообщения */
.m-to { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.m-to select { flex: 1; font: inherit; padding: 6px; }
.m-msg .h .to { color: #2459b8; font-weight: bold; }

/* «Особые отметки и рекомендации» и «Примечание» для менеджера (05.10.2026) */
.m-info__text { white-space: pre-wrap; margin-bottom: 8px; }
.m-info__text.is-empty { color: var(--muted); }
.m-info__edit { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; margin-bottom: 8px; }

/* «Фото» наряда и просмотр во весь экран (05.10.2026) */
.m-photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.m-photo { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 0; overflow: hidden; font: inherit; }
.m-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #f4f6f9; }
.m-photo .c { font-size: 13px; color: var(--muted); padding: 4px 6px; text-align: left; }
.m-viewer { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; align-items: center; justify-content: center; touch-action: none; overflow: hidden; }   /* жесты — просмотру, не странице */
.m-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center center; will-change: transform; user-select: none; -webkit-user-drag: none; }
.m-viewer .x { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.85); font-size: 26px; line-height: 1; }
.m-viewer .n { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #fff; font-size: 14px; }
.m-viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0;
  background: rgba(255,255,255,.25); color: #fff; font-size: 34px; border-radius: 8px; }
.m-viewer .nav.l { left: 6px; } .m-viewer .nav.r { right: 6px; }

/* «Новый заказ-наряд» по снимкам (m-new-order.js, 02.10.2026) */
.m-new-btn { display: block; width: 100%; margin-bottom: 10px; font-size: 17px; }
.m-no-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }   /* 4 плитки 2×2: техпаспорт · номер · VIN · пробег */
.m-no-shot { width: 100%; aspect-ratio: 4 / 3; border: 2px dashed var(--line); border-radius: 10px; background: #f4f6f9;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 6px; position: relative;
  overflow: hidden; font: inherit; color: var(--ink); }
.m-no-shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.m-no-cap, .m-no-st { position: relative; background: rgba(255, 255, 255, .88); border-radius: 6px; padding: 2px 6px;
  font-size: 13px; text-align: center; margin-top: 3px; }
.m-no-cap { font-weight: 700; }
.m-no-tile.is-loading .m-no-shot { border-color: var(--accent); }
.m-no-tile.is-done .m-no-shot { border: 2px solid var(--ok); }
.m-no-tile.is-err .m-no-shot { border: 2px solid var(--danger); }
.m-no-tile.is-err .m-no-st { color: var(--danger); }
.m-no-reason, .m-no-search { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; font: inherit; min-height: 46px; }
.m-no-btnrow .m-btn { width: 100%; }
.m-no-field { display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; margin: 8px 0; align-items: center; }
.m-no-field .l { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.m-no-field input { min-height: 46px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font: inherit;
  font-size: 18px; letter-spacing: .03em; text-transform: uppercase; width: 100%; box-sizing: border-box; }
.m-no-field .chk { background: #fff4d6; color: #8a5a00; border-radius: 6px; padding: 2px 6px; font-size: 12px; font-weight: 700; }
.m-no-field.is-unsure input { border-color: var(--accent); background: #fffaf0; }
.m-no-field .note { grid-column: 1 / -1; color: var(--danger); font-size: 13px; }
.m-no-remark { background: #fff4d6; border-radius: 8px; padding: 6px 8px; font-size: 14px; }
.m-no-car h2, .m-no-client h2 { margin-top: 12px; }
.m-no-pick { margin: 6px 0; text-align: left; width: 100%; font: inherit; }
.m-no-pick.is-on { border: 2px solid var(--brand); background: var(--mine); }
.m-no-hint { color: var(--muted); font-size: 14px; margin: 6px 0; }
.m-no-list .m-item { width: 100%; text-align: left; margin: 4px 0; font: inherit; }
.m-no-done .big { font-size: 20px; font-weight: 700; color: var(--ok); margin-bottom: 8px; }
.m-no-done .t { font-size: 22px; font-weight: 700; }
.m-no-done .s { color: var(--muted); margin: 4px 0 12px; }
.m-run { display: block; margin-bottom: 2px; } .m-run span { display: block; font-size: 13px; color: var(--muted, #667); margin-bottom: 2px; }
.m-busy { margin: 6px 10px; padding: 8px 10px; border-radius: 8px; background: #fff4c2; border: 1px solid #e3c55a; color: #5a4300; font-size: 14px; }

/* «Новая приходная» по сканеру штрихкодов (m-new-in.js, 09.10.2026) */
.m-in-prov { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 16px; }
.m-in-bill, .m-in-search, .m-in-scan { width: 100%; box-sizing: border-box; font-size: 16px; padding: 10px; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; }
.m-in-scan { font-size: 20px; letter-spacing: .05em; border: 2px solid var(--accent, #2a6fdb); }
.m-in-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.m-in-answer { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.m-in-ok { color: var(--ok); font-weight: 600; }
.m-in-remember { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.m-in-head { display: flex; align-items: center; justify-content: space-between; }
.m-in-row { border-top: 1px solid var(--line); padding: 8px 0; }
.m-in-row-top { display: flex; justify-content: space-between; gap: 8px; }
.m-in-row-top .t { font-weight: 600; }
.m-in-row .s { color: var(--muted); font-size: 13px; }
.m-in-row-bot { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.m-in-qty { flex: 0 0 72px; text-align: center; font-size: 18px; border-color: var(--accent); background: #fff; }
/* склад строки и окошко поверх экрана (17.10.2026: черновики и склад с телефона) */
.m-in-store { display: block; width: 100%; text-align: left; margin-top: 6px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; background: #f8fafc; font-size: 14px; color: var(--ink); }
.m-in-store.is-none { color: var(--danger); border-color: var(--danger); }
.m-in-storebtn, .m-in-billbtn { width: 100%; margin-top: 8px; text-align: left; }
.m-in-scanform { margin: 0; }
.m-in-sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 50; display: flex; align-items: flex-end; }
.m-in-sheet { background: var(--card); width: 100%; max-height: 85vh; border-radius: 14px 14px 0 0; display: flex; flex-direction: column; }
.m-in-sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.m-in-sheet-body { overflow-y: auto; padding: 8px 12px 16px; }
.m-in-sheet-form { display: flex; flex-direction: column; gap: 8px; }
.m-in-sheet .m-item.is-cur { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(31, 78, 121, .25); }
.m-in-qtyin { font-size: 24px; text-align: center; }
.m-in-unk-h { font-size: 15px; margin: 14px 12px 4px; color: #b45309; }
.m-in-unk { border-left: 4px solid #f59e0b; }
/* «Соответствие» — найти карточку для неопознанного кода (03.11.2026) */
.m-in-match { flex: 0 0 auto; margin-top: 6px; border-color: #f59e0b; background: #fff7e6; color: #92400e; }
.m-in-x { background: none; border: none; font-size: 22px; color: var(--muted); }
.m-in-total { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; }
.m-muted { color: var(--muted); font-size: 13px; }
/* привести карточку клиента к техпаспорту (обращение №306) */
.m-no-fix { margin: 8px 0; }
.m-no-fixrow { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; border-top: 1px solid var(--line); }
.m-no-fixrow input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.m-no-fixtext .l { font-weight: 600; }
.m-no-fixtext .s { color: var(--muted); font-size: 13px; }
.m-no-fixtext .t { color: #1a7f37; font-size: 14px; }

/* ── «Аренда» (m-rental.js, 17.10.2026): выдать / принять черновиком, фото пачкой ── */
.m-rn-start { display: flex; flex-direction: column; gap: 12px; }
.m-rn-big { min-height: 72px; font-size: 20px; }
.m-rn-info { font-weight: 600; font-size: 16px; }
.m-rn-km { font-size: 22px; text-align: center; }
.m-rn-fuel { display: flex; gap: 6px; margin-top: 6px; }
.m-rn-fuel .m-btn { flex: 1 1 0; min-height: 42px; padding: 0 4px; }
.m-rn-fuel .m-btn.is-on { background: var(--brand); color: #fff; border-color: var(--brand); }
.m-rn-fuel-in { width: 120px; text-align: center; }
.m-rn-notes { min-height: 60px; }
.m-rn-photos { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; align-items: center; }
.m-rn-ph { position: relative; width: 96px; height: 96px; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; background: #f4f6f9; }
.m-rn-ph img { width: 100%; height: 100%; object-fit: cover; }
.m-rn-ph.is-ok { border-color: var(--ok); }
.m-rn-ph.is-load { border-color: var(--accent); }
.m-rn-ph.is-err { border-color: var(--danger); }
.m-rn-ph__st { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.9); font-size: 10px; padding: 2px; text-align: center; }
.m-rn-ph.is-err .m-rn-ph__st { color: var(--danger); }
.m-rn-ph__x { position: absolute; top: 2px; right: 2px; border: none; background: rgba(255,255,255,.85); border-radius: 50%; width: 24px; height: 24px; font-size: 16px; line-height: 1; }
.m-rn-ph--add { font-size: 14px; color: var(--muted); }
.m-rn-shoot { width: 100%; min-height: 56px; font-size: 18px; margin-top: 6px; }
.m-rn-after { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 60; display: flex; align-items: center; justify-content: center; }
.m-rn-after__box { width: 100%; max-width: 640px; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.m-rn-after__box img { width: 100%; max-height: 65vh; object-fit: contain; }
.m-rn-after__btns { display: flex; gap: 8px; }
.m-rn-after__btns .m-btn { flex: 1 1 0; min-height: 56px; font-size: 16px; }
/* инвентаризация по полкам (Ф-802): «по учёту: N» у строки и список «Ещё числится на полке» */
.m-inv-book { margin-left: auto; font-size: 14px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.m-inv-book.is-ok { color: var(--ok); background: #e8f5e9; }
.m-inv-book.is-diff { color: var(--danger); background: #fdecea; }
.m-inv-rest-h { font-size: 15px; margin: 14px 0 4px; color: var(--muted); }
.m-inv-rest { margin-top: 6px; opacity: .85; }
.m-inv-where { margin-top: 6px; font-size: 14px; color: var(--muted); }
.m-inv-where.is-other { color: #8a5a00; font-weight: 600; }
.m-inv-plan { font-size: 15px; font-weight: 600; margin: 2px 0 8px; padding: 6px 10px; border-radius: 8px; background: #eef3f9; }
