/* HubLink service UI: account, tariff, statistics, payment pages and the landing.
   The same rules as the editor (editor.css): warm grey background, white cards, Onest, black main
   button, purple only for focus and Plus. Dark mode follows the phone (prefers-color-scheme). */
:root {
  --ui-bg: #f2f2ef;
  --ui-surface: #ffffff;
  --ui-text: #16161a;
  --ui-muted: #6b6b73;
  --ui-line: #e4e4df;
  --ui-brand: #7c3aed;
  --ui-brand-soft: #f3e8ff;
  --ui-brand-ink: #5b21b6;
  --ui-ok: #0f9f6e;
  --ui-warn: #b45309;
  --ui-danger: #d14343;
  --ui-gradient: linear-gradient(90deg, #a061ff, #ff75b5);
  --ui-radius: 18px;
  --ui-nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ui-bg: #0f1013;
    --ui-surface: #191b21;
    --ui-text: #eceef2;
    --ui-muted: #9ca0ad;
    --ui-line: #2a2d35;
    --ui-brand-soft: #2a1d45;
    --ui-brand-ink: #d8b4fe;
    --ui-ok: #34d399;
    --ui-warn: #fbbf24;
    --ui-danger: #f87171;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }
body.ui {
  min-height: 100vh;
  background: var(--ui-bg);
  color: var(--ui-text);
  font: 400 15px/1.5 "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.ui--nav { padding-bottom: calc(var(--ui-nav-h) + env(safe-area-inset-bottom)); }
/* Zero specificity (:where), so author pages shown inside service pages (.hl-*) keep their theme styles. */
:where(.ui) a { color: inherit; }
:where(.ui) :focus-visible { outline: 3px solid var(--ui-brand); outline-offset: 2px; }
:where(.ui) :where(h1, h2, h3) { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
:where(.ui) p { margin: 0; }
.ui [hidden] { display: none !important; }
strong, span, a { overflow-wrap: anywhere; }

/* Top bar */
.ui-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--ui-surface);
  border-bottom: 1px solid var(--ui-line);
}
.ui-brand { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; font-weight: 700; font-size: 17px; }
.ui-logo { width: 28px; height: 28px; display: block; flex: none; }
.ui-top-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ui-top-title b { font-size: 16px; }
.ui-top-title small { color: var(--ui-muted); font-size: 12.5px; }
.ui-top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ui-top-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--ui-line); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.ui-top-btn--dark { background: var(--ui-text); color: var(--ui-surface) !important; border-color: transparent; }

/* Page column */
.ui-main { width: 100%; max-width: 560px; margin: 0 auto; padding: 20px 16px 32px; display: flex; flex-direction: column; gap: 14px; }
.ui-main--wide { max-width: 960px; }
.ui-head { display: grid; gap: 6px; padding: 4px 4px 2px; }
.ui-head h1 { font-size: clamp(26px, 7vw, 32px); font-weight: 700; }
.ui-head p { color: var(--ui-muted); }

/* Bottom navigation (account pages), like the editor */
.ui-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  min-height: var(--ui-nav-h); padding-bottom: env(safe-area-inset-bottom);
  background: var(--ui-surface); border-top: 1px solid var(--ui-line);
}
.ui-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 56px; font-size: 12.5px; font-weight: 600; text-decoration: none; color: var(--ui-muted); }
.ui-nav a[aria-current="page"] { color: var(--ui-text); }
.ui-nav i { font-size: 18px; }

