/* Общие стили: мини-апп и админка.
   Цвета подстраиваются под тему Telegram (тёмную и светлую). Вне Telegram — своя тёмная тема. */
@import url("https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700;800&display=swap");

:root {
  --bg: var(--tg-theme-bg-color, #0e1320);
  --surface: var(--tg-theme-secondary-bg-color, #161c2b);
  --fg: var(--tg-theme-text-color, #e8ecf4);
  --muted: var(--tg-theme-hint-color, #8892a6);
  --accent: var(--tg-theme-button-color, #4f7cff);
  --accent-fg: var(--tg-theme-button-text-color, #ffffff);

  /* Производные цвета — работают и в светлой, и в тёмной теме */
  --surface-2: color-mix(in srgb, var(--fg) 6%, var(--surface));
  --surface-3: color-mix(in srgb, var(--fg) 11%, var(--surface));
  --line: color-mix(in srgb, var(--fg) 10%, transparent);
  --line-strong: color-mix(in srgb, var(--fg) 18%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);

  --ok: #2fb383;
  --warn: #e9a23b;
  --bad: #e5575b;
  --ok-soft: color-mix(in srgb, var(--ok) 15%, transparent);
  --warn-soft: color-mix(in srgb, var(--warn) 16%, transparent);
  --bad-soft: color-mix(in srgb, var(--bad) 14%, transparent);

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --font: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 15px/1.45 var(--font);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Мини-апп: каркас ---------- */
.wrap { padding: 0 14px 112px; max-width: 640px; margin: 0 auto; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 2px 6px;
}
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 17px;
  color: var(--accent); background: var(--accent-soft);
}
.who-text { min-width: 0; }
.who-name { font-weight: 650; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.screen-title { font-size: 26px; font-weight: 750; letter-spacing: -.02em; margin: 18px 2px 4px; }
.screen-sub { color: var(--muted); margin: 0 2px 14px; font-size: 14px; }

/* ---------- Карточки ---------- */
.card {
  background: var(--surface); border-radius: var(--r-lg); padding: 18px; margin: 12px 0;
  border: 1px solid var(--line);
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }
.card h2 { font-size: 16px; margin: 0; font-weight: 650; }
.muted { color: var(--muted); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Кнопки ---------- */
.btn {
  appearance: none; border: 0; border-radius: var(--r-md); padding: 13px 16px;
  font-weight: 600; font-size: 15px; cursor: pointer; line-height: 1.2;
  background: var(--accent); color: var(--accent-fg);
  transition: transform .08s ease, opacity .15s ease, filter .15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.subtle { background: var(--surface-2); color: var(--fg); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.bad { background: var(--bad); color: #fff; }
.btn.bad-quiet { background: var(--bad-soft); color: var(--bad); }
.btn.sm { width: auto; padding: 8px 12px; font-size: 13px; border-radius: var(--r-sm); gap: 6px; }
.btn.sm svg.i { width: 16px; height: 16px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 0; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); cursor: pointer; flex: none;
}
.icon-btn:hover { color: var(--fg); }
.icon-btn svg.i { width: 18px; height: 18px; }

/* ---------- Поля ---------- */
input, textarea, select {
  width: 100%; font: inherit; color: var(--fg); background: var(--surface-2);
  border: 1px solid transparent; border-radius: var(--r-md); padding: 12px 14px; outline: none;
  transition: border-color .15s ease, background .15s ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { min-height: 200px; font-size: 15px; resize: vertical; line-height: 1.6; font-variant-numeric: tabular-nums; }
label.field { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 500; }
select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238892a6' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}

/* ---------- Статусы ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.new { color: var(--accent); background: var(--accent-soft); }
.badge.in_progress { color: var(--warn); background: var(--warn-soft); }
.badge.done { color: var(--ok); background: var(--ok-soft); }
.badge.rejected { color: var(--bad); background: var(--bad-soft); }
.badge.plain::before { display: none; }
.badge.repeat { color: var(--accent); background: var(--accent-soft); }
.job-code.repeat-ask { display: flex; align-items: center; gap: 8px; color: var(--accent); background: var(--accent-soft); border-color: transparent; font-weight: 600; justify-content: flex-start; }

/* Номер телефона */
.phone { font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: .01em; word-break: break-all; }

/* ---------- Карточка кода в работе (главный экран менеджера) ---------- */
.job { position: relative; padding: 0; overflow: hidden; }
.job-bar { height: 4px; background: var(--surface-3); }
.job-bar > i { display: block; height: 100%; background: var(--ok); transition: width 1s linear, background .3s; }
.job[data-state="warn"] .job-bar > i { background: var(--warn); }
.job[data-state="late"] .job-bar > i { background: var(--bad); }
.job-body { padding: 16px 18px 18px; }
.job-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.job-number {
  display: flex; align-items: center; gap: 10px; margin-top: 6px;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left; width: 100%;
}
.job-number .phone { font-size: 27px; letter-spacing: -.005em; }
.job-number .copy { color: var(--muted); }
.job-number:active .phone { opacity: .7; }
.timer {
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 5px 11px; border-radius: 999px; background: var(--ok-soft); color: var(--ok);
}
.job[data-state="warn"] .timer { background: var(--warn-soft); color: var(--warn); }
.job[data-state="late"] .timer { background: var(--bad-soft); color: var(--bad); }
.job-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; margin-top: 16px; }
.job-actions [data-act="park"] { grid-column: 1 / -1; }
.job-actions .btn { padding: 13px 8px; white-space: nowrap; }
.job-actions .btn.ext { width: auto; padding: 13px 14px; }

/* ---------- Цифры ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.stat .k { font-size: 13px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 750; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat.accent .v { color: var(--accent); }
.stat.ok .v { color: var(--ok); }
.stat.warn .v { color: var(--warn); }
.stat.bad .v { color: var(--bad); }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 13px; background: var(--surface-2); }
td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--fg) 3%, transparent); }

/* ---------- Списки ---------- */
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.list-item .main { min-width: 0; }
.list-item .phone { font-size: 16px; }

.empty { text-align: center; color: var(--muted); padding: 30px 12px 26px; }
.empty .ico {
  width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 12px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted);
}
.empty .ico svg.i { width: 24px; height: 24px; }
.empty b { display: block; color: var(--fg); font-size: 16px; font-weight: 650; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

.skeleton { height: 120px; border-radius: var(--r-lg); margin: 12px 0;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Нижняя навигация (мини-апп) ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 6px;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.bottom-nav button {
  flex: 1; max-width: 160px; background: none; border: 0; color: var(--muted); font-size: 12px; font-weight: 500;
  padding: 7px 4px 6px; border-radius: 14px; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 3px; position: relative;
}
.bottom-nav button svg.i { width: 22px; height: 22px; }
.bottom-nav button.on { color: var(--accent); font-weight: 650; }
.bottom-nav .dot {
  position: absolute; top: 2px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--accent); color: var(--accent-fg); font-size: 11px; font-weight: 700;
  display: grid; place-items: center; font-variant-numeric: tabular-nums;
}

/* ---------- Уведомления ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px);
  background: var(--fg); color: var(--bg); padding: 11px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 550; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; max-width: calc(100% - 32px); z-index: 30;
  display: flex; align-items: center; gap: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); color: #fff; }

/* ---------- Экран входа ---------- */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; padding: 28px 24px 24px; }
.login-box .logo {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  margin-bottom: 18px; background: var(--accent); color: var(--accent-fg);
}
.login-box .logo svg.i { width: 26px; height: 26px; }
.login-box h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.02em; }
.login-box .btn { margin-top: 20px; }
.form-err { color: var(--bad); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---------- Админка: каркас ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px;
  display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; font-weight: 750; font-size: 16px; }
.brand .logo-s {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-fg);
}
.brand .logo-s svg.i { width: 18px; height: 18px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px;
  color: var(--muted); cursor: pointer; font-weight: 550; border: 0;
  background: none; text-align: left; width: 100%;
}
.nav-link:hover { background: var(--surface-2); color: var(--fg); }
.nav-link.on { background: var(--accent-soft); color: var(--accent); }
.sidebar .spacer { flex: 1; }
.main-area { padding: 30px 32px 64px; min-width: 0; max-width: 1180px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; margin: 0; letter-spacing: -.025em; font-weight: 750; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* Сводка: полоса распределения кодов */
.flow { margin: 0 0 14px; }
.flow-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.flow-bar i { display: block; height: 100%; }
.flow-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 16px; }
.flow-legend div { display: flex; flex-direction: column; }
.flow-legend .k { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.flow-legend .k::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--c); }
.flow-legend .v { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hero-money { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-money .big { font-size: 40px; font-weight: 800; letter-spacing: -.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-money .big span { font-size: 20px; color: var(--muted); font-weight: 600; margin-left: 6px; letter-spacing: 0; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar select { width: auto; min-width: 170px; }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg.i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search input { padding-left: 40px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 0; background: var(--surface-2); color: var(--muted); padding: 8px 13px; border-radius: 999px;
  font-size: 13px; font-weight: 550; cursor: pointer;
}
.chip.on { background: var(--fg); color: var(--bg); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; gap: 8px; border-top: 1px solid var(--line); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.inline-form { display: grid; grid-template-columns: 1fr 1.3fr 1fr 1fr auto; gap: 10px; align-items: end; }
.inline-form label.field { margin-top: 0; }
.inline-form .btn { width: auto; padding: 12px 20px; }
select.role-select { width: auto; padding: 7px 32px 7px 11px; border-radius: var(--r-sm); font-size: 13px; background-position: right 11px center; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; border: 0; background: none; padding: 4px 0; font-size: 13px; color: var(--muted); }
.switch i { width: 34px; height: 20px; border-radius: 10px; background: var(--surface-3); position: relative; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch.on { color: var(--fg); }
.switch.on i { background: var(--ok); }
.switch.on i::after { transform: translateX(14px); }
.input-suffix { position: relative; }
.input-suffix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.hint { color: var(--muted); font-size: 13px; margin-top: 8px; }
.save-bar { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.save-bar .btn { width: auto; padding: 12px 22px; }

/* ---------- Адаптив ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; height: auto; flex-direction: row; overflow-x: auto; align-items: center;
    padding: 10px; gap: 4px; z-index: 5; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0 8px 0 2px; }
  .brand b { display: none; }
  .nav-link { white-space: nowrap; padding: 8px 12px; width: auto; }
  .sidebar .spacer { display: none; }
  .main-area { padding: 20px 14px 60px; }
  .grid-2, .inline-form { grid-template-columns: 1fr; }
  .inline-form .btn { width: 100%; }
  .hero-money .big { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Аватарки (как в Telegram: фото или инициалы на цветном градиенте) ---------- */
.ava {
  --s: 36px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; position: relative; overflow: hidden;
  display: inline-grid; place-items: center; color: #fff; font-weight: 650; font-size: calc(var(--s) * .38);
  background: linear-gradient(180deg, var(--a1, #72d5fd), var(--a2, #2a9ef1)); letter-spacing: .01em; user-select: none;
}
.ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ava.lg { --s: 44px; }
.ava.sm { --s: 28px; }
.ava .live {
  position: absolute; right: 0; bottom: 0; width: 28%; height: 28%; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 2px var(--surface);
}
.ava-wrap { position: relative; display: inline-flex; flex: none; }
.ava-wrap .live {
  position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 2px var(--surface);
}
.person { display: flex; flex-direction: row; align-items: center; gap: 10px; min-width: 0; line-height: 1.25; }
.person .txt { display: flex; flex-direction: column; min-width: 0; }
.person .txt b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .txt small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Смена ---------- */
.shift-pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600;
  padding: 5px 11px 5px 9px; border-radius: 999px; background: var(--bad-soft); color: var(--bad); white-space: nowrap;
}
.shift-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.shift-pill.open { background: var(--ok-soft); color: var(--ok); }
.shift-pill.open::before { animation: beat 2s ease-in-out infinite; }
@keyframes beat { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); } }

.status-strip {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-lg); margin: 12px 0;
  background: var(--bad-soft); color: var(--fg);
}
.status-strip.open { background: var(--ok-soft); }
.status-strip .dotbig { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); flex: none; }
.status-strip.open .dotbig { background: var(--ok); }
.status-strip .t { font-weight: 700; font-size: 16px; }
.status-strip .s { color: var(--muted); font-size: 13px; }
.status-strip .faces { margin-left: auto; display: flex; }
.status-strip .faces .ava { margin-left: -8px; box-shadow: 0 0 0 2px var(--bg); }

.shift-card { display: flex; align-items: center; gap: 14px; }
.shift-card .grow { flex: 1; min-width: 0; }
.shift-card .t { font-weight: 700; font-size: 17px; }
.shift-card .btn { width: auto; flex: none; }
.shift-big { text-align: center; padding: 30px 18px 22px; }
.shift-big .ring {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center;
  background: var(--bad-soft); color: var(--bad);
}
.shift-big .ring svg.i { width: 28px; height: 28px; }
.shift-big h2 { font-size: 22px !important; margin: 0 0 6px !important; letter-spacing: -.02em; }
.shift-big .btn { margin-top: 18px; }

/* ---------- Заявки ---------- */
.req { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.req:last-child { border-bottom: 0; }
.req .grow { flex: 1; min-width: 200px; }
.req .note { color: var(--muted); font-size: 13px; margin-top: 4px; }
.req .acts { display: flex; gap: 8px; align-items: center; }

/* ---------- Списки переключателей ---------- */
.opt { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.opt:last-child { border-bottom: 0; padding-bottom: 0; }
.opt:first-of-type { padding-top: 0; }
.opt .switch { padding: 0; }
.opt span.l { font-size: 14px; }
.bind-box { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); }
.bind-box .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.bind-box.off .ico { background: var(--surface-3); color: var(--muted); }
.kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); }
.steps { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.steps li { margin: 4px 0; }

/* Бейдж-счётчик в меню админки */
.nav-link .cnt {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 12px; font-weight: 700;
  background: var(--bad); color: #fff; display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--muted); padding: 7px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600; }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
textarea.plain { font-variant-numeric: normal; min-height: 120px; }
@media (max-width: 860px) {
  .nav-link .cnt { margin-left: 6px; }
  .status-strip .faces { display: none; }
}

/* ---------- График ---------- */
.sched-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 4px 0 2px; }
.sched-list { padding: 4px 18px; }
.sched-day { display: flex; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.sched-day:last-child { border-bottom: 0; }
.sched-day.past { opacity: .45; }
.sched-day.today .sched-date b { color: var(--accent); }
.sched-date { width: 92px; flex: none; display: flex; flex-direction: column; line-height: 1.3; }
.sched-date b { font-weight: 650; }
.sched-date .muted { font-size: 12px; }
.sched-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.sched-entry { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sched-entry .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-entry .ava.sm { --s: 22px; font-size: 9px; }
.sched-entry.dim { opacity: .8; }
.sub-title { font-size: 19px; font-weight: 700; letter-spacing: -.015em; margin: 22px 2px 0; }

.plan { padding: 6px 18px; }
.plan-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.plan-row:last-child { border-bottom: 0; }
.plan-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 9px; }
.plan-head b { font-weight: 650; }
.plan-head .muted { font-size: 12px; }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; padding: 9px 6px; }
.seg button.on.work { background: var(--ok); color: #fff; }
.seg button.on.off { background: var(--surface-3); color: var(--fg); }
.seg button.on.unknown { background: var(--warn); color: #241600; }
.plan-times { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.plan-times input { flex: 1; padding: 10px 12px; font-variant-numeric: tabular-nums; }
.plan-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; margin-top: 12px; }
.plan-actions .btn { padding: 13px 10px; }

/* Админка: сетка графика */
.grid-sched td, .grid-sched th { text-align: center; }
.grid-sched td:first-child, .grid-sched th:first-child { text-align: left; }
.grid-sched th.today { color: var(--accent); }
.cell {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 92px; min-height: 40px;
  border: 0; border-radius: 10px; padding: 6px 8px; cursor: pointer; font-size: 13px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); font-variant-numeric: tabular-nums;
}
.cell:hover { outline: 1px solid var(--line-strong); }
.cell.work { background: var(--ok-soft); color: var(--ok); }
.cell.unknown { background: var(--warn-soft); color: var(--warn); }
.cell.off { background: var(--surface-3); color: var(--fg); }
.cell.past { opacity: .45; cursor: default; }

/* Модальное окно */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.modal h3 { margin: 0 0 4px; font-size: 18px; }
.modal .btn-row { margin-top: 18px; }
@media (max-width: 380px) {
  .sched-date { width: 78px; }
  .plan-actions { grid-template-columns: 1fr; }
}

/* ---------- Код у номера ---------- */
.code-inp {
  width: 104px; flex: none; padding: 9px 11px; font-size: 14px; font-variant-numeric: tabular-nums;
  font-weight: 600; text-align: center; letter-spacing: .02em;
}
.code-inp::placeholder { font-weight: 400; letter-spacing: 0; }
.list-item .main { flex: 1; }
.job-code {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 10px; padding: 11px 14px;
  border: 0; border-radius: var(--r-md); background: var(--surface-2); color: var(--fg); cursor: pointer; text-align: left;
}
.job-code .code-val { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: .04em; margin-right: auto; }
.job-code .copy { color: var(--muted); }
.job-code:active { opacity: .7; }
.job-code.empty { background: none; color: var(--muted); font-size: 13px; cursor: default; padding: 8px 2px 0; }
td.code-cell b { font-variant-numeric: tabular-nums; letter-spacing: .03em; }

.region { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.job-body > .region { font-size: 14px; margin: 4px 0 10px; }
.region.approx { font-style: italic; opacity: .85; }

.fbar select { min-width: 150px; flex: 1 1 150px; }
.fbar input { flex: 1 1 150px; min-width: 130px; width: auto; }

.pack-list { display: grid; gap: 8px; margin-top: 14px; max-height: 50vh; overflow-y: auto; }
.pack-list .pack { justify-content: flex-start; text-align: left; }
.job-actions [data-act="rep"] { grid-column: 1 / -1; }

.pack-edit { display: grid; gap: 8px; margin: 14px 0 10px; max-height: 46vh; overflow-y: auto; }
.pack-row { display: grid; grid-template-columns: 1fr auto auto auto auto auto; gap: 6px; align-items: center; }
.pack-row input { min-width: 0; padding: 9px 11px; }
.pack-row .btn.sm { padding: 8px 10px; }
.pack-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.pname { padding: 8px 11px; }

/* приоритетные пачки: сдержанная пометка */
.pack-list .pack { flex-direction: column; align-items: flex-start; gap: 2px; height: auto; }
.pack .pk-note { font-size: 12.5px; font-weight: 500; opacity: .7; white-space: normal; }
.btn.prio { border-left: 3px solid var(--warn, #f0a830); }
.prio-star { color: var(--warn, #f0a830); font-weight: 700; }
.prio-hint { margin-top: 12px; font-size: 13px; color: var(--muted); }

/* наличие */
.pack-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.pack-item .pack { width: 100%; }
.pack-item .pack:disabled { opacity: .45; }
.qty-pill { padding: 6px 11px; border-radius: 999px; background: var(--surface-2, rgba(255,255,255,.06)); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qty-pill.zero { color: var(--bad); }
.stock { display: flex; align-items: center; gap: 4px; }
.stock input { width: 56px; text-align: center; padding: 9px 4px; font-variant-numeric: tabular-nums; font-weight: 700; }
.stock .btn.sm { padding: 8px 12px; min-width: 40px; }
.stock-list { padding: 4px 16px; }
.stock-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.stock-row:last-child { border-bottom: 0; }
.stock-row .nm { font-weight: 600; min-width: 0; }
.stock-row.zero .nm { opacity: .6; }

/* админка: наличие */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md, 14px); padding: 14px 18px; }
.kpi .k { font-size: 13px; color: var(--muted); }
.kpi .v { font-size: 28px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi.bad .v { color: var(--bad); }
.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stock-card { padding: 16px; display: grid; gap: 10px; align-content: start; }
.stock-card.none { opacity: .6; }
.sc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sc-name { font-weight: 650; line-height: 1.3; }
.sc-total { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1; }
.sc-bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.sc-bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.sc-by { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-chip { font-size: 12.5px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2, rgba(255,255,255,.06)); color: var(--muted); }
.sc-chip b { color: var(--fg); margin-left: 2px; }
@media (max-width: 700px) { .kpis { grid-template-columns: 1fr; } }

/* отправители в очереди */
.senders { display: grid; gap: 8px; margin-top: 12px; max-height: 52vh; overflow-y: auto; }
.sender { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--r-md, 12px); background: var(--surface-2); }
.sender.held { outline: 1px dashed var(--warn, #f0a830); }
.sd-main { min-width: 0; }
.sd-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sd-act { display: flex; gap: 6px; align-items: center; flex: none; }
.sd-act select { padding: 8px 10px; }
.senders-link { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 700px) { .qa-grid { grid-template-columns: 1fr; } .sender { flex-wrap: wrap; } }
.sd-act select { min-width: 112px; padding-right: 32px; }
.sd-act { margin-top: 4px; }
.senders-link .chip { display: inline-flex; align-items: center; gap: 8px; }

/* чат по номеру */
.modal.chat { display: flex; flex-direction: column; max-height: min(86vh, 640px); }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-log { flex: 1; min-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin: 12px 0; padding: 4px 2px; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg .bub { padding: 9px 12px; border-radius: 14px 14px 14px 4px; background: var(--surface-2); line-height: 1.35; word-break: break-word; white-space: pre-wrap; }
.msg.mine .bub { background: var(--accent); color: #fff; border-radius: 14px 14px 4px 14px; }
.msg .t { font-size: 11px; color: var(--muted); margin-top: 2px; }
.chat-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chat-quick .chip { font-size: 12.5px; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.chat-form[hidden] { display: none; }
.badge.unread { background: var(--bad); color: #fff; margin-left: 4px; }
.job-actions [data-act="chat"] { grid-column: 1 / -1; }

.list-item { flex-wrap: wrap; }
.li-acts { flex: 1 1 100%; display: flex; gap: 8px; order: 5; }
.li-acts:not(:has(*)) { display: none; }

/* ---- выплаты и личные настройки ---- */
.topbar .who { flex: 1; }
#setBtn { padding: 8px 10px; }
.pay-row { display: flex; align-items: center; gap: 10px; }
.pay-row input { flex: 1; min-width: 0; }
.modal.settings { max-width: 420px; max-height: 88vh; overflow-y: auto; }
.set-h { margin: 18px 0 6px; font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.modal.settings .chat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.rs-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rs-row input { flex: 1; min-width: 0; }
.rs-row.off input { opacity: .5; }

.plain-inp { background: transparent; border: 0; border-bottom: 1px dashed var(--line); padding: 2px 0; font-weight: 650; font-size: 15px; color: var(--fg); width: 100%; border-radius: 0; }
.plain-inp:focus { outline: none; border-bottom-color: var(--accent); }
.route-opt { gap: 10px; }
.route-opt .l { flex: 1; min-width: 0; }
.route-opt select { max-width: 150px; padding: 6px 8px; font-size: 13px; }
#payBtn { width: 100%; justify-content: center; }

/* ---- категории ---- */
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.badge.cat { color: var(--accent); background: var(--accent-soft); }
.mini-inp { width: 84px; text-align: right; padding: 6px 8px; font-size: 14px; }
tr.dim td { opacity: .55; }
.chip.sm { padding: 3px 10px; font-size: 12px; }

/* ---- защита от растягивания страницы длинным текстом ---- */
html, body { overflow-x: hidden; max-width: 100%; }
.wrap, .card, .list-item, .list-item .main { min-width: 0; max-width: 100%; }
.list-item .main, .list-item .phone, .muted, .card p, .stat .k { overflow-wrap: anywhere; word-break: break-word; }
.list-item .phone { max-width: 100%; }
.code-inp { max-width: 38vw; }
.modal-back { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.modal { min-width: 0; overflow-wrap: anywhere; }
.chat-log > * { max-width: 100%; overflow-wrap: anywhere; }

/* чат: аккуратный «лист» снизу, подстраивается под клавиатуру */
.modal-back.chat-back { display: flex; align-items: flex-end; justify-content: center; padding: 0; inset: 0 0 auto 0; height: 100dvh; }
.modal.chat { width: 100%; max-width: 560px; max-height: 100%; border-radius: 20px 20px 0 0; border-bottom: 0;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); overflow: hidden; }
.modal.chat .chat-head { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.modal.chat .chat-log { margin: 10px 0; min-height: 0; }
.modal.chat .msg { max-width: 86%; }
.modal.chat .chat-quick { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px 8px; padding: 0 14px; scrollbar-width: none; flex: none; }
.modal.chat .chat-quick::-webkit-scrollbar { display: none; }
.modal.chat .chat-quick .chip { flex: none; white-space: nowrap; }
.modal.chat .chat-form, .modal.chat .chat-head, .modal.chat #chHint { flex: none; }
.modal.chat .chat-form input { font-size: 16px; }

/* «Готов принять код» и место в очереди */
.ready-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; border: 1px solid var(--line); }
.ready-card.on { border-color: color-mix(in srgb, var(--ok, #1f9d6b) 55%, transparent); background: color-mix(in srgb, var(--ok, #1f9d6b) 9%, var(--surface)); }
.ready-card .ready-main { min-width: 0; }
.ready-card .muted { margin-top: 3px; }
.ready-card .switch { flex: none; }
.qpos { color: var(--accent); font-variant-numeric: tabular-nums; }

/* смены по категориям, перерыв */
.status-strip.break { background: color-mix(in srgb, #e0a100 14%, var(--surface)); }
.status-strip.break .dotbig { background: #e0a100; }
.state-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.state-chips .sc { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--fg); }
.state-chips .sc i, .pc-st i { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); display: inline-block; }
.state-chips .sc.open i, .pc-st.open i { background: var(--ok); }
.state-chips .sc.break i, .pc-st.break i { background: #e0a100; }
.shift-btns { display: flex; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.pick-list { display: grid; gap: 8px; margin-top: 14px; }
.pick-cat { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pc-st { display: inline-flex; }

/* шапка и нижнее меню на узких экранах */
.who-text > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar > .btn { flex: none; }
@media (max-width: 520px) { #adminLink .al { display: none; } #adminLink { padding: 8px 10px; } }
.bottom-nav { gap: 2px; padding-left: 6px; padding-right: 6px; }
.bottom-nav button { min-width: 0; padding-left: 2px; padding-right: 2px; white-space: nowrap; font-size: 11.5px; }

/* ---------- Подписка на уведомления + обучающие подсказки ---------- */
#bellBtn { padding: 8px 10px; position: relative; }
#bellBtn .dot { position: absolute; top: 5px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad, #e5484d); border: 2px solid var(--bg); }
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); min-width: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none; }
.sheet-head h3 { margin: 0; font-size: 18px; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; margin: 10px -14px 0; padding: 0 14px 6px; min-height: 0; }
.nf-lead { color: var(--muted); font-size: 13.5px; margin: 6px 0 12px; }
.nf-master { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 12px; }
.nf-master b { display: block; font-size: 15px; }
.nf-master .muted { margin-top: 2px; }
.nf-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.nf-preset { border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); border-radius: var(--r-md); padding: 10px 6px;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; line-height: 1.25; min-width: 0; }
.nf-preset small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.nf-preset.on { border-color: var(--accent); background: var(--accent-soft); }
.nf-list { transition: opacity .15s; }
.nf-list.off { opacity: .45; pointer-events: none; }
.nf-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.nf-item:last-child { border-bottom: 0; }
.nf-item .t { min-width: 0; }
.nf-item .t b { font-weight: 600; font-size: 14px; display: block; }
.nf-item .t > span { color: var(--muted); font-size: 12.5px; display: block; margin-top: 2px; overflow-wrap: anywhere; }
.nf-item .switch { flex: none; padding: 0; }
.nf-tag { display: inline-block; font-size: 10.5px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; color: #b7791f; background: color-mix(in srgb, #e0a100 16%, transparent); border-radius: 99px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; }
.nf-foot { color: var(--muted); font-size: 12px; margin-top: 10px; }

.coach { position: fixed; inset: 0; z-index: 90; }
.coach-ring { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(4,6,12,.66), 0 0 0 2px var(--accent) inset; pointer-events: none; transition: all .22s ease; }
.coach-card { position: fixed; width: min(320px, calc(100vw - 24px)); background: var(--surface); color: var(--fg); border: 1px solid var(--accent);
  border-radius: 16px; padding: 14px 14px 12px; box-shadow: 0 12px 40px rgba(0,0,0,.45); z-index: 91; }
.coach-card b { display: block; font-size: 15px; margin-bottom: 4px; }
.coach-card p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.4; color: var(--muted); }
.coach-card .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.coach-card .step { font-size: 12px; color: var(--muted); }
.coach-card .row .btn { flex: none; }
.coach-arrow { position: absolute; width: 14px; height: 14px; background: var(--surface); border: 1px solid var(--accent); transform: rotate(45deg); }
.coach-arrow.up { top: -8px; border-right: 0; border-bottom: 0; }
.coach-arrow.down { bottom: -8px; border-left: 0; border-top: 0; }
@media (prefers-reduced-motion: reduce) { .coach-ring { transition: none; } }

/* ---------- Админка на телефоне ---------- */
.m-top, .m-bottom, .drawer-back { display: none; }
body.no-scroll { overflow: hidden; }
@media (max-width: 860px) {
  .m-top { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 12; padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top));
    background: var(--surface); border-bottom: 1px solid var(--line); }
  .m-top b { flex: 1; min-width: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-burger { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--fg); cursor: pointer; flex: none; }
  .shell { display: block; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; height: auto; width: min(300px, 86vw); z-index: 30; flex-direction: column; overflow-y: auto; overflow-x: hidden;
    padding: calc(14px + env(safe-area-inset-top)) 10px calc(14px + env(safe-area-inset-bottom)); transform: translateX(-102%); transition: transform .22s ease; border-right: 1px solid var(--line); border-bottom: 0; box-shadow: none; }
  .shell.drawer-open .sidebar { transform: none; box-shadow: 8px 0 40px rgba(0,0,0,.5); }
  .brand b { display: inline; }
  .brand { padding: 0 10px 14px; }
  .sidebar .spacer { display: block; flex: 1; min-height: 8px; }
  .nav-link { padding: 12px 14px; min-height: 44px; width: 100%; white-space: normal; }
  .drawer-back { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .shell.drawer-open .drawer-back { opacity: 1; pointer-events: auto; }
  .main-area { padding: 14px 12px calc(92px + env(safe-area-inset-bottom)); max-width: 100%; }
  .main-area h1, .main-area .screen-title { font-size: 24px; }
  .m-bottom { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 12;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .m-bottom button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: none; color: var(--muted);
    font: inherit; font-size: 11px; font-weight: 600; padding: 6px 2px; min-height: 48px; border-radius: 12px; cursor: pointer; }
  .m-bottom button.on { color: var(--accent); background: var(--accent-soft); }
  .m-bottom .i { width: 22px; height: 22px; }
  .m-bottom .cnt { position: absolute; top: 2px; left: 50%; margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad, #e5484d); color: #fff; font-style: normal; font-size: 11px; display: grid; place-items: center; }
  .m-bottom .cnt[hidden] { display: none; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)) !important; }
}
@media (max-width: 700px) {
  input, select, textarea { font-size: 16px; }
  .inline-form { grid-template-columns: 1fr !important; }
  .inline-form .btn { width: 100%; }
  .save-bar { flex-wrap: wrap; } .save-bar .btn { flex: 1; }
  .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .card.flush { padding: 0; }
  /* таблицы → карточки */
  .table-wrap { overflow: visible; border: 0; background: none; }
  table.cardify, table.cardify tbody { display: block; width: 100%; }
  table.cardify thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.cardify tr { display: block; margin: 0 0 10px; padding: 6px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
  table.cardify td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line);
    white-space: normal; overflow-wrap: anywhere; text-align: right; min-width: 0; }
  table.cardify td:last-child { border-bottom: 0; }
  table.cardify td::before { content: attr(data-label); flex: none; max-width: 42%; text-align: left; color: var(--muted); font-size: 12.5px; }
  table.cardify td[data-label=""]::before { display: none; }
  table.cardify td:first-child { justify-content: flex-start; text-align: left; }
  table.cardify td .btn, table.cardify td select { max-width: 100%; }
  table.cardify td.num { font-variant-numeric: tabular-nums; }
  .card.flush > .table-wrap { padding: 8px; }
  /* окна — листом снизу */
  .modal-back { place-items: end stretch; padding: 0; align-items: end; }
  .modal { max-width: none !important; width: 100%; max-height: 92dvh; overflow-y: auto; border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}
@media (max-width: 700px) { .table-wrap:has(.grid-sched) { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-md); } }
@media (max-width: 700px) { .card.flush:has(table.cardify) { background: none; border: 0; } .card.flush > .table-wrap { padding: 0; } }
@media (max-width: 360px) {
  .topbar { gap: 6px; }
  .topbar > .btn { padding: 8px !important; }
  .topbar .who { gap: 8px; }
  .topbar .ava.lg, .topbar .avatar { width: 34px; height: 34px; }
  .bottom-nav button { font-size: 10px; padding-left: 0; padding-right: 0; }
}
@media (max-width: 340px) { .topbar .who .ava { display: none; } }

/* кнопки действий по номеру и отправителей: не ломать подписи на узком экране */
.job-actions .btn { padding: 13px 4px; gap: 5px; font-size: 14px; }
.job-actions .btn.ext { padding: 13px 10px; }
.sender .btn, .sender select { white-space: nowrap; }
.sd-act { flex-wrap: nowrap; }

/* «в работе» по сервисам */
.ready-card.multi { align-items: flex-start; }
.ready-cats { display: grid; gap: 8px; margin-top: 12px; }
.ready-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--r-md, 12px); background: var(--surface-2); }
.ready-row .rr-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.ready-row .pc-st { margin: 0; }

.op-tag { display:inline-block; font-size:12px; font-weight:600; padding:2px 8px; border-radius:999px; color:var(--accent); background:var(--accent-soft); margin-left:6px; vertical-align:middle; }
.op-tag.none { color:var(--muted,#999); background:transparent; font-weight:400; margin-left:0; }
.job-info { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:2px 0 10px; }
.job-info .op-tag { margin-left:0; }

.codes-list { display:flex; flex-direction:column; gap:6px; margin-bottom:10px; }
.codes-list .job-code { margin:0; }
