:root {
  color-scheme: dark;
  --bg: #31363d;
  --card: #3a4048;
  --card2: #454c55;
  --line: #555d68;
  --text: #eef1f4;
  --muted: #aab4bf;
  --accent: #f7c61c;
  --accent-dim: #8a6d10;
  --ok: #4cc45f;
  --err: #ff6b60;
  --warn-bg: #4a3a10;
  --warn-bg2: #3a4048;
  --err-bg: #4a1f1c;
  --err-bg2: #3a4048;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f5;
  --card: #ffffff;
  --card2: #f2f4f7;
  --line: #dde1e7;
  --text: #1c2126;
  --muted: #66707c;
  --accent: #e8ac0e;
  --accent-dim: #c98f06;
  --ok: #1f9d4c;
  --err: #d1453b;
  --warn-bg: #fdf1cf;
  --warn-bg2: #ffffff;
  --err-bg: #fbe2e0;
  --err-bg2: #ffffff;
}
* { box-sizing: border-box; }
html { scrollbar-width: none; } /* Firefox */
html::-webkit-scrollbar { display: none; } /* Chrome/Safari/Edge */
body {
  margin: 0; font-family: -apple-system, system-ui, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

/* Layout: modal-style screens (login, install, etc) */
.center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; }

/* Brand — единый SVG-логотип: рамка буквально продолжает штрихи буквы Ʌ
   (её ноги идут дальше вниз до нижнего края рамки), между ногами — та же
   пустота что и у самой буквы. Масштабируется через height, ширина по viewBox. */
.brand { display: inline-flex; }
.tablo-logo { height: 60px; width: auto; color: var(--accent); display: block; }

/* Inputs & buttons */
input, select, textarea, button {
  font-size: 16px; font-family: inherit; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--card2); color: var(--text); padding: 13px 14px; width: 100%;
}
button {
  background: var(--accent); color: #1a1200; border: none; font-weight: 700; cursor: pointer;
  min-height: 44px; transition-property: transform, opacity, background-color; transition-duration: .12s;
}
button:active { transform: scale(0.96); }
button.sec { background: var(--card2); color: var(--text); border: 1px solid var(--line); font-weight: 600; }
button.sec.active { background: var(--accent); color: #1a1200; border-color: var(--accent); }
button.danger { background: transparent; color: var(--err); border: 1px solid var(--err); }
button:disabled { opacity: .5; transform: none; }
label { font-size: 13px; color: var(--muted); display: block; margin: 12px 0 6px; }
.check { display: flex; align-items: center; gap: 6px; width: auto; font-size: 14px; color: var(--text); }
.check input { width: auto; min-height: auto; }

/* Cards — outer radius = inner (buttons/pills radius) + padding, kept concentric */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px;
  margin-bottom: 14px; box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 6px 20px rgba(0,0,0,.15); }
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.card.compact { padding: 12px 14px; margin-bottom: 8px; border-radius: var(--radius-md); box-shadow: none; }
.card.compact .ac-text { margin-top: 2px; font-size: 13px; }
.card.compact .ac-meta { margin-top: 4px; }

