/* Manrope, OFL — see fonts/OFL.txt. Latin and Cyrillic only: the panel speaks
   Russian and English, and the unicode-range lets a page load just the one
   script it actually shows. */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/manrope-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/manrope-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/manrope-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/manrope-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/manrope-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/manrope-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 800; font-display: swap; src: url(fonts/manrope-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 800; font-display: swap; src: url(fonts/manrope-cyrillic-800-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

:root {
  --bg: #F6F7FA;
  --card: #FFFFFF;
  --line: #E2E9F0;
  --line-strong: #CBD5E1;
  --ink: #000000;
  --ink-soft: #1F2937;
  --ink-dim: #6B7280;
  --ink-faint: #9AA3AF;
  --primary: #012FFF;
  --primary-soft: #E8EDFF;
  --accent: #FF00D0;
  --lime: #DDFF00;
  --ok-bg: #DBFFE3;
  --ok-ink: #067647;
  --bad-bg: #FFE5E6;
  --bad-ink: #C0243B;
  --warn-bg: #FFF3D6;
  --warn-ink: #8A5300;
  --r-card: 20px;
  --r-pill: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .04);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidebar: 248px;
  --rail: 76px;
  --gutter: 22px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.45 var(--font); }
a { color: inherit; text-decoration: none; }
h1, h2 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 24px; line-height: 1.2; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Lucide draws with strokes; one rule sets them for every icon in the sprite. */
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- frame ------------------------------------------------------------ */

.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: 16px; padding: 16px; min-height: 100vh; }
.shell.is-collapsed { grid-template-columns: var(--rail) minmax(0, 1fr); }

.sidebar { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 16px 12px; position: sticky; top: 16px; height: fit-content; max-height: calc(100vh - 32px); overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 16px; font-weight: 800; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--ink); color: var(--lime); display: grid; place-items: center; flex: none; }
.brand-mark .icon { width: 20px; height: 20px; stroke-width: 2; }
.nav-section { padding: 6px 0; border-top: 1px solid var(--line); }
.nav-section:first-child { border-top: 0; padding-top: 0; }
.nav-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); padding: 6px 12px; white-space: nowrap; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin-top: 2px; border-radius: var(--r-pill); color: var(--ink-dim); font-weight: 600; white-space: nowrap; }
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.is-active { background: var(--ink); color: #fff; }
.nav-item.is-active .icon { color: var(--lime); }
.sidebar-toggle { margin: 8px auto 0; width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink-dim); cursor: pointer; display: grid; place-items: center; padding: 0; }
.sidebar-toggle:hover { color: var(--ink); border-color: var(--line-strong); }
.sidebar-toggle .when-collapsed { display: none; }

/* The rail: every label goes, the icons stay and carry a title tooltip. */
.is-collapsed .sidebar { padding-inline: 10px; }
.is-collapsed .brand { justify-content: center; padding-inline: 0; }
.is-collapsed .brand-name,
.is-collapsed .nav-title,
.is-collapsed .nav-label { display: none; }
.is-collapsed .nav-item { justify-content: center; padding-inline: 0; }
.is-collapsed .sidebar-toggle .when-expanded { display: none; }
.is-collapsed .sidebar-toggle .when-collapsed { display: block; }

.main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.search { position: relative; flex: 1; max-width: 440px; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }
.search input { width: 100%; padding-left: 42px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.lang { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 12px; font-weight: 700; font-size: 13px; }
.lang:hover { border-color: var(--line-strong); }
.who { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 4px 14px 4px 5px; background: var(--card); border-radius: 999px; font-weight: 600; white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--lime); color: var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 13px; text-transform: uppercase; }

.content { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---- cards ------------------------------------------------------------ */

.card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 20px var(--gutter) 16px; }
.card-title { display: grid; gap: 4px; min-width: 0; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--ink-dim); font-size: 13px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card-body { padding: 0 var(--gutter) var(--gutter); }

