/* Swapix AI interface.
   The chrome is calibrated neutral gray, like a photo editor: color belongs to photographs.
   Mobile first; breakpoints at 620px, 960px and 1100px. */

/* ---------- Fonts (SIL OFL, self-hosted because the CSP allows only same-origin fonts) ---------- */
@font-face { font-family: Onest; src: url(fonts/onest-cyrillic.woff2?v=37268be) format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; src: url(fonts/onest-latin.woff2?v=37268be) format("woff2"); font-weight: 100 900; font-display: swap;
  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; }
@font-face { font-family: Unbounded; src: url(fonts/unbounded-cyrillic.woff2?v=37268be) format("woff2"); font-weight: 200 900; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Unbounded; src: url(fonts/unbounded-latin.woff2?v=37268be) format("woff2"); font-weight: 200 900; font-display: swap;
  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; }

@property --split { syntax: "<percentage>"; inherits: true; initial-value: 50%; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #1c1c1e;
  --bg-deep: #161618;
  --panel: #232326;
  --panel-2: #2b2b2f;
  --panel-3: #35353a;
  --line: #313136;
  --line-2: #414147;
  --text: #ededf0;
  --text-2: #b6b6bd;
  --muted: #8e8e96;
  --primary: #f1f1f3;
  --primary-hover: #ffffff;
  --primary-ink: #161618;
  --tg: #1a7bbe;
  --tg-hover: #1f88d0;
  --ok: #5ac48f;
  --warn: #e4ae4f;
  --danger: #f27a6f;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --shadow-pop: 0 28px 70px -24px rgb(0 0 0 / .7), 0 2px 10px rgb(0 0 0 / .35);
  --font-text: Onest, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: Unbounded, Onest, ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --mobile-nav-height: 66px;
  --gutter: 16px;
  /* Vertical rhythm of the cabinet: between page blocks, inside grids, inside cards (phones: --space-card-sm). */
  --space-section: 28px;
  --space-grid: 12px;
  --space-card: 20px;
  --space-card-sm: 16px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { min-width: 280px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
/* Words break only when one word cannot fit a line; URLs and codes may break anywhere. */
h1, h2, h3, p { margin-top: 0; overflow-wrap: break-word; }
h1 {
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: clamp(25px, 6.2vw, 34px);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.03em;
}
h2 { margin-bottom: 10px; font-size: 18px; font-weight: 650; line-height: 1.3; letter-spacing: -0.01em; }
h3 { margin-bottom: 6px; font-size: 16px; font-weight: 600; line-height: 1.35; }
p { margin-bottom: 14px; }
small { font-size: 13px; }
strong, b { font-weight: 650; }
code, .code { font-family: var(--font-mono); font-size: .92em; overflow-wrap: anywhere; }
::selection { background: rgb(255 255 255 / .22); }
:focus-visible { outline: 3px solid rgb(241 241 243 / .9); outline-offset: 3px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.eyebrow { margin-bottom: 6px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.success { color: var(--ok); }
.error { color: var(--danger); }
.field-hint { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.ui-icon { width: 20px; height: 20px; flex: none; }

/* ---------- Buttons ---------- */
button, .button {
  min-width: 48px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  overflow-wrap: break-word;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease);
}
button:hover, .button:hover { background: var(--primary-hover); }
button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.secondary { border-color: var(--line-2); background: var(--panel-2); color: var(--text); }
.secondary:hover { background: var(--panel-3); }
.ghost { background: transparent; color: var(--text-2); }
.ghost:hover { background: var(--panel-2); color: var(--text); }
.danger { background: rgb(242 122 111 / .1); color: var(--danger); }
.danger:hover { background: rgb(242 122 111 / .18); }
.small { min-height: 44px; padding: 0 14px; border-radius: var(--radius-sm); font-size: 14px; }
.wide { width: 100%; }
.telegram-primary { background: var(--tg); color: #fff; }
.telegram-primary:hover { background: var(--tg-hover); }
.telegram-primary .ui-icon { width: 19px; height: 19px; }

.language-switch {
  min-width: 0;
  min-height: 40px;
  gap: 6px;
  padding: 0 12px;
  border-color: var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow-wrap: normal;
  flex: none;
}
.language-switch span { color: var(--muted); font-weight: 500; }
.language-switch:hover { background: var(--panel-2); }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-mark svg { display: block; width: 100%; height: 100%; }
.brand-name { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; white-space: nowrap; }
.brand-name small { margin-left: 3px; color: var(--muted); font-family: var(--font-text); font-size: 13px; font-weight: 600; letter-spacing: 0; }

/* ---------- Forms ---------- */
label { display: block; margin: 16px 0 8px; color: var(--text-2); font-size: 14px; font-weight: 500; }
input,
textarea,
select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, textarea:focus, select:focus { border-color: #9a9aa2; box-shadow: 0 0 0 3px rgb(255 255 255 / .1); }
/* Fields show focus with their border and glow instead of the generic outline. */
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 3px solid rgb(241 241 243 / .9); outline-offset: 2px; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
input::placeholder, textarea::placeholder { color: #6e6e76; opacity: 1; }
input[readonly] { background: var(--panel); color: var(--text-2); }
textarea { min-height: 128px; resize: vertical; line-height: 1.5; }
select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23b6b6bd' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
}
/* Radio choices (the move and reserve dialogs) look like the checkboxes, not like text fields. */
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; flex: none; margin: 1px 0 0; padding: 0; accent-color: var(--primary); }
input[type="file"] { padding: 9px; cursor: pointer; }
input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; }

.form-grid, .check-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 14px; }
.form-grid.align-end { align-items: end; }
.form-field { min-width: 0; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-actions > * { flex: 1 1 auto; }
.form-error { margin: 12px 0 0; font-size: 14px; }
.form-error:empty { display: none; }
/* The field a refusal is about (aria-invalid, set by the page) is outlined until it is typed in again. */
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 8px 0 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}
.check-row:has(input:disabled) { opacity: .6; cursor: not-allowed; }
.check-row small { display: block; margin-top: 2px; color: var(--muted); font-weight: 400; }
.editor-section { margin-top: 24px; padding-top: 6px; border-top: 1px solid var(--line); }
.editor-section legend { float: left; width: 100%; margin: 14px 0 2px; color: var(--text); font-size: 16px; font-weight: 650; }
.editor-section legend + * { clear: both; }
.provider-group { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel); }
.provider-group summary {
  min-height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.provider-group summary::-webkit-details-marker { display: none; }
.provider-group summary .muted { font-size: 14px; font-weight: 500; }
.provider-group[open] summary { border-bottom: 1px solid var(--line); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.provider-body { padding: 6px 16px 18px; }
.package-editor { display: grid; gap: 12px; margin: 14px 0; }
.package-card { padding: 6px 16px 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel); }
.package-card legend { float: left; width: 100%; margin: 12px 0 0; font-weight: 650; }
.package-card legend + * { clear: both; }
.package-footer { display: flex; justify-content: flex-end; margin-top: 14px; }

/* ---------- Layout primitives ---------- */
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row > * { min-width: 0; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-grid); }
.grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.section { margin-top: var(--space-section); }
.section-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; margin-bottom: 14px; }
.section-title h2, .section-title h3 { margin: 0; }
.section-title .pill { margin-top: 6px; }
/* A period switch in a heading: labels stay on one line; on a narrow phone a whole button moves to the next line instead of breaking «7 дн.». */
.section-title .segmented { max-width: 100%; flex-wrap: wrap; }
.section-title .segmented button { flex: none; white-space: nowrap; }
#admin-finance { scroll-margin-top: 84px; }
.card { min-width: 0; padding: var(--space-card); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); }
.card > h2:first-child, .card > h3:first-child { margin-bottom: 8px; }
.card .form-actions { margin-top: 16px; }
.list { display: grid; }
.list-item { min-width: 0; padding: 14px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; padding-top: 6px; }
.list-item small { color: var(--muted); }
.list-item.row > span { line-height: 1.4; }
.divider { height: 1px; margin: 18px 0; background: var(--line); }
.note { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-deep); color: var(--text-2); font-size: 14px; }
.code-box {
  display: block;
  margin: 12px 0;
  padding: 13px 15px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.security-code { font-size: 22px; letter-spacing: .14em; text-align: center; }
.code-box:empty { display: none; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}
.pill.success { background: rgb(90 196 143 / .12); color: var(--ok); }
.pill.warn { background: rgb(228 174 79 / .12); color: var(--warn); }
.pill.muted { color: var(--muted); }
.dot, .status-dot { width: 8px; height: 8px; display: inline-block; flex: none; border-radius: 50%; background: var(--ok); }
.pill.muted .dot { background: var(--muted); }
.status-dot.paused { background: var(--warn); }

.table-wrap { margin-top: 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--bg-deep); color: var(--muted); font-weight: 500; text-align: left; white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
td:last-child { text-align: right; }
.card > .table-wrap { margin-bottom: 0; }
/* Raw event log: a long value wraps inside its cell (in full on hover); a word breaks only when it cannot fit a line
   of its own, so «Неизвестно» stays whole and the table scrolls sideways instead. A sum never splits from its $. */
.table-wrap.dense td { max-width: 300px; overflow: hidden; white-space: normal; overflow-wrap: break-word; }
.table-wrap td.traffic-money { white-space: nowrap; }
.traffic-online { margin-top: 14px; }
/* Sortable column headers and comparison bars. */
.sort-head { min-width: 0; min-height: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 500; white-space: nowrap; }
.sort-head:hover { background: none; color: var(--text); }
th[aria-sort="ascending"] .sort-head, th[aria-sort="descending"] .sort-head { color: var(--text); }
.meter { display: block; width: 100%; height: 6px; margin-top: 8px; border: 0; border-radius: 999px; background: var(--panel-3); -webkit-appearance: none; appearance: none; }
.meter::-webkit-meter-bar { height: 6px; border: 0; border-radius: 999px; background: var(--panel-3); }
.meter::-webkit-meter-optimum-value, .meter::-webkit-meter-suboptimum-value, .meter::-webkit-meter-even-less-good-value { border-radius: 999px; background: var(--text-2); }
.meter::-moz-meter-bar { border-radius: 999px; background: var(--text-2); }
.list-item .row + .meter { margin-bottom: 2px; }

/* ---------- App shell ---------- */
.shell { min-height: 100svh; }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: max(10px, env(safe-area-inset-top)) var(--gutter) 10px;
  border-bottom: 1px solid var(--line);
  background: rgb(22 22 24 / .88);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sidebar nav, .side-bottom { display: none; }
.workspace {
  width: 100%;
  min-width: 0;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px var(--gutter) calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 28px);
}
.mobile-nav {
  position: fixed;
  z-index: 30;
  inset: auto 0 0;
  display: grid;
  /* Four destinations, five for creators («Админка»): equal columns either way. */
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  padding: 6px 6px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgb(22 22 24 / .94);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.mobile-nav button {
  min-width: 0;
  min-height: 54px;
  flex-direction: column;
  gap: 4px;
  padding: 4px 2px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}
/* Only a real pointer hovers: on a phone the tab tapped last would otherwise stay lit after leaving it. */
@media (hover: hover) { .mobile-nav button:hover { background: transparent; color: var(--text); } }
.mobile-nav .ui-icon { width: 52px; height: 28px; padding: 3px 15px; border-radius: 999px; transition: background-color .2s var(--ease); }
.mobile-nav button.active { color: var(--text); }
.mobile-nav button.active .ui-icon { background: var(--panel-3); }
.site-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 20px; margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-footer a:hover { color: var(--text); }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
.site-footer > span:first-child { margin-right: auto; }
/* A phone: the name on its own line, the links in rows from the left (not a staircase at the right). */
@media (max-width: 619px) { .site-footer { justify-content: flex-start; gap: 0 18px; } .site-footer > span:first-child { flex-basis: 100%; margin: 0 0 4px; } }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 22px; }
.page-head > div:first-child { min-width: 0; }
.page-head h1 { margin: 0 0 6px; }
@media (max-width: 619px) { .page-head h1.is-long { font-size: clamp(20px, 6vw, 28px); line-height: 1.15; } }
.page-head p { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Dashboard ---------- */
.home-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.home-heading h1 { margin-bottom: 6px; }
.home-heading p { margin: 0; }
.profile-shortcut {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-color: var(--line-2);
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--text);
}
.profile-shortcut:hover { background: var(--panel-3); }
.home-balance {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 18px;
  margin-bottom: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
}
.home-balance small { display: block; margin-bottom: 2px; color: var(--muted); font-size: 14px; }
.home-balance strong, .compact-summary strong, .stat .value, .bot-footer strong, .chart-card figcaption strong {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.home-balance strong { display: block; font-size: clamp(28px, 7.6vw, 40px); line-height: 1.1; }
/* «На проверке: 20,00 $» under a balance: payout requests whose money is held until they are paid or returned. */
.home-balance .balance-held, .wd-balance .balance-held { margin: 6px 0 0; color: var(--warn); font-size: 13px; }
.balance-action { flex: none; }
.home-onboarding {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 14px 16px;
  margin-bottom: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
}
.home-onboarding h2 { margin-bottom: 4px; }
.home-onboarding p { margin: 0; color: var(--text-2); }
.home-onboarding > button { grid-column: 1 / -1; }
.onboarding-icon, .tile-icon, .avatar, .large-icon, .badge {
  display: grid;
  place-items: center;
  flex: none;
  background: var(--panel-3);
  color: var(--text);
}
.onboarding-icon { width: 44px; height: 44px; border-radius: 12px; }

.action-grid { display: grid; margin-bottom: 4px; }
.action-tile {
  min-height: 66px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-top-width: 0;
  border-radius: 0;
  background: var(--panel);
  color: var(--text);
  font-weight: 500;
  text-align: left;
}
.action-tile:hover { background: var(--panel-2); }
.action-tile > .ui-icon:last-child { width: 18px; height: 18px; color: var(--muted); }
.tile-icon { width: 40px; height: 40px; border-radius: 11px; }
.tile-copy { display: grid; gap: 1px; min-width: 0; }
.tile-copy strong { font-size: 16px; font-weight: 600; }
.tile-copy small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.tile-primary {
  margin-bottom: 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--primary);
  color: var(--primary-ink);
}
.tile-primary:hover { background: var(--primary-hover); }
.tile-primary .tile-icon { background: rgb(22 22 24 / .08); color: var(--primary-ink); }
.tile-primary .tile-copy small, .tile-primary > .ui-icon:last-child { color: #5d5d64; }
.tile-primary + .action-tile { border-top-width: 1px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.action-tile:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.home-bots { margin-top: 30px; }
.bot-grid { gap: 12px; }
.bot-card { display: grid; gap: 16px; padding: 18px; }
.bot-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bot-top > div:last-child { min-width: 0; }
.avatar { width: 44px; height: 44px; border-radius: 12px; font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.bot-name { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
a.bot-name { display: block; color: var(--text); text-decoration: none; }
a.bot-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.bot-footer .site-card-visitors { margin-top: 4px; }
.bot-meta { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.bot-footer { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.bot-footer small { display: block; color: var(--muted); font-size: 13px; }
.bot-footer strong { font-size: 20px; }

.compact-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); }
.compact-summary > div { min-width: 0; padding: 16px 18px; }
.compact-summary > div + div { border-left: 1px solid var(--line); }
.compact-summary small { display: block; color: var(--muted); font-size: 13px; }
.compact-summary strong { font-size: 22px; }

.stat { display: grid; align-content: start; gap: 4px; }
.stat .label { color: var(--muted); font-size: 14px; }
.stat .value { font-size: clamp(24px, 5.4vw, 30px); line-height: 1.15; overflow-wrap: break-word; }
.stat .foot { color: var(--muted); font-size: 13px; }
.stat .foot:empty { display: none; }
.accent-card { border-color: var(--line-2); background: var(--panel-2); box-shadow: inset 0 1px 0 rgb(255 255 255 / .05); }
/* Rows of figures stay compact on phones: two per row, an odd last one spans the row. */
.grid:has(> .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid:has(> .stat) > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (max-width: 619px) { .stat { padding: var(--space-card-sm); } }

.level { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.card > h2 + .level { border-top: 0; }
.badge { width: 38px; height: 38px; border-radius: 10px; font-weight: 650; font-variant-numeric: tabular-nums; }
.level h3 { margin: 0; font-size: 15px; }
.level strong { font-variant-numeric: tabular-nums; }
/* Earnings from before the levels were recorded: the line that makes the levels add up to «Заработано». */
.income-earlier { margin: 0; padding: 12px 0; border-top: 1px solid var(--line); color: var(--text-2); font-size: 14px; }

.empty { display: grid; justify-items: center; gap: 2px; padding: 40px 22px; text-align: center; }
.empty p { max-width: 440px; }
.large-icon { width: 56px; height: 56px; margin-bottom: 12px; border-radius: 16px; color: var(--text-2); font-size: 22px; }
.profile-card label:first-of-type { margin-top: 4px; }
.profile-card p { margin-bottom: 4px; }
.profile-card > button { margin-top: 16px; }
.profile-card > button + button, .profile-card > button + .button { margin-top: 10px; }
.profile-card h2 + p.muted { margin-bottom: 12px; }
.help-guide h3 { margin: 18px 0 4px; }
.help-guide h3:first-child { margin-top: 0; }
.help-guide p { color: var(--text-2); }
.help-guide .row { margin-top: 18px; }
.home-steps { margin-top: 12px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); }
.home-steps h2 { margin-bottom: 14px; }
.home-steps ol { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.home-steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: start; gap: 12px; color: var(--text-2); counter-increment: step; }
.home-steps li::before {
  content: counter(step);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-3);
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

/* Admin and creator tools */
.admin-section-nav { display: flex; gap: 6px; margin: -2px 0 20px; padding: 2px; overflow-x: auto; scrollbar-width: none; }
.admin-section-nav::-webkit-scrollbar { display: none; }
.admin-section-nav button { flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; font-size: 14px; }
/* A phone: «Все разделы» opens every creator section — each group under its name, two sections to a row, all at once. */
.admin-menu { margin: -2px 0 20px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel); }
.admin-menu > summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px; cursor: pointer; list-style: none; font-weight: 650; }
.admin-menu > summary::-webkit-details-marker { display: none; }
.admin-menu > summary .ui-icon { flex: none; width: 20px; height: 20px; }
.admin-menu-title { flex: none; }
.admin-menu-current { min-width: 0; margin-left: auto; overflow: hidden; color: var(--muted); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.admin-menu > summary .nav-count { flex: none; }
.admin-menu > summary::after { content: ""; flex: none; width: 8px; height: 8px; margin: -4px 2px 0 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
.admin-menu[open] > summary::after { margin-top: 4px; transform: rotate(-135deg); }
.admin-menu .admin-section-nav.admin-sections { display: grid; gap: 16px; margin: 0; padding: 14px 16px 16px; overflow: visible; border-top: 1px solid var(--line); }
.admin-menu-group { display: grid; gap: 8px; }
.admin-menu-name { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.admin-menu-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.admin-menu .admin-menu-items button { justify-content: flex-start; min-height: 46px; padding: 8px 12px; border-radius: var(--radius-sm); line-height: 1.2; text-align: left; white-space: normal; }
.admin-menu .admin-menu-items button .nav-count { margin-left: auto; }
/* A computer: the creator sections live in the sidebar (grouped, under «Админка»); «Все разделы» is for phones. */
@media (min-width: 960px) {
  .admin-menu { display: none; }
  .admin-section-nav:not(.traffic-tabs):not(.admin-sections) { flex-wrap: wrap; overflow-x: visible; column-gap: 4px; }
  .admin-side { display: grid; gap: 0; margin: 2px 0 4px 22px; padding-left: 10px; border-left: 1px solid var(--line); }
  .admin-side-group { margin: 10px 0 2px 10px; color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
  .sidebar nav .admin-side-item { min-height: 31px; padding: 0 10px; border-radius: 8px; font-size: 13.5px; font-weight: 500; }
  .sidebar nav .admin-side-item.active { background: var(--panel-2); color: var(--text); font-weight: 650; }
  .admin-side-item .nav-count { margin-left: auto; }
}
/* The overview tile «Заявки на вывод» is a card that opens «Выплаты». */
.stat-link { justify-content: stretch; justify-items: start; align-items: start; min-height: 0; color: var(--text); font-weight: 400; text-align: left; }
.stat-link:hover { background: var(--panel-3); }
.stat-link .foot { display: inline-flex; align-items: center; gap: 4px; }
.stat-link .foot .ui-icon { width: 16px; height: 16px; }
/* A link-like button inside a line of text (e.g. «Меню и тексты → Эффекты» under a page title or a field). */
.text-link { min-width: 0; min-height: 0; display: inline; padding: 0; border: 0; border-radius: 0; background: none; color: var(--text); font-size: inherit; font-weight: 550; text-align: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.text-link:hover { background: none; text-decoration-color: currentColor; }
/* «Подписи вариантов» of the effect editor: one block per value, its API code above the RU/EN fields. */
.effect-labels-group { margin-top: 14px; }
.effect-labels-group h4 { margin: 0 0 4px; font-size: 15px; font-weight: 650; }
.effect-value-label { padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.effect-value-label:last-child { border-bottom: 0; }
.effect-value-code { margin: 0 0 2px; color: var(--muted); font-size: 13px; }
/* Section tabs inside one page: an underline bar, distinct from the pill navigation above it. */
.traffic-tabs { gap: 0; margin: 0 0 22px; padding: 0; border-bottom: 1px solid var(--line); }
.traffic-tabs button { min-height: 46px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--text-2); font-size: 15px; font-weight: 550; }
.traffic-tabs button:hover { background: transparent; color: var(--text); }
.traffic-tabs button.active { border-bottom-color: var(--text); background: transparent; color: var(--text); }
.segmented { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-deep); }
.segmented button { min-width: 0; min-height: 36px; padding: 0 12px; border-radius: 9px; font-size: 13px; }
.segmented .secondary { border-color: transparent; background: transparent; color: var(--text-2); }
.segmented .secondary:hover { background: var(--panel-2); color: var(--text); }
.chart-card { margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); }
.chart-card figcaption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 12px; color: var(--text-2); font-size: 14px; }
.chart-card figcaption strong { color: var(--text); font-size: 20px; }
.stats-chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.chart-area { fill: rgb(255 255 255 / .05); stroke: none; }
.chart-line { fill: none; stroke: #e7e7eb; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-dates { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; margin-top: 8px; color: var(--muted); font-size: 12px; }
/* «Ссылки и домены»: the line that sends to the websites' own domain pool («Сайты»). */
.links-sites-pool { margin-top: 12px; gap: 6px 12px; }
.links-sites-pool .field-hint { margin: 0; }
.effect-list, .article-list { display: grid; gap: 10px; }
.effect-row, .article-row { display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: 16px 18px; }
.effect-row h3, .article-row h3 { margin: 2px 0 4px; }
.effect-row p, .article-row p { margin-bottom: 4px; }
.article-cover-preview { width: 100%; max-height: 220px; margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); object-fit: cover; }
.menu-image-preview { display: block; width: 100%; max-width: 480px; height: auto; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-deep); object-fit: cover; }
.node-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 14px 0; }
.node-facts dt { color: var(--muted); }
.node-facts dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- Dialog, toast, loading ---------- */
dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: min(88svh, 920px);
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xl);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-pop);
}
dialog::backdrop { background: rgb(8 8 10 / .66); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog[open] { animation: sheet-in .22s var(--ease); }
dialog h2:focus { outline: none; }
dialog h2 { margin-bottom: 14px; font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
dialog p { color: var(--text-2); }
dialog .row.wrap { margin-top: 6px; }
#toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 14px);
  display: none;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--panel-3);
  color: var(--text);
  box-shadow: var(--shadow-pop);
  font-size: 14px;
  font-weight: 550;
  transform: translateX(-50%);
}
/* Inside an open dialog (see placeToast in app.js) the toast stays fixed to the viewport, at the top so
   it never covers the dialog buttons of a phone bottom sheet. */
