/* Кабинет Zhoop. Идея: спокойный рабочий инструмент. Один акцент (глубокий бирюзовый), нейтрали с лёгким оттенком того же цвета,
   рамки только там, где нужно отделить объект. Шрифт Onest лежит на нашем сервере: у Google ничего не запрашивается. */
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/onest-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/onest-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f3f5f5; --panel: #ffffff; --sunken: #e8eded; --line: #dbe2e2; --text: #0e1a1a; --muted: #566464;
  --accent: #0b7a75; --accent-hover: #096460; --accent-soft: #dcf0ee; --accent-ink: #ffffff;
  --ok: #2b7a30; --ok-soft: #e1f2e0; --warn: #8a5000; --warn-soft: #fcefd2; --bad: #b3261e; --bad-soft: #fbe4e2; --bad-ink: #ffffff;
  --bubble-in: #ffffff; --bubble-bot: #dcf0ee; --bubble-bot-ink: #0e1a1a; --bubble-me: #0b7a75; --bubble-me-ink: #ffffff;
  --av-s: 42%; --av-l: 86%; --av-t: 26%;
  --shadow: 0 1px 2px rgba(14, 26, 26, .06); --lift: 0 10px 32px rgba(14, 26, 26, .22);
  --focus: 0 0 0 3px rgba(11, 122, 117, .28);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1111; --panel: #111a1a; --sunken: #182322; --line: #243131; --text: #e6efee; --muted: #8fa09e;
    --accent: #3dbdb2; --accent-hover: #66d4ca; --accent-soft: #123633; --accent-ink: #031d1b;
    --ok: #74c778; --ok-soft: #173019; --warn: #f0b64f; --warn-soft: #33270d; --bad: #ff8f86; --bad-soft: #3a1815; --bad-ink: #3a0d0a;
    --bubble-in: #172120; --bubble-bot: #143a36; --bubble-bot-ink: #e6efee; --bubble-me: #3dbdb2; --bubble-me-ink: #031d1b;
    --av-s: 30%; --av-l: 24%; --av-t: 82%;
    --shadow: none; --lift: 0 10px 32px rgba(0, 0, 0, .5);
    --focus: 0 0 0 3px rgba(61, 189, 178, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1 { font-size: 24px; line-height: 1.2; font-weight: 650; letter-spacing: -.012em; margin: 0; text-wrap: balance; }
h2 { font-size: 15px; font-weight: 600; margin: 0; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; }
.ic { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tnum { font-variant-numeric: tabular-nums; }

/* Каркас: слева навигация, справа страница. На телефоне навигация уходит вниз. */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.side { display: flex; flex-direction: column; gap: 2px; padding: 20px 12px 14px; background: var(--panel); border-right: 1px solid var(--line); position: relative; z-index: 20; }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 10px 16px; font-weight: 650; font-size: 18px; letter-spacing: -.01em; }
.mark { width: 24px; height: 24px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.nav a .ic { color: var(--muted); }
@media (hover: hover) { .nav a:hover { background: var(--sunken); } }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); } .nav a[aria-current="page"] .ic { color: var(--accent); }
.badge { margin-left: auto; min-width: 20px; padding: 0 6px; height: 20px; display: inline-grid; place-items: center; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; }
.side .foot { margin-top: auto; padding: 12px 10px 0; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); font-size: 13px; }
.side .foot button { align-self: flex-start; }
.tabbar { display: none; }
.main { overflow-y: auto; min-width: 0; } .main.flush { overflow: hidden; }
.page { max-width: 720px; margin: 0 auto; padding: 32px 28px 64px; } .page.wide { max-width: 960px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 22px; }
.head p { margin-top: 4px; }
* + .block { margin-top: 32px; } .head + .block { margin-top: 0; } .block > h2 { margin-bottom: 12px; }
#app { height: 100%; }