.store-list-head { display: flex; align-items: center; gap: 6px; padding: 0 40px 6px 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.store-list-head .store-col-pair { flex: 0 1 70px; max-width: 70px; }
.store-list-head .store-col-hub { flex: 0 1 64px; max-width: 64px; }
.store-list-head .store-col-title { flex: 1 1 130px; max-width: 220px; }
.store-list-head .store-col-toggle { flex: 0 0 auto; width: 118px; }
.store-row { position: relative; padding: 8px 40px 8px 10px; margin-bottom: 6px; }
.store-fields { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.store-input { width: auto; min-width: 0; flex: 1 1 130px; max-width: 220px; padding: 6px 8px; font-size: 13px; min-height: auto; }
.store-input.store-pair { flex: 0 1 70px; max-width: 70px; font-weight: 700; }
.store-input.store-hub { flex: 0 1 64px; max-width: 64px; color: var(--muted); }
.switch-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; flex: 0 0 auto; width: 118px; white-space: nowrap; }
.switch { position: relative; display: inline-block; width: 30px; height: 18px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background-color .15s; }
.switch-track::before { content: ''; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; background: var(--card); border-radius: 50%; transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::before { transform: translateX(12px); }

/* Пошаговые инструкции с иконками (установка PWA) */
.step-list { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step-list li {
  counter-increment: step; display: flex; align-items: center; gap: 10px;
  font-size: 14px; line-height: 1.5; padding: 8px 0; border-bottom: 1px solid var(--line);
}
.step-list li:last-child { border-bottom: none; }
.step-list li::before {
  content: counter(step); flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #1a1200; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.step-icon {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: var(--card2); color: var(--text); display: flex; align-items: center; justify-content: center;
}

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row.scroll { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
.row.scroll > * { flex: 0 0 auto; width: auto; white-space: nowrap; }
.row.wrap { flex-wrap: wrap; }
.row.wrap > * { flex: 1 1 130px; width: auto; min-width: 0; }

.status { font-size: 14px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--card2); border: 1px solid var(--line); }
.status.ok { color: var(--ok); } .status.err { color: var(--err); }

.pill { display: inline-block; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--card2);
  border: 1px solid var(--line); color: var(--muted); margin: 2px 4px 2px 0; font-variant-numeric: tabular-nums; }
.pill.role-owner { color: var(--accent); border-color: var(--accent-dim); }
.pill.role-admin { color: #7fd0ff; border-color: #2c5a70; }
.pill.role-supervisor { color: var(--ok); border-color: #235c2c; }
.pill.role-store_admin, .pill.role-office { color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.rate-hi { color: var(--ok); } .rate-mid { color: var(--accent); } .rate-lo { color: var(--err); }
.trend-up { color: var(--ok); font-weight: 700; }
.trend-down { color: var(--err); font-weight: 700; }
.trend-flat { color: var(--accent); font-weight: 700; }

.link { color: var(--accent); cursor: pointer; text-decoration: none; font-size: 14px; background: none; border: none;
  width: auto; padding: 6px; min-height: auto; font-weight: 600; }
.hint { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.link-subtle { color: var(--muted); cursor: pointer; font-size: 12px; opacity: .55; }
.link-subtle:hover { opacity: .9; }

.pills-wrap { display: flex; flex-wrap: wrap; gap: 5px; }

/* Карточка-аккордеон: заголовок/текст/метаданные, разворачивается по клику */
.accordion-card { position: relative; cursor: pointer; padding-right: 44px; }
.ac-text { color: var(--muted); font-size: 14px; margin-top: 4px; line-height: 1.4; }
.ac-clamped { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ac-meta { font-size: 12px; margin-top: 8px; }
.ac-full { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.ac-del { position: absolute; top: 14px; right: 14px; opacity: .55; padding: 8px; border-radius: var(--radius-sm);
  min-width: 32px; min-height: 32px; display: flex; align-items: center; justify-content: center;
  transition: opacity .12s, background-color .12s; }
.ac-del:hover { opacity: 1; background: var(--card2); }
.store-row .ac-del { top: 50%; transform: translateY(-50%); }
.accordion-card:has(.ac-drag) { padding-left: 34px; padding-right: 78px; }
.accordion-card:has(.ac-edit) { padding-right: 78px; }
.ac-drag { position: absolute; top: 14px; left: 6px; opacity: .4; cursor: grab; font-size: 16px; touch-action: none; padding: 8px; margin: -8px; }
.ac-drag:active { cursor: grabbing; }
.accordion-card.dragging { opacity: .5; }
.ac-edit { position: absolute; top: 14px; right: 50px; opacity: .55; padding: 8px; border-radius: var(--radius-sm);
  min-width: 32px; min-height: 32px; display: flex; align-items: center; justify-content: center;
  transition: opacity .12s, background-color .12s; }
.ac-edit:hover { opacity: 1; background: var(--card2); }
.span2 { grid-column: 1 / -1; }
.hist-del { position: absolute; top: 8px; right: 8px; cursor: pointer; font-size: 15px; opacity: .55; padding: 10px;
  border-radius: var(--radius-sm); line-height: 1; display: flex; align-items: center; justify-content: center;
  min-width: 40px; min-height: 40px; transition-property: opacity, background-color; transition-duration: .12s; }
.hist-del:hover { opacity: 1; background: var(--card2); }

/* ── Modals ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 30;
  display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto;
}
.modal-card { width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.4); margin: auto; position: relative; }
.modal-close-x {
  position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; min-height: 30px; padding: 0;
  display: flex; align-items: center; justify-content: center; background: none; border: none;
  color: var(--muted); border-radius: var(--radius-sm); z-index: 1;
}
.modal-close-x:hover { background: var(--card2); color: var(--text); }
.modal-close-x svg { width: 15px; height: 15px; }

/* Переключатель темы (тёмная/светлая) */
.theme-toggle {
  position: relative; width: 56px; height: 30px; min-height: 30px; flex: none; padding: 0 7px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card2); border: 1px solid var(--line); border-radius: 999px;
}
.theme-toggle-icon { width: 14px; height: 14px; color: var(--muted); position: relative; z-index: 1; }
.theme-toggle-knob {
  position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); transition: transform .2s cubic-bezier(0.2, 0, 0, 1);
}
.theme-toggle.light .theme-toggle-knob { transform: translateX(26px); }
.theme-toggle:disabled { opacity: .5; cursor: not-allowed; }
.profile-section { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.profile-section:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }

/* Табы внутри модалок (Профиль) */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; background: var(--card2); border-radius: var(--radius-md); padding: 4px; }
.tabs button { flex: 1; width: auto; background: none; border: none; color: var(--muted); font-weight: 600; font-size: 13px;
  padding: 9px 6px; border-radius: var(--radius-sm); min-height: 36px; }
.tabs button.active { background: var(--accent); color: #1a1200; }
.tabs.scroll { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
.tabs.scroll button { flex: 0 0 auto; padding: 9px 14px; white-space: nowrap; }
.picker-panel { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px; background: var(--card2); }
.picker-list { max-height: 180px; overflow-y: auto; font-size: 14px; }
.picker-list label { display: flex; align-items: center; gap: 8px; padding: 6px 2px; margin: 0; color: var(--text); min-height: 40px; }
.picker-list input[type="checkbox"] { width: auto; min-height: auto; }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 2px; }
.status-dot.ok { background: var(--ok); } .status-dot.err { background: var(--err); }

.log-box { background: #202429; color: #d3d8de; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px;
  font-size: 12px; line-height: 1.5; overflow-x: auto; white-space: pre-wrap; max-height: 340px; overflow-y: auto;
  font-family: "SF Mono", Menlo, Consolas, monospace; }

.article-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 12px; }
.article-gallery img, .article-gallery video { width: 100%; height: 90px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #000; }
.article-gallery .att-item { position: relative; }
.article-gallery .att-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border-radius: 50%;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 12px; cursor: pointer; }
.article-body a { color: var(--accent); word-break: break-word; }

/* ── Комментарии к инструкции ─────────────────────────────────────────────── */
.comment-item { border-top: 1px solid var(--line); padding: 10px 0; }
.comment-item:first-child { border-top: none; }
.comment-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 14px; }
.comment-body { margin-top: 4px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.comment-body textarea { width: 100%; }
.comment-actions { display: flex; gap: 4px; margin-top: 4px; }
.comment-actions .icon-btn-sm { background: none; border: none; color: var(--muted); }
.comment-actions .icon-btn-sm:hover { background: var(--card2); color: var(--text); }

/* ── Shell layout: sidebar (desktop) / drawer (mobile) ───────────────────────── */
/* sidebar — position:fixed (вне потока), поэтому .shell остаётся обычным блоком:
   mobile-topbar и main складываются друг под другом естественным block-flow */
.shell { min-height: 100vh; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 19; opacity: 0;
  pointer-events: none; transition: opacity .2s ease; }
.drawer-backdrop.show { opacity: 1; pointer-events: auto; }

.sidebar {
  width: 240px; flex: 0 0 240px; background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px;
  position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; z-index: 20;
  overflow-y: auto;
  transform: translateX(-100%); transition: transform .25s cubic-bezier(0.2, 0, 0, 1);
}
.sidebar.open { transform: translateX(0); }
.sidebar-brand { display: inline-flex; margin: 4px 0 18px; }
.sidebar-brand .tablo-logo { height: 38px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  background: none; border: none; color: var(--muted); text-align: left; font-weight: 600;
  padding: 12px 12px; border-radius: var(--radius-sm); min-height: 44px;
}
.nav-item:active { transform: scale(0.98); }
.nav-item.active { background: var(--card2); color: var(--accent); }
.nav-item:hover { background: var(--card2); }
.nav-icon { width: 18px; height: 18px; flex: none; opacity: .75; }
.nav-item.active .nav-icon { opacity: 1; }

.nav-parent { justify-content: space-between; width: 100%; }
.nav-label { display: flex; align-items: center; gap: 12px; }
.nav-chevron { transition: transform .15s; opacity: .7; }
.nav-group.open .nav-chevron { transform: rotate(90deg); }
.nav-children { display: none; flex-direction: column; gap: 4px; margin-top: 4px; }
.nav-group.open .nav-children { display: flex; }
.nav-child { padding-left: 28px; font-weight: 500; font-size: 14px; width: 100%; }

.sidebar-footer {
  position: sticky; bottom: 0; background: var(--card);
  border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; flex-shrink: 0;
}
.profile-trigger {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: none; border: none;
  padding: 10px 12px; border-radius: var(--radius-sm); width: 100%; text-align: left; min-height: 44px;
}
.profile-trigger:hover { background: var(--card2); }
.profile-name { font-weight: 700; font-size: 14px; color: var(--text); }
.profile-role { font-size: 12px; color: var(--muted); }
.profile-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; background: var(--card2);
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.35);
  display: flex; flex-direction: column; gap: 2px;
}
.profile-menu button {
  display: flex; align-items: center; gap: 12px;
  background: none; border: none; color: var(--text); text-align: left; font-weight: 500; padding: 10px 12px;
  border-radius: var(--radius-sm); min-height: 40px; width: 100%;
}
.profile-menu .nav-icon { opacity: .75; }
.profile-menu button:hover { background: var(--card); }

.mobile-topbar { display: none; }
.icon-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; display: flex; align-items: center;
  justify-content: center; font-size: 20px; background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.icon-btn-sm { width: 30px; height: 30px; min-height: 30px; font-size: 15px; flex: none; }

.main { flex: 1; min-width: 0; padding: 24px 28px 48px; margin-left: 240px; }
.main > section { width: 100%; }

/* Home page */
.alert-block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.alert-block-head h2 { margin: 0; }
.upd { font-size: 12px; font-variant-numeric: tabular-nums; }

.push-warn {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--warn-bg); border-color: var(--accent-dim);
}
.push-warn-text { flex: 1; font-size: 14px; line-height: 1.4; color: var(--text); }

.incident-banner-wrap { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.incident-banner {
  background: linear-gradient(135deg, var(--err-bg), var(--err-bg2)); border: 1px solid var(--err);
}
.incident-banner b { color: var(--err); font-size: 15px; }
.incident-banner-body { margin-top: 6px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; color: var(--text); }

.info-banner-wrap { margin-bottom: 16px; }
.info-banner-frame { position: relative; }
.info-banner-slides { position: relative; height: 108px; overflow: hidden; touch-action: pan-y; }
.info-banner-slide {
  background: linear-gradient(135deg, var(--warn-bg), var(--warn-bg2)); border: 1px solid var(--accent-dim); border-radius: var(--radius-lg);
  padding: 16px 44px 16px 18px; position: absolute; inset: 0; opacity: 0; pointer-events: none; cursor: pointer;
  transition: opacity .3s cubic-bezier(0.2, 0, 0, 1); overflow: hidden;
}
.info-banner-slide.active { opacity: 1; pointer-events: auto; position: relative; }
.info-banner-slide h3 { margin: 0 0 4px; font-size: 15px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-banner-slide p {
  margin: 0; font-size: 14px; color: var(--text); line-height: 1.45;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.info-banner-dots { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
/* Видимая точка маленькая, но кликабельная область вокруг неё — гораздо больше */
.info-banner-dot {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; padding: 0; min-height: auto; cursor: pointer;
}
.info-banner-dot::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background-color .12s, transform .12s; }
.info-banner-dot.active::after { background: var(--accent); transform: scale(1.3); }
.info-banner-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(0,0,0,.35); color: #fff;
  font-size: 20px; line-height: 1; display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.info-banner-frame:hover .info-banner-arrow { opacity: 1; pointer-events: auto; }
.info-banner-arrow:hover { background: rgba(0,0,0,.55); }
.info-banner-arrow-prev { left: 6px; }
.info-banner-arrow-next { right: 6px; }
@media (max-width: 859px) { .info-banner-arrow { display: none; } } /* на тачскринах есть свайп, стрелки лишние */

.alert-item { position: relative; background: var(--card2); border-radius: var(--radius-md); padding: 12px 40px 12px 14px;
  margin-bottom: 8px; cursor: pointer; transition: border-color .12s; border: 1px solid transparent; }
.alert-item:hover { border-color: var(--accent-dim); }
.alert-item .a-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.alert-item .a-body { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Статус магазинов на Главной: компактная одна строка на магазин */
.status-item.status-ok { border-left: 3px solid var(--ok); cursor: default; }
.status-item.status-problem { border-left: 3px solid var(--err); cursor: pointer; }
.status-item.status-ok .a-body { color: var(--ok); }
.status-item.status-problem .a-body { font-weight: 600; }
.status-item:hover { border-color: transparent; }
.status-item.status-ok:hover { border-left-color: var(--ok); }
.status-item.status-problem:hover { border-left-color: var(--err); }

/* Десктоп: сайдбар всегда открыт, drawer скрыт */
@media (min-width: 860px) {
  .sidebar { transform: translateX(0); position: fixed; }
  .mobile-topbar { display: none !important; }
  #hamburger { display: none; }
  .main > section { max-width: 900px; margin-inline: auto; }
  #tab-home { max-width: 1180px; }
  #hometab-status { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
  #hometab-status .card { margin-bottom: 0; }
  #historyList { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #historyList .card { margin: 0; }
}

/* Мобильный режим: sidebar превращается в drawer, показываем topbar+гамбургер */
@media (max-width: 859px) {
  .main { margin-left: 0; padding: 16px 14px 40px; }
  .mobile-topbar { display: flex; align-items: center; gap: 12px; padding: 10px 4px 18px 14px; position: sticky; top: 0; background: var(--bg); z-index: 10; }
  .brand-sm { display: inline-flex; }
  .brand-sm .tablo-logo { height: 32px; }
  body.drawer-open { overflow: hidden; height: 100%; }
}

/* Тосты (успех отправки, входящий пуш) */
.toast-stack { position: fixed; top: 16px; right: 16px; left: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; max-width: 380px; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); cursor: pointer; overflow: hidden; position: relative;
  animation: toast-in .18s ease-out; }
.toast b { display: block; margin-bottom: 2px; font-size: 14px; }
.toast .toast-body { font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.toast .toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); width: 100%; }
.toast.toast-ok .toast-bar { background: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 480px) { .toast-stack { left: auto; } }