#toast { pointer-events: none; }
#toast.in-dialog { top: max(14px, env(safe-area-inset-top)); bottom: auto; }
.loading { min-height: 100svh; display: grid; place-items: center; color: var(--muted); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Authentication ---------- */
.auth-page { width: min(1120px, 100%); min-height: 100svh; display: flex; flex-direction: column; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) var(--gutter) max(18px, env(safe-area-inset-bottom)); }
.auth-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.auth-layout { flex: 1; display: grid; align-content: center; gap: 28px; padding: 28px 0 40px; }
.auth-introduction h1 { margin-bottom: 12px; font-size: clamp(30px, 8vw, 54px); line-height: 1.06; white-space: pre-line; }
.auth-introduction > p { max-width: 30em; color: var(--text-2); font-size: 17px; }
.auth-features { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 18px; color: var(--text-2); }
.auth-features > div { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; }
.auth-features strong { font-weight: 550; }
.auth-features .ui-icon { color: var(--muted); }
.auth-card { padding: 22px 18px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--panel); box-shadow: var(--shadow-pop); }
.auth-card h2 { margin-bottom: 18px; font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.auth-note { margin: 10px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.auth-legal { margin-top: 18px; line-height: 1.5; }
.auth-legal a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.email-entry { margin: 0; }
.email-entry summary {
  position: relative;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 44px;
  text-align: center;
  line-height: 1.3;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 15px;
  font-weight: 550;
  list-style: none;
  cursor: pointer;
  transition: background-color .15s var(--ease);
}
.email-entry summary:hover { background: var(--panel-2); }
.email-entry summary::-webkit-details-marker { display: none; }
.email-entry summary::after { content: ""; position: absolute; top: 50%; right: 20px; width: 7px; height: 7px; margin-top: -6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); transition: transform .2s var(--ease); }
.email-entry[open] summary::after { margin-top: -2px; transform: rotate(-135deg); }
.email-body { padding-top: 16px; }
.email-body form > button[type="submit"] { width: 100%; margin-top: 20px; }
.email-body > .ghost { margin-top: 6px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-deep); }
.auth-tabs button { min-width: 0; min-height: 40px; padding: 0 8px; border-radius: 9px; font-size: 14px; }
.auth-tabs .ghost:hover { background: var(--panel-2); }
/* Sign-in page under the shared public header (web/site-header.js) */
.auth-shell .auth-page { min-height: calc(100svh - 64px); padding-top: 0; }
.auth-alert { margin: -6px 0 16px; padding: 12px 14px; border: 1px solid rgb(242 122 111 / .35); border-radius: var(--radius-md); background: rgb(242 122 111 / .08); color: var(--text); font-size: 14px; }
.auth-bot-login { margin-top: 8px; }
@media (max-width: 619px) {
  /* The sign-in card first: on a phone the introduction keeps only a smaller headline. */
  .auth-layout { align-content: start; gap: 18px; padding: 16px 0 28px; }
  .auth-introduction h1 { margin-bottom: 0; font-size: 30px; }
  .auth-introduction > p, .auth-features { display: none; }
  .auth-or { margin: 14px 0 10px; }
}