.card-error { padding: 56px 24px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.card-error p { color: var(--ink-dim); max-width: 46ch; }
.card-error .btn { margin-top: 8px; }
.error-mark { width: 64px; height: 64px; border-radius: 20px; background: var(--bg); display: grid; place-items: center; margin-bottom: 4px; }
.error-mark .icon { width: 30px; height: 30px; stroke-width: 1.6; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }

/* ---- figures ---------------------------------------------------------- */

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { font-weight: 600; color: var(--ink-dim); }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--bg); color: var(--ink); display: grid; place-items: center; flex: none; }
.kpi-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.kpi-value { margin-left: auto; font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge .icon { width: 13px; height: 13px; stroke-width: 2.2; }
.badge-up { background: var(--ok-bg); color: var(--ok-ink); }
.badge-down { background: var(--bad-bg); color: var(--bad-ink); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-info { background: var(--primary-soft); color: var(--primary); }
.badge-flat { background: var(--bg); color: var(--ink-dim); }
.badge-lime { background: var(--lime); color: var(--ink); }
.is-pos { color: var(--ok-ink); }
.is-neg { color: var(--bad-ink); }

.outcomes { display: flex; flex-wrap: wrap; gap: 10px; }
.outcomes .badge { font-size: 14px; padding: 8px 14px; }

.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.funnel-step { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) 56px 64px; align-items: center; gap: 14px; }
.funnel-label { font-weight: 600; }
.funnel-bar { height: 12px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.funnel-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.funnel-count { text-align: right; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.funnel-share { text-align: right; color: var(--ink-dim); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .funnel-step { grid-template-columns: minmax(0, 1fr) 48px 56px; gap: 6px 10px; }
  .funnel-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* ---- forms ------------------------------------------------------------ */

input, select { font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 9px 14px; min-height: 42px; }
input:hover, select:hover { border-color: var(--line-strong); }
input:focus-visible, select:focus-visible { outline: 2px solid var(--primary); outline-offset: -1px; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; accent-color: var(--ink); }
label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-dim); }
label.checkbox { display: flex; align-items: center; gap: 10px; min-height: 42px; font-size: 14px; color: var(--ink); cursor: pointer; }

.btn { font: inherit; font-weight: 700; border-radius: var(--r-pill); padding: 0 16px; min-height: 42px; border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; color: inherit; background: transparent; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-soft); }
.btn-ghost { border: 1px dashed var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--bg); border-style: solid; }
.btn-danger { background: var(--bad-bg); color: var(--bad-ink); }
.btn-danger:hover { background: #FFD3D6; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-square { padding: 0; width: 42px; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; padding: 0 var(--gutter) 18px; }
/* The buttons get a row of their own: squeezed into one 170px cell they
   stacked "Apply" above "Reset". */
.filters .actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.form-error { display: flex; align-items: center; gap: 8px; background: var(--bad-bg); color: var(--bad-ink); border-radius: var(--r-pill); padding: 10px 14px; font-weight: 600; }

/* ---- tables ----------------------------------------------------------- */

.table-scroll { overflow-x: auto; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); padding: 10px; font-weight: 700; }
td { padding: 12px 10px; border-top: 1px dashed var(--line); }
td a { font-weight: 700; }
td a:hover { color: var(--primary); }
tbody tr:not(.total):hover > td { background: #FAFBFD; }
tr.total > td { border-top: 0; font-weight: 800; background: var(--bg); }
tr.total > td:first-child { border-radius: 10px 0 0 10px; }
tr.total > td:last-child { border-radius: 0 10px 10px 0; }
.th-sort:hover { color: var(--ink); }
.th-sort.is-sorted { color: var(--primary); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.col-action { width: 1%; text-align: right; }
/* Broker order ids are full UUIDs; clipped, the whole id is still in the
   title and in what a copy picks up. */
.cell-clip { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.btn-sm.btn-square { width: 34px; }

/* A row that leads to one place: its single real link is stretched over the
   whole row, so the row is clickable without a script and without nesting a
   table inside an anchor. */
.rows-link tbody tr { position: relative; cursor: pointer; }
.rows-link a.row-link::after { content: ""; position: absolute; inset: 0; }

.ladder { width: 100%; background: var(--bg); border-radius: 12px; }

/* ---- detail popovers -------------------------------------------------- */

/* Opened by the browser from popovertarget, so no script is involved; Esc
   and a click on the backdrop close it. */
.sheet { width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 48px); margin: auto; padding: 0; border: 0; border-radius: var(--r-card); background: var(--card); color: var(--ink); box-shadow: 0 24px 64px rgba(16, 24, 40, .18); overflow: auto; }
.sheet::backdrop { background: rgba(16, 24, 40, .35); }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px var(--gutter) 14px; background: var(--card); border-bottom: 1px dashed var(--line); }
.sheet-body { display: grid; gap: 18px; padding: 18px var(--gutter) var(--gutter); }
.sheet .facts { grid-template-columns: minmax(130px, 190px) minmax(0, 1fr); }
.sheet .table-scroll { margin-inline: 0; padding-inline: 0; }
@media (max-width: 900px) {
  .sheet { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
}
.ladder th, .ladder td { padding: 7px 10px; font-size: 13px; }
.ladder td { border-top-color: var(--line-strong); }

.pager { display: flex; align-items: center; gap: 8px; padding-top: 14px; color: var(--ink-dim); font-weight: 600; }
.pager-count { margin-right: auto; }
.empty { padding: 44px 16px; display: grid; justify-items: center; gap: 10px; color: var(--ink-dim); text-align: center; }
.empty .icon { width: 28px; height: 28px; color: var(--ink-faint); stroke-width: 1.6; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 20px var(--gutter) 12px; }
.chips.tabs { padding: 0 0 16px; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-weight: 700; color: var(--ink-dim); }
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }

.chart { width: 100%; height: 260px; display: block; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.chart .tick { fill: var(--ink-faint); font-size: 11px; font-weight: 600; }

/* ---- the person ------------------------------------------------------- */

.profile { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.profile-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.actions-card { position: sticky; top: 16px; }
.actions-card .card-body { display: grid; gap: 16px; }
.action-block { display: grid; gap: 10px; padding-top: 16px; border-top: 1px dashed var(--line); }
.action-block:first-child { border-top: 0; padding-top: 0; }
.action-title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.action-row { display: flex; gap: 8px; }
.action-row > input, .action-row > select { flex: 1; min-width: 0; }
.action-block input[name="note"] { width: 100%; }
.action-block .btn { width: 100%; }
.card-tabs { padding-top: 20px; }

.facts { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 12px 16px; margin: 0; }
.facts dt { color: var(--ink-dim); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---- admins ----------------------------------------------------------- */

/* Icon buttons in a row: the forms around the submit-only ones must not add
   boxes of their own, or the icons stop lining up with the popover buttons. */
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.row-actions form { display: contents; }
.page-error { margin: 0 var(--gutter) 16px; }

.sheet-form { display: grid; gap: 14px; }
.sheet-form input, .sheet-form select { width: 100%; }
.sheet-form select:disabled { color: var(--ink-dim); background: var(--bg); }
.sheet-form textarea { width: 100%; min-height: 180px; font: inherit; resize: vertical; }
/* ---- broadcasts ------------------------------------------------------- */

.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover { background: var(--ink); }
.btn-ghost:disabled:hover { background: transparent; border-style: dashed; }

/* Форма слева, превью «как в Telegram» справа; уже 1180px — друг под другом. */
.bc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.bc-side { position: sticky; top: 16px; display: grid; gap: 10px; }
.bc-side-title { font-size: 12px; font-weight: 600; color: var(--ink-dim); }
.bc-field { display: grid; gap: 6px; }
.bc-field-label { font-size: 12px; font-weight: 600; color: var(--ink-dim); }

.bc-audience { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 12px; align-items: end; border: 1px solid var(--line); border-radius: 16px; padding: 4px 16px 16px; margin: 0; min-width: 0; }
.bc-audience-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 0 4px; font-weight: 700; color: var(--ink); float: left; margin: 12px 0 2px; grid-column: 1 / -1; }
.bc-count { display: inline-flex; align-items: center; gap: 6px; background: var(--lime); color: var(--ink); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bc-count .icon { width: 15px; height: 15px; }

.toggles { display: flex; flex-wrap: nowrap; gap: 4px; min-height: 42px; align-items: center; }
.toggle { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-pill); font-size: 13px; font-weight: 700; color: var(--ink-dim); cursor: pointer; user-select: none; }
.toggle:hover { border-color: var(--line-strong); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.toggle:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #fff; }
.toggle:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }
.toggle .icon { width: 15px; height: 15px; }
.toggle-danger { justify-self: start; min-height: 34px; }
.toggle-danger:has(input:checked) { background: var(--bad-bg); border-color: var(--bad-bg); color: var(--bad-ink); }

.bc-editor { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--card); }
.bc-editor:focus-within { border-color: var(--line-strong); }
.bc-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px dashed var(--line); background: var(--bg); }
.btn-tool { color: var(--ink-soft); }
.btn-tool:hover { background: var(--card); color: var(--ink); }
.sheet-form .bc-editor textarea { display: block; width: 100%; min-height: 200px; border: 0; border-radius: 0; padding: 12px 14px; font: inherit; line-height: 1.5; resize: vertical; background: transparent; }
.bc-editor textarea:focus-visible { outline: none; }

.bc-drop { display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 16px; border: 1px dashed var(--line-strong); border-radius: 16px; cursor: pointer; color: var(--ink); font-size: 14px; background: var(--card); }
.bc-drop:hover, .bc-drop.is-over { background: var(--primary-soft); border-color: var(--primary); }
.bc-drop input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.bc-drop-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--bg); display: grid; place-items: center; flex: none; }
.bc-drop-text { display: grid; gap: 2px; min-width: 0; }
.bc-drop-text strong { overflow-wrap: anywhere; }

