:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #15171a);
  --hint: var(--tg-theme-hint-color, #8a8f98);
  --link: var(--tg-theme-link-color, #2481cc);
  --btn: var(--tg-theme-button-color, #2481cc);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --sec: var(--tg-theme-secondary-bg-color, #f2f3f5);
  --line: color-mix(in srgb, var(--hint) 25%, transparent);
  --danger: #e5484d;
  --ok: #2f9e66;
  --warn: #d98a00;
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg) {
    --bg: #17191c; --text: #eceef1; --hint: #8b919a; --sec: #22252a; --link: #5aa9ef; --btn: #3b8fd8;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--sec); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 4px; }
.brand { font-weight: 700; font-size: 18px; }
.icon-btn { background: var(--sec); border: 0; border-radius: 10px; width: 36px; height: 36px; font-size: 17px; cursor: pointer; margin-left: 6px; }
.tabs { display: flex; gap: 6px; padding: 6px 10px 10px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 0 0 auto; border: 0; background: var(--sec); padding: 8px 12px; border-radius: 20px; cursor: pointer; white-space: nowrap; }
.tabs button.active { background: var(--btn); color: var(--btn-text); }
.cnt:not(:empty) { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px;
  background: color-mix(in srgb, currentColor 20%, transparent); font-size: 12px; font-weight: 600; text-align: center; }

main { padding: 10px 10px 96px; }
.empty { text-align: center; color: var(--hint); padding: 40px 16px; }
.subtabs { display: flex; gap: 6px; margin: 0 2px 10px; }
.subtabs button { border: 1px solid var(--line); background: var(--bg); border-radius: 16px; padding: 5px 12px; cursor: pointer; }
.subtabs button.active { border-color: var(--btn); color: var(--btn); font-weight: 600; }

.card { background: var(--bg); border-radius: var(--r); padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.card:active { opacity: .75; }
.card .row1 { display: flex; align-items: center; gap: 8px; }
.card .num { font-weight: 700; }
.card .age { margin-left: auto; color: var(--hint); font-size: 13px; }
.card .model { font-weight: 600; margin: 3px 0 2px; }
.card .meta { color: var(--hint); font-size: 13px; word-break: break-word; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 8px; background: var(--sec); white-space: nowrap; }
.badge.warn { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); font-weight: 600; }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.match { font-size: 12px; color: var(--link); margin-top: 4px; }

.fab { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 6;
  border: 0; border-radius: 14px; padding: 14px; background: var(--btn); color: var(--btn-text);
  font-weight: 600; font-size: 16px; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.15); }

.sheet { position: fixed; inset: 0; z-index: 20; background: var(--sec); display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
.sheet-title { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { border: 0; background: none; color: var(--link); font-size: 16px; cursor: pointer; padding: 4px 6px 4px 0; }
.sheet-body { flex: 1; overflow-y: auto; padding: 12px 10px calc(24px + env(safe-area-inset-bottom)); }

.section { background: var(--bg); border-radius: var(--r); padding: 4px 14px; margin-bottom: 10px; }
.section h3 { margin: 10px 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--hint); font-weight: 600; }
.kv { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--hint); flex: 0 0 38%; font-size: 14px; }
.kv .v { flex: 1; word-break: break-word; white-space: pre-wrap; }
.copy { cursor: pointer; border-bottom: 1px dashed var(--hint); }
a { color: var(--link); }

.status-pill { display: inline-block; padding: 4px 10px; border-radius: 10px; font-weight: 600; font-size: 13px; margin: 2px 0 10px; }
.st-in_transit { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.st-in_stock { background: color-mix(in srgb, var(--link) 15%, transparent); color: var(--link); }
.st-done { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.st-cancelled { background: var(--bg); color: var(--hint); }

.actions { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 14px; }
.actions .row { display: flex; gap: 8px; }
.actions .row .btn { flex: 1; }
.btn { border: 0; border-radius: 12px; padding: 12px 14px; background: var(--btn); color: var(--btn-text); font-weight: 600; cursor: pointer; }
.btn.ghost { background: var(--bg); color: var(--link); }
.btn.danger { background: var(--bg); color: var(--danger); }
.btn:disabled { opacity: .5; }

.timeline { list-style: none; margin: 0; padding: 6px 0; }
.timeline li { position: relative; padding: 6px 0 8px 18px; border-left: 2px solid var(--line); margin-left: 4px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--btn); }
.timeline .when { color: var(--hint); font-size: 12px; }
.timeline .what { font-size: 14px; white-space: pre-wrap; word-break: break-word; }

.field { margin: 10px 0 12px; }
.field label { display: block; font-size: 13px; color: var(--hint); margin-bottom: 4px; }
.field label .req { color: var(--danger); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); background: var(--sec);
  border-radius: 10px; padding: 11px 12px; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--btn); }
.field.err input, .field.err select, .field.err textarea { border-color: var(--danger); }
.field .hint { font-size: 12px; color: var(--hint); margin-top: 4px; }
.serial-check { font-size: 13px; margin-top: 6px; font-weight: 600; }
.serial-check.ok { color: var(--ok); } .serial-check.bad { color: var(--danger); }
.expected { background: var(--sec); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.expected b { font-size: 17px; letter-spacing: .03em; }

.search-box { position: sticky; top: 0; }
.search-box input { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none; }
.notice { border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-weight: 600; }
.notice.ok { background: color-mix(in srgb, var(--ok) 14%, var(--bg)); color: var(--ok); }
.notice.warn { background: color-mix(in srgb, var(--warn) 16%, var(--bg)); color: var(--warn); }
.group-title { color: var(--hint); font-size: 13px; margin: 14px 4px 6px; text-transform: uppercase; }

.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-row .grow { flex: 1; }
.user-row small { color: var(--hint); }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-box { background: var(--bg); border-radius: 16px; padding: 18px; width: 100%; max-width: 420px; max-height: 80vh; overflow-y: auto; }
.modal-title { font-weight: 700; font-size: 17px; margin-bottom: 8px; }
.modal-text { white-space: pre-wrap; font-size: 14px; }
.modal-text ul { padding-left: 18px; margin: 6px 0; } .modal-text li { margin-bottom: 6px; }
.modal-input textarea { width: 100%; margin-top: 10px; border: 1px solid var(--line); background: var(--sec); border-radius: 10px; padding: 10px; }
.modal-btns { display: flex; gap: 8px; margin-top: 16px; } .modal-btns .btn { flex: 1; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 60; background: rgba(20,20,20,.88); color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw; text-align: center; }
.more { display: block; width: 100%; margin-top: 6px; }

.saved { position: fixed; left: 12px; right: 12px; top: calc(10px + env(safe-area-inset-top)); z-index: 70;
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px;
  background: var(--ok); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  transform: translateY(-140%); transition: transform .25s ease; }
.saved.show { transform: translateY(0); }
.saved-icon { font-size: 26px; line-height: 1; }
.saved-title { font-weight: 700; font-size: 16px; }
.saved-sub { font-size: 13px; opacity: .92; }
.offline { position: fixed; left: 0; right: 0; bottom: 0; z-index: 65; background: var(--danger); color: #fff;
  text-align: center; font-size: 13px; font-weight: 600; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }

.wide { display: block; width: 100%; margin: 0 0 10px; }
.cat { font-weight: 400; color: var(--hint); font-size: 13px; }
.pad { padding: 0 6px; font-size: 12px; color: var(--hint); }
.empty.small { padding: 12px; font-size: 13px; }

/* история изменений */
.hist { background: var(--bg); border-radius: var(--r); padding: 12px 14px; margin-bottom: 8px; }
.hist-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.hist-head span { color: var(--hint); font-size: 12px; white-space: nowrap; }
.hist-who { color: var(--hint); font-size: 13px; margin: 2px 0 6px; }
.hist .what { white-space: pre-wrap; font-size: 14px; word-break: break-word; }
.chg { padding: 6px 0; border-top: 1px solid var(--line); }
.chg-k { font-size: 12px; color: var(--hint); }
.chg-v { font-size: 14px; word-break: break-word; }
.chg .old { color: var(--danger); text-decoration: line-through; }
.chg .new { color: var(--ok); font-weight: 600; }

/* сотрудники */
.user-row.tap { cursor: pointer; }
.chev { color: var(--hint); font-size: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 8px; background: color-mix(in srgb, var(--btn) 12%, transparent); color: var(--btn); }
.chip.strong { background: var(--btn); color: var(--btn-text); }
.chip.muted { background: var(--sec); color: var(--hint); }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--btn); flex: 0 0 auto; }
.check span { display: flex; flex-direction: column; }
.check small { color: var(--hint); font-size: 12px; }
.check.perm input:disabled + span { opacity: .55; }
.section > .hint { font-size: 12px; color: var(--hint); padding: 8px 0 10px; }

