:root {
  --bg: #f5f6f4; --card: #fff; --text: #1b1f1c; --muted: #66706a; --line: #dfe3df;
  --brand: #1f6f43; --brand-ink: #fff; --warn: #a15c00; --warn-bg: #fff4e0; --bad: #b3261e; --bad-bg: #fdecea;
  --ok: #1f6f43; --ok-bg: #e6f4ea; --chip: #eef1ee;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121513; --card: #1c201d; --text: #e8ece9; --muted: #9aa49e; --line: #2d332f;
    --brand: #3fa86f; --brand-ink: #08130c; --warn: #f0b35a; --warn-bg: #2e2412; --bad: #ff8a80; --bad-bg: #3a1a18;
    --ok: #7dd3a0; --ok-bg: #15301f; --chip: #262b27;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, Roboto, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
header#top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: var(--brand); color: var(--brand-ink);
}
header h1 { flex: 1; font-size: 18px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button { font: inherit; cursor: pointer; }
.icon { background: none; border: 0; color: inherit; font-size: 24px; min-width: 40px; min-height: 40px; }
.badge-host { position: relative; }
.badge { position: absolute; top: 2px; right: 0; background: var(--bad); color: #fff; border-radius: 10px; font-size: 12px; padding: 0 6px; }
.net { width: 10px; height: 10px; border-radius: 50%; background: #bbb; }
.net.on { background: #7dff9f; } .net.off { background: #ff6b6b; }
main { padding: 12px; max-width: 900px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.tabs { position: relative; display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; }
.tabs button { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 18px; padding: 6px 14px; white-space: nowrap; }
.tabs button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
input, select, textarea {
  font: inherit; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text);
}
textarea { min-height: 70px; }
input[type=checkbox], input[type=radio] { width: auto; flex: none; }
label { display: block; margin: 8px 0 4px; font-size: 14px; color: var(--muted); }
.btn { display: inline-block; border: 0; border-radius: 10px; padding: 12px 16px; background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.wide { width: 100%; }
.btn.ghost { background: var(--chip); color: var(--text); }
.btn.danger { background: var(--bad); color: #fff; }
.btn:disabled { opacity: .5; }
.list .item { display: flex; gap: 10px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); background: var(--card); }
.list .item:first-child { border-radius: 12px 12px 0 0; } .list .item:last-child { border-radius: 0 0 12px 12px; border-bottom: 0; }
.list { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.item .name { font-weight: 600; }
.tag { display: inline-block; font-size: 12px; border-radius: 6px; padding: 1px 6px; background: var(--chip); color: var(--muted); margin-right: 4px; }
.tag.bad { background: var(--bad-bg); color: var(--bad); } .tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.plate { border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-weight: 600; }
.plate.bad { background: var(--bad-bg); color: var(--bad); } .plate.warn { background: var(--warn-bg); color: var(--warn); }
.plate.ok { background: var(--ok-bg); color: var(--ok); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.kv b { text-align: right; }
.prod { padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--card); }
.prod .top { display: flex; gap: 8px; }
.pimg { width: 52px; height: 52px; flex: none; border-radius: 8px; object-fit: cover; background: var(--line); }
.pimg.no { display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--muted); text-align: center; }
.prod.stock .price { font-size: 14px; font-weight: 600; margin-top: 2px; }
.prod .name { overflow-wrap: anywhere; min-width: 0; display: block; }
.planbtns { margin-bottom: 10px; gap: 8px; }
.prod .meta { font-size: 13px; color: var(--muted); }
.prod.in { background: var(--ok-bg); }
.qty { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.qty button { width: 44px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--chip); color: var(--text); font-size: 20px; }
.qty input { width: 80px; text-align: center; }
.cartbar {
  position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; padding: 10px 12px;
  background: var(--card); border-top: 1px solid var(--line); margin: 0 -12px -12px;
}
/* сверху, под шапкой: внизу сообщение закрывало «Очистить»/«Отправить» */
#toast {
  position: fixed; left: 50%; top: 64px; transform: translateX(-50%); background: #222; color: #fff;
  padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; z-index: 20;
}
#toast.show { opacity: .95; }
.small-btn, .qty button.small-btn { width: auto; height: auto; min-height: 40px; padding: 6px 10px; font-size: 14px; font-weight: 500; }
.list .item { flex-wrap: wrap; }
.list .item > .grow { flex-basis: 60%; }
.tabs button { flex: 0 0 auto; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.section { font-weight: 700; margin: 14px 0 6px; }
@media (min-width: 700px) { .kv { grid-template-columns: 200px 1fr; } }

/* помощь: «? Помощь» в шапке (раздел роли) и «?» у заголовка экрана (ролик про экран) */
.ttl { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.ttl h1 { flex: 0 1 auto; min-width: 0; }
.help-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px 0 6px; border-radius: 17px;
  background: rgba(255, 255, 255, .18); color: inherit; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.help-btn::before { content: "?"; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--brand-ink); color: var(--brand); font-weight: 800; font-size: 14px; }
.help-q { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid currentColor; color: inherit; font-weight: 700; font-size: 15px; text-decoration: none; opacity: .9; }
.help-q[hidden], .help-btn[hidden] { display: none; }
.help-q.help-in { width: 22px; height: 22px; font-size: 13px; vertical-align: middle; margin-left: 6px; opacity: .75; }
.plate.reshoot-mark { display: flex; align-items: center; gap: 8px; }
.help-item { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.help-item:first-of-type { margin-top: 8px; }
.help-h { font-size: 18px; margin: 4px 0 10px; }
.help-video { width: 100%; max-height: 70vh; border-radius: 10px; background: #000; }
.help-steps { padding-left: 22px; margin: 10px 0; } .help-steps li { margin: 4px 0; }
/* "Помощь" ТП (партнёр 17.11): "☰ Помощь" открывает оглавление, "?" у заголовка урок экрана; в уроке "☰ Все уроки" */
.help-btn.toc::before { content: "☰"; font-size: 13px; }
.help-btn.toc.all { background: #fff; color: var(--text); }
.help-btn.toc.all::before { background: none; color: var(--text); width: auto; }
.help-n { width: 22px; color: var(--muted); }
.help-vfail { border: 1px dashed var(--line); border-radius: 10px; padding: 22px 14px; text-align: center; background: var(--chip); }
.help-vfail[hidden] { display: none; }
.help-vfail b { display: block; margin-bottom: 6px; } .help-vfail .btn { margin-top: 10px; background: #fff; border: 1px solid var(--line); }
.help-pager { display: flex; gap: 8px; margin: 2px 0 12px; }
/* партнёр 18.11 (msg 831): кнопки одной высоты, текстовый блок по центру по вертикали, длинное название переносится */
.help-pager .btn { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px;
  text-align: center; text-decoration: none; padding: 10px 8px; overflow-wrap: anywhere; }
.help-pager small { display: block; font-weight: 400; font-size: 12px; opacity: .8; }

/* Заказ ТП: все вкладки и кнопки доступны на узком телефоне. */
.order-tabs { flex-wrap: wrap; overflow: visible; margin: 8px 0; }
.order-tabs button { flex: 1 1 40%; white-space: normal; min-height: 44px; }
.qty { flex-wrap: wrap; }
@media (max-width: 420px) {
  .cartbar { flex-wrap: wrap; gap: 6px; }
  .cartbar > .grow { flex-basis: 100%; }
  .prod .top > .grow { min-width: 0; overflow-wrap: anywhere; }
}

.contact-actions { flex-wrap: wrap; margin: 8px 0; }
.contact-actions a { text-decoration: none; text-align: center; }
.point-contact { margin-top: 8px; overflow-wrap: anywhere; }

/* Поиск в корзине: выпадающий список оставляет строки заказа доступными ниже. */
.cart-search-results { max-height: 45vh; overflow-y: auto; overflow-x: hidden; margin-top: 4px; box-shadow: 0 4px 12px #0002; }

/* фото точки */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin-bottom: 8px; }
.ph { position: relative; padding: 0; border: 0; background: #eee; border-radius: 8px; overflow: hidden; aspect-ratio: 1; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph.wait img { opacity: .6; }
.ph .tag { position: absolute; left: 4px; bottom: 4px; font-size: 11px; }
.phview { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.92); display: flex; flex-direction: column; padding: 12px; gap: 10px; }
.phview img { flex: 1; min-height: 0; object-fit: contain; width: 100%; }
.phview .cap { color: #fff; font-size: 15px; }

/* задачи на визит */
.task.hot { border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad-bg); }
.task .tabs { margin: 8px 0; }
/* ТЗ № 6: фото по задаче – миниатюра "Посмотреть фото", статус фото, крупный просмотр */
.ph-open { display: flex; gap: 10px; align-items: center; margin: 4px 0 10px; padding: 0; border: 0; background: none; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.ph-open .ph { width: 96px; flex: none; display: block; }
.ph-open .lnk { color: var(--accent, #1f6f43); font-weight: 600; text-decoration: underline; }
.ph-open .s { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.pstat { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.pstat .ph { width: 56px; flex: none; }
.pstat .t { flex: 1; }
.tag.info { background: #e7eefb; color: #2856a3; }
.qsub { color: var(--muted); }
.qth { width: 56px; flex: none; margin: 0 8px; }
.tview { position: fixed; inset: 0; z-index: 70; background: #000; color: #fff; display: flex; flex-direction: column; }
.tview .vt { display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; }
.tview .vt b { flex: 1; font-size: 16px; }
.tview .x { background: none; border: 0; color: #fff; font-size: 26px; line-height: 1; padding: 4px 8px; }
.tview .vtask { padding: 0 12px 8px; color: #cfcfcf; font-size: 13px; }
.tview .stage { flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; position: relative; touch-action: none; }
.tview .stage img { max-width: 100%; max-height: 100%; display: block; transform-origin: center; user-select: none; -webkit-user-select: none; }
.tview .zoom { position: absolute; right: 10px; top: 10px; background: rgba(0,0,0,.6); border-radius: 6px; padding: 2px 8px; font-size: 13px; }
.tview .vb { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
.tview .vb p { margin: 0 0 8px; font-size: 13px; color: #cfcfcf; }
.tview .vb p.vsize { color: #9a9a9a; font-size: 12px; margin-top: -4px; }
.tview .vb b { color: #fff; }
.tview .vb .row { display: flex; gap: 8px; } .tview .vb .btn { flex: 1; }
.tview .btn.ghost { background: #2b2b2b; color: #fff; border-color: #555; }

/* черновики прошлых визитов (партнёр 18.11, msg 795) */
.odraft { display: flex; gap: 10px; align-items: center; margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: #f3f4f6; border: 1px dashed #b9bec7; }
.odraft .ph { width: 44px; flex: none; }
.odraft .t { flex: 1; font-size: 13px; line-height: 1.3; min-width: 0; }
.odraft .m, .odrafts .m { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.odraft .acts { display: flex; flex-direction: column; gap: 4px; }
.odraft .acts button, .odq .acts .btn { font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 8px; border: 1px solid #c9ced6; background: #fff; color: inherit; min-height: 0; }
.odraft .acts .del, .odq .acts .danger { color: #a1271b; border-color: #e3b4ae; background: #fff; }
.odrafts { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: #f3f4f6; border: 1px dashed #b9bec7; font-size: 13px; }
.odrafts summary { cursor: pointer; }
.odrafts .odraft { background: #fff; border-style: solid; border-color: #e1e4e8; margin: 6px 0 0; }
.odq .acts { display: flex; flex-direction: column; gap: 4px; }
.tsheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; display: flex; align-items: flex-end; }
.tsheet .card { width: 100%; margin: 0; border-radius: 16px 16px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; }
.tsheet h2 { margin: 0 0 8px; font-size: 18px; }
.tsheet .kv { display: grid; grid-template-columns: 96px 1fr; gap: 4px 10px; margin: 8px 0; font-size: 14px; }
.tsheet .kv dt { color: var(--muted); } .tsheet .kv dd { margin: 0; }
.tsheet .big { display: block; width: 100%; padding: 0; border: 0; background: none; margin: 6px 0 4px; }
.tsheet .big img { width: 100%; border-radius: 10px; display: block; max-height: 40vh; object-fit: contain; background: #f2f2f2; }
.tsheet .lnk { border: 0; background: none; padding: 0; color: #1f6f43; font: inherit; font-weight: 600; text-decoration: underline; font-size: 14px; }
.tsheet .note { font-size: 13px; color: #5b616b; background: #f3f4f6; border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.tsheet .row { display: flex; gap: 8px; margin-top: 10px; } .tsheet .row .btn { flex: 1; }
.tsheet .btn.ghost.danger { background: #fff; color: #a1271b; border-color: #e3b4ae; }

/* "Отправка": строка состояния отправки (партнёр 18.11, msg 813) */
.sendhead { color: var(--muted); font-size: 14px; }
.sendhead.info { color: #2856a3; font-weight: 600; }
.sendhead.bad { color: #a1271b; }
.sendhead.warn { color: #7a4b00; }

/* ---------- ТП в общем стиле с кабинетом супервайзера (партнёр 18.11, msg 897/927) ----------
   Шапка: имя ТП (обрезается многоточием, кнопки не вытесняет), справа связь, "Помощь", "⇅ N" (вход в "Отправку");
   на главной вторая строка вкладок "Сегодня"/"Все точки"; в "Помощи" одна строка "‹ <откуда>" и "Выйти". */
body.tp header#top { flex-wrap: wrap; row-gap: 0; padding: 6px 14px 0; }
body.tp header#top #title { flex: 1 1 auto; min-width: 0; font-size: 19px; }
body.tp header#top .ttl { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; min-height: 44px; }
body.tp header#top #back { flex: 0 0 auto; min-width: 0; font-size: 22px; padding: 0 4px 0 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.tp header#top #backTxt { font-size: 16px; font-weight: 700; margin-left: 6px; }
body.tp header#top #backTxt:empty { display: none; }
body.tp.tp-help header#top #back { flex: 1 1 auto; }
body.tp.tp-help header#top .ttl, body.tp.tp-help header#top #helpBtn, body.tp.tp-help header#top #queueBtn, body.tp.tp-help header#top #net { display: none; }
body.tp header#top .help-btn { flex: 0 0 auto; font-size: 14px; gap: 0; min-height: 30px; padding: 0 12px; border: 1px solid currentColor; background: none; color: inherit; }
body.tp header#top .help-btn::before { content: none; }
body.tp header#top #queueBtn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-width: 0; min-height: 30px; padding: 0 12px;
  border: 1px solid currentColor; border-radius: 16px; font-size: 15px; }
body.tp header#top #queueBtn .badge { position: static; background: #fff; color: #b3261e; font-weight: 700; font-size: 13px; line-height: 18px; }
body.tp header#top #queueBtn .badge[hidden] { display: none; }
.tp-pill { flex: 0 0 auto; border: 1px solid currentColor; border-radius: 16px; padding: 4px 12px; font-size: 14px; color: inherit; text-decoration: none; white-space: nowrap; }
.tp-pill[hidden] { display: none; }
body.tp header#top .tp-tabs { order: 9; flex-basis: 100%; display: flex; gap: 4px; margin: 0; padding: 0; background: none; overflow: visible; }
body.tp header#top .tp-tabs[hidden] { display: none; }
body.tp header#top .tp-tabs button { flex: 1; background: none; border: 0; border-radius: 0; color: inherit; opacity: .75; font-weight: 600; font-size: 15px;
  padding: 8px 0 9px; border-bottom: 3px solid transparent; }
body.tp header#top .tp-tabs button.on { opacity: 1; border-bottom-color: currentColor; background: none; color: inherit; }
.tp-acts { padding: 12px 14px; }
.tp-acts h3 { margin: 0 0 8px; font-size: 15px; }
.tp-acts .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tp-acts .row .btn { width: 100%; }
.tp-sech { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 8px; }
.tp-sech h2 { margin: 0; font-size: 20px; min-width: 0; }
.tp-about { flex: 0 0 auto; font-size: 14px; white-space: nowrap; text-decoration: none; color: inherit; border: 1px solid var(--line, #ccc); border-radius: 16px; padding: 4px 10px; }
.help-ltoc { padding: 0; overflow: hidden; }
.help-ltoc h3 { margin: 0; padding: 12px 14px; font-size: 15px; }
.help-ltoc a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 11px 14px; border-top: 1px solid var(--line, #e3e6e8); color: inherit; text-decoration: none; font-size: 15px; }
.help-ltoc a.on { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.help-ltoc .help-n { opacity: .7; font-size: 13px; margin-right: 8px; }