/* Кнопки и поля */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--text); }
@media (hover: hover) { .btn:hover { background: var(--sunken); } } .btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }@media (hover: hover) { .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); } }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }@media (hover: hover) { .btn.quiet:hover { background: var(--sunken); color: var(--text); } }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }@media (hover: hover) { .btn.danger:hover { background: var(--bad-soft); } }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: var(--bad-ink); }@media (hover: hover) { .btn.danger.solid:hover { filter: brightness(1.08); } }
.btn.sm { height: 32px; padding: 0 11px; font-size: 14px; } .btn.icon { width: 38px; padding: 0; } .btn.round { width: 40px; height: 40px; border-radius: 50%; padding: 0; flex: none; }
.btn.block { width: 100%; }
label, .label { display: block; font-size: 13px; font-weight: 500; margin: 0 0 6px; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
::placeholder { color: var(--muted); opacity: .75; }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
input[type="time"] { width: auto; }
.field { margin-bottom: 16px; } .field:last-child { margin-bottom: 0; } .hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; } .cols2:last-child { margin-bottom: 0; }
.check { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 400; margin: 0; cursor: pointer; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 14px; font-weight: 500; margin: 0; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch .track { position: relative; width: 38px; height: 22px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 45%, var(--line)); transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); } .switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

.seg { display: flex; gap: 2px; padding: 3px; background: var(--sunken); border-radius: 10px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; font-weight: 500; color: var(--muted); cursor: pointer; }
@media (hover: hover) { .seg button:hover { color: var(--text); } }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--text); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 1px solid var(--line); background: transparent; border-radius: 99px; padding: 4px 12px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
@media (hover: hover) { .pill:hover { color: var(--text); background: var(--sunken); } }
.pill[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 500; background: var(--sunken); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); } .chip.bad { background: var(--bad-soft); color: var(--bad); } .chip.brand { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; } .dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); }
.notice { padding: 10px 14px; border-radius: 10px; font-size: 14px; background: var(--warn-soft); color: var(--warn); }
.notice.ok { background: var(--ok-soft); color: var(--ok); } .notice.bad { background: var(--bad-soft); color: var(--bad); }
.stack > * + * { margin-top: 12px; }