/* статистика */
.month-nav { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; font-size: 17px; }
.month-nav .icon-btn { background: var(--bg); font-size: 22px; margin: 0; }
.month-nav .icon-btn:disabled { opacity: .3; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.tile { background: var(--bg); border-radius: var(--r); padding: 12px; }
.tile-v { font-size: 24px; font-weight: 700; }
.tile-k { font-size: 12px; color: var(--hint); line-height: 1.25; }
.tile.warn .tile-v { color: var(--danger); }
.bar-row { padding: 7px 0; }
.bar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.bar-top small { color: var(--hint); font-weight: 400; }
.bar { height: 8px; background: var(--sec); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--btn); border-radius: 4px; }
.ptable { width: 100%; border-collapse: collapse; font-size: 14px; margin: 4px 0 8px; }
.ptable th { font-size: 11px; color: var(--hint); font-weight: 600; text-align: center; padding: 4px; }
.ptable td { padding: 7px 4px; border-top: 1px solid var(--line); text-align: center; }
.ptable td:first-child, .ptable th:first-child { text-align: left; }

.notice.del { background: color-mix(in srgb, var(--danger) 12%, var(--bg)); color: var(--danger); font-weight: 500; }
.notice.del small { color: var(--hint); }
.st-deleted { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.btn.ghost.red { color: var(--danger); }
.btn.danger { border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
small.muted { color: var(--hint); font-size: 12px; }
.subtabs { flex-wrap: wrap; }
.btn.fill-danger { background: var(--danger); color: #fff; }

/* нет связи с сервером — заметно и сверху */
.offline { top: 0; bottom: auto; padding: calc(8px + env(safe-area-inset-top)) 14px 9px; display: flex; flex-direction: column;
  gap: 1px; box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 80; }
.offline b { font-size: 15px; } .offline span { font-weight: 500; font-size: 12.5px; opacity: .95; }
body.is-offline .top, body.is-offline .sheet-head { margin-top: 54px; }
body.is-offline .saved { top: 70px; }
/* «тикет изменил другой сотрудник» */
#liveBanner { position: sticky; top: 0; z-index: 3; margin: -2px 0 10px; }
.live { background: color-mix(in srgb, var(--warn) 16%, var(--bg)); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  border-radius: 12px; padding: 10px 12px; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.live.bad { background: color-mix(in srgb, var(--danger) 13%, var(--bg)); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.live .btn { display: block; width: 100%; margin-top: 8px; padding: 9px; }
.conf { border-top: 1px solid var(--line); padding: 8px 0; font-size: 13.5px; }
.conf .new { color: var(--ok); font-weight: 600; }

/* вкладки: длинные названия видны полностью — сетка 2×2 вместо прокрутки */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; overflow: visible; }
.tabs button { white-space: normal; text-align: left; line-height: 1.25; padding: 9px 11px; border-radius: 12px; min-height: 44px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 14px; }
.tabs button .cnt:not(:empty) { flex: 0 0 auto; }

/* «Назад» — всегда на виду, крупная зона нажатия */
.sheet-head { position: sticky; top: 0; z-index: 4; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.back { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px 6px 8px; margin-left: -4px;
  border-radius: 10px; background: color-mix(in srgb, var(--link) 10%, transparent); font-weight: 600; flex: 0 0 auto; }
.back:active { opacity: .7; }
.top { padding-top: env(safe-area-inset-top, 0px); }

/* отметка «может оставить отзыв» */
.badge.poop { background: color-mix(in srgb, #8b5a2b 18%, transparent); color: #8b5a2b; font-weight: 600; }
.notice.poop { background: color-mix(in srgb, #8b5a2b 14%, var(--bg)); color: #7a4a1e; font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not(.tg) .badge.poop, :root:not(.tg) .notice.poop { color: #e0b182; } }
.tg .badge.poop, .tg .notice.poop { color: #b07a45; }

/* редактируемые списки */
.list-tools { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.link-btn { border: 0; background: none; color: var(--link); padding: 4px 0; font-size: 13.5px; cursor: pointer; font-weight: 500; }
.li-row { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.li-row:last-child { border-bottom: 0; }
.li-row .grow { flex: 1; min-width: 0; word-break: break-word; }
.li-row .icon-btn { margin: 0; width: 34px; height: 34px; font-size: 15px; }
.field .check { border-bottom: 0; padding: 4px 0; }
.tile.span2 { grid-column: 1 / -1; }
body.sheet-open { overflow: hidden; }

/* ===== вкладки: 2 ряда по 2 + длинный «Поиск», у каждой свой значок ===== */
.tabs { grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px 10px 10px; }
.tabs button { --c: var(--link); position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px;
  min-height: 52px; padding: 8px 10px; border-radius: 14px; border: 1.5px solid transparent; background: var(--sec);
  text-align: left; font-size: 13px; line-height: 1.22; font-weight: 500; color: var(--text); }
.tabs .ti { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--c);
  background: color-mix(in srgb, var(--c) 13%, transparent); }
.tabs .ti svg { width: 20px; height: 20px; }
.tabs .tl { min-width: 0; }
.tabs .t-transit { --c: #d98a00; } .tabs .t-arrived { --c: #7c5cd6; } .tabs .t-stock { --c: #2481cc; } .tabs .t-done { --c: #2f9e66; }
.tabs .t-search { --c: var(--hint); grid-column: 1 / -1; min-height: 44px; grid-template-columns: auto 1fr; font-size: 14px; }
.tabs button.active { background: color-mix(in srgb, var(--c) 11%, var(--bg)); border-color: var(--c); color: var(--text); font-weight: 650; }
.tabs button.active .ti { background: var(--c); color: #fff; }
.tabs button.active .ti svg circle[fill] { fill: var(--c); }
.tabs .cnt:not(:empty) { background: var(--c); color: #fff; min-width: 22px; padding: 1px 7px; border-radius: 11px; font-size: 12px; font-weight: 700; }
@media (max-width: 360px) { .tabs button { font-size: 12px; gap: 6px; } .tabs .ti { width: 26px; height: 26px; } }

/* кнопки создания внизу */
.fab-bar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 6; display: flex; gap: 8px; }
.fab-btn { flex: 1; border: 0; border-radius: 14px; padding: 14px; background: var(--btn); color: var(--btn-text);
  font-weight: 600; font-size: 16px; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.fab-btn.alt { background: var(--bg); color: var(--btn); border: 1.5px solid var(--btn); }
.fab-bar.two .fab-btn { font-size: 15px; }

/* статусы */
.st-arrived { background: color-mix(in srgb, #7c5cd6 15%, transparent); color: #7c5cd6; }
.st-task { background: color-mix(in srgb, var(--link) 15%, transparent); color: var(--link); }
.st-task_done { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.task { background: color-mix(in srgb, var(--link) 14%, transparent); color: var(--link); font-weight: 600; }
.card.is-task { border-left: 3px solid var(--link); }

/* контакт клиента в карточке */
.contact { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 3px 0 2px; font-size: 13.5px; }
.contact .ct { display: inline-flex; gap: 4px; align-items: baseline; text-decoration: none; padding: 2px 8px; border-radius: 8px;
  background: color-mix(in srgb, var(--link) 9%, transparent); color: var(--link); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 0; }
.contact .ct b { font-weight: 600; }
.contact .ct-tg { color: #2a9bd6; } .contact .ct-vk { color: #3b6fb6; } .contact .ct-max { color: #6c4bd8; } .contact .ct-avito { color: #2f9e66; }
.contact .ct-wa { color: #1f9d55; } .contact span.ct { color: var(--text); background: var(--sec); }
.contact .ct-m { font-size: 12px; color: var(--hint); }
.contact-box { padding: 10px 14px; } .contact-box .contact { margin: 0; font-size: 15px; }

/* фото */
.photo-box h3 small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.ph-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 6px 0 4px; }
.ph { position: relative; width: 92px; height: 92px; border-radius: 12px; overflow: hidden; background: var(--sec); flex: 0 0 auto; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.ph.loading::after { content: "…"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--hint); }
.ph.broken::after { content: "нет фото"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--hint); font-size: 12px; }
.ph-del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; cursor: pointer; }
.ph-date { position: absolute; left: 4px; bottom: 4px; font-size: 10.5px; padding: 1px 5px; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; }
.ph.add { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1.5px dashed color-mix(in srgb, var(--btn) 55%, transparent);
  background: color-mix(in srgb, var(--btn) 6%, transparent); color: var(--btn); cursor: pointer; }
.ph.add span { font-size: 28px; line-height: 1; } .ph.add small { font-size: 12px; }
.photo-box.drop { outline: 2px dashed var(--btn); outline-offset: -4px; }
.photo-box .hint { font-size: 12px; color: var(--hint); padding: 2px 0 10px; }
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: 12px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 18px; }

/* кнопка сохранения всегда видна внизу формы */
.submit-bar { position: sticky; bottom: calc(-24px - env(safe-area-inset-bottom)); z-index: 3; margin: 14px -10px calc(-24px - env(safe-area-inset-bottom));
  padding: 10px 10px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--sec) 75%, transparent); }
.submit-bar .btn { width: 100%; padding: 14px; font-size: 16px; box-shadow: 0 4px 14px rgba(0,0,0,.12); }

/* поля */
.field .want { color: var(--warn); font-size: 11.5px; font-weight: 600; margin-left: 4px; }
.own-input { margin-top: 6px; }

/* похожие тикеты */
.sim { border-top: 1px solid var(--line); padding: 10px 0; font-weight: 400; color: var(--text); }
.sim-top { display: flex; align-items: center; gap: 8px; } .sim-top .status-pill { margin: 0; font-size: 12px; }
.sim-meta { font-size: 13px; color: var(--hint); margin: 3px 0; }
.sim-why { font-size: 13.5px; margin-bottom: 6px; }
.sim .btn { width: 100%; padding: 9px; border: 1px solid var(--line); }
.sim-lead { font-weight: 600; margin-bottom: 4px; }
.notice.simwarn { background: color-mix(in srgb, var(--danger) 11%, var(--bg)); color: var(--danger); border: 1.5px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.modal-text .hint { font-size: 12.5px; color: var(--hint); margin-top: 8px; }

/* админ-панель */
.adm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.adm-grid button { border: 1.5px solid transparent; background: var(--bg); border-radius: 14px; padding: 10px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; font-size: 18px; text-align: left; }
.adm-grid button span { font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.adm-grid button.active { border-color: var(--btn); background: color-mix(in srgb, var(--btn) 8%, var(--bg)); }

/* редактор полей */
.fe-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fe-row:last-child { border-bottom: 0; }
.fe-row .grow { flex: 1; min-width: 0; cursor: pointer; }
.fe-row small { color: var(--hint); font-size: 12px; }
.fe-move { display: flex; flex-direction: column; gap: 2px; }
.fe-move .icon-btn { width: 30px; height: 22px; font-size: 10px; margin: 0; border-radius: 6px; }
.fe-move .icon-btn:disabled { opacity: .25; }
.fe-row .icon-btn { margin: 0; }
.fe-row.is-heading b { text-transform: uppercase; letter-spacing: .03em; font-size: 12.5px; color: var(--hint); }
.fe-row.is-hidden .grow { opacity: .5; }
.field label.check { display: flex; color: var(--text); font-size: 15px; margin: 0; }
.tabs button { grid-template-columns: auto 1fr; }
.tabs .cnt:not(:empty) { position: absolute; top: 5px; right: 6px; font-size: 11px; min-width: 20px; padding: 0 6px; line-height: 18px; }
.tabs button:has(.cnt:not(:empty)) .tl { padding-right: 18px; }
.modal-text .sim, .modal-text .sim-lead, .modal-text .hint { white-space: normal; }
.notice.simwarn .sim { white-space: normal; }
.lbl-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.lbl-row label { margin-bottom: 0 !important; }
.lbl-row .list-tools { margin: 0; gap: 2px 10px; flex: 0 0 auto; flex-wrap: nowrap; }
.lbl-row .link-btn { font-size: 13px; padding: 2px 0; }
.card .age { white-space: nowrap; }
/* сканер штрихкода */
.scan-row { display: flex; gap: 8px; align-items: stretch; }
.scan-row input { flex: 1; min-width: 0; }
.scan-btn { flex: 0 0 auto; width: 48px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--btn) 45%, transparent);
  background: color-mix(in srgb, var(--btn) 10%, transparent); font-size: 20px; cursor: pointer; }
.scan-btn.busy { opacity: .5; animation: scanpulse 1s infinite; }
@keyframes scanpulse { 50% { opacity: .2; } }
.scan-pick { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; white-space: normal; }
.scan-pick .btn { border: 1px solid var(--line); font-family: ui-monospace, Menlo, monospace; }
/* окно «штрихкод отсканирован» */
.scan-ok { text-align: center; white-space: normal; }
.scan-cap { color: var(--hint); font-size: 14px; }
.scan-num { font: 700 26px/1.25 ui-monospace, Menlo, monospace; letter-spacing: .5px; margin: 6px 0 8px; word-break: break-all;
  padding: 10px 8px; border-radius: 12px; background: color-mix(in srgb, var(--btn) 10%, transparent); color: var(--text); }
.scan-meta { font-size: 15px; margin-bottom: 12px; }
.scan-check { font-size: 15px; font-weight: 600; padding: 10px; border-radius: 12px; border: 2px dashed #e0a100;
  background: color-mix(in srgb, #ffc107 14%, transparent); }
.scan-tail { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
.scan-tail span { min-width: 34px; padding: 6px 0; border-radius: 8px; background: var(--bg); border: 1px solid var(--line);
  font: 800 28px/1 ui-monospace, Menlo, monospace; color: var(--text); }
.scan-more { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.scan-more .btn { width: 100%; }
.scan-nf { white-space: normal; }
.badge.meet { background: color-mix(in srgb, #2e9d57 15%, transparent); color: #2e9d57; font-weight: 600; }
.card .row1 { flex-wrap: wrap; row-gap: 4px; min-width: 0; } .card .badge { max-width: 100%; white-space: normal; }
.scan-num { font-size: clamp(16px, 5.6vw, 26px); }
.scan-more .btn.ghost { border: 1px solid var(--line); }
.scan-tail { gap: 4px; } .scan-tail span { min-width: 0; flex: 0 1 34px; font-size: clamp(20px, 6.5vw, 28px); }