.bc-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; padding-top: 4px; }
.bc-actions .field-hint { flex-basis: 100%; text-align: right; }
.bc-field > .field-hint, .bc-drop .field-hint { font-size: 12px; }

/* Превью сообщения: пузырь бота на фоне чата. */
.tg-chat { background: #DCE6EE; border-radius: 16px; padding: 18px 14px; }
.tg-bubble { background: #fff; border-radius: 14px 14px 14px 4px; overflow: hidden; box-shadow: 0 1px 1px rgba(16, 24, 40, .12); max-width: 100%; }
.tg-media img, .tg-media video { display: block; width: 100%; max-height: 360px; object-fit: cover; background: #0b1220; }
/* display: block у img и video перебил бы атрибут hidden. */
.tg-bubble [hidden] { display: none; }
.tg-text { padding: 9px 12px 10px; font-size: 14px; line-height: 1.45; color: #000; overflow-wrap: anywhere; }
.tg-text a { color: #2481CC; }
.tg-text code, .tg-text pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: #F1F3F5; border-radius: 4px; padding: 0 3px; }
.tg-empty { color: var(--ink-faint); }

.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tg-button { margin-top: 4px; padding: 9px 12px; border-radius: 12px; background: #6B8196; color: #fff; font-size: 14px; font-weight: 600; text-align: center; }
.bc-card { display: grid; gap: 20px; }
.bc-card .facts { grid-template-columns: minmax(90px, 120px) minmax(0, 1fr); }
.bc-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.bc-progress-bar { height: 10px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.bc-progress-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--ink); }
.bc-progress-label { font-weight: 700; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

.inline-filter { display: flex; align-items: center; gap: 8px; }
.inline-filter select { min-height: 34px; padding: 5px 12px; font-size: 13px; }

@media (max-width: 1180px) {
  .bc-layout { grid-template-columns: minmax(0, 1fr); }
  .bc-side { position: static; max-width: 420px; }
}
@media (max-width: 900px) {
  .bc-audience { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid-4, .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.form-notice { display: flex; align-items: center; gap: 8px; background: var(--ok-bg); color: var(--ok-ink); border-radius: var(--r-pill); padding: 10px 14px; font-weight: 600; }
.field-hint { font-weight: 400; color: var(--ink-faint); }
.sheet-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.sheet-body > p { color: var(--ink-dim); }

/* ---- sign-in ---------------------------------------------------------- */

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); padding: 28px; display: grid; gap: 16px; }
.login .brand { padding: 0 0 4px; }
.login input { width: 100%; }
.login .btn { width: 100%; }

dialog { border: 0; border-radius: var(--r-card); box-shadow: var(--shadow); padding: 24px; min-width: 320px; }
dialog::backdrop { background: rgba(16, 24, 40, .35); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ---- narrower screens ------------------------------------------------- */

@media (max-width: 1180px) {
  .profile, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .actions-card { position: static; }
}

/* Below this the sidebar would eat the first screen, so it becomes a strip
   of icons across the top; the collapse toggle has nothing left to do. */
@media (max-width: 900px) {
  :root { --gutter: 16px; }
  .shell, .shell.is-collapsed { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 12px; }
  .sidebar { position: static; max-height: none; flex-direction: row; align-items: center; gap: 8px; padding: 8px; overflow-x: auto; }
  .brand { padding: 0 4px 0 0; }
  .brand-name, .nav-title, .nav-label, .sidebar-toggle { display: none; }
  .sidebar nav { display: flex; }
  .nav-section { display: flex; gap: 2px; padding: 0 0 0 8px; margin-left: 8px; border-top: 0; border-left: 1px solid var(--line); }
  .nav-section:first-child { border-left: 0; padding-left: 0; margin-left: 0; }
  .nav-item { margin: 0; padding: 10px; }
  .topbar { flex-wrap: wrap; }
  .search { order: 2; flex-basis: 100%; max-width: none; }
  .who span:not(.avatar) { display: none; }
  .who { padding-right: 5px; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .facts dd { margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.copy-field { display: flex; gap: .25rem; align-items: center; min-width: 0; }
.copy-field input { flex: 1; min-width: 8rem; text-overflow: ellipsis; font-size: .8125rem; }
.copy-field .is-done { color: var(--ok-ink); }