/* Owner traffic funnels (web/traffic.js) */
.funnel-card > .field-hint { margin: 0 0 8px; }

/* ---------- Telegram sign-in dialog (web/telegram-login.js) ---------- */
.login-lead { margin-bottom: 16px; }
/* Who the visitor confirms in: the bot's name, avatar initials, @username and why this bot. */
.login-bot { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-bot-avatar { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--tg); color: #fff; font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: .02em; }
.login-bot-name { display: grid; min-width: 0; line-height: 1.35; }
.login-bot-name strong { font-size: 16px; overflow-wrap: anywhere; }
.login-bot-name .muted { font-size: 13px; }
.login-bot-why { margin: 0 0 14px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
/* Password recovery says before anything is typed that it is confirmed in Telegram, not by email. */
.reset-lead { display: grid; gap: 6px; margin-bottom: 14px; }
.reset-lead p { margin: 0; }
.reset-lead p:first-child { padding: 12px 14px; border-radius: var(--radius-md); background: var(--bg-deep); color: var(--text); font-size: 14px; line-height: 1.5; }
.login-oidc-hint { margin: 8px 0 0; text-align: center; }
.login-options { display: grid; gap: 16px; align-items: center; }
.login-qr { display: none; margin: 0; }
.login-qr .qr-code { display: block; width: 176px; height: 176px; border-radius: 14px; background: #fff; color: #111; }
.login-qr figcaption { max-width: 176px; margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.4; text-align: center; }
.login-open { display: grid; gap: 10px; min-width: 0; }
.login-open .field-hint { margin: 0; }
.login-hint-wide { display: none; }
.login-manual { margin: 16px 0 0; border: 1px solid var(--line); border-radius: var(--radius-md); }
.login-manual summary { min-height: 48px; display: flex; align-items: center; padding: 0 14px; color: var(--text-2); font-size: 14px; font-weight: 550; cursor: pointer; }
.login-manual summary:hover { color: var(--text); }
.login-manual > :not(summary) { margin-inline: 14px; }
.login-manual > .row { margin-bottom: 14px; }
.login-status { display: flex; align-items: center; gap: 10px; margin: 18px 0 0; padding: 12px 14px; border-radius: var(--radius-md); background: var(--bg-deep); color: var(--text); font-size: 14px; line-height: 1.45; }
dialog .login-status { color: var(--text); }
.login-spinner { width: 16px; height: 16px; flex: none; border: 2px solid var(--line-2); border-top-color: var(--text); border-radius: 50%; animation: login-spin .9s linear infinite; }
.login-status.is-notice .login-spinner { border-top-color: var(--warn); }
.login-status.is-error { color: var(--danger); }
.login-status.is-error .login-spinner { border-color: var(--danger); animation: none; }
.login-status.is-done .login-spinner { border-color: var(--ok); border-top-color: var(--ok); }
@keyframes login-spin { to { transform: rotate(360deg); } }
@media (min-width: 620px) {
  .login-options { grid-template-columns: auto minmax(0, 1fr); gap: 22px; }
  .login-options.no-qr { grid-template-columns: minmax(0, 1fr); }
  .login-qr, .login-open .login-hint-wide { display: block; }
  .login-open .login-hint-phone { display: none; }
}

/* ---------- Public website ---------- */
.public-page { overflow-x: clip; }
/* The public header (.public-header, navigation, burger) lives in site-header.css, shared with the blog. */

.public-main, .public-footer-inner { width: min(1200px, 100%); margin: 0 auto; padding: 0 var(--gutter); }
.public-hero { display: grid; gap: 36px; padding: 34px 0 56px; }
.public-hero-copy { min-width: 0; }
.public-hero h1 { margin-bottom: 18px; font-size: clamp(34px, 8.8vw, 62px); line-height: 1.04; letter-spacing: -0.045em; text-wrap: balance; }
.public-lead { max-width: 33em; margin-bottom: 26px; color: var(--text-2); font-size: clamp(17px, 2.2vw, 19px); line-height: 1.55; }
.public-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.public-hero-actions .button { flex: 1 1 auto; min-height: 52px; padding: 0 22px; font-size: 16px; }
.public-hero-note { display: flex; align-items: center; gap: 8px; margin: 18px 0 0; color: var(--muted); font-size: 14px; }
.public-hero-note .ui-icon { width: 17px; height: 17px; }

/* Telegram chat demo with a before/after comparison */
.public-visual { position: relative; min-width: 0; }
.public-visual::before { content: ""; position: absolute; inset: -12% -8%; z-index: -1; background: radial-gradient(closest-side, rgb(255 255 255 / .07), transparent); pointer-events: none; }
.tg-demo {
  width: min(440px, 100%);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 26px;
  background: #18181b;
  box-shadow: var(--shadow-pop);
}
.tg-head { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.tg-avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: none; border-radius: 50%; background: var(--panel-3); }
.tg-avatar svg { width: 20px; height: 20px; }
.tg-head strong { display: block; font-size: 15px; line-height: 1.25; }
.tg-head small { color: var(--muted); }
.tg-body { display: grid; gap: 8px; padding: 16px 12px 14px; }
.tg-bubble { max-width: 88%; margin: 0; padding: 9px 13px; border-radius: 16px 16px 16px 6px; background: var(--panel-2); color: var(--text); font-size: 14.5px; line-height: 1.45; }
.tg-photo { overflow: hidden; border-radius: 16px 16px 16px 6px; background: var(--panel-2); }
.tg-caption { margin: 0; padding: 9px 13px 11px; font-size: 14.5px; line-height: 1.4; }
.tg-keyboard { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tg-keyboard span { min-height: 40px; display: grid; place-items: center; padding: 0 8px; border-radius: 10px; background: var(--panel-2); color: var(--text-2); font-size: 14px; font-weight: 550; text-align: center; }

.compare { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #0e1227; user-select: none; touch-action: pan-y; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.compare-before { filter: saturate(.25) contrast(.8) brightness(.78) blur(1.6px); clip-path: inset(0 calc(100% - var(--split)) 0 0); transform: scale(1.02); }
.compare-handle { position: absolute; top: 0; bottom: 0; left: var(--split); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .12), 0 0 18px rgb(0 0 0 / .45); pointer-events: none; }
.compare-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='10' fill='none' stroke='%23161618' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 1L1 5l4 4M13 1l4 4-4 4'/%3E%3C/svg%3E") center / 18px 10px no-repeat;
  box-shadow: 0 6px 18px rgb(0 0 0 / .4);
  transform: translate(-50%, -50%);
}
.compare-label { position: absolute; top: 10px; padding: 3px 9px; border-radius: 999px; background: rgb(10 10 12 / .55); color: #fff; font-size: 12px; font-weight: 600; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); pointer-events: none; }
.compare-label.before { left: 10px; }
.compare-label.after { right: 10px; }
.compare-range { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; opacity: 0; cursor: ew-resize; -webkit-appearance: none; appearance: none; }
.compare-range:focus-visible { opacity: 0; }
.compare:has(.compare-range:focus-visible) { outline: 3px solid rgb(241 241 243 / .9); outline-offset: -3px; }
.compare-range::-webkit-slider-thumb { width: 44px; height: 300px; -webkit-appearance: none; appearance: none; cursor: ew-resize; }
.compare-range::-moz-range-thumb { width: 44px; height: 300px; border: 0; cursor: ew-resize; }
.compare.is-intro { animation: compare-intro 1.7s var(--ease) .6s backwards; }
@keyframes compare-intro { from { --split: 90%; } to { --split: 50%; } }

.public-section { padding: 56px 0; border-top: 1px solid var(--line); scroll-margin-top: 72px; }
.public-section:focus { outline: none; }
.public-section-heading { max-width: 640px; margin-bottom: 30px; }
.public-section-heading h2, .public-final h2, .public-blog-section h2 {
  margin-bottom: 12px;
  font-family: var(--font-display);
  font-size: clamp(26px, 6vw, 40px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.035em;
}
.public-section-heading p { margin: 0; color: var(--text-2); font-size: 17px; }

.public-step-grid { display: grid; gap: 28px; margin: 0 0 32px; padding: 0; list-style: none; }
.public-step-grid li { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-content: start; column-gap: 16px; }
.public-step-grid li > :not(.public-step-number) { grid-column: 2; }
.public-step-number {
  grid-row: span 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}
.public-step-grid h3 { margin: 9px 0 6px; font-size: 18px; }
.public-step-grid p { margin: 0; color: var(--text-2); }

.public-feature-grid { display: grid; border-top: 1px solid var(--line); }
.public-feature { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 16px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.public-feature > :not(.feature-icon) { grid-column: 2; }
.feature-icon { grid-row: span 2; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--panel-2); color: var(--text); }
.public-feature h3 { margin: 10px 0 6px; font-size: 18px; }
.public-feature p { margin: 0; color: var(--text-2); }
.public-feature:last-child { border-bottom: 0; }

.public-rates { display: grid; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--panel); }
.public-rates > div { display: grid; gap: 4px; padding: 22px; }
.public-rates > div + div { border-top: 1px solid var(--line); }
.public-rates strong { font-family: var(--font-display); font-size: clamp(34px, 8vw, 52px); font-weight: 500; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.public-rates span { color: var(--text-2); }

.public-blog-section { display: grid; gap: 22px; align-items: end; }
.public-blog-section p { max-width: 36em; margin: 0; color: var(--text-2); font-size: 17px; }
.public-blog-section .button { justify-self: start; }

.public-contact-grid { display: grid; gap: 10px; }
.public-contact-card {
  min-height: 84px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
a.public-contact-card:hover { border-color: var(--line-2); background: var(--panel-2); }
.public-contact-card .feature-icon { grid-row: span 2; }
.public-contact-card h3 { grid-column: 2; margin: 0; font-size: 16px; }
.public-contact-card p { grid-column: 2; margin: 0; overflow: hidden; color: var(--muted); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.contact-badge { grid-column: 3; grid-row: 1 / span 2; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.contact-pending .contact-badge { padding: 3px 10px; border: 1px solid var(--line-2); border-radius: 999px; }
.public-contact-actions { margin-top: 18px; }

.public-final { margin: 8px 0 56px; padding: 40px 22px; border: 1px solid var(--line-2); border-radius: 28px; background: var(--panel); text-align: center; }
.public-final h2 { max-width: 16ch; margin-inline: auto; }
.public-final p { max-width: 34em; margin: 0 auto 24px; color: var(--text-2); font-size: 17px; }
.public-final .button { min-height: 52px; padding: 0 24px; font-size: 16px; }

.public-footer { border-top: 1px solid var(--line); background: var(--bg-deep); }
.public-footer-inner { display: grid; gap: 14px; padding-top: 30px; padding-bottom: max(30px, env(safe-area-inset-bottom)); }
.public-footer p { margin: 0; color: var(--muted); }
.public-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.public-footer nav a { color: var(--text-2); }
.public-footer nav a:hover { color: var(--text); }
.public-footer small { color: var(--muted); }

/* ---------- Tablet ---------- */
@media (min-width: 620px) {
  :root { --gutter: 28px; }
  .grid, .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-actions > * { flex: 0 0 auto; }
  .card { padding: 22px; }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .action-tile, .tile-primary + .action-tile, .action-tile:last-child { border-width: 1px; border-radius: var(--radius-lg); }
  /* Six tiles: two even columns, three rows (the create tile is one of them). */
  .tile-primary { margin-bottom: 0; }
  .effect-row, .article-row { flex-direction: row; align-items: center; justify-content: space-between; }
  .article-row > .row { flex: 0 0 180px; flex-direction: column; align-items: stretch; }
  .article-row > .row > * { width: 100%; }
  .auth-card { padding: 28px; }
  .public-step-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
  .public-step-grid li { grid-template-columns: minmax(0, 1fr); }
  .public-step-grid li > :not(.public-step-number) { grid-column: 1; }
  .public-step-number { grid-row: auto; margin-bottom: 16px; }
  .public-step-grid h3 { margin-top: 0; }
  .public-feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; }
  .public-feature:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
  .public-hero-actions .button { flex: 0 0 auto; }
  .public-rates { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .public-rates > div + div { border-top: 0; border-left: 1px solid var(--line); }
  .public-contact-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .public-contact-card { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto 1fr; row-gap: 4px; align-items: start; min-height: 172px; padding: 20px; }
  .public-contact-card .feature-icon { grid-row: auto; grid-column: 1; margin-bottom: 14px; }
  .public-contact-card h3, .public-contact-card p { grid-column: 1 / -1; }
  .contact-badge { grid-column: 2; grid-row: 1; align-self: start; }
  .public-final { padding: 64px 32px; }
  .public-footer-inner { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 28px; }
  .public-footer small { grid-column: 1 / -1; }
  dialog { padding: 28px; }
}

/* ---------- Phone sheet ---------- */
@media (max-width: 619px) {
  dialog {
    width: 100%;
    max-width: 100%;
    max-height: 92svh;
    margin: auto 0 0;
    padding: 22px var(--gutter) max(20px, env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 24px 24px 0 0;
  }
  dialog[open] { animation-name: sheet-up; }
  @keyframes sheet-up { from { transform: translateY(30px); opacity: .4; } }
}
@media (max-width: 540px) {
  .table-wrap { overflow: visible; border: 0; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr { display: block; }
  .table-wrap thead { display: none; }
  .table-wrap tr { margin-bottom: 10px; padding: 4px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-deep); }
  .table-wrap td { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); text-align: right; }
  .table-wrap td::before { content: attr(data-label); color: var(--muted); text-align: left; }
  .table-wrap td:last-child { border-bottom: 0; }
  .table-wrap td:empty { display: none; }
  /* A one-cell row («nobody yet»): the message centred, no empty label before it. */
  .table-wrap td[colspan] { justify-content: center; text-align: center; color: var(--muted); }
  .table-wrap td[colspan]::before { content: none; }
  .table-wrap.dense td { max-width: none; overflow: visible; white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 360px) {
  :root { --gutter: 14px; }
  .home-balance { padding: 18px 16px; }
  .compact-summary > div { padding: 14px; }
  .brand-name small { display: none; }
}

/* ---------- Desktop ---------- */
@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); background: linear-gradient(90deg, var(--bg-deep) 0 247px, var(--line) 247px 248px, var(--bg) 248px); }
  .sidebar {
    height: 100svh;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 26px 16px 20px;
    overflow: hidden;
    border: 0;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  /* Only the list scrolls (the admin sections are taller than a window): the brand, language and account stay put,
     and a Windows scrollbar no longer narrows the header into a sideways scroll. The bar shows on hover only. */
  .sidebar-header { flex: none; gap: 8px; padding: 0 0 0 8px; }
  .sidebar .language-switch { padding: 0 10px; }
  .sidebar nav { display: grid; gap: 2px; min-height: 0; margin: -6px -8px; padding: 6px 8px; overflow: hidden auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: transparent transparent; }
  .sidebar nav:hover, .sidebar nav:focus-within { scrollbar-color: var(--line-2) transparent; }
  .sidebar nav button { justify-content: flex-start; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 11px; background: transparent; color: var(--text-2); font-weight: 550; }
  .sidebar nav button:hover { background: var(--panel); color: var(--text); }
  .sidebar nav button.active { background: var(--panel-2); color: var(--text); }
  .side-link { min-height: 44px; display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 0 12px; border-top: 1px solid var(--line); border-radius: 0; color: var(--text-2); font-weight: 550; }
  .side-link:hover { color: var(--text); }
  .side-link .ui-icon { color: var(--muted); }
  .side-bottom { display: block; flex: none; margin-top: auto; padding: 16px 8px 0; border-top: 1px solid var(--line); }
  .side-bottom p { margin-bottom: 8px; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
  .side-bottom button { width: 100%; min-height: 40px; justify-content: flex-start; padding: 0 10px; }
  .mobile-nav { display: none; }
  .workspace { padding: 44px 48px 56px; }
  .profile-shortcut { display: none; }
  #toast { bottom: 28px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid:has(> .stat) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.two:has(> .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.four:has(> .stat) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid:has(> .stat) > .stat:last-child:nth-child(odd) { grid-column: auto; }
  .page-head { margin-bottom: 28px; }
  .auth-layout { grid-template-columns: minmax(0, 1.1fr) minmax(360px, 440px); gap: 64px; align-items: center; }
  .public-hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: center; gap: 56px; padding: 72px 0 96px; }
  .public-section { padding: 88px 0; }
  .public-section-heading { margin-bottom: 44px; }
  .public-blog-section { grid-template-columns: minmax(0, 1fr) auto; }
  .public-blog-section .button { justify-self: end; }
}
@media (min-width: 1100px) {
  .action-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .action-tile { position: relative; min-height: 132px; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; align-content: start; align-items: start; gap: 18px; padding: 18px; }
  .action-tile > .ui-icon:last-child { position: absolute; top: 20px; right: 18px; }
  .tile-copy strong { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Owner cabinet: permanent page facts (the page itself is styled by landing.css) ---------- */
.status-dot.idle { background: var(--muted); }
.page-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; color: var(--muted); font-size: 14px; }
/* The reserve became the main bot: one line until a new reserve is connected. */
.promo-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 16px; border-left: 3px solid var(--warn); }
.bot-previous { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
/* The owner's page designer (web/page-design.js) is styled by page-design.css. */

/* ---------- Bot menu constructor (web/menu-builder.js) and bot profile (web/bot-profile.js) ----------
   A Telegram-like preview in the graphite palette: chat bubble on the deep background, buttons as
   muted panels, links in Telegram blue. */
.mb-layout { display: grid; gap: 16px; }
.mb-editor { display: grid; gap: 16px; min-width: 0; }
.mb-editor .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mb-toolbar, .mb-chips { gap: 6px; margin-bottom: 10px; }
.mb-toolbar button { min-width: 40px; }
.mb-chips .chip { min-height: 32px; padding: 0 10px; border-radius: 999px; font-family: var(--font-mono); font-size: 12px; }
.mb-text { width: 100%; min-height: 200px; font-family: var(--font-mono); font-size: 14px; line-height: 1.5; resize: vertical; }
.mb-button-row { display: grid; gap: 10px; }
.mb-button-main { display: grid; gap: 4px; min-width: 0; }
.mb-button-main strong, .mb-button-main small { overflow-wrap: anywhere; }
.mb-button-tools { gap: 6px; }
.mb-off .mb-button-main { opacity: .55; }
.mb-notice { margin-top: 16px; border-color: var(--warn); }
.mb-dirty { color: var(--warn); font-weight: 500; }
.mb-preview { display: grid; gap: 10px; }
.tgp-chat { display: grid; gap: 6px; padding: 14px; border-radius: var(--radius-lg); background: var(--bg-deep); }
.tgp-bubble { padding: 10px 12px; border-radius: 14px 14px 14px 4px; background: var(--panel-2); color: var(--text); font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.tgp-bubble blockquote { margin: 4px 0; padding: 2px 0 2px 10px; border-left: 3px solid var(--tg); white-space: pre-wrap; }
.tgp-bubble code { padding: 0 4px; border-radius: 4px; background: var(--panel-3); font-family: var(--font-mono); font-size: 13px; }
.tgp-link { color: var(--tg-hover); text-decoration: none; }
.tgp-link:hover { text-decoration: underline; }
.tgp-keyboard { display: grid; gap: 6px; }
.tgp-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.tgp-button { min-width: 0; padding: 9px 8px; border-radius: 10px; background: var(--panel-3); color: var(--text); font-size: 13px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tgp-button.tgp-url::after { content: " ↗"; color: var(--muted); }
.bp-preview { display: grid; gap: 12px; }
.bp-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); }
.bp-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bp-head > div { display: grid; min-width: 0; }
.bp-head strong { overflow-wrap: anywhere; }
.bp-about { margin: 0; overflow-wrap: anywhere; }
.bp-description strong { display: block; margin-bottom: 4px; }
.bp-avatar { margin: 14px 0; display: grid; gap: 12px; }
.bp-avatar-row { display: flex; align-items: center; gap: 14px; min-width: 0; }
.bp-avatar-row h3 { margin: 0 0 4px; }
.bp-avatar-photo { width: 72px; height: 72px; flex: none; border-radius: 50%; object-fit: cover; }
.bp-avatar-empty { display: grid; place-items: center; background: var(--panel-2); color: var(--text-2); font-family: var(--font-display); font-size: 26px; font-weight: 600; }
.bp-photo { object-fit: cover; border-radius: 50%; }
@media (min-width: 960px) {
  .mb-layout { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .mb-preview-card { position: sticky; top: 16px; }
  .mb-button-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .bp-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Owner payouts and the creator payout desk (web/withdrawals.js) ---------- */
.wd-balance { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.wd-balance small { display: block; color: var(--muted); font-size: 13px; }
.wd-balance strong { display: block; margin-top: 4px; font-family: var(--font-display); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.wd-balance p { margin: 0; }
.wd-methods { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
/* A card is a <button>: without its own column the base button centring (justify-content: center) shrinks the
   grid to its content and leaves an empty area on the left. */
.wd-method { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; gap: 10px; justify-items: start; min-height: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); color: var(--text); font-weight: 400; text-align: left; }
.wd-method:hover { border-color: var(--line-2); background: var(--panel-2); }
.wd-method.is-low { opacity: .7; }
.wd-method-head { width: 100%; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.wd-method-head .pill { flex: none; }
.wd-method-head h3 { margin: 0; }
.wd-method-head strong { font-size: 16px; font-weight: 600; }
.wd-method-facts, .wd-facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.wd-method-facts span, .wd-facts span { padding: 3px 9px; border-radius: 999px; background: var(--panel-2); color: var(--text-2); font-size: 13px; line-height: 1.4; }
.wd-method:hover .wd-method-facts span { background: var(--panel-3); }
.wd-facts { margin-bottom: 6px; }
.wd-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.wd-preview { margin-top: 14px; }
.wd-summary { display: grid; gap: 0; margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-deep); }
.wd-summary > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 14px; border-top: 1px solid var(--line); }
.wd-summary > div:first-child { border-top: 0; }
.wd-summary dt { color: var(--text-2); font-size: 14px; }
.wd-summary dd { min-width: 0; margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.wd-summary .wd-total dd { font-size: 17px; font-weight: 600; }
.wd-summary small { color: var(--muted); }
.wd-warning { margin: 10px 0; padding: 10px 14px; border-radius: var(--radius-sm); background: rgb(228 174 79 / .1); color: var(--warn); font-size: 14px; }
.wd-break { overflow-wrap: anywhere; word-break: break-all; }
.wd-last { margin-top: 8px; }
.wd-pill.warn { background: rgb(228 174 79 / .12); color: var(--warn); }
.wd-pill.danger { background: rgb(242 122 111 / .12); color: var(--danger); }
.wd-table th, .wd-table td { padding: 16px; }
.wd-table td { vertical-align: top; white-space: nowrap; }
.wd-table .wd-wrap { display: block; min-width: 120px; white-space: normal; }
.wd-table td small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.wd-table td:last-child { text-align: left; }
.wd-tx { display: block; margin-top: 4px; color: var(--text); font-size: 13px; }
.wd-reason { max-width: 240px; white-space: normal; overflow-wrap: anywhere; }
.wd-address { display: inline-flex; align-items: center; gap: 4px; }
.wd-address code { font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.wd-copy { min-width: 32px; min-height: 32px; padding: 0 6px; font-size: 15px; line-height: 1; }
.wd-filters { gap: 10px; margin-top: 16px; }
.wd-filters + p, .wd-filters + .table-wrap { margin-top: 16px; }
.wd-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-top: 8px; }
.wd-admin-methods { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.wd-admin-method { display: grid; gap: 10px; }
.wd-admin-method.is-off { opacity: .75; }
.wd-admin-method h3 { font-size: 16px; }
@media (max-width: 540px) {
  .wd-table td { white-space: normal; }
  .wd-table td > div { min-width: 0; text-align: right; }
  .wd-table .wd-wrap { min-width: 0; }
  .wd-actions { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
  .wd-reason { max-width: none; }
}
@media (min-width: 620px) {
  .wd-methods:not(.in-dialog), .wd-admin-methods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* The queue is wider than the page on laptops: status, transaction and the decision buttons stay in view while it scrolls. */
@media (min-width: 541px) {
  .wd-table th:last-child, .wd-table td:last-child { position: sticky; right: 0; z-index: 1; background: var(--panel); box-shadow: -1px 0 0 var(--line); }
  .wd-table th:last-child { background: var(--bg-deep); }
}
@media (min-width: 1100px) {
  .wd-methods:not(.in-dialog) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Bot health (web/bot-health.js): creator tab and the owner's status line ---------- */
.status-dot.danger { background: var(--danger); }
.bh-pill { white-space: nowrap; }
.bh-pill.warn { background: rgb(228 174 79 / .12); color: var(--warn); }
.bh-pill.danger { background: rgb(242 122 111 / .12); color: var(--danger); }
.bh-pill.muted .status-dot { background: var(--muted); }
.bh-summary { margin-bottom: 8px; }
.bh-card { width: 100%; min-height: 0; grid-template-columns: minmax(0, 1fr); justify-content: stretch; align-content: start; justify-items: start; padding: 18px 20px; border-color: var(--line); border-left: 3px solid var(--line-2); background: var(--panel); color: var(--text); font-weight: 400; text-align: left; }
.bh-card:hover { background: var(--panel-2); }
.bh-card.ok { border-left-color: var(--ok); }
.bh-card.warn { border-left-color: var(--warn); }
.bh-card.danger { border-left-color: var(--danger); }
.bh-card.is-active { border-color: var(--line-2); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.bh-card .value { font-family: var(--font-display); font-weight: 600; }
.bh-filters { max-width: 100%; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.bh-filters::-webkit-scrollbar { display: none; }
.bh-filters button { flex: none; }
.bh-search { margin: 0 0 4px; }
.bh-search .row { align-items: stretch; }
.bh-search input, .bh-search select { flex: 1 1 auto; min-width: 0; margin: 0; }
.bh-search button { flex: none; }
.bh-table th, .bh-table td { padding: 10px 11px; }
.bh-table th { white-space: normal; vertical-align: bottom; }
.bh-table th .sort-head { white-space: normal; text-align: left; }
.bh-table td { vertical-align: top; }
.bh-table td small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.bh-table td:last-child { text-align: left; }
/* «Управление»: the bot window, as narrow as its button; the bot's name keeps room for a whole @username. */
.bh-table .bh-manage { width: 1%; white-space: nowrap; }
@media (min-width: 541px) { .bh-table td:first-child .bh-cell { min-width: 180px; } }
.bh-table .bh-name { display: block; width: 100%; min-width: 0; min-height: 0; padding: 0; border: 0; background: none; color: var(--text); font-weight: 650; text-align: left; overflow-wrap: anywhere; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.bh-table .bh-name:hover { background: none; text-decoration-color: currentColor; }
.bh-row.down td:first-child, .bh-row.never_started td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.bh-row.reserve td:first-child, .bh-row.limited td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
/* Five state cards: two per row on phones (the fifth takes the row), three then five per row on wider screens. */
@media (min-width: 960px) { .grid.four.bh-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .grid.four.bh-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.bh-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bh-badges .pill { min-height: 22px; font-size: 12px; }
.bh-events { margin: 8px 0 0; padding: 0; list-style: none; }
.bh-events > li { padding: 10px 0; border-top: 1px solid var(--line); }
.bh-events > li:first-child { border-top: 0; }
.bh-events small { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.bh-events li > .row > span { font-size: 14px; line-height: 1.5; }
.bh-events time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bh-events .bh-link { min-width: 0; min-height: 32px; padding: 0 6px; }
.bh-detail { overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 12px; }
.bh-events .bh-event.failed strong, .bh-events .bh-event.probe_failed strong { color: var(--danger); }
.bh-events .bh-event.reserve_started strong, .bh-events .bh-event.rate_limited strong, .bh-events .bh-event.identity_changed strong { color: var(--warn); }
.bh-events .bh-event.recovered strong { color: var(--ok); }
.bh-facts dd small { color: var(--muted); }
.bh-explain { margin: 4px 0 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text-2); font-size: 14px; line-height: 1.5; }
.bh-owner-line { flex-wrap: wrap; margin-top: 6px; }
.bh-owner-line[data-health="down"], .bh-owner-line[data-health="never_started"] { color: var(--danger); }
.bh-owner-line[data-health="reserve"] { color: var(--warn); }
.bh-owner-hint { display: block; margin-top: 4px; color: var(--text-2); font-size: 13px; }
.bh-cell { min-width: 0; }
@media (max-width: 540px) {
  .bh-table td { align-items: flex-start; }
  .bh-table .bh-cell { text-align: right; }
  .bh-table .bh-name { text-align: right; }
  .bh-table .bh-badges { justify-content: flex-end; }
  .bh-row.down td:first-child, .bh-row.never_started td:first-child, .bh-row.reserve td:first-child { box-shadow: none; }
  .bh-row.down, .bh-row.never_started { border-left: 3px solid var(--danger); }
  .bh-row.reserve { border-left: 3px solid var(--warn); }
  .bh-card { padding: 14px 16px; }
  /* A phone: «Управление» closes the bot's card at full width. */
  .bh-table td.bh-manage { display: block; width: auto; }
  .bh-table td.bh-manage::before { content: none; }
  .bh-table .bh-manage button { width: 100%; }
}

/* ---------- @broadcasts: website broadcasts (web/broadcasts.js, web/broadcast-compose.js) ---------- */
.bcast-compose .sr-only, .bcast-filters .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.bcast-compose { display: grid; gap: 16px; }
.bcast-main, .bcast-side { display: grid; gap: 16px; min-width: 0; align-content: start; }
.bcast-title { margin-top: -8px; }
.bcast-card .section-title { margin-bottom: 10px; }
.bcast-card .section-title p { margin-top: 4px; }
.bcast-modes { flex-wrap: wrap; }
.bcast-search { margin-top: 12px; }
.bcast-search input { min-height: 44px; }
.bcast-bots { display: grid; gap: 6px; max-height: 380px; margin-top: 10px; padding: 6px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-deep); }
.bcast-bot { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; margin: 0; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--text); font-weight: 400; cursor: pointer; }
.bcast-bot:hover { background: var(--panel); }
.bcast-bot.is-on { border-color: var(--line-2); background: var(--panel); }
.bcast-bot:has(input:disabled) { cursor: default; }
.bcast-bot input { margin: 0; }
.bcast-bot-name { display: grid; min-width: 0; }
.bcast-bot-name strong, .bcast-bot-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcast-bot-name small, .bcast-bot-count small { color: var(--muted); font-size: 12px; }
.bcast-bot-tags { display: flex; flex-wrap: wrap; gap: 4px; grid-column: 2 / 4; grid-row: 2; }
.bcast-bot-tags .pill { min-height: 22px; padding: 0 8px; font-size: 12px; }
.bcast-bot-count { display: grid; justify-items: end; grid-column: 3; grid-row: 1; font-variant-numeric: tabular-nums; }
.bcast-reach { margin: 14px 0 0; }
.bcast-langmode { display: grid; gap: 8px; margin-bottom: 18px; }
.bcast-langmode h3 { margin: 0; font-size: 15px; }
.bcast-langmodes { display: flex; flex-wrap: wrap; max-width: 100%; }
.bcast-langmodes button { min-height: 40px; padding: 6px 12px; text-align: left; }
.bcast-lang-note { display: grid; gap: 8px; }
.bcast-lang-note p { margin: 0; }
.bcast-lang-warn { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; border-color: rgb(228 174 79 / .45); color: var(--text); }
.bcast-text-head { align-items: center; }
.bcast-text-head p { margin: 0; }
.bcast-text { min-height: 190px; }
#bcast-count.error { color: var(--danger); }
.bcast-media { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-deep); }
.bcast-media > div:last-child { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.bcast-media-preview img, .bcast-media-preview video { display: block; width: 112px; height: 84px; object-fit: cover; border-radius: var(--radius-sm); background: var(--panel-2); }
.bcast-kb { display: grid; gap: 8px; margin-bottom: 12px; }
.bcast-kb-row { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-deep); }
.bcast-kb-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.bcast-kb-tools { flex-wrap: wrap; gap: 6px; }
.bcast-chip { display: inline-flex; align-items: center; gap: 2px; min-width: 0; max-width: 100%; padding: 2px 2px 2px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel-2); font-size: 14px; }
.bcast-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcast-chip button { min-width: 36px; min-height: 36px; padding: 0 8px; border-radius: 999px; }
.bcast-chip.tgp-primary { border-color: rgb(26 123 190 / .55); }
.bcast-chip.tgp-success { border-color: rgb(90 196 143 / .5); }
.bcast-chip.tgp-danger { border-color: rgb(242 122 111 / .5); }
.bcast-timeline { display: grid; gap: 4px; margin: 16px 0 0; padding: 0; list-style: none; font-size: 14px; }
.bcast-timeline li { display: grid; grid-template-columns: minmax(70px, auto) minmax(0, 1fr) auto; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--bg-deep); font-variant-numeric: tabular-nums; }
.bcast-timeline li span:first-child { color: var(--muted); }
.bcast-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 12px 0 16px; font-size: 14px; }
.bcast-facts dt { color: var(--muted); }
.bcast-facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.bcast-summary h3 { margin-top: 0; }
.bcast-summary .row { gap: 8px; }
.bcast-chat { margin-top: 4px; }
.bcast-bubble.has-media { padding: 0; overflow: hidden; }
.bcast-bubble-text { padding: 0; white-space: pre-wrap; }
.bcast-bubble.has-media .bcast-bubble-text { padding: 10px 12px; }
.tgp-media { display: block; width: 100%; max-height: 360px; object-fit: cover; background: var(--panel-3); }
.tgp-bubble pre { margin: 4px 0; padding: 8px 10px; border-radius: 8px; background: var(--panel-3); font-family: var(--font-mono); font-size: 13px; white-space: pre-wrap; }
.tgp-bubble tg-spoiler { border-radius: 4px; background: var(--line-2); color: transparent; text-shadow: 0 0 7px rgb(237 237 240 / .75); }
.tgp-name { border-bottom: 1px dashed var(--muted); }
.tgp-button.tgp-primary { background: rgb(26 123 190 / .5); }
.tgp-button.tgp-success { background: rgb(90 196 143 / .32); }
.tgp-button.tgp-danger { background: rgb(242 122 111 / .32); }
.bcast-pill.warn { background: rgb(228 174 79 / .12); color: var(--warn); }
.bcast-pill.danger { background: rgb(242 122 111 / .12); color: var(--danger); }
.page-head h1 .bcast-pill { margin-left: 8px; vertical-align: middle; font-family: var(--font-text); letter-spacing: 0; }
.bcast-cards { margin-bottom: 4px; }
.bcast-filters { gap: 12px; margin-bottom: 6px; }
.bcast-filters .segmented { flex-wrap: wrap; }
.bcast-search-form .row input { min-height: 44px; }
.bcast-search-form .form-error { margin: 4px 0 0; }
.bcast-table .meter, .bcast-progress .meter { margin-top: 0; }
@media (min-width: 541px) { .bcast-table th, .bcast-table td { padding: 10px 11px; } }
.bcast-meter { min-width: 80px; }
.bcast-progress-cell { display: grid; gap: 4px; min-width: 110px; }
.bcast-progress-cell small { color: var(--muted); font-size: 12px; }
.bcast-message-cell { display: grid; gap: 2px; min-width: 180px; max-width: 340px; text-align: left; }
.bcast-message-cell strong, .bcast-message-cell small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcast-message-cell small, .bcast-note { color: var(--muted); font-size: 12px; }
.bcast-note { display: block; margin-top: 4px; max-width: 240px; white-space: normal; }
.bcast-note.error { color: var(--danger); }
.bcast-link-button { min-width: 0; min-height: 0; padding: 0; border: 0; background: none; color: var(--tg-hover); font-weight: 650; }
.bcast-link-button:hover { background: none; text-decoration: underline; }
.bcast-row-actions { justify-content: flex-end; gap: 4px; }
.bcast-row-actions button { min-width: 40px; min-height: 40px; padding: 0 10px; }
.bcast-progress { display: grid; gap: 12px; }
.bcast-progress > .row strong { font-family: var(--font-display); font-size: 26px; font-weight: 600; }
.bcast-times { margin: 4px 0 0; }
.bcast-detail-grid { display: grid; gap: 16px; }
.bcast-empty { margin-top: 16px; }
@media (min-width: 620px) {
  .bcast-timeline li { grid-template-columns: 90px minmax(0, 1fr) auto; }
  .bcast-times { grid-template-columns: repeat(2, auto minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .bcast-detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
@media (min-width: 1100px) {
  .bcast-compose { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
  .bcast-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
}
@media (max-width: 540px) {
  .bcast-media { grid-template-columns: minmax(0, 1fr); }
  .bcast-media-preview img, .bcast-media-preview video { width: 100%; height: auto; max-height: 220px; }
  .bcast-message-cell { min-width: 0; max-width: 60vw; text-align: right; justify-items: end; }
  .bcast-progress-cell { justify-items: end; }
  .bcast-note { max-width: none; text-align: right; }
}

/* ---------- @blogai: blog editor, AI assistant review and blog analytics (web/blog-editor.js, web/blog-ai.js, web/blog-stats.js) ---------- */
.blog-tabs { margin-top: 18px; }
.blog-editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 20px; }
.blog-main .form-field + .form-field { margin-top: 14px; }
.blog-main .form-grid.two { gap: 0 14px; }
.blog-main .notice, .blog-card .notice, #dialog .notice { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--radius-md); background: var(--panel-2); color: var(--text); font-size: 14px; line-height: 1.5; }
#dialog .notice.warn, .blog-main .notice.warn { border-color: rgb(228 174 79 / .45); background: rgb(228 174 79 / .08); }
#dialog .notice ul { margin: 8px 0 0; padding-left: 18px; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.label-row label { margin-bottom: 6px; }
.label-row .small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.counter { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.field-label { margin: 16px 0 6px; color: var(--text-2); font-size: 14px; font-weight: 600; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-deep); }
.editor-toolbar .small, .editor-toolbar .button.small { min-height: 34px; padding: 0 10px; border-radius: 8px; font-size: 13px; }
.file-button { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.link-suggestions .pill { flex: none; white-space: nowrap; }
.blog-editor .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.blog-main textarea.article-body { min-height: 420px; font-family: var(--font-mono); font-size: 14px; line-height: 1.6; }
.blog-side { display: grid; gap: 16px; align-content: start; min-width: 0; }
.blog-card h2 { margin: 0 0 10px; font-size: 17px; }
.blog-card h3 { margin: 16px 0 6px; font-size: 15px; }
.blog-card select { width: 100%; }
.blog-ai-actions { display: grid; gap: 8px; margin-top: 12px; }
.blog-ai-actions button { min-height: 44px; justify-content: flex-start; text-align: left; }
.seo-checks, .link-suggestions, .plain-list { margin: 0; padding: 0; list-style: none; }
.seo-checks li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px; padding: 5px 0; color: var(--text-2); font-size: 14px; line-height: 1.45; }
.seo-checks li span { width: 18px; height: 18px; display: grid; place-items: center; margin-top: 1px; border-radius: 50%; font-size: 11px; font-weight: 700; }
.seo-checks li.ok span { background: rgb(90 196 143 / .16); color: var(--ok); }
.seo-checks li.warn span { background: rgb(228 174 79 / .16); color: var(--warn); }
.seo-checks li.bad span { background: rgb(242 122 111 / .16); color: var(--danger); }
.link-suggestions li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.link-suggestions li:first-child { border-top: 0; }
.link-suggestions li > span:first-child { min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.link-suggestions small { display: block; color: var(--muted); font-size: 12px; }
.link-suggestions .small { flex: none; min-height: 34px; }
.plain-list li { padding: 4px 0; font-size: 14px; }
.share-links { display: flex; flex-wrap: wrap; gap: 8px; }
.serp { display: grid; gap: 3px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-deep); }
.serp-url { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.serp-title { color: #b9c7ff; font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
.serp-text { color: var(--text-2); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.guide summary { cursor: pointer; font-weight: 650; list-style: none; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after { content: '+'; float: right; color: var(--muted); }
.guide[open] summary::after { content: '−'; }
.guide-list { margin: 10px 0 0; padding-left: 20px; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.guide-list li + li { margin-top: 8px; }
#dialog .diff { max-height: 46vh; overflow: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-deep); font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
#dialog .diff-line { display: block; min-height: 1.6em; }
#dialog .diff-fold { display: block; margin: 4px 0; color: var(--muted); font-size: 12px; }
#dialog del { border-radius: 4px; background: rgb(242 122 111 / .18); color: #ffb4ac; text-decoration: line-through; }
#dialog ins { border-radius: 4px; background: rgb(90 196 143 / .18); color: #a6efc6; text-decoration: none; }
#dialog .ai-preview { max-height: 34vh; overflow: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-deep); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
#dialog .ai-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 14px; margin: 0 0 12px; }
#dialog .ai-fields dt { margin-top: 8px; color: var(--muted); font-size: 13px; }
#dialog .ai-fields dd { margin: 0; overflow-wrap: anywhere; }
#dialog .ai-changes { margin: 8px 0 12px; padding-left: 18px; font-size: 14px; }
#dialog .ai-choices { margin: 0 0 14px; padding: 0; border: 0; }
#dialog .ai-choices legend { margin-bottom: 6px; font-weight: 650; }
#dialog .ai-choices input[type="radio"] { width: 20px; height: 20px; min-height: 0; flex: none; margin: 1px 0 0; padding: 0; accent-color: var(--primary); }
#dialog .ai-choices input[type="radio"]:focus-visible { outline: 3px solid rgb(241 241 243 / .9); outline-offset: 2px; }
#dialog .ai-faq h3 { margin: 14px 0 4px; font-size: 16px; }
.blog-stats-table td:first-child { min-width: 220px; white-space: normal; text-align: left; }
.blog-stats-table td:first-child a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
@media (min-width: 720px) {
  #dialog .ai-fields { grid-template-columns: 160px minmax(0, 1fr); }
  #dialog .ai-fields dt { margin-top: 0; }
  .blog-main .form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blog-main .form-grid.two .form-field + .form-field { margin-top: 0; }
}
@media (min-width: 1100px) {
  .blog-editor { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .blog-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
/* @blogseo: the SEO workspace uses the cabinet palette and native controls under strict CSP. */
.seo-workspace { display: grid; gap: 20px; margin-top: 24px; min-width: 0; }
.seo-workspace .card { min-width: 0; }
.seo-workspace a, .seo-workspace td { overflow-wrap: anywhere; }
.seo-keyword-filters .form-grid { gap: 12px; }
.seo-keyword-scopes { display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%; }
.seo-keyword-scopes button { flex: 1; white-space: normal; }
/* The query table keeps its columns and scrolls inside its card; numbers never wrap inside a word. */
.seo-keyword-table { max-width: 100%; overflow-x: auto; }
.seo-keyword-table table { min-width: 860px; }
.seo-keyword-table td > div { min-width: 0; }
.seo-keyword-table small { display: block; margin-top: 4px; color: var(--muted); }
.seo-keyword-table td:first-child { min-width: 180px; }
.seo-keyword-table td:nth-child(3) { min-width: 160px; max-width: 260px; }
.seo-workspace .seo-keyword-table .seo-num { overflow-wrap: normal; text-align: right; }
.seo-keyword-table .seo-num strong, .seo-keyword-table .seo-was { white-space: nowrap; }
.seo-rank-up { color: var(--ok); }
.seo-rank-down { color: var(--warn); }
.seo-keyword-source .stat .value { font-size: 32px; }
.seo-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.seo-tabs button { flex: 0 1 auto; }
.seo-form { margin: 16px 0 24px; }
.seo-form .row input { flex: 1; min-width: 0; }
.seo-form button[type="submit"] { margin-top: 8px; }
.seo-form .row button { margin-top: 0; }
.seo-competitors, .seo-ideas, .seo-article-list, .seo-job-list, .seo-recommendations { padding: 0; list-style: none; }
.seo-competitors > li, .seo-ideas > li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.seo-article-list > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.seo-article-list small, .seo-ideas small, .seo-candidates small, .seo-job-list small, .seo-recommendations small, .seo-workspace .stat .foot small { display: block; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.seo-clusters { display: grid; gap: 16px; }
.seo-clusters > article { border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.seo-candidates { min-width: 0; border: 0; padding: 0; }
.seo-candidates .check-row { align-items: start; }
.seo-candidates .check-row span { overflow-wrap: anywhere; min-width: 0; }
.seo-matrix table { min-width: 100%; }
.seo-matrix th { max-width: 280px; }
.seo-matrix td { text-align: center; }
.seo-matrix td button { min-width: 36px; padding: 4px 8px; }
.seo-matrix caption { text-align: left; color: var(--muted); margin-bottom: 12px; }
.seo-matrix { max-width: 100%; overflow-x: auto; }
.seo-empty { padding: 16px 0; }
.seo-score { display: grid; gap: 8px; margin-bottom: 12px; }
.seo-score > strong { font-size: 44px; color: var(--text); letter-spacing: -2px; }
.seo-score > strong small { font-size: 18px; color: var(--muted); letter-spacing: 0; }
.seo-score progress { width: 100%; height: 10px; accent-color: var(--tg); }
.seo-recommendations li { margin: 8px 0; }
.seo-recommendations button { display: flex; justify-content: space-between; align-items: start; gap: 12px; width: 100%; text-align: left; white-space: normal; }
.seo-recommendations strong { flex-shrink: 0; color: var(--tg); }
.seo-job-list > li { display: flex; align-items: start; gap: 8px; margin-top: 12px; overflow-wrap: anywhere; }
.seo-job-list > li > span:last-child { min-width: 0; }
.seo-brief details, .seo-summary details { margin: 12px 0; }
.seo-brief ul, .seo-brief ol { padding-left: 20px; }
.seo-brief li { margin: 6px 0; }
.seo-subheading { margin-left: 16px !important; }
.seo-option-list p { display: flex; gap: 8px; align-items: start; }
.seo-option-list span { min-width: 0; overflow-wrap: anywhere; }
#bed-research label { display: block; margin: 12px 0 6px; }
#bed-research .row { margin-top: 12px; }
.seo-brief { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
@media (min-width: 720px) { .seo-clusters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .seo-workspace .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 599px) { .seo-competitors > li, .seo-ideas > li { flex-direction: column; align-items: stretch; } .seo-form .row { flex-wrap: wrap; } .seo-form .row input { flex-basis: 100%; } .seo-tabs button { flex-grow: 1; } }
/* The link matrix and the query table stay scrollable tables; the cabinet's mobile record cards cannot express columns. */
@media (max-width: 540px) {
  .seo-matrix, .seo-keyword-table { overflow-x: auto; border: 1px solid var(--line); }
  .seo-matrix table, .seo-keyword-table table { display: table; }
  .seo-matrix thead, .seo-keyword-table thead { display: table-header-group; }
  .seo-matrix tbody, .seo-keyword-table tbody { display: table-row-group; }
  .seo-matrix tr, .seo-keyword-table tr { display: table-row; padding: 0; margin: 0; border: 0; border-radius: 0; background: none; }
  .seo-matrix td { display: table-cell; padding: 12px 14px; text-align: center; }
  .seo-keyword-table td { display: table-cell; padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
  .seo-keyword-table td.seo-num { text-align: right; }
  .seo-matrix td::before, .seo-keyword-table td::before { content: none; }
  .seo-matrix th { white-space: normal; min-width: 48px; }
  .seo-matrix th:first-child { min-width: 180px; }
}

/* Shared cabinet controls: constrained action menus, readable uploads and roomy payout rows. */
.row-menu { position: relative; flex: none; margin: 0; }
.row-menu > summary { display: grid; place-items: center; width: 44px; min-height: 44px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel-2); cursor: pointer; list-style: none; font-size: 22px; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-items { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; }
@media (min-width: 541px) {
  /* Beside the button, one row high: the table row keeps its height and the popover never leaves the table. */
  .row-menu-items { position: absolute; top: 50%; right: calc(100% + 6px); z-index: 3; flex-wrap: nowrap; padding: 4px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel); transform: translateY(-50%); white-space: nowrap; }
}
.file-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; position: relative; min-width: 0; }
.file-name { flex: 1 1 160px; min-width: 0; color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.file-native { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; overflow: hidden; clip-path: inset(50%); }
.file-picker:focus-within { outline: 2px solid var(--text-2); outline-offset: 4px; border-radius: var(--radius-sm); }
.bh-section-title + .field-hint { margin: -8px 0 14px; }
.bh-section-title h2 { flex: 1 1 auto; }
.bh-section-title > a { flex: none; }
@media (max-width: 600px) {
  .bh-section-title { flex-direction: row; }
  /* Loaded admin modules have their own compact controls; the phone target applies to them too. */
  #app button:not(.switch), #app a.button, #dialog button, #dialog a.button, #app summary { min-height: 44px; }
  #app button.text-link, #app button.bh-name { display: inline-flex; align-items: center; }
  #app button.bell { min-width: 44px; }
  #app summary { align-content: center; }
  #app .journey-period button { min-height: 52px; }
  #mb-tg-tools .mb-preview-tools .segmented button { min-height: 44px; white-space: normal; padding: 6px 10px; }
  /* A link inside a sentence stays a word of it: the line keeps its height. */
  #app p:not(.admin-version) button.text-link { display: inline; min-height: 0; }
  /* 16 px in every field: iOS zooms the page in on a smaller one and leaves it zoomed. */
  #app :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea),
  #dialog :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) { font-size: 16px; }
}

/* Names and addresses remain readable even when the owner supplies a long value (the event log: see .table-wrap.dense). */
.bot-name, .side-bottom p, .bcast-bot-name strong, .bcast-bot-name small, .bcast-chip > span, .bcast-message-cell strong { white-space: normal; overflow-wrap: anywhere; }

/* Accessible separators stay in the reading order without becoming layout rows. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* A release came out while this page was open (web/app.js noticeVersion): one line on top until it is reloaded. */
.version-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 16px; background: var(--warn); color: #111; font-weight: 600; text-align: center; }
.version-banner button { flex: none; }

/* «Модель API» beside an effect (web/model-ref.js): the line in monospace, 16 px (a phone does not zoom in on it), inside its
   card — as wide as the line, wrapped whole on a narrow card (`field-sizing`; elsewhere its first row, the rest scrolls in
   the field), never wider than the page; «Скопировать» beside it, under it on a narrow card. */
.model-ref { min-width: 0; margin: 8px 0; }
.model-ref-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 13px; font-weight: 500; }
.model-ref-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.model-ref-value { flex: 1 1 auto; width: auto; min-width: 0; max-width: 100%; min-height: 44px; padding: 10px 12px; background: var(--panel); color: var(--text-2);
  font-family: var(--font-mono); font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; resize: none; field-sizing: content; }
.model-ref-copy { flex: none; }
.model-ref-bar { margin: 8px 0 12px; }
/* The browser's own copy (no clipboard API): a field off sight, 16 px so a phone does not zoom in on it. */
.model-ref-clip { position: fixed; top: 0; left: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; font-size: 16px; pointer-events: none; }
