:root {
  --ink: #101828; --ink-2: #344054; --muted: #667085; --subtle: #98a2b3; --line: #e4e7ec;
  --paper: #f6f8fb; --card: #fff; --nav: #101828; --nav-muted: #98a2b3; --nav-active: #ffb547;
  --lime: #c8f36a; --mint: #e9f8d0; --accent: #f79009; --red: #f04438; --blue: #2e90fa;
  --shadow: 0 16px 35px rgba(16, 24, 40, .07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); }
button, select, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }
a { color: var(--accent); }
code { font-size: .95em; background: #f2f4f7; padding: 1px 5px; border-radius: 5px; }
.skip-link { position: absolute; left: 12px; top: -50px; z-index: 20; background: var(--lime); color: var(--nav); padding: 11px 14px; border-radius: 0 0 10px 10px; font-weight: 800; }
.skip-link:focus { top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- boot & login ---------- */
.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 20% 10%, #c8f36a33, transparent 40%), var(--nav); }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 18px; padding: 30px 28px; box-shadow: 0 30px 60px #0006; display: grid; gap: 14px; }
.login-card h1 { margin: 6px 0 0; font-size: 24px; letter-spacing: -.6px; }
.login-card .muted { margin: -8px 0 4px; font-size: 12px; }
.login-brand { padding: 0; margin: 0; color: var(--ink); }
.wide { width: 100%; padding: 13px 15px; font-size: 13px; }

/* ---------- shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 276px; background: var(--nav); color: #fff; padding: 26px 18px 18px; display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 12px; margin-bottom: 40px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--lime); color: var(--nav); font-weight: 900; }
.brand strong { display: block; font-size: 16px; }
.brand small { display: block; color: #7aba18; font-size: 8px; letter-spacing: 2px; font-weight: 800; margin-top: 2px; }
.sidebar .brand small { color: var(--lime); }
.eyebrow { display: block; color: #667085; font-size: 9px; font-weight: 800; letter-spacing: 1.2px; margin: 0 12px 9px; }
.workspace-select { padding-bottom: 25px; border-bottom: 1px solid #ffffff14; }
.branch-button { display: flex; justify-content: space-between; align-items: center; border: 1px solid #ffffff12; background: #ffffff0a; color: #fff; border-radius: 12px; width: 100%; padding: 12px; font-size: 12px; text-align: left; }
.branch-button b, .branch-button small { display: block; }
.branch-button b { overflow-wrap: anywhere; }
.branch-button small { color: var(--nav-muted); font-size: 10px; margin-top: 4px; }
.nav-list { padding-top: 23px; display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--nav-muted); padding: 11px 12px; text-align: left; font-size: 12px; font-weight: 700; width: 100%; text-decoration: none; }
.nav-item:hover, .nav-item:focus-visible { background: #ffffff0c; color: #fff; }
.nav-item.active { background: var(--nav-active); color: var(--nav); box-shadow: 0 8px 20px #f7900933; }
.nav-icon { width: 19px; text-align: center; font-size: 16px; }
.sidebar-foot { margin-top: auto; padding-top: 20px; }
.sync-status { display: flex; align-items: center; gap: 10px; border-top: 1px solid #ffffff14; padding: 19px 8px 17px; color: var(--nav-muted); font-size: 10px; }
.sync-status strong, .sync-status small, .user-meta strong, .user-meta small { display: block; }
.sync-status strong { color: #fff; font-size: 10px; }
.sync-status small, .user-meta small { font-size: 10px; margin-top: 4px; color: var(--nav-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--lime); box-shadow: 0 0 0 4px #c8f36a1c; }
.status-dot.failed { background: var(--red); box-shadow: 0 0 0 4px #f044381c; }
.status-dot.pending { background: var(--nav-active); box-shadow: 0 0 0 4px #ffb5471c; }
.status-dot.neutral { background: var(--subtle); box-shadow: 0 0 0 4px #98a2b31c; }
.user-card { display: flex; align-items: center; gap: 9px; border-top: 1px solid #ffffff14; width: 100%; padding: 17px 7px 0; color: #fff; }
.user-meta { min-width: 0; flex: 1; color: inherit; text-decoration: none; border-radius: 6px; }
.user-meta:hover strong, .user-meta:focus-visible strong { text-decoration: underline; }
.user-meta strong { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; background: #ffd6ae; border-radius: 10px; color: #9c4e0b; font-size: 10px; font-weight: 800; }
.logout-button { border: 1px solid #ffffff1f; background: transparent; color: var(--nav-muted); border-radius: 8px; padding: 7px 9px; font-size: 10px; font-weight: 800; flex-shrink: 0; }
.logout-button:hover, .logout-button:focus-visible { color: #fff; background: #ffffff12; }
.main-content { min-width: 0; flex: 1; }
.topbar { height: 78px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 44px; }
.breadcrumbs { display: flex; gap: 10px; align-items: center; color: var(--subtle); font-size: 12px; min-width: 0; }
.breadcrumbs span, .breadcrumbs strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumbs strong { color: var(--ink); }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.role-pill { display: inline-flex; align-items: center; padding: 7px 10px; border-radius: 99px; background: var(--mint); color: #4c6b13; font-size: 10px; font-weight: 800; white-space: nowrap; }
.mobile-menu { display: none; border: 0; background: transparent; font-size: 22px; }
.sidebar-backdrop { display: none; }
.page-wrap { max-width: 1500px; padding: 38px 44px 60px; margin: auto; outline: none; }

/* ---------- page parts ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-head h1 { font-size: 32px; line-height: 1.1; margin: 7px 0 9px; letter-spacing: -1.2px; overflow-wrap: anywhere; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.overline { color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: 1.5px; }
.primary-button, .secondary-button { border-radius: 9px; padding: 11px 15px; font-size: 11px; font-weight: 800; }
.primary-button { border: 0; background: var(--ink); color: #fff; }
.secondary-button { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.secondary-button:hover:not(:disabled) { border-color: var(--subtle); }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #f790095e; outline-offset: 2px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 17px; }
.metric-card, .panel, .filter-bar, .info-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.metric-card { position: relative; overflow: hidden; padding: 20px 21px; min-width: 0; }
.metric-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.metric-icon { font-size: 18px; color: var(--accent); }
.metric-value { font-size: 26px; font-weight: 900; letter-spacing: -1px; margin: 14px 0 8px; overflow-wrap: anywhere; }
.metric-change { font-size: 10px; color: #5f9b17; font-weight: 700; }
.metric-change.negative { color: var(--red); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr); gap: 17px; margin-bottom: 17px; }
.visits-grid { grid-template-columns: minmax(0, 1fr); }
.panel { padding: 22px 23px; margin-bottom: 17px; }
.content-grid .panel { margin-bottom: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 21px; flex-wrap: wrap; }
.panel h2 { font-size: 15px; letter-spacing: -.25px; margin: 0; }
.panel-note, .muted { font-size: 11px; color: var(--muted); font-weight: 400; margin: 5px 0 0; }
.text-button { color: var(--accent); font-size: 11px; font-weight: 800; border: 0; background: transparent; text-decoration: none; padding: 4px 0; }
.table-panel { overflow: hidden; padding: 0; }
.table-panel .panel-head { padding: 22px 23px 16px; margin: 0; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.data-table th { padding: 10px 23px; color: var(--subtle); font-size: 9px; letter-spacing: .7px; text-align: left; text-transform: uppercase; font-weight: 900; border-top: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 14px 23px; border-top: 1px solid #f1f2f4; vertical-align: top; white-space: nowrap; }
.data-table td.wrap { white-space: normal; min-width: 180px; max-width: 360px; overflow-wrap: anywhere; }
.data-table .num { text-align: right; }
.data-table tbody tr:hover { background: #fffaf3; }
.cell-sub { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.error-text { color: #b42318; }
.load-more { display: flex; justify-content: center; padding: 16px; border-top: 1px solid #f1f2f4; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 99px; background: var(--mint); color: #4c6b13; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status.pending { background: #fff4de; color: #b54708; }
.status.failed { background: #feeceb; color: #b42318; }
.status.neutral { background: #f2f4f7; color: var(--muted); }
.filter-bar { display: flex; gap: 10px; align-items: end; padding: 15px 16px; margin-bottom: 17px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; min-width: 165px; }
.field label { font-size: 9px; color: var(--subtle); font-weight: 900; text-transform: uppercase; letter-spacing: .8px; }
.field { grid-template-columns: minmax(0, 1fr); max-width: 100%; }
.field select { max-width: 100%; min-width: 0; text-overflow: ellipsis; } /* a long option (YCLIENTS category, branch) must not widen the page */
.field select, .field input[type="date"] { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 9px 11px; color: var(--ink); font-size: 11px; font-family: inherit; }
.field input[aria-invalid] { border-color: #b42318; }
/* The period picker and filter groups lay their fields out directly in the filter bar. */
.period-picker, .filter-group { display: contents; }
.period-range { align-self: center; margin: 0; white-space: nowrap; }
.field-error { flex-basis: 100%; margin: 0; color: #b42318; font-size: 11px; }
.inline-filter .field { min-width: 150px; }
/* ---------- revenue by service group ---------- */
.revenue-table th[scope="row"] { padding: 12px 23px; text-align: left; font-size: 11px; font-weight: 700; color: var(--ink); text-transform: none; letter-spacing: 0; border-top: 1px solid #f1f2f4; white-space: normal; min-width: 200px; }
.revenue-table td { padding: 12px 23px; }
/* With comparison the table has 8 columns: keep it inside the panel at ~1400px. */
.revenue-table.comparing th, .revenue-table.comparing td { padding-left: 10px; padding-right: 10px; }
.revenue-table.comparing th[scope="row"] { padding-left: 16px; min-width: 160px; }
.revenue-table.comparing .service-row th[scope="row"] { padding-left: 34px; }
.revenue-table .cmp { font-size: 10px; }
.revenue-table th.cmp { white-space: normal; min-width: 72px; }
.expand-button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; padding: 0; color: var(--ink); font-weight: 800; text-align: left; }
.expand-icon { display: inline-block; transition: transform .15s; color: var(--accent); }
.expand-button[aria-expanded="true"] .expand-icon { transform: rotate(90deg); }
.revenue-table .service-row th[scope="row"] { padding-left: 46px; font-weight: 400; color: var(--ink-2); }
.revenue-table .service-row { background: #fcfcfd; }
.revenue-table tfoot th, .revenue-table tfoot td { border-top: 2px solid var(--line); font-weight: 900; }
.change { font-weight: 800; }
.change.positive { color: #4c6b13; }
.change.negative { color: #b42318; }
.change.new { color: #b54708; }
.revenue-note { padding: 14px 23px 18px; margin: 0; border-top: 1px solid #f1f2f4; }
.integration-warnings { margin: 10px 0 0; padding-left: 18px; color: #93370d; font-size: 11px; line-height: 1.5; }
.notice { padding: 13px 15px; margin-bottom: 16px; border-radius: 10px; background: #fff4de; color: #93370d; font-size: 11px; line-height: 1.5; }
.onboarding { border-color: #f7900955; }
.onboarding h2 { font-size: 16px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 12px; color: var(--ink-2); line-height: 1.5; }

/* ---------- states ---------- */
.state-block { text-align: center; padding: 28px 15px; color: var(--muted); }
.state-block strong { display: block; color: var(--ink); font-size: 14px; margin-bottom: 6px; }
.state-block p { font-size: 11px; margin: 0 auto 12px; max-width: 460px; line-height: 1.5; }
.state-symbol { font-size: 23px; color: var(--accent); margin-bottom: 6px; }
.state-error .state-symbol { color: var(--red); }
.state-empty .state-symbol { color: #b54708; }
.state-loading .state-symbol { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; right: 25px; bottom: 25px; z-index: 30; max-width: min(420px, calc(100vw - 32px)); background: var(--nav); color: #fff; padding: 12px 16px; border-radius: 9px; font-size: 12px; line-height: 1.4; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: #b42318; }

/* ---------- campaigns ---------- */
.campaign-list { display: grid; gap: 12px; }
.campaign-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 16px; border: 1px solid var(--line); border-radius: 11px; }
.campaign-text { min-width: 0; flex: 1; }
.campaign-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.campaign-item h3 { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.campaign-meta { margin: 6px 0 0; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.campaign-body { margin: 10px 0 0; font-size: 12px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; background: #f9fafb; border-radius: 8px; padding: 10px 12px; }
.campaign-item details { margin-top: 8px; font-size: 11px; }
.campaign-item summary { cursor: pointer; color: var(--accent); font-weight: 700; }
.moderation-actions { display: grid; gap: 8px; min-width: 240px; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- forms ---------- */
.form-panel { border-color: #f7900955; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.span-2 { grid-column: span 2; }
.form-field { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.form-field label, .form-field legend, .field-label { font-size: 10px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .7px; padding: 0; }
.form-field legend { margin-bottom: 6px; }
.form-field input:not([type="checkbox"]):not([type="radio"]), .form-field textarea, .form-field select, .reason-input, .copy-input {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 10px 12px; color: var(--ink); font-size: 13px;
}
.form-field textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.reason-input { font-size: 11px; padding: 8px 10px; }
.field-hint { color: var(--subtle); font-size: 10px; }
.form-error { margin: 14px 0 0; padding: 10px 12px; border-radius: 9px; background: #feeceb; color: #b42318; font-size: 12px; }
.login-card .form-error { margin: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.radio, .check { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 500; cursor: pointer; }
.form-field label.radio, .form-field label.check { font-size: 12px; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 500; }
.check-list { display: flex; flex-wrap: wrap; gap: 10px 18px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; }
.form-subhead { margin: 22px 0 4px; font-size: 14px; }
.alert-rule { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; min-width: 0; overflow-wrap: anywhere; } /* a fieldset is min-content wide by default: 390 px would scroll */
.alert-rule legend { padding: 0 4px; }
.alert-rule .form-grid { margin-top: 8px; }

/* ---------- settings ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 17px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 10px 14px; font-size: 12px; font-weight: 800; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.active { color: var(--ink); border-color: var(--accent); }
.integration-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 17px; }
.integration-card { border: 1px solid var(--line); border-radius: 16px; padding: 19px; background: #fff; box-shadow: var(--shadow); }
.integration-card.off { border-color: #fecdca; }
.integration-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.integration-card h3 { margin: 0; font-size: 18px; }
.integration-sub { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.integration-detail { margin: 14px 0 0; font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.copy-row { display: flex; gap: 8px; }
.copy-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.sync-requested { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin: 0 0 14px; }

/* ---------- responsive ---------- */
/* Клиенты (card 0002 §3, §5) */
.field input[type="search"] { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 9px 11px; color: var(--ink); font-size: 11px; font-family: inherit; }
.search-field { min-width: 220px; }
.search-main { margin-bottom: 16px; max-width: 640px; }
.search-main label { font-weight: 600; }
.search-main input { font-size: 1.05rem; padding: 10px 12px; }
.search-field input { width: 100%; box-sizing: border-box; min-width: 0; }
.segment-counters { display: grid; gap: 10px; }
.segment-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.segment-caption { min-width: 150px; font-size: 9px; color: var(--subtle); font-weight: 900; text-transform: uppercase; letter-spacing: .8px; }
.segment-counter { display: inline-flex; align-items: center; gap: 9px; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 12px; font-size: 11px; font-weight: 700; color: var(--ink); }
.segment-counter strong { font-size: 13px; }
.segment-counter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.category-chip { display: inline-flex; align-items: center; padding: 4px 8px; margin: 1px 0; border-radius: 99px; background: #f2f4f7; color: var(--ink); font-size: 10px; font-weight: 800; white-space: nowrap; }
.client-link { font-weight: 800; color: var(--ink); }
.client-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.client-facts { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 10px 16px; margin: 0; font-size: 12px; }
.client-facts dt { color: var(--muted); }
.client-facts dd { margin: 0; overflow-wrap: anywhere; }
.visit-services { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 220px; }
.visit-services li { display: flex; justify-content: space-between; gap: 16px; }
.visit-services .num { white-space: nowrap; }
/* Ссылки и QR салонов, подписчики по салонам (card 0002 §4а) */
.bot-link-row { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; padding: 16px 0; border-top: 1px solid #f1f2f4; }
.bot-link-text { flex: 1; min-width: 0; }
.bot-link-text h3 { margin: 0 0 10px; font-size: 13px; overflow-wrap: anywhere; }
.qr-box { margin: 0; display: grid; gap: 6px; justify-items: center; }
.qr-preview { width: 200px; min-height: 120px; display: grid; place-items: center; }
.qr-preview img { width: 200px; height: 200px; image-rendering: pixelated; }
.qr-preview .state-block { padding: 10px; }
.qr-pair { display: flex; gap: 20px; flex-wrap: wrap; justify-content: flex-end; }
.qr-channel { width: 240px; max-width: 100%; align-content: start; }
.qr-channel .copy-row { width: 100%; }
.qr-title { font-weight: 600; font-size: 13px; }
.channel-max { background: #eef2ff; color: #3730a3; }
.channel-telegram { background: #e0f2fe; color: #075985; }
.channel-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.channel-table th, .channel-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #f1f2f4; }
.priority-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
/* Конструктор рассылок (card 0004, tech §7) */
.stepper { margin-bottom: 14px; }
.stepper ol { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.stepper .step { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 12px; color: var(--ink-2); }
.stepper .step.current { background: var(--nav); color: #fff; border-color: var(--nav); }
.step-number { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #f2f4f7; color: var(--ink); font-size: 11px; }
.stepper-compact { display: none; margin: 0; font-weight: 800; font-size: 13px; }
.builder-panel h3, .builder-subhead { font-size: 13px; margin: 18px 0 8px; }
.field-label { display: block; font-size: 11px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.chip-picker, .insert-row, .chip-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.insert-row { margin-bottom: 8px; }
.chip-toggle { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-size: 12px; min-height: 36px; }
.chip-toggle[aria-pressed="true"] { background: var(--mint); border-color: #a6d86b; font-weight: 700; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #f2f4f7; border-radius: 999px; padding: 4px 4px 4px 12px; font-size: 12px; max-width: 100%; overflow-wrap: anywhere; }
.chip-remove { flex: none; border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; width: 32px; height: 32px; border-radius: 50%; }
.chip-remove:hover { background: #fee4e2; color: var(--red); }
.add-source { display: flex; align-items: flex-end; gap: 8px; }
.add-source .field { flex: 1; min-width: 0; }
.builder-search { margin-top: 18px; max-width: 480px; }
.manual-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 12px; }
.manual-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.manual-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; border-bottom: 1px solid #f1f2f4; padding: 4px 0; }
.manual-list li span { min-width: 0; overflow-wrap: anywhere; }
.found-list { max-width: 480px; margin-top: 8px; }
.tpl-preview { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; color: var(--ink-2); }
.tpl-token { background: var(--mint); border-radius: 4px; padding: 0 2px; }
.tpl-error { background: #fee4e2; color: var(--red); border-radius: 4px; padding: 0 2px; text-decoration: underline wavy; }
.sample-text { background: #f9fafb; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.sample-text p { margin: 0; }
.preview-summary { font-size: 15px; font-weight: 800; margin: 14px 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs [role="tab"] { border: 0; background: transparent; padding: 10px 14px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; min-height: 44px; }
.tabs [aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.preview-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.preview-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.preview-row { border-top: 1px solid #f1f2f4; padding: 10px 0; display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: 4px 16px; align-items: start; font-size: 12px; }
.preview-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; overflow-wrap: anywhere; }
.preview-text { min-width: 0; }
.preview-text summary { list-style: none; cursor: pointer; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-text summary::-webkit-details-marker { display: none; }
.preview-text[open] summary { display: none; }
.preview-text p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.builder-actions { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.test-send { display: grid; gap: 4px; max-width: 360px; }
.save-state { min-height: 18px; font-size: 12px; }

/* Клиенты: выбор строк и «В рассылку (N)» (card 0004, сценарий Б) */
.select-cell { width: 44px; padding-right: 0 !important; }
.select-box { display: inline-grid; place-items: center; width: 44px; height: 44px; margin: -12px -10px; cursor: pointer; }
.select-box input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.select-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 23px; background: #fffaf3; border-top: 1px solid var(--line); font-size: 12px; }
.handoff-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--nav); color: #fff; border-radius: 14px; box-shadow: var(--shadow); }
.handoff-bar small { color: var(--nav-muted); }
.handoff-bar [data-handoff] { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 12px 20px; border: 0; border-radius: 12px; background: var(--lime); color: var(--nav); font-weight: 900; font-size: 14px; box-shadow: 0 6px 16px #0004; }
.handoff-bar [data-handoff]:disabled { background: #475467; color: #d0d5dd; box-shadow: none; }
.handoff-bar [data-clear-selection] { background: transparent; color: #fff; border: 1px solid #ffffff55; }
/* Мастера (spec 0006) */
.staff-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px 20px 6px; }
.staff-kpi { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.staff-kpi strong { font-size: 20px; }
.staff-footnote, .staff-summary + .notice { margin: 6px 20px 10px; }
.staff-row { cursor: pointer; }
.staff-name { font-size: 13px; font-weight: 700; white-space: normal; }
.staff-row:hover, .staff-row:focus-visible { background: #f9fafb; }
.staff-details { padding: 6px 0 12px; }
.staff-details-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.staff-details-grid h3, .staff-subhead { font-size: 13px; margin: 8px 0; }
.staff-subhead { padding: 0 20px; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 12px; }
.weekday-bars { list-style: none; margin: 0; padding: 0 20px; display: grid; gap: 6px; }
.weekday-bar { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 12px; }
.weekday-track { height: 10px; border-radius: 5px; background: #f2f4f7; overflow: hidden; }
.weekday-fill { display: block; height: 100%; background: var(--nav-active); }
.table-panel > div > .panel-note { padding: 0 20px 16px; }
@media (max-width: 760px) {
  .staff-summary { grid-template-columns: 1fr; padding: 16px 16px 4px; }
  .staff-table thead { display: none; }
  .staff-table, .staff-table tbody, .staff-table tr, .staff-table th, .staff-table td { display: block; width: 100%; }
  .staff-table .staff-row { padding: 10px 0; border-bottom: 1px solid #eaecf0; }
  .staff-table .staff-row td { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: baseline; text-align: right; border: 0; padding-top: 3px; padding-bottom: 3px; }
  .staff-table .staff-row td::before { content: attr(data-label); color: var(--muted); text-align: left; }
  .staff-table .staff-row td.staff-name { display: block; text-align: left; white-space: normal; }
  .staff-table .staff-row td.staff-name::before { content: none; }
  .staff-details-grid { grid-template-columns: 1fr; }
  .weekday-bars, .staff-subhead { padding: 0 16px; }
  .weekday-bar { grid-template-columns: 24px minmax(0, 1fr); }
  .weekday-value { grid-column: 2; }
}

@media print {
  /* «Ссылки и QR салонов»: one salon per card, MAX and Telegram in one line */
  .bot-link-row { break-inside: avoid; }
  .qr-pair { flex-wrap: nowrap; }
  .qr-channel .copy-row button, [data-qr-download], [data-print] { display: none; }
}
.source-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; max-width: 480px; }
.source-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; border-bottom: 1px solid #f1f2f4; padding-bottom: 6px; }
.source-list li span { overflow-wrap: anywhere; }

/* Профиль → Мои уведомления (spec 0007) */
.profile-channels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 14px; }
.profile-channel { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.profile-channel h3 { margin: 0; font-size: 14px; }
.profile-channel .qr-box { justify-items: start; }
.profile-channel .qr-box img { max-width: 100%; height: auto; }
.profile-preferred { margin: 0 0 12px; }
.form-actions .secondary-button { margin-left: 8px; }
.staff-link-channel { display: block; white-space: nowrap; }
.card-table td { white-space: normal; overflow-wrap: anywhere; }
/* journal and staff tables become cards on phones (data-label), no horizontal scroll at 390 px */
@media (max-width: 760px) {
  .card-table thead { display: none; }
  .card-table, .card-table tbody, .card-table tr, .card-table td { display: block; width: 100%; }
  .card-table tr { padding: 10px 0; border-bottom: 1px solid #eaecf0; }
  .card-table td { display: grid; grid-template-columns: minmax(90px, auto) minmax(0, 1fr); column-gap: 12px; align-items: baseline; border: 0; padding-top: 3px; padding-bottom: 3px; }
  .card-table td::before { content: attr(data-label); color: var(--muted); }
  .card-table td > .cell { min-width: 0; overflow-wrap: anywhere; }
  .staff-link-channel { white-space: normal; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
  .settings-tabs { flex-wrap: wrap; overflow-x: visible; }
  .form-actions .secondary-button { margin: 8px 0 0; }
}

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
  .page-wrap { padding: 30px 25px; }
  .topbar { padding: 0 25px; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; z-index: 15; left: -288px; top: 0; bottom: 0; height: auto; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 12px 0 30px #10182866; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 14; background: #10182866; }
  .topbar { padding: 0 16px; height: 64px; }
  .mobile-menu { display: block; padding: 4px 6px; }
  .breadcrumbs { flex: 1; }
  .breadcrumbs span { display: none; }
  .page-wrap { padding: 22px 16px 40px; }
  .page-head { display: block; margin-bottom: 20px; }
  .page-head h1 { font-size: 26px; }
  .head-actions { margin-top: 16px; }
  .metric-grid { gap: 10px; margin-bottom: 10px; }
  .metric-card { padding: 14px; }
  .metric-value { font-size: 19px; margin: 10px 0 6px; }
  .metric-label { font-size: 10px; }
  .panel { padding: 18px 16px; }
  .table-panel { padding: 0; }
  .table-panel .panel-head { padding: 18px 16px 14px; }
  .data-table th, .data-table td { padding-left: 16px; padding-right: 16px; }
  .filter-bar { padding: 12px; }
  .filter-bar .field { flex: 1 1 140px; min-width: 0; }
  .campaign-item { flex-direction: column; }
  .moderation-actions { min-width: 0; width: 100%; }
  .form-grid, .integration-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .copy-row { flex-direction: column; }
  .profile-channels { grid-template-columns: 1fr; }
  .client-grid { grid-template-columns: minmax(0, 1fr); }
  .channel-table th, .channel-table td { padding: 5px 4px; }
  .bot-link-row { flex-direction: column; }
  .segment-caption { min-width: 0; flex-basis: 100%; }
  .search-field { min-width: 0; }
  .toast { right: 16px; left: 16px; bottom: 16px; max-width: none; }
  .stepper ol { display: none; }
  .stepper-compact { display: block; }
  .manual-grid { grid-template-columns: minmax(0, 1fr); }
  .preview-row { grid-template-columns: minmax(0, 1fr); }
  .builder-actions > * { width: 100%; }
  .builder-actions .primary-button, .builder-actions .secondary-button { width: 100%; }
  /* the client list becomes cards; the checkbox is a 44×44 target in the top left corner */
  .selectable-table thead { display: none; }
  .selectable-table, .selectable-table tbody { display: block; }
  .selectable-table tr { display: block; position: relative; padding: 10px 16px 10px 56px; border-top: 1px solid #f1f2f4; }
  .selectable-table td { display: block; padding: 2px 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
  .selectable-table td.wrap { min-width: 0; max-width: none; }
  .selectable-table td.select-cell { position: absolute; left: 6px; top: 6px; width: 44px; padding: 0; }
  .selectable-table .select-box { margin: 0; }
  .select-banner { padding: 10px 16px; }
  .handoff-bar { position: fixed; left: 0; right: 0; bottom: 0; border-radius: 0; margin: 0; }
  .handoff-bar .item-actions { display: flex; width: 100%; gap: 8px; }
  .handoff-bar [data-handoff] { flex: 1 1 auto; width: 100%; }
  .has-handoff { min-height: 110px; }
}
.share-of { display: block; font-size: 0.75rem; }
.hint-mark { opacity: 0.6; cursor: help; }
.revenue-legend strong { font-weight: 600; }