/* Footer */
.ui-foot { max-width: 560px; margin: 0 auto; padding: 8px 20px 28px; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ui-muted); font-size: 13px; }
.ui-foot a { text-decoration: none; }
.ui-foot a:hover { color: var(--ui-text); }
.ui-foot span:last-child { margin-left: auto; }
.ui-main--wide + .ui-foot { max-width: 960px; }
/* «Поддержать HubLink» (donation to HubLink): a small pill, first in the footer line. */
.ui-donate, .ui-company { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--ui-line); color: var(--ui-text); font-weight: 600; }
.ui-company svg { width: 14px; height: 14px; flex: none; }
.ui-donate::before { content: "♥"; color: #e0306f; font-weight: 400; }
.ui-foot .ui-donate:hover, .ui-foot .ui-company:hover, .as-foot .ui-donate:hover { color: var(--ui-text); border-color: currentColor; }
.ui-donate:focus-visible, .ui-company:focus-visible { outline: 3px solid var(--ui-brand); outline-offset: 2px; }

/* Cards and layout helpers (class names shared by all account pages) */
.stack { display: flex; flex-direction: column; gap: 14px; }
.card { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: var(--ui-radius); background: var(--ui-surface); border: 1px solid var(--ui-line); min-width: 0; }
.card h2 { font-size: 20px; font-weight: 700; }
.card h3 { font-size: 16px; font-weight: 600; }
.grid { display: grid; gap: 14px; min-width: 0; }
.section-head { display: grid; gap: 6px; }
.section-head .eyebrow + h2 { margin-top: -2px; }
.eyebrow { font-size: 12.5px; font-weight: 600; color: var(--ui-muted); }
.muted { color: var(--ui-muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions--fill > * { flex: 1 1 140px; }
.ui-or { display: flex; align-items: center; gap: 12px; color: var(--ui-muted); font-size: 13px; }
.ui-or::before, .ui-or::after { content: ""; flex: 1; height: 1px; background: var(--ui-line); }
.ui-alt { text-align: center; color: var(--ui-muted); font-size: 14px; }
.ui-alt a { color: var(--ui-text); font-weight: 600; }
.status-hero { display: grid; gap: 10px; }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.auth-grid, .auth-card { min-width: 0; }

/* Buttons: black main action, outlined secondary, soft purple for Plus */
.btn, .btn-ghost, .btn-soft, .btn-plus {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px;
  border: 0; border-radius: 14px; font-family: inherit; font-weight: 600; font-size: 16px; line-height: 1.2;
  text-decoration: none; text-align: center; cursor: pointer; white-space: nowrap;
}
.btn { background: var(--ui-text); color: var(--ui-surface) !important; }
.btn-ghost { background: var(--ui-surface); color: var(--ui-text); border: 1px solid var(--ui-line); }
.btn-soft { background: var(--ui-brand-soft); color: var(--ui-brand-ink) !important; }
.btn-plus { background: var(--ui-gradient); color: #fff !important; }
.btn:hover, .btn-plus:hover { filter: brightness(1.08); }
.btn-ghost:hover { background: var(--ui-bg); }
.btn[disabled], .btn-ghost[disabled] { opacity: .6; cursor: progress; }
form.card > .btn, form.card > .btn-ghost, .btn-block { width: 100%; }
.btn-small { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.field input, .field textarea, .field select, .wz-contact select, .wz-contact input {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--ui-line); border-radius: 14px;
  background: var(--ui-bg); color: var(--ui-text); font-family: inherit; font-size: 16px; font-weight: 400; line-height: 1.4;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus, .field textarea:focus, .field select:focus, .wz-contact select:focus, .wz-contact input:focus { outline: 2px solid var(--ui-brand); outline-offset: 1px; border-color: transparent; }
.field input[type="file"] { padding: 8px; font-size: 14px; color: var(--ui-muted); }
.field input[type="file"]::file-selector-button { margin-right: 10px; padding: 8px 14px; border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface); color: var(--ui-text); font: inherit; font-weight: 600; cursor: pointer; }
.field-hint { color: var(--ui-muted); font-size: 13px; font-weight: 400; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; font-size: 14px; }
.check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ui-brand); }
.ui-choice { margin: 0; padding: 0; border: 0; min-width: 0; }
.ui-choice legend { padding: 0 0 4px; font-weight: 600; font-size: 14px; }
.ui-choice .check { min-height: 36px; align-items: center; }
.ui-choice .check input { margin: 0; }
/* Numbered steps (account/payment-request.php). */
.ui-steps { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: ui-step; }
.ui-steps li { position: relative; display: grid; gap: 2px; padding-left: 44px; counter-increment: ui-step; }
.ui-steps li::before { content: counter(ui-step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ui-brand-soft); color: var(--ui-brand); font-weight: 700; font-size: 14px; }
.ui-steps b { font-size: 15px; }
/* Support conversation (account/support.php, setpanel/support.php): the viewer's own messages on the right. */
.ui-chat { display: grid; gap: 12px; }
.ui-msg { display: grid; gap: 6px; max-width: min(560px, 88%); padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: var(--ui-bg); }
.ui-msg--own { justify-self: end; border-radius: 16px 16px 4px 16px; background: var(--ui-brand-soft); }
.ui-msg-meta { color: var(--ui-muted); font-size: 12.5px; }
.ui-msg-meta b { color: var(--ui-text); font-weight: 600; }
.ui-msg-body { font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.ui-msg-image img { display: block; max-width: 100%; max-height: 360px; border-radius: 10px; }
.ui-ticket-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ui-steps span { color: var(--ui-muted); font-size: 14px; }

/* Messages */
.note { padding: 12px 14px; border-radius: 14px; background: var(--ui-bg); color: var(--ui-text); font-size: 14px; }
.note a { font-weight: 600; }
.ui-main > .note { background: var(--ui-surface); border: 1px solid var(--ui-line); }
.note.error { background: color-mix(in srgb, var(--ui-danger) 12%, transparent); color: var(--ui-danger); }
.note.success { background: color-mix(in srgb, var(--ui-ok) 12%, transparent); color: var(--ui-ok); }
.note.plus { background: var(--ui-brand-soft); color: var(--ui-brand-ink); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 10px; border: 1px solid currentColor; border-radius: 999px; font-size: 12.5px; font-weight: 500; background: transparent; color: var(--ui-muted); }
.badge.success { color: var(--ui-ok); }
.badge.warn { color: var(--ui-warn); }
.badge.danger { color: var(--ui-danger); }
.badge.plus { color: var(--ui-brand-ink); }
/* A red «!» sticker on a row icon: something new to look at (an unread support answer). */
.ui-icon--alert { position: relative; }
.ui-icon--alert::after { content: "!"; position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ui-danger); color: #fff; font-size: 11px; font-weight: 800; transform: rotate(8deg); box-shadow: 0 0 0 2px var(--ui-surface); }

/* Lists: rows separated by thin lines (as the editor's blocks list) */
.feature-list { display: flex; flex-direction: column; }
.feature-item { display: grid; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--ui-line); min-width: 0; }
.feature-item:first-child { padding-top: 0; }
.feature-item:last-child { border-bottom: 0; padding-bottom: 0; }
.feature-item > span { color: var(--ui-muted); font-size: 14px; }
.feature-item .actions { margin-top: 6px; }
.grid > .feature-item { padding: 14px; border: 1px solid var(--ui-line); border-radius: 14px; }
.kv { display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--ui-line); min-width: 0; }
.row:last-child { border-bottom: 0; }
.row > :last-child { text-align: right; min-width: 0; }
.ui-promo { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.ui-promo .field { flex: 1 1 180px; }
.ui-promo input { text-transform: uppercase; }
.ui-promo input[type="number"] { text-transform: none; }
.ui-amount { white-space: nowrap; }
.ui-plus-amount { color: var(--ui-ok); }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.copy-value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 400; overflow-wrap: anywhere; }
/* A status pill next to long text keeps its width instead of being squeezed letter by letter. */
.row > .badge { flex: none; white-space: nowrap; }

/* Tappable rows with an icon tile (dashboard, settings) */
.ui-rows { display: flex; flex-direction: column; }
.ui-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 0; border-bottom: 1px solid var(--ui-line); text-decoration: none; min-width: 0; }
.ui-row:last-child { border-bottom: 0; }
.ui-row > span:nth-child(2) { flex: 1; min-width: 0; }
.ui-row b { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 600; }
.ui-row b .badge { min-height: 22px; padding: 1px 8px; font-size: 12px; }
.ui-row small { display: block; color: var(--ui-muted); font-size: 13.5px; }
.ui-row .badge { flex: none; }
.ui-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--ui-bg); }
.ui-chevron { color: var(--ui-muted); flex: none; width: 20px; text-align: center; }
.card.ui-row { flex-direction: row; padding: 12px 16px; gap: 12px; border-bottom: 1px solid var(--ui-line); }
a.ui-row:hover b { text-decoration: underline; text-underline-offset: 3px; }