/* Панели, списки, раскрывающиеся блоки */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.rows > * + * { border-top: 1px solid var(--line); }
.item { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.item.top { align-items: flex-start; }
.item .name { font-weight: 600; } .item a.name { color: var(--text); text-decoration: none; }@media (hover: hover) { .item a.name:hover { color: var(--accent); } }
.item.click { cursor: pointer; }@media (hover: hover) { .item.click:hover { background: var(--sunken); } }
.facts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); margin-top: 4px; }
details.fold { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
details.fold + details.fold { margin-top: 10px; }
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-weight: 550; cursor: pointer; border-radius: 12px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .sub { margin-left: auto; font-weight: 400; font-size: 13px; color: var(--muted); }
details.fold > summary::after { content: ""; width: 7px; height: 7px; margin: 0 4px 3px 2px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; flex: none; }
details.fold > summary:not(:has(.sub))::after { margin-left: auto; }
details.fold[open] > summary::after { transform: rotate(-135deg); margin-bottom: -2px; }
details.fold > .body { padding: 2px 16px 18px; }
.tabs { display: flex; gap: 4px; margin: 0 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 9px 14px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
@media (hover: hover) { .tabs a:hover { color: var(--text); } } .tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.empty { padding: 44px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.empty b { font-size: 16px; font-weight: 600; } .empty p { color: var(--muted); max-width: 38ch; } .empty .btn { margin-top: 12px; }
.bar { height: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.savebar { position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; padding: 10px 10px 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--lift); font-size: 14px; }
.savebar .btn { background: var(--bg); color: var(--text); border-color: transparent; } .savebar .btn.quiet { background: transparent; color: inherit; opacity: .8; }
.status { width: auto; padding: 5px 8px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }
.status.new { background: var(--accent-soft); color: var(--accent); border-color: transparent; } .status.in_progress { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.status.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; } .status.lost { color: var(--muted); }

/* Аватары */
.av { --h: 180; position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; background: hsl(var(--h) var(--av-s) var(--av-l)); color: hsl(var(--h) 45% var(--av-t)); }
.av.sm { width: 32px; height: 32px; font-size: 14px; }
.av .ch { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }

/* Диалоги */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: 100%; }
.convs { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.convs .top { padding: 20px 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.convs .top h1 { font-size: 20px; }
.search { position: relative; } .search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; } .search input { padding-left: 34px; }
.setup { margin: 0 16px 12px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.setup .step { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; }
@media (hover: hover) { .setup .step:hover span:last-child { text-decoration: underline; } }
.setup .tick { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--accent); display: grid; place-items: center; flex: none; color: var(--accent-ink); }
.setup .step.done { color: var(--muted); } .setup .step.done .tick { background: var(--accent); }
.list { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
@media (hover: hover) { .conv:hover { background: var(--sunken); } } .conv[aria-current="true"] { background: var(--accent-soft); }
.conv .name { font-weight: 600; } .conv .when { font-size: 12.5px; color: var(--muted); }
.conv .prev { color: var(--muted); font-size: 14px; }
.conv.unread .prev { color: var(--text); font-weight: 500; }
.thread { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.thread-head .name { font-weight: 600; }
.thread .strip { padding: 10px 20px 0; display: flex; flex-direction: column; gap: 8px; }
.msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.msg { max-width: min(540px, 82%); padding: 8px 13px 6px; border-radius: 16px 16px 16px 4px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bubble-in); border: 1px solid var(--line); align-self: flex-start; }
.msg.bot, .msg.human { align-self: flex-end; border-radius: 16px 16px 4px 16px; border-color: transparent; }
.msg.bot { background: var(--bubble-bot); color: var(--bubble-bot-ink); } .msg.human { background: var(--bubble-me); color: var(--bubble-me-ink); }
.msg.system { align-self: center; background: transparent; border: 0; color: var(--muted); font-size: 13px; padding: 4px; }
.msg .meta { display: block; margin-top: 2px; font-size: 12px; opacity: .7; text-align: right; } .msg.failed { outline: 1.5px solid var(--bad); }
.msg .chip { margin: 0 4px 2px 0; }
.composer { padding: 12px 20px 16px; background: var(--panel); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.composer .line { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { min-height: 40px; height: 40px; max-height: 140px; resize: none; border-radius: 20px; padding: 9px 15px; }
.placeholder { height: 100%; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; color: var(--muted); }

/* Каналы */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 20px; }
.tile .logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; margin-bottom: 8px; }
.tile.instagram .logo { background: #c1306f; } .tile.whatsapp .logo { background: #1d9f55; }
.tile p { flex: 1; } .tile .btn { margin-top: 12px; }
.link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; text-align: left; }
@media (hover: hover) { .link:hover { color: var(--text); } }

/* Окна и подсказки */
dialog.modal { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: var(--lift); }
dialog.modal::backdrop { background: rgba(5, 12, 12, .5); }
.checklist { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.checklist li { position: relative; padding-left: 22px; font-size: 14px; line-height: 1.45; }
.checklist li::before { content: ""; position: absolute; left: 4px; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
dialog.modal details.fold { margin-top: 16px; } dialog.modal h2 { font-size: 18px; margin-bottom: 8px; } dialog.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; } dialog.modal .actions .spacer { margin-right: auto; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; max-width: min(420px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 14px; box-shadow: var(--lift); }
.toast.bad { background: var(--bad); color: var(--bad-ink); }

/* Вход */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 6px; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.auth-card .brand { padding: 0 0 20px; } .auth-card h1 { margin-bottom: 2px; } .auth-card form { margin-top: 18px; } .auth-card .foot { margin-top: 18px; font-size: 14px; }

/* Таблица администратора */
.tablewrap { overflow-x: auto; } table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; } tr:last-child td { border-bottom: 0; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
pre { margin: 6px 0 10px; padding: 10px; background: var(--sunken); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.5px; }

.day { display: grid; grid-template-columns: 62px 1fr auto 1fr; gap: 8px; align-items: center; margin-bottom: 6px; } .day-label { justify-content: space-between; font-weight: 500; } .day input[type="time"] { width: 100%; }
.chat { display: flex; flex-direction: column; gap: 4px; min-height: 280px; max-height: 52vh; overflow-y: auto; padding: 16px; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }


/* Переключатель бизнесов: как смена аккаунта в Instagram */
.biz { position: relative; margin: 0 0 14px; }
.biz-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; text-align: left; }
@media (hover: hover) { .biz-btn:hover { background: var(--sunken); } }
.biz-btn .chev { width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: 0 4px 3px 0; flex: none; }
.biz-btn[aria-expanded="true"] .chev { transform: rotate(-135deg); margin-bottom: -3px; }
.menu { position: absolute; z-index: 40; left: 0; top: calc(100% + 6px); width: max(100%, 270px); padding: 6px; display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--lift); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; }
@media (hover: hover) { .menu-item:hover { background: var(--sunken); } } .menu-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.menu-item.add { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; color: var(--muted); }
@media (hover: hover) { .menu-item.add:hover { color: var(--text); } }
.menu-item .plus { width: 32px; height: 32px; flex: none; border-radius: 50%; border: 1px dashed var(--muted); display: grid; place-items: center; }
.bizbar { display: none; }
.notice.info { background: var(--accent-soft); color: var(--accent); }

/* Мастер настройки нового бизнеса */
.wizard { max-width: 900px; min-height: 100%; margin: 0 auto; padding: 22px 20px 0; }
.wiz-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 26px; }
.wiz-head .brand { flex: none; } .wiz-head .btn { min-width: 0; max-width: 60%; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 30px; }
.steps { display: flex; align-items: center; gap: 6px; margin-bottom: 18px; }
.steps i { width: 32px; height: 4px; border-radius: 99px; background: var(--line); } .steps i.on { background: var(--accent); } .steps span { margin-left: 6px; }
.wiz-group h2 { margin: 26px 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.typegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.typecard { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); cursor: pointer; }
@media (hover: hover) { .typecard:hover { border-color: var(--muted); } }
.typecard[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.wiz-body { padding-bottom: 8px; }
.wiz-actions { position: sticky; bottom: 0; display: flex; gap: 10px; justify-content: flex-end; margin-top: 28px; padding: 14px 0 max(16px, env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 70%, transparent); }

.lead { flex: 1 1 240px; }
/* Каталог */
.cat-head { padding-block: 10px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--sunken); border-radius: 12px 12px 0 0; }
.c-price { width: 120px; flex: none; text-align: right; } .c-stock { width: 96px; flex: none; text-align: right; } .c-on { width: 84px; flex: none; display: flex; justify-content: center; white-space: nowrap; }
.stock-in { width: 80px; padding: 6px 8px; text-align: right; } .stock-in.zero { color: var(--bad); border-color: var(--bad); }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .bizbar { display: block; grid-row: 1; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 20; } .bizbar .biz { margin: 0; } .bizbar .menu { width: 100%; }
  .main { grid-row: 2; } .tabbar { grid-row: 3; }
  .shell:has(.inbox.open) .bizbar { display: none; }
  .c-stock { display: flex; align-items: center; gap: 8px; } .c-stock::before { content: attr(data-label) ":"; font-size: 13px; color: var(--muted); }
  .item.cat { flex-wrap: wrap; } .item.cat .grow { flex: 1 1 100%; } .cat-head { display: none; } .c-price { width: auto; text-align: left; } .c-stock { width: auto; } .c-on { width: auto; }
  .wizard { padding: 16px 16px 0; } .typegrid { grid-template-columns: 1fr; }
  .side { display: none; }
  .tabbar { display: flex; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .tabbar a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; font-size: 11.5px; font-weight: 500; color: var(--muted); text-decoration: none; position: relative; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar .badge { position: absolute; top: 3px; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; font-size: 11px; }
  .shell:has(.inbox.open) .tabbar { display: none; }
  .page { padding: 20px 16px 40px; }
  h1 { font-size: 22px; }
  .cols2 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: minmax(0, 1fr); } .inbox.open .convs { display: none; } .inbox:not(.open) .thread { display: none; }
  .thread-head { padding: 10px 12px; flex-wrap: wrap; row-gap: 8px; } .thread-head .av { display: none; } .thread-head .switch { order: 5; flex-basis: 100%; }
  .auth-card { padding: 22px; } .msgs { padding: 14px 12px; } .composer { padding: 10px 12px 12px; } .thread .strip { padding: 10px 12px 0; }
  .toast { bottom: 76px; }
  .savebar { bottom: 12px; }
}
@media (min-width: 821px) { .back, .only-mobile { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Сенсорные экраны: без «залипшего» наведения, быстрый отклик, свой цвет при нажатии */
html { -webkit-text-size-adjust: 100%; }
* { -webkit-tap-highlight-color: transparent; }
a, button, summary, select, label, input, textarea { touch-action: manipulation; }
.main, .msgs, .list { overscroll-behavior-y: contain; }
.btn:active { background: var(--sunken); } .btn.primary:active { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger:active { background: var(--bad-soft); } .btn.danger.solid:active { background: var(--bad); filter: brightness(1.08); }
.item.click:active, .conv:active, .menu-item:active, .nav a:active, .biz-btn:active, .typecard:active, .tabbar a:active { background: var(--sunken); }
.row-actions { display: flex; align-items: center; gap: 4px; flex: none; }
@keyframes sheet-up { from { transform: translateY(28px); opacity: 0; } }

/* Телефон: цели нажатия не меньше 44 px, поля 16 px (иначе iPhone приближает страницу), окна выезжают снизу, под большим пальцем */
@media (max-width: 820px) {
  input, select, textarea { font-size: 16px; padding: 11px 12px; }
  .composer textarea { min-height: 44px; height: 44px; padding: 10px 16px; }
  .btn { height: 44px; } .btn.sm { height: 40px; padding: 0 13px; } .btn.icon { width: 44px; } .btn.round { width: 44px; height: 44px; }
  .seg button { padding: 11px 6px; }
  .pill { padding: 9px 15px; font-size: 14px; }
  .check { min-height: 40px; gap: 12px; } input[type="checkbox"] { width: 22px; height: 22px; }
  .switch { min-height: 44px; } .switch .track { width: 46px; height: 28px; } .switch .track::after { width: 22px; height: 22px; } .switch input:checked + .track::after { transform: translateX(18px); }
  .tabs { gap: 0; margin-bottom: 18px; } .tabs a { flex: 1 1 auto; text-align: center; padding: 12px 8px; font-size: 14px; }
  .tabbar a { font-size: 12px; min-height: 56px; justify-content: center; }
  .conv { padding: 14px 16px; }
  .thread-head .back { margin-left: -8px; }
  .menu-item { padding: 11px 10px; } .biz-btn { padding: 9px 12px; }
  .item.biz-row { flex-wrap: wrap; row-gap: 4px; } .biz-row .row-actions { flex: 1 1 100%; padding-left: 44px; }
  .item.cat { gap: 6px 16px; }
  .c-price { display: inline-flex; align-items: center; gap: 5px; } .c-price::before { content: attr(data-label) ":"; font-size: 13px; color: var(--muted); }
  .c-on { margin-left: auto; align-items: center; } .c-on::before { content: "Бот видит"; font-size: 13px; color: var(--muted); margin-right: 10px; }
  .stock-in { width: 84px; }
  dialog.modal { width: 100%; max-width: none; max-height: 90dvh; margin: auto 0 0; padding: 20px 18px max(18px, env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 18px 18px 0 0; animation: sheet-up .2s ease-out; }
  dialog.modal .actions { flex-wrap: wrap; } dialog.modal .actions .btn { flex: 1 1 calc(50% - 4px); } dialog.modal .actions .spacer { margin-right: 0; flex-basis: 100%; order: 3; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .head { margin-bottom: 14px; }
  .biz-row .row-actions { padding-left: 31px; }
  .wiz-actions .btn { flex: 1; }
  .tile { display: grid; grid-template-columns: 44px 1fr; align-items: center; column-gap: 12px; row-gap: 8px; padding: 16px; }
  .tile .logo { grid-row: 1; grid-column: 1; margin: 0; } .tile > b { grid-row: 1; grid-column: 2; font-size: 17px; }
  .tile > p, .tile > .btn { grid-column: 1 / -1; } .tile > .btn { margin-top: 4px; width: 100%; }
}