/* Big link to the author's page */
.ui-link-box { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 6px 6px 14px; border-radius: 14px; background: var(--ui-bg); }
.ui-link-box > a:first-child { flex: 1; min-width: 0; font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Plus */
.ui-plus-card { position: relative; overflow: hidden; }
.ui-plus-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--ui-gradient); }
.ui-price { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }

/* Plus checkout: period cards, summary, consents (texts switch with the chosen period via :has) */
.ui-periods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding: 0; border: 0; min-width: 0; }
.ui-periods legend { padding: 0 0 8px; font-weight: 600; font-size: 14px; }
.ui-period { position: relative; display: block; cursor: pointer; }
.ui-period input { position: absolute; opacity: 0; }
.ui-period > span { display: grid; gap: 2px; min-height: 64px; padding: 12px 14px; border: 1.5px solid var(--ui-line); border-radius: 14px; }
.ui-period b { font-size: 16px; }
.ui-period small { color: var(--ui-muted); font-size: 13px; }
.ui-period input:checked + span { border-color: var(--ui-brand); background: var(--ui-brand-soft); }
.ui-period input:focus-visible + span { outline: 3px solid var(--ui-brand); outline-offset: 2px; }
.ui-period-sticker { position: absolute; top: -10px; right: -6px; padding: 4px 9px; border-radius: 999px; background: var(--ui-gradient); color: #fff; font-size: 12px; font-style: normal; font-weight: 700; line-height: 1.2; white-space: nowrap; transform: rotate(4deg); box-shadow: 0 4px 10px rgba(236, 72, 153, .3); pointer-events: none; }
.ui-consents { display: grid; gap: 4px; }
form:has(input[name="period"][value="month"]:checked) [data-for="year"],
form:not(:has(input[name="period"][value="month"]:checked)) [data-for="month"] { display: none; }

/* On/off switch row (auto-renewal), same as the editor's block switches */
.ui-switch-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--ui-bg); }
.ui-switch-row > span { flex: 1; min-width: 0; }
.ui-switch-row b { display: block; font-weight: 600; }
.ui-switch-row small { display: block; color: var(--ui-muted); font-size: 13.5px; }
.ui-switch { position: relative; flex: none; width: 52px; height: 32px; padding: 0; border: 0; border-radius: 999px; background: var(--ui-line); cursor: pointer; }
.ui-switch span { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s ease; }
.ui-switch.is-on { background: var(--ui-ok); }
.ui-switch.is-on span { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) { .ui-switch span { transition: none; } }

/* Statistics */
.ui-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ui-stat { display: grid; gap: 2px; padding: 14px 16px; border-radius: 16px; background: var(--ui-surface); border: 1px solid var(--ui-line); min-width: 0; }
.ui-stat strong { font-size: 24px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A name instead of a number: smaller and allowed to wrap to two lines. */
.ui-stat--text strong { font-size: 18px; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ui-stat span { color: var(--ui-muted); font-size: 13px; }
.ui-bars { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.ui-bars li { display: grid; gap: 4px; }
.ui-bars div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.ui-bars div span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-bar { height: 8px; border-radius: 999px; background: var(--ui-bg); overflow: hidden; }
.ui-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ui-gradient); }
.ui-chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ui-chart-tip { font-size: 13px; font-weight: 600; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
.ui-chart-tip.is-picked { color: var(--ui-text); }
.ui-chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.ui-chart i { flex: 1; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--ui-gradient); opacity: .85; }
.ui-chart-bar {
  flex: 1; height: 100%; padding: 0; border: 0; background: transparent; cursor: pointer;
  display: flex; align-items: flex-end; min-width: 0; border-radius: 4px;
}
.ui-chart-bar span { display: block; width: 100%; height: var(--h, 3%); min-height: 3px; border-radius: 4px 4px 0 0; background: var(--ui-gradient); opacity: .78; transition: opacity .12s ease, transform .12s ease; }
.ui-chart-bar:hover span, .ui-chart-bar:focus-visible span, .ui-chart-bar.is-active span { opacity: 1; transform: scaleY(1.04); transform-origin: bottom; }
.ui-chart-bar.is-active { background: color-mix(in srgb, var(--ui-brand) 10%, transparent); }
.ui-chart-axis { display: flex; justify-content: space-between; color: var(--ui-muted); font-size: 12px; }
.ui-empty { color: var(--ui-muted); font-size: 14px; }

@media (min-width: 720px) {
  .ui-main--wide .grid, .grid.section-medium { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .ui-main:not(.ui-main--wide) .grid.section-medium { grid-template-columns: 1fr; }
  .ui-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  body.ui--nav { padding-bottom: 0; }
  .ui-nav { position: sticky; top: 65px; left: auto; right: auto; bottom: auto; z-index: 19; width: min(560px, calc(100% - 32px)); margin: 16px auto 0; border: 1px solid var(--ui-line); border-radius: 18px; padding-bottom: 0; }
  .ui-nav--wide { width: min(960px, calc(100% - 32px)); }
}
/* Telegram Mini App: Telegram draws its own header with the back button */
.ui--tg .ui-top { display: none; }
@media (min-width: 960px) { .ui--tg .ui-nav { top: 16px; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
/* Consent with the privacy policy (assets/js/consent.js): above the bottom menu on phones. */
.ui-consent { position: fixed; z-index: 50; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(720px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px 16px; padding: 12px 14px 12px 18px; border-radius: 16px; background: var(--ui-surface); color: var(--ui-text); border: 1px solid var(--ui-line); box-shadow: 0 10px 30px rgba(0, 0, 0, .14); }
.ui-consent p { margin: 0; flex: 1; font-size: 14px; line-height: 1.4; }
.ui-consent a { color: var(--ui-brand); }
.ui-consent .btn { flex: none; }
body.ui--nav .ui-consent { bottom: calc(var(--ui-nav-h) + 12px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 520px) { .ui-consent { flex-direction: column; align-items: stretch; } .ui-consent .btn { width: 100%; } }
@media (min-width: 960px) { body.ui--nav .ui-consent { bottom: 12px; } }

/* «Заявки» (account/leads.php) */
.ui-leads { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ui-lead { padding: 14px 16px; border: 1px solid var(--ui-line); border-radius: 14px; display: grid; gap: 8px; }
.ui-lead-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ui-lead-head time { color: var(--ui-muted); font-size: 13px; }
.ui-lead dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 14.5px; }
.ui-lead dt { color: var(--ui-muted); }
.ui-lead dd { margin: 0; overflow-wrap: anywhere; }
.ui-lead-delete { justify-self: end; }
/* «Excel» / «Для CRM» in «Заявки»: small outlined pills, the Excel one with its green sheet mark. */
.ui-export { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--ui-line); border-radius: 999px; background: var(--ui-surface); color: var(--ui-text); font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: border-color .15s, background .15s; }
.ui-export:hover { border-color: currentColor; }
.ui-export svg { flex: none; }
.ui-export i { color: var(--ui-muted); font-size: 14px; }
.ui-export--excel:hover { border-color: #107c41; background: color-mix(in srgb, #107c41 7%, var(--ui-surface)); }
/* QR code of the page (account/qr.php). */
.ui-qr { align-items: center; text-align: center; }
.ui-qr-box { width: min(280px, 100%); padding: 12px; border: 1px solid var(--ui-line); border-radius: 20px; background: #fff; }
.ui-qr-code svg { display: block; width: 100%; height: auto; }
.ui-qr-url { margin: 0; font-weight: 600; color: var(--ui-text); }
.ui-qr-colors { display: flex; justify-content: center; gap: 10px; margin: 0; padding: 0; border: 0; }
.ui-qr-colors legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ui-qr-color { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--ui-line); border-radius: 999px; font-size: 14px; cursor: pointer; }
.ui-qr-color input { position: absolute; opacity: 0; }
.ui-qr-color span { width: 22px; height: 22px; border-radius: 50%; background: var(--c); }
.ui-qr-color:has(input:checked) { border-color: var(--ui-text); box-shadow: inset 0 0 0 1px var(--ui-text); }
.ui-qr-color:has(input:focus-visible) { outline: 2px solid var(--ui-text); outline-offset: 2px; }

/* «Заявки» → аналитика: cards of a row share their height; an odd last card takes the whole row, no hole beside it. */
.ui-lead-grid { align-items: stretch; }
.ui-lead-grid > .card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.ui-lead-grid > .card { align-self: stretch; display: flex; flex-direction: column; gap: 12px; }
.ui-lead-grid > .card > .ui-chart { flex: 1; min-height: 120px; }
.ui-lead-grid code { white-space: nowrap; }
/* «Картинка для сторис» on the QR page: the 9:16 picture, phone-sized. */
.ui-story-image { display: block; width: min(100%, 300px); height: auto; aspect-ratio: 9 / 16; margin: 0 auto; border-radius: 18px; border: 1px solid var(--ui-line); background: var(--ui-bg); }

/* A pop-up (<dialog>): «Идеи и предложения» in the account. */
.ui-dialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-sizing: border-box; padding: 20px; border: 0; border-radius: 20px; background: var(--ui-surface); color: var(--ui-text, inherit); box-shadow: 0 20px 60px rgba(20, 16, 31, .25); }
.ui-dialog::backdrop { background: rgba(20, 16, 31, .45); }
.ui-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ui-dialog-head h2 { margin: 0; font-size: 20px; }
.ui-dialog-close { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--ui-bg); color: inherit; font-size: 16px; cursor: pointer; }

/* --- Мастер первого входа (account/welcome.php) и «Готовность страницы» в кабинете --- */
.ui-top-actions form { margin: 0; }
.ui-top-actions button.ui-top-btn { font: inherit; cursor: pointer; }
.wz-progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.wz-progress span { height: 5px; border-radius: 5px; background: var(--ui-line); }
.wz-progress span.is-done { background: var(--ui-gradient); }
.wz-step { margin: -4px 0 0; color: var(--ui-muted); font-size: 13.5px; }
.wz-step a { color: var(--ui-text); font-weight: 600; }
.wz-card { display: flex; flex-direction: column; gap: 14px; }
.wz-niches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wz-niche { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; border: 1.5px solid var(--ui-line); background: var(--ui-surface); cursor: pointer; }
.wz-niche input, .wz-theme input { position: absolute; opacity: 0; pointer-events: none; }
.wz-niche .ui-icon { margin-bottom: 4px; }
.wz-niche b { font-weight: 650; line-height: 1.25; }
.wz-niche small { color: var(--ui-muted); font-size: 13px; line-height: 1.35; }
.wz-niche:has(input:checked), .wz-theme:has(input:checked) .wz-mini { border-color: var(--ui-brand); box-shadow: 0 0 0 2px var(--ui-brand); }
.wz-niche:has(input:focus-visible), .wz-theme:has(input:focus-visible) .wz-mini { outline: 2px solid var(--ui-brand); outline-offset: 2px; }
.wz-photo { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--ui-bg); cursor: pointer; }
.wz-photo > span:nth-child(2) { flex: 1; min-width: 0; }
.wz-photo b { display: block; font-weight: 600; }
.wz-photo small { display: block; color: var(--ui-muted); font-size: 13.5px; }
.wz-photo input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.wz-avatar { display: grid; place-items: center; width: 64px; height: 64px; flex: none; border-radius: 50%; background: var(--ui-surface) center / cover no-repeat; border: 1px dashed var(--ui-line); color: var(--ui-muted); font-size: 20px; }
.wz-group { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 10px; }
.wz-group legend { padding: 0; margin-bottom: 8px; font-weight: 650; }
.wz-contact { display: grid; grid-template-columns: minmax(0, 120px) minmax(0, 1fr); gap: 8px; }
.wz-contact select, .wz-contact input { width: 100%; min-width: 0; }
.wz-themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-height: 60vh; overflow-y: auto; padding: 4px; margin: -4px; }
.wz-theme { position: relative; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.wz-mini { display: block; aspect-ratio: 390 / 560; overflow: hidden; border-radius: 14px; border: 1.5px solid var(--ui-line); background: var(--hl-bg); pointer-events: none; container-type: inline-size; contain: strict; }
.wz-mini .hl-page { display: block; width: 390px; min-height: 560px; padding: 18px 16px; transform: scale(calc(100cqw / 390px)); transform-origin: top left; }
.wz-theme-name { font-size: 13px; text-align: center; color: var(--ui-muted); }
.wz-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.wz-actions .btn { flex: 1 1 auto; }
@media (max-width: 420px) { .wz-themes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ui-ready { display: flex; flex-direction: column; gap: 8px; }
.ui-ready-head { display: flex; align-items: flex-start; gap: 10px; }
.ui-ready-head > div { flex: 1; }
.ui-ready-bar { height: 6px; border-radius: 6px; background: var(--ui-line); overflow: hidden; margin-top: 8px; }
.ui-ready-bar span { display: block; height: 100%; background: var(--ui-gradient); }
.ui-ready-close { border: 0; background: none; color: var(--ui-muted); font-size: 18px; padding: 2px 4px; cursor: pointer; }
.ui-ready .ui-row--wrap { flex-wrap: wrap; }
.ui-ready .ui-row--wrap > span:nth-child(2) { flex: 1 1 180px; }
.ui-ready .ui-row--wrap .btn-ghost { margin-left: 52px; }
.ui-ready .ui-row.is-done b { text-decoration: line-through; color: var(--ui-muted); font-weight: 500; }
.ui-ready .ui-row.is-done .ui-icon { background: var(--ui-brand-soft); color: var(--ui-ok); }

/* Confirm dialog (ui.js, data-confirm) and toast feedback (data-copy). */
.ui-confirm { display: grid; gap: 16px; }
.ui-confirm:not([open]) { display: none; }
.ui-confirm-text { margin: 0; font-size: 15px; line-height: 1.45; color: var(--ui-text); }
.ui-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px;
  border: 0; border-radius: 14px; background: var(--ui-danger); color: #fff !important;
  font-family: inherit; font-weight: 600; font-size: 16px; line-height: 1.2; cursor: pointer;
}
.btn-danger:hover { filter: brightness(1.06); }
.ui-toast {
  position: fixed; z-index: 60; left: 50%; bottom: 20px; transform: translate(-50%, 16px);
  padding: 10px 16px; border-radius: 999px; background: var(--ui-text); color: var(--ui-surface);
  font-size: 14px; font-weight: 600; box-shadow: 0 12px 30px rgba(0, 0, 0, .24);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
}
.ui-toast.is-show { opacity: 1; transform: translate(-50%, 0); }
body.ui--nav .ui-toast { bottom: calc(var(--ui-nav-h) + 14px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 960px) { body.ui--nav .ui-toast { bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { .ui-toast, .ui-chart-bar span { transition: none; } }

/* Password visibility toggle, collapsible promo field, and 6-digit OTP input. */
.ui-pass { position: relative; display: flex; align-items: center; }
.ui-pass input { padding-right: 48px; }
.ui-pass-btn {
  position: absolute; right: 4px; display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px;
  background: transparent; color: var(--ui-muted); font-size: 16px; cursor: pointer;
}
.ui-pass-btn:hover { color: var(--ui-text); }
.ui-promo-toggle { font-size: 14px; }
.ui-promo-toggle summary { color: var(--ui-muted); font-weight: 600; cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 7px; padding: 4px 0; }
.ui-promo-toggle summary::-webkit-details-marker { display: none; }
.ui-promo-toggle summary:hover { color: var(--ui-text); }
.ui-promo-chevron { font-size: 11px; transition: transform .18s ease; }
.ui-promo-toggle[open] summary { margin-bottom: 8px; color: var(--ui-text); }
.ui-promo-toggle[open] .ui-promo-chevron { transform: rotate(180deg); }
.field input.field-code { text-align: center; font-size: 24px; font-weight: 700; letter-spacing: .32em; font-variant-numeric: tabular-nums; padding-left: calc(14px + .32em); }

/* Segmented tabs (stats.php <-> account/leads.php) and quick leads search. */
.ui-seg {
  display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; align-self: flex-start;
  padding: 4px; border-radius: 14px; background: color-mix(in srgb, var(--ui-text) 6%, transparent);
  min-width: min(320px, 100%);
}
.ui-seg a {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 10px;
  text-decoration: none; font-size: 14px; font-weight: 600; color: var(--ui-muted);
}
.ui-seg a[aria-current="page"] { background: var(--ui-surface); color: var(--ui-text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.ui-seg-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px;
  padding: 0 6px; border-radius: 999px; background: var(--ui-brand-soft); color: var(--ui-brand-ink);
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ui-search { position: relative; display: flex; align-items: center; }
.ui-search i { position: absolute; left: 14px; color: var(--ui-muted); font-size: 14px; pointer-events: none; }
.ui-search input {
  width: 100%; min-height: 44px; padding: 8px 14px 8px 38px; border: 1px solid var(--ui-line);
  border-radius: 12px; background: var(--ui-bg); color: var(--ui-text); font: inherit; font-size: 15px;
}
.ui-search input:focus { outline: 2px solid var(--ui-brand); outline-offset: 1px; border-color: transparent; }

/* Collapsible PWA app card in account/dashboard.php */
.ui-app-card { padding: 14px 20px; gap: 0; }
.ui-app-sum {
  display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none;
  min-height: 44px; user-select: none;
}
.ui-app-sum::-webkit-details-marker { display: none; }
.ui-app-sum > span:nth-child(2) { flex: 1; min-width: 0; }
.ui-app-sum b { display: block; font-size: 16px; font-weight: 700; line-height: 1.25; }
.ui-app-sum small { display: block; color: var(--ui-muted); font-size: 13.5px; }
.ui-app-chevron { flex: none; color: var(--ui-muted); font-size: 13px; transition: transform .18s ease; }
.ui-app-card[open] .ui-app-chevron { transform: rotate(180deg); }
.ui-app-body { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
