:root {
  --ink: #171a2e;
  --muted: #6f7588;
  --line: #e5e8ee;
  --surface: #ffffff;
  --surface-soft: #f8f9fb;
  --bg: #f4f5f8;
  --navy: #222a5b;
  --accent: #ff5c35;
  --accent-soft: #fff0eb;
  --green: #16825d;
  --green-soft: #eaf8f2;
  --yellow: #a86600;
  --yellow-soft: #fff7df;
  --red: #cc3b39;
  --red-soft: #fff0ef;
  --radius: 18px;
  --shadow: 0 10px 35px rgba(28, 35, 66, .055);
  --type-caption: 13px;
  --type-secondary: 14px;
  --type-body: 16px;
  --type-control: 16px;
  --type-heading-small: 18px;
  --type-heading-medium: 22px;
}
* { box-sizing: border-box; }
html { color-scheme: light; font-family: Inter, "Segoe UI", Arial, system-ui, sans-serif; color: var(--ink); background: var(--bg); }
body { margin: 0; min-width: 320px; }
a { color: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px 22px; background: #171d43; color: #fff; display: flex; flex-direction: column; }
.brand-row { display: flex; align-items: flex-start; gap: 8px; }
.brand { flex: 1; display: flex; align-items: center; gap: 12px; padding: 0 10px 32px; font-weight: 800; text-decoration: none; letter-spacing: -.03em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--accent); }
.theme-toggle { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid rgba(255,255,255,.16); border-radius: 11px; color: #fff; background: rgba(255,255,255,.08); font-size: 17px; cursor: pointer; transition: transform .2s, background .2s; }
.theme-toggle:hover { transform: translateY(-1px); background: rgba(255,255,255,.15); }
.nav { display: grid; gap: 6px; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.nav a { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 11px; color: #abb1c8; text-decoration: none; font-size: 14px; font-weight: 600; transition: .2s; }
.nav a:hover, .nav a.active { color: #fff; background: rgba(255,255,255,.09); }
.nav a span { font-size: 18px; width: 18px; text-align: center; }
.sidebar-note { margin-top: auto; padding: 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; color: #abb1c8; font-size: 11px; line-height: 1.5; }
.sidebar-note strong { color: #fff; }
.live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #49d39b; box-shadow: 0 0 0 4px rgba(73,211,155,.12); }
.account-card { display: flex; align-items: center; gap: 9px; min-width: 0; }
.account-card > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-card small { display: block; max-width: 140px; overflow: hidden; color: #8f96b3; text-overflow: ellipsis; }
.avatar { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #fff; background: var(--accent); font-weight: 800; }
.account-links { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.account-links a, .account-links button { padding: 0; border: 0; color: #abb1c8; background: none; font: inherit; text-decoration: none; cursor: pointer; }
.main { padding: 38px 42px 60px; overflow: hidden; }
.app-topbar { position: relative; z-index: 45; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 14px; min-height: 54px; margin-bottom: 24px; }
.app-topbar .agency-switcher { flex: 1; min-width: 0; margin-bottom: 0; }
.topbar-spacer { flex: 1; }
.user-menu { position: relative; flex: 0 0 auto; }
.user-menu > summary { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 9px 6px 7px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--surface); box-shadow: 0 8px 24px rgba(28,35,66,.06); list-style: none; cursor: pointer; transition: border-color .18s, box-shadow .18s, transform .18s; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { border-color: #cfd4e1; box-shadow: 0 12px 30px rgba(28,35,66,.1); transform: translateY(-1px); }
.user-menu[open] > summary { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.user-menu-icon { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; color: #fff; background: linear-gradient(145deg, var(--accent), #ff825f); box-shadow: 0 6px 14px rgba(255,92,53,.22); }
.user-menu-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.user-menu-identity { display: grid; min-width: 0; text-align: left; }
.user-menu-identity strong { max-width: 150px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-identity small { max-width: 170px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-chevron { color: var(--muted); font-size: 15px; transition: transform .18s; }
.user-menu[open] .user-menu-chevron { transform: rotate(180deg); }
.user-menu-popover { position: absolute; top: calc(100% + 9px); right: 0; width: min(300px, calc(100vw - 36px)); overflow: hidden; padding: 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 22px 55px rgba(23,29,67,.18); }
.user-menu-profile { display: grid; gap: 3px; margin: 2px 2px 7px; padding: 11px 12px; border-radius: 10px; background: var(--bg); }
.user-menu-profile strong, .user-menu-profile small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-profile strong { font-size: 12px; }
.user-menu-profile small { color: var(--muted); font-size: 10px; }
.user-menu-popover > a { display: grid; grid-template-columns: 28px minmax(0,1fr); align-items: center; gap: 9px; padding: 10px 11px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.user-menu-popover > a:hover { background: var(--bg); }
.user-menu-popover > a > span:first-child { color: var(--accent); font-size: 17px; text-align: center; }
.user-menu-popover > a > span:last-child { display: grid; gap: 2px; min-width: 0; }
.user-menu-popover > a strong { font-size: 11px; }
.user-menu-popover > a small { color: var(--muted); font-size: 9px; }
.user-menu-popover form { margin: 7px 2px 1px; padding-top: 7px; border-top: 1px solid var(--line); }
.user-menu-popover form button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 11px; border: 0; border-radius: 10px; color: var(--red); background: transparent; font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }
.user-menu-popover form button:hover { background: var(--red-soft); }
.app-footer { display: flex; justify-content: flex-end; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 38px; padding-top: 22px; border-top: 1px solid var(--line); }
.footer-privacy-link, .auth-privacy-link { color: var(--muted); font-size: 12px; font-weight: 700; }
.auth-privacy-link { position: absolute; bottom: 24px; right: 28px; }
.consent-checkbox a, .privacy-document a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.consent-checkbox { display: grid !important; grid-template-columns: 20px 1fr; align-items: start; gap: 10px !important; font-size: 12px !important; line-height: 1.5; }
.consent-checkbox input { width: 18px !important; min-height: 18px !important; margin: 2px 0 0; }
.consent-checkbox .errorlist { grid-column: 2; }
.privacy-document { width: min(920px, 100%); margin: 0 auto; padding: 42px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.auth-shell .privacy-document { margin-top: 76px; }
.privacy-hero { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.privacy-document h1 { margin: 8px 0 12px; font-size: clamp(32px, 5vw, 52px); line-height: 1; }
.privacy-document section { padding-top: 24px; }
.privacy-document h2 { margin: 0 0 9px; font-size: 19px; }
.privacy-document p, .privacy-document li { color: var(--muted); font-size: 14px; line-height: 1.7; }
.privacy-document ul { padding-left: 22px; }
.privacy-consent-card { width: min(620px, 100%); margin: 8vh auto; padding: 36px; }
.privacy-consent-card h1 { margin: 7px 0 10px; font-size: 34px; }
.hiqu-credit { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; font-weight: 700; text-decoration: none; }
.hiqu-credit:hover { color: var(--ink); }
.hiqu-credit img { width: 34px; height: 34px; object-fit: contain; }
.sidebar-credit { margin: 14px 6px 0; color: #8f96b3; }
.sidebar-credit:hover { color: #fff; }
.sidebar-credit img { width: 28px; height: 28px; filter: invert(1); opacity: .85; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 11px; text-transform: uppercase; letter-spacing: .14em; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 3vw, 42px); letter-spacing: -.045em; line-height: 1.05; }
.page-header p:not(.eyebrow) { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.agency-switcher { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.agency-switcher > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.agency-switcher > div strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agency-switcher form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; max-width: 100%; }
.agency-switcher label { color: var(--muted); font-size: 13px; }
.agency-switcher select { min-width: min(230px, 100%); max-width: 100%; margin: 0; }
.bid-apply-form { display: grid; gap: 8px; min-width: 220px; }
.bid-apply-form label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.bid-apply-form select, .bid-apply-form input { margin: 0; }
.device-auth-card { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-bottom: 24px; }
.device-auth-card > div { min-width: 0; }
.device-auth-card h2 { margin: 4px 0 10px; font-size: 18px; }
.device-code { display: inline-block; margin-top: 8px; padding: 12px 18px; border: 1px dashed var(--accent); border-radius: 12px; color: var(--text); background: var(--surface-soft); font: 800 28px/1 monospace; letter-spacing: .16em; user-select: all; }
.device-auth-card form { margin-top: 12px; }
.period-filter { display: flex; align-items: center; gap: 10px; padding: 5px 5px 5px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; white-space: nowrap; font-size: 12px; color: var(--muted); }
.period-filter select { border: 0; outline: none; background: #f1f2f6; border-radius: 7px; padding: 8px 9px; font: inherit; font-weight: 700; color: var(--ink); }
.period-filter em { padding-right: 7px; color: #c27819; font-size: 10px; font-style: normal; font-weight: 800; }
.period-custom-fields { display: none; align-items: center; gap: 6px; }
.period-filter.is-custom .period-custom-fields { display: flex; }
.period-filter.is-custom .period-dates { display: none; }
.period-custom-fields label { display: flex; align-items: center; gap: 4px; }
.period-custom-fields input { width: 132px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--surface); font: inherit; }
.period-custom-fields button { min-height: 34px; padding: 0 11px; border: 0; border-radius: 7px; color: #fff; background: var(--navy); font: inherit; font-weight: 800; cursor: pointer; }
.period-error { margin-top: -18px; margin-bottom: 22px; color: var(--red); font-size: 12px; font-weight: 700; }
.period-summary { display: flex; align-items: center; gap: 10px; margin: -14px 0 20px; color: var(--muted); font-size: 12px; }
.period-summary strong { color: var(--ink); }
.metric-change { display: inline-flex; align-items: center; gap: 3px; margin-left: 5px; font-weight: 800; }
.metric-change.up { color: var(--green); }
.metric-change.down { color: var(--red); }
.metric-change.neutral { color: var(--muted); }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 43px; padding: 0 18px; border: 0; border-radius: 11px; font: 700 13px Inter, "Segoe UI", Arial, system-ui, sans-serif; text-decoration: none; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--accent); box-shadow: 0 8px 18px rgba(255,92,53,.22); }
.button-secondary { color: var(--navy); background: #fff; border: 1px solid var(--line); }
.button-disabled { color: #969ba9; background: #eef0f4; cursor: not-allowed; box-shadow: none; }
.button-disabled:hover { transform: none; }
.button-wide { width: 100%; }
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { padding: 19px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.kpi-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.kpi strong { display: block; margin: 9px 0 5px; font-size: 22px; letter-spacing: -.04em; }
.kpi-note { font-size: 10px; color: var(--muted); }
.kpi-note.positive { color: var(--green); font-weight: 800; }
.kpi-accent { color: #fff; background: var(--navy); border-color: var(--navy); }
.kpi-accent .kpi-label, .kpi-accent .kpi-note { color: #b8beda; }
.ad-kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.ad-filters { display: grid; grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 1fr) auto auto; align-items: end; gap: 12px; margin-bottom: 18px; padding: 16px; }
.ad-filters label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.ad-filters input, .ad-filters select { min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); font: inherit; }
.ad-filters > a { align-self: center; color: var(--muted); font-size: 12px; font-weight: 700; }
.ad-table-panel { overflow: hidden; }
.ads-table { min-width: 1240px; }
.ads-table td { vertical-align: top; }
.ads-table td > strong, .ads-table td > small { display: block; }
.ads-table td > small { margin-top: 5px; }
.table-sort { display: inline-flex; align-items: center; gap: 5px; color: inherit; text-decoration: none; white-space: normal; overflow-wrap: anywhere; }
.table-sort:hover { color: var(--accent); }
.table-sort span { color: var(--accent); font-size: 13px; }
.ad-copy-cell { min-width: 290px; max-width: 390px; }
.ad-copy-cell strong { margin: 5px 0 3px; color: var(--ink); font-size: 15px; }
.ad-copy-cell b { display: block; color: var(--ink); font-size: 12px; }
.ad-copy-cell p { margin: 7px 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.ad-id { color: var(--accent); font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.ad-status { display: inline-block; margin-bottom: 5px; color: var(--ink); font-weight: 800; }
.back-link { display: inline-block; margin-bottom: 14px; color: var(--muted); font-size: 12px; font-weight: 800; text-decoration: none; }
.ad-detail-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; margin-bottom: 16px; }
.ad-preview { padding: 26px; }
.ad-preview > span { color: var(--accent); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .12em; }
.ad-preview h2 { margin: 18px 0 4px; font-size: 25px; }
.ad-preview h3 { margin: 0 0 15px; font-size: 17px; }
.ad-preview p { color: var(--muted); line-height: 1.55; }
.ad-preview a { display: block; margin-bottom: 16px; color: #4774d9; font-size: 12px; overflow-wrap: anywhere; }
.ad-preview small { color: var(--muted); }
.ad-result-card { display: grid; grid-template-columns: 1fr 1fr; padding: 10px; }
.ad-result-card div { padding: 18px; border-bottom: 1px solid var(--line); }
.ad-result-card div:nth-last-child(-n+2) { border-bottom: 0; }
.ad-result-card span, .ad-result-card strong { display: block; }
.ad-result-card span { margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.ad-result-card strong { color: var(--ink); font-size: 18px; }
.ai-advisor { padding: 28px; }
.ai-advisor-head { display: flex; justify-content: space-between; gap: 20px; }
.ai-advisor-head p { margin-bottom: 0; color: var(--muted); }
.ai-badge { display: grid; place-items: center; flex: 0 0 52px; height: 52px; border-radius: 16px; color: #fff; background: linear-gradient(135deg, #17234f, #ff5c35); font-weight: 900; }
.ai-analysis-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 14px; margin-top: 22px; padding: 17px; border-radius: 14px; background: var(--bg); }
.ai-analysis-form label { display: grid; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 800; }
.ai-analysis-form textarea { padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); font: inherit; resize: vertical; }
.ai-result { margin-top: 25px; padding-top: 25px; border-top: 1px solid var(--line); }
.ai-verdict { padding: 20px; border-radius: 14px; background: rgba(69, 201, 150, .09); }
.ai-verdict span { color: var(--green); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .12em; }
.ai-verdict h3 { margin: 7px 0 0; font-size: 20px; }
.ai-verdict p { margin: 8px 0 0; color: var(--muted); }
.ai-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 24px; }
.ai-columns > div { padding: 17px; border: 1px solid var(--line); border-radius: 13px; }
.ai-columns h3 { font-size: 14px; }
.ai-columns ul, .ai-columns ol { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.ad-variant-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0 16px; }
.ad-variant-grid article { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.ad-variant-grid article > span { color: var(--accent); font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.ad-variant-grid h4 { margin: 12px 0 4px; font-size: 16px; }
.ad-variant-grid strong { font-size: 12px; }
.ad-variant-grid p { margin: 10px 0; color: var(--ink); font-size: 13px; line-height: 1.5; }
.ad-variant-grid small { display: block; color: var(--muted); line-height: 1.45; }
.copy-ad { margin-top: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }
.audience-layout { display: grid; grid-template-columns: 1.05fr .95fr; gap: 16px; margin-bottom: 18px; }
.audience-builder, .audience-explain { padding: 27px; }
.audience-builder > p:not(.eyebrow), .audience-explain > p { color: var(--muted); line-height: 1.55; }
.audience-builder .stack-form { margin-top: 20px; }
.audience-warning { padding: 13px; border-radius: 10px; color: #8a5a12; background: #fff5df; font-size: 12px; line-height: 1.5; }
.audience-explain ol { display: grid; gap: 15px; margin: 22px 0; padding-left: 22px; color: var(--ink); line-height: 1.55; }
.audience-rules { overflow: hidden; }
.help { display: inline-grid; place-items: center; width: 14px; height: 14px; margin-left: 4px; border-radius: 50%; background: #eef0f4; font-size: 9px; cursor: help; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.analytics-quality {
  --quality-accent: #a86600;
  display: grid;
  grid-template-columns: minmax(270px, .9fr) minmax(390px, 1.25fr) minmax(190px, .58fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 14px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, var(--surface), rgba(255,255,255,.72));
  box-shadow: var(--shadow);
}
.analytics-quality.amocrm { --quality-accent: #16825d; }
.quality-overview { display: flex; align-items: center; gap: 15px; min-width: 0; }
.quality-overview > div:last-child { min-width: 0; }
.quality-score { position: relative; isolation: isolate; flex: 0 0 auto; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: conic-gradient(var(--quality-accent) calc(var(--quality-score) * 1%), var(--line) 0); }
.quality-score::before { content: ""; position: absolute; z-index: -1; inset: 6px; border-radius: 50%; background: var(--surface); }
.quality-score span { margin-top: 5px; color: var(--ink); font-size: 22px; line-height: 1; font-weight: 900; }
.quality-score small { margin-top: -15px; color: var(--muted); font-size: 8px; font-weight: 700; }
.quality-heading-row { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.quality-mode, .quality-confidence { padding: 5px 8px; border-radius: 999px; color: var(--quality-accent); background: color-mix(in srgb, var(--quality-accent) 11%, var(--surface)); font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.quality-confidence { color: var(--muted); background: var(--bg); }
.quality-overview h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.025em; }
.quality-overview p { margin: 0; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.quality-signals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--line); }
.quality-signals > div { min-width: 0; padding: 13px; background: var(--surface); }
.quality-signals span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .07em; font-weight: 800; }
.quality-signals strong { display: block; overflow: hidden; color: var(--ink); font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.quality-signals small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.quality-action { display: grid; gap: 9px; padding-left: 18px; border-left: 1px solid var(--line); }
.quality-action span { color: var(--muted); font-size: 10px; line-height: 1.45; }
.quality-action a { color: var(--quality-accent); font-size: 11px; line-height: 1.35; font-weight: 900; text-decoration: none; }
.quality-action a:hover { text-decoration: underline; text-underline-offset: 3px; }
.analytics-mode-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.savings-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(300px, 1.25fr) minmax(330px, .95fr) minmax(240px, .72fr);
  gap: 26px;
  align-items: center;
  margin: 14px 0;
  padding: 30px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 12% 0, rgba(85,198,157,.24), transparent 38%),
    radial-gradient(circle at 100% 100%, rgba(102,116,203,.30), transparent 42%),
    linear-gradient(135deg, #121936 0%, #202958 58%, #172044 100%);
  box-shadow: 0 24px 60px rgba(18,25,54,.22);
}
.savings-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -90px;
  right: 30%;
  width: 210px;
  height: 210px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(255,255,255,.025), 0 0 0 76px rgba(255,255,255,.018);
}
.savings-hero.is-clear {
  background:
    radial-gradient(circle at 12% 0, rgba(85,198,157,.27), transparent 40%),
    linear-gradient(135deg, #102b2b, #183f3a 58%, #172f3c);
}
.savings-hero.is-waiting {
  background:
    radial-gradient(circle at 12% 0, rgba(128,168,241,.22), transparent 40%),
    linear-gradient(135deg, #172044, #222a5b 58%, #20284b);
}
.savings-hero.is-waiting .savings-amount { font-size: clamp(27px, 2.8vw, 42px); }
.savings-hero-main { min-width: 0; }
.savings-hero-label { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; color: #d8ddef; font-size: 13px; font-weight: 800; }
.savings-hero-label small { padding: 5px 8px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; color: #aeb8d7; font-size: 10px; font-weight: 700; }
.savings-spark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: #172044; background: linear-gradient(145deg, #80e0bd, #d8ffe9); box-shadow: 0 7px 18px rgba(85,198,157,.24); }
.savings-amount { display: block; margin-bottom: 10px; font-size: clamp(32px, 3.3vw, 49px); line-height: 1; letter-spacing: -.05em; }
.savings-hero-main p { max-width: 620px; margin: 0; color: #aeb8d7; font-size: 12px; line-height: 1.55; }
.savings-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid rgba(255,255,255,.11); border-radius: 16px; background: rgba(255,255,255,.11); }
.savings-metrics > div { min-width: 0; padding: 17px 13px; background: rgba(12,17,38,.52); }
.savings-metrics span, .savings-next-step > span { display: block; margin-bottom: 7px; color: #9fa9ca; font-size: 9px; line-height: 1.35; text-transform: uppercase; letter-spacing: .09em; font-weight: 800; }
.savings-metrics strong { display: block; overflow: hidden; color: #fff; font-size: 21px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.savings-metrics small { display: block; margin-top: 5px; color: #9fa9ca; font-size: 9px; white-space: nowrap; }
.savings-next-step { display: flex; min-width: 0; padding-left: 25px; flex-direction: column; border-left: 1px solid rgba(255,255,255,.12); }
.savings-next-step > strong { overflow: hidden; margin-bottom: 5px; font-size: 14px; line-height: 1.35; text-overflow: ellipsis; }
.savings-next-step > small { margin-bottom: 15px; color: #aeb8d7; font-size: 10px; line-height: 1.45; }
.savings-next-step a { display: flex; justify-content: space-between; align-items: center; min-height: 39px; margin-top: auto; padding: 0 12px; border: 1px solid rgba(255,255,255,.15); border-radius: 10px; color: #fff; background: rgba(255,255,255,.08); font-size: 11px; font-weight: 800; text-decoration: none; transition: background .18s, transform .18s; }
.savings-next-step a:hover { background: rgba(255,255,255,.14); transform: translateY(-1px); }
.savings-next-step a b { color: #80e0bd; font-size: 15px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 14px; }
.chart-panel, .funnel-panel { padding: 22px; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.panel-header h2, .section-heading h2, .upload-panel h2, .guide-panel h2 { margin-bottom: 4px; font-size: 17px; letter-spacing: -.025em; }
.panel-header p { margin: 0; color: var(--muted); font-size: 11px; }
.panel-header a, .section-heading a { color: var(--navy); font-size: 12px; font-weight: 800; text-decoration: none; }
.legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.legend span { width: 18px; height: 3px; border-radius: 4px; margin-left: 5px; }
.legend-cost { background: var(--accent); }
.legend-revenue { background: var(--navy); }
.chart-wrap { height: 250px; }
.chart-wrap canvas { width: 100%; height: 100%; }
.seo-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; padding: 16px 20px; }
.seo-toolbar > span { color: var(--muted); font-size: 13px; }
.domain-mapping-panel { margin-bottom: 14px; padding: 16px 20px; }
.domain-mapping-panel summary { cursor: pointer; font-weight: 800; }
.domain-mapping-panel[open] summary { margin-bottom: 16px; }
.domain-mapping-form { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); align-items: end; gap: 12px; }
.domain-mapping-form > label:not(.consent-field) { display: grid; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 800; }
.domain-mapping-form .consent-field { grid-column: 1 / -2; }
.channel-domain-card { margin-bottom: 14px; padding: 22px; }
.channel-domain-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.channel-domain-head > div { display: grid; gap: 3px; }
.channel-domain-head > div strong { font-size: 20px; }
.channel-domain-head span, .channel-domain-head a, .channel-footnote { color: var(--muted); font-size: 12px; }
.channel-domain-head a { color: var(--navy); font-weight: 800; text-decoration: none; }
.channel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.channel-card { padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-soft); }
.channel-card-title { display: flex; align-items: center; gap: 10px; }
.channel-card-title i { width: 10px; height: 38px; border-radius: 6px; background: #32a875; }
.channel-direct .channel-card-title i { background: #ff5c35; }
.channel-rsya .channel-card-title i { background: #7868d8; }
.channel-card-title div { display: grid; gap: 2px; }
.channel-card-title strong { font-size: 17px; }
.channel-card-title span { color: var(--muted); font-size: 11px; }
.channel-funnel { display: grid; grid-template-columns: repeat(5, auto); align-items: center; justify-content: space-between; gap: 6px; margin: 18px 0; }
.channel-funnel div { display: grid; gap: 3px; }
.channel-funnel span, .channel-money span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.channel-funnel b { font-size: 20px; }
.channel-funnel em { color: var(--muted); font-style: normal; }
.channel-money { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 13px; border-top: 1px solid var(--line); }
.channel-money div { display: grid; gap: 4px; min-width: 0; }
.channel-money strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.channel-money .negative { color: var(--red); }
.channel-footnote { margin: 12px 0 0; }
.seo-domain-form { display: flex; align-items: center; gap: 10px; }
.seo-domain-form label { font-weight: 800; }
.seo-domain-form select { min-width: 230px; }
.seo-kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.seo-chart-panel { margin-top: 14px; }
.seo-import-panel { margin-bottom: 14px; padding: 16px 20px; }
.seo-import-panel summary { cursor: pointer; font-weight: 800; }
.seo-import-panel[open] summary { margin-bottom: 14px; }
.legend-seo-clicks { background: var(--accent); }
.legend-seo-leads { background: #5267d8; }
.seo-plan-panel { margin-top: 14px; padding: 22px; }
.seo-plan-form { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding: 16px; border-radius: 14px; background: var(--surface-soft); }
.seo-plan-form > label:first-of-type { flex: 1 1 100%; display: grid; gap: 8px; }
.seo-plan-form .consent-field { flex: 1 1 340px; }
.seo-plan-form small { font-size: 14px; line-height: 1.5; color: var(--muted); }
.seo-plan-list article { overflow-wrap: anywhere; }
.seo-plan-form > label:first-child { display: grid; gap: 7px; font-weight: 800; }
.seo-plan-form input[type="number"] { width: 130px; }
.seo-plan-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.seo-plan-list article { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.seo-plan-list article > span { color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.seo-plan-list h3 { margin: 8px 0; font-size: 17px; }
.seo-plan-list p, .seo-plan-list small { color: var(--muted); }
.seo-plan-list details { margin-top: 12px; }
.seo-upload-form { display: grid; width: min(620px, 100%); gap: 14px; margin-top: 20px; text-align: left; }
.consent-field { display: flex !important; align-items: flex-start !important; gap: 8px !important; color: var(--muted); font-size: 12px; font-weight: 500 !important; }
@media (max-width: 1180px) { .seo-kpi-grid { grid-template-columns: repeat(3, 1fr); } .domain-mapping-form { grid-template-columns: repeat(2, 1fr); } .channel-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .seo-toolbar, .seo-plan-form { align-items: stretch; flex-direction: column; } .seo-kpi-grid, .seo-plan-list, .domain-mapping-form { grid-template-columns: 1fr; } .domain-mapping-form .consent-field { grid-column: auto; } .channel-domain-head { align-items: flex-start; flex-direction: column; } }
.funnel { display: grid; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 8px; position: relative; padding-bottom: 10px; font-size: 11px; color: var(--muted); }
.funnel-row strong { color: var(--ink); font-size: 15px; }
.funnel-row small { color: var(--green); font-weight: 800; min-width: 35px; text-align: right; }
.funnel-row i { position: absolute; bottom: 0; left: 0; height: 5px; border-radius: 9px; background: linear-gradient(90deg, var(--navy), #7c86c1); opacity: .85; }
.funnel-row.unclassified i { background: linear-gradient(90deg, var(--yellow), #e5b24b); }
.funnel-setup { display: block; margin-top: 16px; color: var(--accent); font-size: 10px; font-weight: 800; text-decoration: none; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; margin: 30px 2px 13px; }
.section-heading h2 { margin: 0; }
.recommendation-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.recommendation { position: relative; display: flex; gap: 13px; padding: 18px; border: 1px solid var(--line); border-left: 3px solid var(--yellow); border-radius: 14px; background: #fff; }
.recommendation.critical { border-left-color: var(--red); }
.recommendation.success { border-left-color: var(--green); }
.recommendation.info { border-left-color: #4b75c8; }
.rec-icon { flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--yellow); background: var(--yellow-soft); font-weight: 800; }
.critical .rec-icon { color: var(--red); background: var(--red-soft); }
.success .rec-icon { color: var(--green); background: var(--green-soft); }
.info .rec-icon { color: #4b75c8; background: #edf3ff; }
.rec-level { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.recommendation h3 { margin: 5px 0 7px; font-size: 13px; }
.recommendation p { margin-bottom: 10px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.recommendation > div > strong { display: block; font-size: 10px; line-height: 1.45; }
.table-panel { margin-top: 14px; padding: 22px; }
.table-panel.spacious { margin-top: 0; }
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; scrollbar-color: #c8ccd6 transparent; }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 12px; }
th { padding: 10px 12px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .07em; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; overflow-wrap: normal; word-break: normal; }
td { max-width: 360px; padding: 14px 12px; border-bottom: 1px solid #f0f1f4; white-space: normal; overflow-wrap: break-word; word-break: normal; vertical-align: top; }
td > *, td strong, td small, td a, td p { max-width: 100%; overflow-wrap: break-word; word-break: normal; }
td input, td select, td textarea, td button { max-width: 100%; }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { min-width: 220px; }
td small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.client-sortable { cursor: pointer; user-select: none; }
.client-sortable:hover, .client-sortable:focus-visible { color: var(--accent); outline: none; }
.client-sort-indicator { display: inline-block; min-width: 10px; margin-left: 5px; color: var(--accent); font-size: 13px; }
.badge { display: inline-block; padding: 5px 8px; border-radius: 20px; font-size: 9px; font-weight: 800; }
.badge.good { color: var(--green); background: var(--green-soft); }
.badge.warning { color: var(--yellow); background: var(--yellow-soft); }
.badge.danger { color: var(--red); background: var(--red-soft); }
.recommendation-list { display: grid; gap: 12px; }
.recommendation-basis { --basis-accent: var(--yellow); display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 14px; padding: 17px 20px; border: 1px solid color-mix(in srgb, var(--basis-accent) 28%, var(--line)); border-radius: 14px; background: color-mix(in srgb, var(--basis-accent) 7%, var(--surface)); }
.recommendation-basis.amocrm { --basis-accent: var(--green); }
.recommendation-basis > div { display: grid; gap: 5px; min-width: 0; }
.recommendation-basis span { color: var(--basis-accent); font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.recommendation-basis strong { font-size: 12px; line-height: 1.4; }
.recommendation-basis a { flex: 0 0 auto; color: var(--basis-accent); font-size: 11px; font-weight: 900; text-decoration: none; }
.recommendation-basis a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ai-insight { position: relative; display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 18px; margin: 0 0 22px; padding: 23px; overflow: hidden; border: 1px solid rgba(102,83,232,.18); border-radius: 20px; background: linear-gradient(135deg, color-mix(in srgb, #6653e8 8%, var(--surface)), var(--surface) 62%); box-shadow: 0 18px 48px rgba(42,39,99,.08); }
.ai-insight::after { position: absolute; top: -80px; right: -55px; width: 210px; height: 210px; border-radius: 50%; background: radial-gradient(circle, rgba(255,92,53,.13), transparent 68%); content: ""; pointer-events: none; }
.ai-insight-mark { position: relative; z-index: 1; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: #fff; background: linear-gradient(145deg, #6653e8, #ff5c35); box-shadow: 0 10px 24px rgba(102,83,232,.24); font-size: 20px; }
.ai-insight-main { position: relative; z-index: 1; min-width: 0; }
.ai-insight-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.ai-insight-heading span { color: #6653e8; font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .09em; }
.ai-insight-heading small, .ai-insight-note { color: var(--muted); font-size: 9px; }
.ai-insight h2 { margin: 0 0 7px; font-size: clamp(18px, 2vw, 25px); line-height: 1.2; }
.ai-insight-main > p { max-width: 880px; margin: 0 0 17px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.ai-insight-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.ai-insight-grid > div { display: grid; gap: 5px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--surface) 88%, transparent); }
.ai-insight-grid span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.ai-insight-grid strong { font-size: 11px; line-height: 1.45; }
.ai-insight ol { display: grid; gap: 7px; margin: 15px 0 10px; padding-left: 20px; }
.ai-insight li { padding-left: 4px; font-size: 11px; font-weight: 750; line-height: 1.45; }
.ai-insight-unavailable { margin-bottom: 20px; }
.ai-insight-refresh { display: inline-flex; margin-top: 10px; color: #6653e8; font-size: 14px; font-weight: 850; text-decoration: none; }
.recommendation-list .recommendation { align-items: flex-start; padding: 22px; }
.rec-body { flex: 1; }
.rec-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.confidence { padding: 5px 8px; border-radius: 20px; color: var(--muted); background: var(--bg); font-size: 10px; font-weight: 800; white-space: nowrap; }
.rec-evidence { display: inline-flex; margin: 0 0 10px; padding: 7px 9px; border-radius: 8px; color: var(--navy); background: #edf3ff; font-size: 11px; font-weight: 700; }
.action-box { padding: 12px 14px; border-radius: 10px; background: var(--bg); }
.action-box span, .potential span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .07em; font-weight: 800; }
.potential { min-width: 115px; text-align: right; }
.network-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.network-card { padding: 20px; }
.network-card > span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.network-card > strong { display: block; margin: 10px 0; font-size: 24px; }
.network-card > div { display: flex; flex-wrap: wrap; gap: 8px 15px; color: var(--muted); font-size: 11px; }
.placement-panel { margin-top: 18px; }
.placement-panel td:first-child { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.placement-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi-danger { border-color: #f2cfcc; background: linear-gradient(145deg, var(--surface), var(--red-soft)); }
.kpi-danger strong { color: var(--red); }
.placement-filters { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(210px, .8fr) minmax(190px, .65fr) auto auto; align-items: end; gap: 12px; margin-bottom: 14px; padding: 18px; }
.placement-filters label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 800; }
.placement-filters input, .placement-filters select { width: 100%; min-height: 43px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; color: var(--ink); background: var(--surface); font: 14px inherit; }
.placement-filters input:focus, .placement-filters select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(34,42,91,.08); }
.placement-reset { align-self: center; color: var(--muted); font-size: 12px; font-weight: 800; text-decoration: none; }
.placement-control-panel { margin-top: 0; }
.placement-control-table td:first-child { min-width: 285px; max-width: 360px; white-space: normal; }
.placement-control-table td:nth-child(2) { max-width: 260px; white-space: normal; }
.placement-domain { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.placement-status { display: inline-flex; margin-top: 7px; padding: 5px 8px; border-radius: 20px; color: var(--muted); background: var(--bg); font-size: 10px; font-weight: 900; }
.placement-status.critical { color: var(--red); background: var(--red-soft); }
.placement-status.warning { color: var(--yellow); background: var(--yellow-soft); }
.placement-status.effective { color: var(--green); background: var(--green-soft); }
.placement-row.is-excluded { opacity: .72; background: var(--bg); }
.placement-error { max-width: 220px; color: var(--red); white-space: normal; }
.placement-api-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
.placement-api-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.button-small { min-height: 36px; padding-inline: 12px; font-size: 12px; }
.button-danger { color: #fff; background: var(--red); box-shadow: 0 7px 16px rgba(204,59,57,.16); }
.placement-footnote { margin-top: 14px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: var(--surface); font-size: 12px; line-height: 1.55; }
.placement-footnote strong { color: var(--ink); }
.pagination { display: flex; justify-content: center; align-items: center; gap: 18px; padding-top: 18px; color: var(--muted); font-size: 12px; font-weight: 800; }
.pagination a { color: var(--navy); text-decoration: none; }
.sync-overlay { position: fixed; z-index: 9999; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(12,17,36,.72); backdrop-filter: blur(8px); cursor: wait; }
.sync-overlay[hidden] { display: none; }
.sync-overlay-card { width: min(92vw, 470px); padding: 38px; border: 1px solid rgba(255,255,255,.12); border-radius: 22px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.3); text-align: center; }
.sync-overlay-card h2 { margin: 5px 0 10px; font-size: 25px; }
.sync-overlay-card > p:not(.eyebrow) { margin-bottom: 22px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.sync-spinner { display: block; width: 48px; height: 48px; margin: 0 auto 19px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sync-spin .8s linear infinite; }
.sync-progress { height: 5px; overflow: hidden; border-radius: 10px; background: var(--line); }
.sync-progress i { display: block; width: 42%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #ff9a63); animation: sync-progress 1.4s ease-in-out infinite alternate; }
body.syncing { overflow: hidden; }
@keyframes sync-spin { to { transform: rotate(360deg); } }
@keyframes sync-progress { from { transform: translateX(-30%); } to { transform: translateX(170%); } }
.sync-status-layer { position: fixed; z-index: 10000; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(12,17,36,.72); backdrop-filter: blur(10px); }
.sync-status-layer[hidden] { display: none; }
.sync-status-card { width: min(520px, calc(100vw - 32px)); padding: 32px; border: 1px solid rgba(255,255,255,.14); border-radius: 22px; color: var(--ink); background: var(--surface); box-shadow: 0 34px 100px rgba(0,0,0,.34); }
.sync-status-card[data-status="completed"] { border-color: color-mix(in srgb, var(--green) 38%, var(--line)); }
.sync-status-card[data-status="partial"], .sync-status-card[data-status="failed"] { border-color: color-mix(in srgb, var(--red) 38%, var(--line)); }
.sync-status-head, .sync-status-head > div, .sync-status-meta { display: flex; align-items: center; }
.sync-status-head { justify-content: space-between; gap: 12px; }
.sync-status-head > div { gap: 9px; }
.sync-status-head button { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; color: var(--muted); background: var(--bg); font-size: 21px; cursor: pointer; }
.sync-status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 15%, transparent); animation: sync-dot 1.2s ease-in-out infinite; }
.sync-status-card[data-status="completed"] .sync-status-dot { background: var(--green); animation: none; }
.sync-status-card[data-status="partial"] .sync-status-dot, .sync-status-card[data-status="failed"] .sync-status-dot { background: var(--red); animation: none; }
.sync-status-card > p { margin: 18px 0 20px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.sync-status-progress { height: 9px; overflow: hidden; border-radius: 20px; background: var(--line); }
.sync-status-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #ff9a63); transition: width .35s ease; }
.sync-status-card[data-status="completed"] .sync-status-progress i { background: var(--green); }
.sync-status-meta { justify-content: space-between; margin-top: 11px; color: var(--muted); font-size: 12px; font-weight: 800; }
.sync-status-details { max-height: 160px; overflow: auto; margin-top: 13px; padding-top: 10px; border-top: 1px solid var(--line); }
.sync-status-details p { margin: 5px 0; font-size: 11px; line-height: 1.45; }
.sync-status-details .success { color: var(--green); }
.sync-status-details .error { color: var(--red); }
@keyframes sync-dot { 50% { opacity: .45; transform: scale(.82); } }
@media (max-width: 640px) {
  .sync-status-layer { padding: 14px; }
  .sync-status-card { width: 100%; padding: 24px 20px; border-radius: 18px; }
}
.upload-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.upload-panel, .guide-panel { padding: 28px; }
.upload-panel > p, .guide-panel > p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.step-number { margin-bottom: 20px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.dropzone { display: grid; place-items: center; min-height: 185px; margin: 22px 0 14px; padding: 25px; border: 1.5px dashed #cdd1dc; border-radius: 14px; text-align: center; background: #fafbfc; cursor: pointer; }
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { max-width: 210px; margin-top: 12px; font-size: 10px; }
.dropzone small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.upload-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 12px; border-radius: 12px; color: var(--accent); background: var(--accent-soft); font-size: 20px; }
.columns { display: flex; flex-wrap: wrap; gap: 7px; margin: 20px 0; }
code { padding: 5px 7px; border-radius: 5px; background: #eef0f5; color: var(--navy); font-size: 10px; }
.form-errors { color: var(--red); font-size: 11px; }
.form-errors ul { padding-left: 16px; }
.import-history { margin-top: 14px; padding: 22px; }
.import-history h2 { font-size: 15px; }
.import-row { display: grid; grid-template-columns: 1fr auto auto; gap: 25px; padding: 11px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.import-row strong { color: var(--ink); }
.empty-state { min-height: 480px; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 50px; border: 1px dashed #cfd3dc; border-radius: var(--radius); text-align: center; background: #fff; }
.empty-state.compact { min-height: 260px; }
.empty-state h2 { margin-bottom: 10px; font-size: 26px; }
.empty-state > p:not(.eyebrow) { max-width: 520px; color: var(--muted); line-height: 1.65; }
.empty-state .button { margin: 14px 0; }
.empty-state > span { color: var(--muted); font-size: 10px; }
.empty-mark { display: grid; place-items: center; width: 55px; height: 55px; margin-bottom: 20px; border-radius: 16px; color: var(--accent); background: var(--accent-soft); font-size: 26px; }
.empty-inline { padding: 20px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 12px; grid-column: 1/-1; }
.messages { margin-bottom: 16px; }
.message { padding: 12px 15px; border-radius: 10px; background: #edf3ff; font-size: 12px; }
.message.success { color: var(--green); background: var(--green-soft); }
.message.warning { color: var(--yellow); background: var(--yellow-soft); }
.message.error { color: var(--red); background: var(--red-soft); }
.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; }

.auth-shell { min-height: 100vh; display: grid; align-content: center; justify-items: center; padding: 70px 20px; background: radial-gradient(circle at 20% 10%, rgba(255,92,53,.13), transparent 30%), #171d43; }
.auth-brand { position: absolute; top: 28px; left: 34px; color: #fff; }
.auth-theme-toggle { position: absolute; top: 27px; right: 34px; }
.auth-credit { position: absolute; bottom: 24px; color: #aeb5cd; }
.auth-credit:hover { color: #fff; }
.auth-credit img { filter: invert(1); }
.auth-card { width: min(100%, 480px); padding: 36px; border-radius: 22px; background: #fff; box-shadow: 0 25px 70px rgba(0,0,0,.2); }
.auth-card h1 { font-size: 32px; }
.auth-card > p:not(.eyebrow) { color: var(--muted); font-size: 13px; }
.stack-form { display: grid; gap: 14px; margin-top: 24px; }
.stack-form label { display: grid; gap: 7px; color: var(--ink); font-size: 11px; font-weight: 800; }
.stack-form input, .stack-form select, .stack-form textarea, .chat-compose textarea { width: 100%; min-height: 43px; padding: 10px 13px; border: 1px solid #d8dbe3; border-radius: 10px; outline: none; background: #fff; font: 13px inherit; }
.stack-form input:focus, .stack-form select:focus, .stack-form textarea:focus, .chat-compose textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(34,42,91,.08); }
.stack-form small { color: var(--muted); font-size: 9px; font-weight: 500; line-height: 1.45; }
.stack-form .errorlist { margin: 0; padding-left: 17px; color: var(--red); font-size: 10px; font-weight: 500; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-footer { margin-top: 20px; text-align: center; color: var(--muted); font-size: 11px; }
.auth-footer a { color: var(--accent); font-weight: 800; }

.connection-status { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid #cceadc; border-radius: 20px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 800; white-space: nowrap; }
.connection-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(22,130,93,.1); }
.integration-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 14px; }
.connection-list { display: grid; gap: 14px; margin-bottom: 14px; }
.connection-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; padding: 26px; }
.connection-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.connection-card.onboarding { grid-template-columns: auto 1fr; align-items: start; }
.connection-card h2, .integration-aside h2, .token-panel h2, .setup-guide h2, .settings-card h2 { margin: 9px 0 5px; font-size: 18px; }
.connection-card p, .integration-aside p, .token-panel p { margin: 0 0 8px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.service-logo { display: grid; place-items: center; width: 55px; height: 55px; border-radius: 16px; color: #fff; background: #fc3f1d; font-size: 26px; font-weight: 800; }
.integration-aside, .token-panel, .setup-guide { padding: 26px; }
.check-list { display: grid; gap: 11px; margin: 18px 0 24px; padding: 0; list-style: none; color: var(--muted); font-size: 11px; }
.check-list li::before { content: "✓"; display: inline-grid; place-items: center; width: 17px; height: 17px; margin-right: 8px; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: 9px; font-weight: 900; }
.text-button { padding: 0; border: 0; background: transparent; font: 700 10px inherit; cursor: pointer; }
.text-button.danger { color: var(--red); }
.inline-alert { margin-top: 14px; padding: 11px 13px; border-radius: 9px; color: var(--navy); background: #edf3ff; font-size: 10px; line-height: 1.5; }
.inline-alert.danger { color: var(--red); background: var(--red-soft); }
.inline-alert.success { margin: 0 0 14px; color: var(--green); background: var(--green-soft); }
.setup-guide { margin-top: 14px; }
.setup-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; }
.setup-steps div { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 11px; background: var(--bg); color: var(--muted); font-size: 10px; }
.setup-steps strong { display: grid; place-items: center; flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; color: #fff; background: var(--navy); }
.oauth-simple-card { width: min(100%, 620px); margin: 0 auto; padding: 40px; text-align: center; }
.oauth-simple-card h2 { margin: 12px 0 10px; font-size: 28px; letter-spacing: -.04em; }
.oauth-simple-card > p:not(.eyebrow) { max-width: 500px; margin: 0 auto 25px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.oauth-hero-icon { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 24px; border-radius: 20px; color: #fff; background: #fc3f1d; font-size: 31px; font-weight: 900; box-shadow: 0 15px 35px rgba(252,63,29,.2); }
.oauth-hero-icon.metrika-logo { background: linear-gradient(145deg, #ff4f37, #9a48d0); box-shadow: 0 15px 35px rgba(154,72,208,.2); }
.oauth-simple-card .button { min-height: 52px; font-size: 15px; }
.oauth-safe-note { display: block; margin-top: 14px; color: var(--muted); font-size: 11px; }
.oauth-steps { display: grid; gap: 14px; margin-top: 26px; text-align: left; }
.oauth-step { display: flex; align-items: center; gap: 12px; }
.oauth-step > span { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px; color: #fff; background: var(--navy); font-size: 13px; font-weight: 900; }
.oauth-step > div { display: grid; gap: 3px; }
.oauth-step strong { color: var(--ink); font-size: 14px; }
.oauth-step small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.oauth-code-form { margin-top: 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.oauth-code-form .oauth-code-input { min-height: 52px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; font-weight: 700; letter-spacing: .08em; text-align: center; }
.advanced-connection { width: min(100%, 620px); margin: 14px auto 0; overflow: hidden; }
.advanced-connection summary { padding: 16px 20px; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.advanced-connection > div { padding: 0 22px 24px; border-top: 1px solid var(--line); }
.advanced-connection > div > p { margin: 18px 0 0; color: var(--muted); font-size: 12px; }
.credentials-layout { align-items: start; }
.settings-intro { color: var(--muted); font-size: 13px; line-height: 1.6; }
.credential-section { display: grid; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: var(--bg); }
.credential-heading { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.credential-heading .service-logo { width: 42px; height: 42px; border-radius: 12px; font-size: 20px; }
.credential-heading > div:not(.service-logo) { display: grid; gap: 3px; }
.credential-heading strong { font-size: 15px; }
.credential-heading small { color: var(--muted); font-size: 11px; }
.credential-checkbox { display: flex !important; grid-template-columns: none; align-items: flex-start; gap: 10px !important; padding: 14px; border-radius: 12px; background: #edf3ff; }
.credential-checkbox input { width: 18px; height: 18px; margin-top: 2px; }
.credential-checkbox span { display: grid; gap: 3px; }
.credential-checkbox strong { font-size: 13px; }

.settings-card { max-width: 700px; padding: 28px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.settings-grid .settings-card { width: 100%; max-width: none; }
.settings-card .stack-form { margin-top: 20px; }
.settings-card .stack-form .button { justify-self: start; margin-top: 8px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 25px; padding: 18px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row:first-child { padding-top: 0; }
.switch-row span { display: grid; gap: 4px; }
.switch-row strong { font-size: 12px; }
.switch-row small { color: var(--muted); font-size: 10px; }
.switch-row input { width: 38px; height: 20px; accent-color: var(--accent); }
.settings-card .button { margin-top: 22px; }

.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: stretch; }
.price-card { position: relative; display: flex; flex-direction: column; padding: 27px; }
.price-card.featured { border: 2px solid var(--accent); transform: translateY(-5px); box-shadow: 0 18px 45px rgba(255,92,53,.12); }
.price-name { color: var(--navy); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.price-card h2 { margin: 13px 0 8px; font-size: 29px; letter-spacing: -.04em; }
.price-card h2 small { color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: 0; }
.price-card > p { min-height: 36px; color: var(--muted); font-size: 11px; }
.price-card .check-list { flex: 1; }
.popular { position: absolute; top: -11px; right: 20px; padding: 5px 9px; border-radius: 20px; color: #fff; background: var(--accent); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.stub-note { margin-top: 18px; color: var(--muted); font-size: 10px; text-align: center; }

.support-layout { display: grid; grid-template-columns: minmax(240px, .42fr) minmax(560px, 1fr); gap: 18px; max-width: 1180px; align-items: stretch; }
.support-card { align-self: start; padding: 28px; background: linear-gradient(155deg, #20285a, #171d43); color: #fff; border: 0; overflow: hidden; }
.support-agent { display: flex; align-items: center; gap: 12px; margin-bottom: 38px; }
.support-avatar { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 14px; color: #fff; background: var(--accent); font-size: 19px; font-weight: 900; box-shadow: 0 9px 20px rgba(255,92,53,.3); }
.support-agent strong, .support-agent small { display: block; }
.support-agent strong { font-size: 14px; }
.support-agent small { margin-top: 4px; color: #bfc5df; font-size: 12px; }
.support-agent i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #49d39b; }
.support-card h2 { margin-bottom: 10px; font-size: 25px; letter-spacing: -.035em; }
.support-card > p { color: #c4cae2; font-size: 14px; line-height: 1.65; }
.support-card ul { display: grid; gap: 13px; margin: 28px 0 0; padding: 22px 0 0; border-top: 1px solid rgba(255,255,255,.12); list-style: none; color: #dfe2f1; font-size: 13px; }
.support-card li::before { content: "✓"; margin-right: 9px; color: #49d39b; font-weight: 900; }
.chat { min-width: 0; overflow: hidden; }
.chat-toolbar { display: flex; justify-content: space-between; align-items: center; min-height: 76px; padding: 17px 22px; border-bottom: 1px solid var(--line); background: #fff; }
.chat-toolbar strong, .chat-toolbar small { display: block; }
.chat-toolbar strong { font-size: 15px; }
.chat-toolbar small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.chat-secure { padding: 7px 10px; border-radius: 20px; color: var(--green); background: var(--green-soft); font-size: 11px; font-weight: 800; }
.chat-history { height: clamp(440px, 55vh, 610px); display: flex; flex-direction: column; gap: 13px; padding: 28px; overflow-y: auto; background: linear-gradient(180deg, #f8f9fb, #f4f5f8); scroll-behavior: smooth; }
.chat-bubble { max-width: min(72%, 560px); padding: 14px 17px; border: 1px solid #eceef3; border-radius: 16px 16px 16px 4px; background: #fff; box-shadow: 0 5px 18px rgba(23,26,46,.055); }
.chat-bubble.user { align-self: flex-end; border-radius: 14px 14px 4px 14px; color: #fff; background: var(--navy); }
.chat-bubble > div { display: flex; justify-content: space-between; gap: 20px; }
.chat-bubble strong, .chat-bubble time { font-size: 9px; }
.chat-bubble time { color: var(--muted); }
.chat-bubble.user time { color: #aeb4d2; }
.chat-bubble p { margin: 8px 0 0; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); }
.chat-empty span { display: grid; place-items: center; width: 45px; height: 45px; margin: 0 auto 15px; border-radius: 13px; color: var(--accent); background: var(--accent-soft); font-size: 20px; font-weight: 800; }
.chat-empty h2 { margin-bottom: 6px; color: var(--ink); font-size: 17px; }
.chat-empty p { font-size: 11px; }
.chat-compose { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 16px 18px 12px; border-top: 1px solid var(--line); background: #fff; }
.chat-compose textarea { resize: none; min-height: 52px; max-height: 130px; border-radius: 13px; background: #f8f9fb; }
.chat-compose .button { min-width: 128px; gap: 8px; border-radius: 13px; }
.chat-compose > small { grid-column: 1/-1; color: var(--muted); font-size: 11px; }

.admin-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.admin-kpi { position: relative; padding: 20px; overflow: hidden; }
.admin-kpi::after { content: ""; position: absolute; top: -25px; right: -25px; width: 72px; height: 72px; border-radius: 50%; background: var(--bg); }
.admin-kpi.attention { color: #fff; background: var(--navy); border-color: var(--navy); }
.admin-kpi.attention::after { background: rgba(255,255,255,.06); }
.admin-kpi span, .admin-kpi small { display: block; color: var(--muted); font-size: 12px; }
.admin-kpi.attention span, .admin-kpi.attention small { color: #bfc5df; }
.admin-kpi strong { display: block; margin: 12px 0 5px; font-size: 29px; letter-spacing: -.04em; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-table { padding: 23px; }
.admin-list-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.admin-list-row > div { min-width: 0; }
.admin-list-row strong, .admin-list-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-list-row strong { font-size: 13px; }
.admin-list-row small, .admin-list-row time { margin-top: 3px; color: var(--muted); font-size: 11px; }
.admin-list-link { color: inherit; text-decoration: none; transition: .2s; }
.admin-list-link:hover { padding-inline: 8px; border-radius: 10px; background: var(--bg); }

.operator-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.operator-header h1 { margin: 0; }
.operator-online { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.operator-online i { width: 8px; height: 8px; border-radius: 50%; background: #49d39b; box-shadow: 0 0 0 4px rgba(73,211,155,.13); }
.operator-workspace { display: grid; grid-template-columns: 290px minmax(430px, 1fr) 245px; min-height: 690px; overflow: hidden; }
.conversation-sidebar { min-width: 0; border-right: 1px solid var(--line); background: #fbfbfc; }
.conversation-title { display: flex; justify-content: space-between; align-items: center; height: 73px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.conversation-title strong { font-size: 17px; }
.conversation-title span { display: grid; place-items: center; min-width: 25px; height: 25px; padding: 0 7px; border-radius: 20px; color: var(--navy); background: #eceef6; font-size: 11px; font-weight: 800; }
.conversation-list { max-height: 617px; overflow-y: auto; }
.conversation-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 15px 14px; color: inherit; text-decoration: none; border-bottom: 1px solid #eff0f3; transition: .18s; }
.conversation-item:hover, .conversation-item.active { background: #fff; }
.conversation-item.active { box-shadow: inset 3px 0 var(--accent); }
.conversation-item strong, .conversation-item p { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-item strong { font-size: 13px; }
.conversation-item p { margin: 4px 0 6px; color: var(--muted); font-size: 11px; }
.conversation-item time { color: #9ba0af; font-size: 10px; }
.conversation-empty { padding: 40px 22px; color: var(--muted); text-align: center; font-size: 13px; }
.status-open, .status-waiting, .status-closed { display: inline-block; font-size: 10px; font-weight: 800; }
.status-open { color: var(--red); }
.status-waiting { color: var(--yellow); }
.status-closed { color: var(--green); }
.operator-chat { min-width: 0; display: flex; flex-direction: column; background: #f6f7f9; }
.operator-chat-head { display: flex; justify-content: space-between; align-items: center; min-height: 73px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fff; }
.client-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.client-identity strong, .client-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-identity strong { font-size: 14px; }
.client-identity small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.operator-chat-head .button { min-height: 37px; padding-inline: 12px; font-size: 11px; }
.operator-history { flex: 1; height: 480px; display: flex; flex-direction: column; gap: 12px; padding: 22px; overflow-y: auto; }
.operator-compose { padding: 15px 18px; border-top: 1px solid var(--line); background: #fff; }
.operator-compose textarea { width: 100%; min-height: 74px; resize: none; padding: 12px 13px; border: 1px solid #d8dbe3; border-radius: 12px; outline: 0; font: 14px inherit; background: #f8f9fb; }
.operator-compose textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(34,42,91,.08); }
.operator-compose > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 9px; }
.operator-compose small { color: var(--muted); font-size: 11px; }
.client-panel { padding: 24px 20px; border-left: 1px solid var(--line); background: #fff; text-align: center; }
.client-avatar { display: grid; place-items: center; width: 68px; height: 68px; margin: 25px auto 13px; border-radius: 22px; color: #fff; background: linear-gradient(145deg, var(--navy), #4c5798); font-size: 25px; font-weight: 900; }
.client-panel h2 { margin-bottom: 5px; font-size: 17px; overflow-wrap: anywhere; }
.client-panel > p:not(.eyebrow) { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.client-panel dl { margin: 28px 0 0; text-align: left; }
.client-panel dl div { padding: 13px 0; border-top: 1px solid var(--line); }
.client-panel dt { color: var(--muted); font-size: 10px; }
.client-panel dd { margin: 5px 0 0; font-size: 12px; font-weight: 700; }
.operator-placeholder { margin: auto; padding: 40px; text-align: center; color: var(--muted); }
.operator-placeholder span { font-size: 30px; color: var(--accent); }
.operator-placeholder h2 { margin: 14px 0 7px; color: var(--ink); }

.model-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 14px; }
.model-card, .depth-card, .goals-panel { padding: 27px; }
.model-card h2, .depth-card h2, .goals-panel h2 { margin-bottom: 5px; font-size: 18px; }
.formula-preview { display: grid; gap: 6px; padding: 13px; border-radius: 10px; background: var(--bg); }
.formula-preview span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.formula-preview code { padding: 0; background: transparent; font-size: 11px; }
.depth-flow { display: grid; gap: 7px; margin: 18px 0; }
.depth-flow div { display: flex; align-items: center; gap: 10px; position: relative; padding: 9px 11px; border-radius: 10px; background: var(--bg); }
.depth-flow i { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: #fff; background: var(--navy); font-size: 9px; font-style: normal; font-weight: 800; }
.depth-flow span { display: grid; }
.depth-flow strong { font-size: 11px; }
.depth-flow small, .depth-card > p { color: var(--muted); font-size: 9px; line-height: 1.5; }
.goals-panel { margin-top: 14px; }
.goal-layout { display: grid; grid-template-columns: .9fr 1.1fr; gap: 30px; }
.goal-form { align-self: start; align-content: start; margin-top: 0; padding: 18px; border-radius: 13px; background: var(--bg); }
.goal-list { display: grid; align-content: start; gap: 8px; }
.goal-list article { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.goal-list article > div { display: grid; gap: 3px; }
.goal-list strong { font-size: 11px; }
.goal-list small { color: var(--muted); font-size: 9px; }
.stage-badge { padding: 5px 7px; border-radius: 20px; color: #4b75c8; background: #edf3ff; font-size: 8px; font-weight: 800; white-space: nowrap; }
.stage-badge.lead { color: var(--yellow); background: var(--yellow-soft); }
.stage-badge.qualified { color: var(--green); background: var(--green-soft); }
.stage-badge.sale { color: #fff; background: var(--navy); }
.icon-button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; color: var(--muted); background: var(--bg); font-size: 18px; cursor: pointer; }
.amo-funnel-panel { margin-top: 14px; padding: 27px; }
.amo-mapping-form { display: grid; gap: 18px; }
.revenue-field { display: grid; gap: 7px; max-width: 720px; font-size: 13px; font-weight: 800; }
.revenue-field input { min-height: 43px; padding: 10px 13px; border: 1px solid #d8dbe3; border-radius: 10px; outline: none; font: 14px inherit; }
.revenue-field input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(34,42,91,.08); }
.revenue-field small { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.5; }
.amo-mapping-head, .amo-mapping-row { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(200px, .65fr) 120px; align-items: center; gap: 18px; }
.amo-mapping-head { padding: 0 14px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.amo-mapping-list { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.amo-mapping-row { min-height: 68px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.amo-mapping-row:last-child { border-bottom: 0; }
.amo-mapping-row > div { display: grid; gap: 4px; }
.amo-mapping-row strong { font-size: 13px; }
.amo-mapping-row small { color: var(--muted); font-size: 11px; }
.amo-mapping-row select { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #d8dbe3; border-radius: 9px; color: var(--ink); background: #fff; font: 13px inherit; }
.revenue-switch { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; }
.revenue-switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.amo-mapping-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.amo-mapping-actions p { margin: 0; color: var(--muted); font-size: 11px; }
.utm-attribution-panel { background: linear-gradient(145deg, var(--surface) 0%, #f7f9ff 100%); }
.utm-attribution-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.utm-attribution-stats div { display: grid; gap: 5px; padding: 13px 14px; border: 1px solid #e1e6f3; border-radius: 12px; background: rgba(255,255,255,.86); }
.utm-attribution-stats span { color: var(--muted); font-size: 10px; font-weight: 700; }
.utm-attribution-stats strong { font-size: 20px; }
.utm-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.utm-field-grid label { display: grid; gap: 7px; min-width: 0; color: var(--ink); font-size: 12px; font-weight: 800; }
.utm-field-grid input { width: 100%; min-height: 43px; padding: 10px 13px; border: 1px solid #d8dbe3; border-radius: 10px; outline: none; background: var(--surface); font: 13px inherit; }
.utm-field-grid input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(34,42,91,.08); }
.utm-scheme { display: grid; gap: 8px; padding: 16px; border: 1px solid #dce4f5; border-radius: 12px; background: #edf3ff; }
.utm-scheme strong { font-size: 12px; }
.utm-scheme > code { display: block; overflow-x: auto; padding: 10px 12px; border-radius: 8px; color: #fff; background: var(--navy); font-size: 11px; line-height: 1.5; white-space: nowrap; }
.utm-scheme small { color: #536189; font-size: 10px; line-height: 1.5; }
.writeback-divider { height: 1px; margin: 28px 0; background: linear-gradient(90deg, transparent, #d8deed 12%, #d8deed 88%, transparent); }
.writeback-form { padding: 20px; border: 1px solid #dce3f2; border-radius: 16px; background: rgba(255,255,255,.76); }
.writeback-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.writeback-heading h3 { margin: 8px 0 6px; font-size: 18px; }
.writeback-heading p { max-width: 720px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.writeback-switch { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; padding: 11px 13px; border: 1px solid #d9e2f2; border-radius: 11px; background: #f3f7ff; font-size: 11px; font-weight: 800; cursor: pointer; }
.writeback-switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.writeback-status { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border-radius: 10px; color: #287058; background: var(--green-soft); font-size: 11px; }
.inline-alert.danger { color: #9f3a31; background: #fff0ee; }
.field-tooltip { position: relative; z-index: 4; display: inline-grid; place-items: center; width: 19px; height: 19px; margin-left: 4px; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: var(--surface); font: 800 11px/1 inherit; vertical-align: 1px; cursor: help; }
.field-tooltip:hover, .field-tooltip:focus-visible, .field-tooltip[aria-expanded="true"] { z-index: 20; color: #fff; border-color: var(--navy); background: var(--navy); outline: none; }
.field-tooltip-bubble { position: absolute; z-index: 30; top: 50%; left: calc(100% + 11px); bottom: auto; width: min(300px, 72vw); padding: 11px 13px; border-radius: 9px; color: #fff; background: #171d43; box-shadow: 0 10px 28px rgba(15, 21, 50, .25); font-size: 11px; font-weight: 500; line-height: 1.45; text-align: left; text-transform: none; letter-spacing: 0; pointer-events: none; opacity: 0; visibility: hidden; transform: translate(5px, -50%); transition: opacity .16s ease, transform .16s ease, visibility .16s; }
.field-tooltip-bubble::after { content: ""; position: absolute; top: 50%; right: 100%; left: auto; border: 6px solid transparent; border-right-color: #171d43; transform: translateY(-50%); }
.field-tooltip:hover .field-tooltip-bubble, .field-tooltip:focus-visible .field-tooltip-bubble, .field-tooltip[aria-expanded="true"] .field-tooltip-bubble { opacity: 1; visibility: visible; transform: translate(0, -50%); }
.help-header { align-items: flex-end; }
.help-start { margin-bottom: 22px; padding: 26px; }
.help-time { padding: 7px 10px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 11px; font-weight: 800; }
.help-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.help-steps article { display: flex; align-items: flex-start; gap: 10px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--bg); }
.help-steps article > span { flex: 0 0 auto; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: #fff; background: var(--accent); font-size: 11px; font-weight: 900; }
.help-steps h3 { margin: 1px 0 6px; font-size: 13px; }
.help-steps p { margin: 0 0 8px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.help-steps a { font-size: 10px; font-weight: 800; }
.help-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: 22px; }
.help-toc { position: sticky; top: 22px; display: grid; gap: 3px; padding: 16px; }
.help-toc strong { padding: 5px 9px 9px; font-size: 12px; }
.help-toc a { padding: 8px 9px; border-radius: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.help-toc a:hover { color: var(--ink); background: var(--bg); }
.help-content { display: grid; gap: 20px; min-width: 0; }
.help-section { padding: 28px; scroll-margin-top: 24px; }
.help-section > h2 { margin: 2px 0 12px; font-size: 25px; }
.help-section > h3 { margin: 22px 0 8px; font-size: 16px; }
.help-section > p { max-width: 820px; color: var(--muted); line-height: 1.65; }
.help-source-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0; }
.help-source-grid article { padding: 18px; border: 1px solid var(--line); border-radius: 13px; }
.help-source-grid i { display: grid; place-items: center; width: 35px; height: 35px; margin-bottom: 14px; border-radius: 10px; color: #fff; background: #ff4e2d; font-style: normal; font-weight: 900; }
.help-source-grid h3 { margin: 0 0 6px; font-size: 14px; }
.help-source-grid p { min-height: 48px; margin: 0 0 10px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.help-source-grid strong { color: var(--green); font-size: 10px; }
.help-note, .help-warning { margin-top: 16px; padding: 14px 16px; border-radius: 11px; color: #334172; background: #edf3ff; font-size: 12px; line-height: 1.55; }
.help-warning { color: #76561b; background: var(--yellow-soft); }
.attribution-example { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.attribution-example span { padding: 8px 10px; border-radius: 8px; color: #fff; background: var(--navy); font-size: 11px; font-weight: 800; }
.attribution-example b { color: var(--muted); font-size: 10px; font-weight: 600; }
.attribution-example b::after { content: "→"; margin-left: 8px; color: var(--accent); }
.attribution-example b:last-child::after { display: none; }
.term-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.term-grid article { padding: 15px; border: 1px solid var(--line); border-radius: 11px; }
.term-grid strong { font-size: 13px; }
.term-grid p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.help-list { display: grid; gap: 12px; margin: 18px 0 22px; padding-left: 22px; }
.help-list li { padding-left: 5px; color: var(--muted); line-height: 1.55; }
.help-list strong { color: var(--ink); }
.help-section details { border-top: 1px solid var(--line); }
.help-section details:last-of-type { border-bottom: 1px solid var(--line); }
.help-section summary { padding: 16px 2px; font-size: 13px; font-weight: 800; cursor: pointer; }
.help-section details p { margin: -5px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.help-contact { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 24px; padding: 18px; border-radius: 13px; background: var(--bg); }
.help-contact p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.attribution-alert { margin: 0 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.attribution-alert > div { display: grid; gap: 4px; }
.attribution-alert span { color: var(--muted); }
.source-mapping-form { margin-top: 18px; }
.source-mapping-list { overflow: visible; border: 1px solid var(--line); border-radius: 14px; }
.source-mapping-row { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(300px, 1fr); align-items: center; gap: 24px; min-height: 82px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.source-mapping-row:last-child { border-bottom: 0; }
.source-mapping-row > div, .source-mapping-row label { display: grid; gap: 5px; }
.source-mapping-row small, .source-mapping-row label span { color: var(--muted); font-size: 11px; }
.source-mapping-row select { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid #d8dbe3; border-radius: 9px; color: var(--ink); background: var(--surface); font: 13px inherit; }
.inline-status select { padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: 10px inherit; }
.leads-panel-header { align-items: flex-end; }
.leads-sort-form { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 800; }
.leads-sort-form select { min-height: 39px; padding: 7px 34px 7px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); font: 13px inherit; }
.sort-link { display: inline-flex; align-items: center; gap: 5px; color: inherit; text-decoration: none; white-space: normal; overflow-wrap: anywhere; }
.sort-link span { color: #b3b7c3; font-size: 12px; }
.sort-link:hover, .sort-link.active { color: var(--navy); }
.sort-link.active span { color: var(--accent); }
.modal { width: min(92vw, 700px); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 25px 80px rgba(20,25,48,.25); }
.modal::backdrop { background: rgba(19,23,48,.55); backdrop-filter: blur(3px); }
.modal-card { margin: 0; padding: 28px; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; }
.modal-header h2 { margin: 0; font-size: 20px; }

/* Увеличенная типографика: читаемый минимум для рабочего интерфейса. */
body { font-size: 16px; }
.app-shell { grid-template-columns: 264px 1fr; }
.nav a { font-size: 15px; }
.nav a span { font-size: 20px; }
.sidebar-note { font-size: 13px; }
.account-card small { font-size: 11px; }
.eyebrow { font-size: 12px; }
.page-header p:not(.eyebrow) { font-size: 15px; line-height: 1.55; }
.period-filter { font-size: 13px; }
.button { font-size: 14px; }
.kpi-label { font-size: 13px; }
.kpi strong { font-size: 26px; }
.kpi-note { font-size: 12px; line-height: 1.45; }
.help { width: 17px; height: 17px; font-size: 11px; }
.panel-header h2,
.section-heading h2,
.upload-panel h2,
.guide-panel h2 { font-size: 20px; }
.panel-header p { font-size: 13px; line-height: 1.5; }
.panel-header a, .section-heading a { font-size: 13px; }
.legend { font-size: 12px; }
.funnel-row { font-size: 13px; }
.funnel-row strong { font-size: 18px; }
.funnel-row small { font-size: 11px; }
.funnel-setup { font-size: 12px; line-height: 1.5; }
.rec-level { font-size: 11px; }
.recommendation h3 { font-size: 15px; }
.recommendation p { font-size: 13px; }
.recommendation > div > strong { font-size: 12px; }
table { font-size: 14px; }
th { font-size: 11px; }
td small { font-size: 11px; }
.badge { font-size: 11px; }
.action-box span, .potential span { font-size: 11px; }
.upload-panel > p, .guide-panel > p { font-size: 14px; }
.step-number { font-size: 12px; }
.dropzone small, .dropzone input { font-size: 12px; }
code { font-size: 12px; }
.form-errors, .import-row, .empty-inline, .message { font-size: 13px; }
.empty-state > span { font-size: 12px; }
.stack-form label { font-size: 13px; }
.stack-form input,
.stack-form select,
.stack-form textarea,
.chat-compose textarea { font-size: 14px; }
.stack-form small, .stack-form .errorlist { font-size: 11px; }
.auth-card > p:not(.eyebrow), .auth-footer { font-size: 14px; }
.connection-status, .inline-alert, .stub-note { font-size: 12px; }
.connection-card h2,
.integration-aside h2,
.token-panel h2,
.setup-guide h2,
.settings-card h2,
.model-card h2,
.depth-card h2,
.goals-panel h2 { font-size: 20px; }
.connection-card p, .integration-aside p, .token-panel p,
.check-list, .setup-steps div, .price-card > p { font-size: 13px; }
.switch-row strong { font-size: 14px; }
.switch-row small { font-size: 12px; }
.price-name { font-size: 13px; }
.price-card h2 small { font-size: 12px; }
.popular { font-size: 10px; }
.chat-bubble strong, .chat-bubble time { font-size: 11px; }
.chat-bubble p, .chat-empty p { font-size: 13px; }
.chat-empty h2 { font-size: 20px; }
.formula-preview span, .depth-flow i { font-size: 11px; }
.formula-preview code, .depth-flow strong, .goal-list strong { font-size: 13px; }
.depth-flow small, .depth-card > p, .goal-list small { font-size: 11px; }
.stage-badge { font-size: 10px; }
.inline-status select { font-size: 12px; }
.modal-header h2 { font-size: 22px; }
.integrations-count { padding: 9px 13px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); background: #fff; font-size: 13px; font-weight: 800; }
.integration-catalog { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.integration-tile { display: flex; flex-direction: column; padding: 25px; }
.integration-tile h2 { margin: 5px 0 7px; font-size: 22px; }
.integration-tile > div > p:not(.eyebrow) { min-height: 58px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.integration-tile .check-list { flex: 1; }
.tile-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.service-logo.metrika-logo { color: #fff; background: linear-gradient(145deg, #ff4f37, #9a48d0); }
.service-logo.amo-logo { color: #fff; background: #2e5bff; font-family: Georgia, serif; font-style: italic; }
.data-flow-panel { display: flex; justify-content: space-between; align-items: center; gap: 30px; margin-top: 14px; padding: 22px 25px; }
.data-flow-panel > div { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.data-flow-panel > div > i { color: #b3b7c3; font-style: normal; }
.data-flow-panel > p { max-width: 520px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.flow-node { display: grid; gap: 2px; padding: 9px 12px; border-radius: 10px; color: #fff; background: var(--navy); font-size: 12px; font-weight: 800; }
.flow-node small { color: rgba(255,255,255,.7); font-size: 9px; font-weight: 500; }
.metrika-node { background: linear-gradient(145deg, #ff4f37, #9a48d0); }
.amo-node { background: #2e5bff; }
@media (max-width: 1350px) {
  .analytics-quality { grid-template-columns: 1fr 1.35fr; }
  .quality-action { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: 13px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .savings-hero { grid-template-columns: 1fr 1fr; }
  .savings-next-step { grid-column: 1 / -1; padding: 18px 0 0; border-top: 1px solid rgba(255,255,255,.12); border-left: 0; }
  .savings-next-step a { width: fit-content; min-width: 240px; margin-top: 0; }
}
@media (max-width: 1100px) {
  .analytics-mode-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .recommendation-grid { grid-template-columns: 1fr; }
  .network-summary { grid-template-columns: 1fr 1fr; }
  .placement-kpis { grid-template-columns: repeat(3, 1fr); }
  .placement-filters { grid-template-columns: 1fr 1fr; }
  .connection-card { grid-template-columns: auto 1fr; }
  .connection-card form { grid-column: 2; }
  .admin-kpis { grid-template-columns: repeat(3, 1fr); }
  .operator-workspace { grid-template-columns: 260px minmax(430px, 1fr); }
  .client-panel { display: none; }
  .help-steps { grid-template-columns: repeat(2, 1fr); }
  .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; grid-template-columns: repeat(4, 1fr); }
  .help-toc strong { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 14px 16px; }
  .brand { padding: 0 0 14px; }
  .nav { display: flex; overflow-x: auto; overflow-y: hidden; }
  .nav a { white-space: nowrap; }
  .sidebar-note { display: none; }
  .placement-kpis { grid-template-columns: 1fr 1fr; }
  .placement-filters { grid-template-columns: 1fr; }
  .sidebar-credit { display: none; }
  .main { padding: 26px 18px 45px; }
  .app-topbar { align-items: flex-start; margin-bottom: 20px; }
  .app-topbar .agency-switcher { flex: 1; }
  .user-menu-identity, .user-menu-chevron { display: none; }
  .user-menu > summary { min-height: 46px; padding: 5px; border-radius: 13px; }
  .user-menu-icon { width: 34px; height: 34px; }
  .analytics-quality { grid-template-columns: 1fr; }
  .ai-insight { grid-template-columns: 1fr; padding: 19px; }
  .ai-insight-grid { grid-template-columns: 1fr; }
  .ai-insight-heading { align-items: flex-start; flex-direction: column; }
  .quality-action { grid-column: auto; }
  .savings-hero { grid-template-columns: 1fr; padding: 24px; }
  .savings-next-step { grid-column: auto; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; flex-wrap: wrap; }
  .agency-switcher { align-items: stretch; flex-direction: column; }
  .agency-switcher form { align-items: stretch; flex-direction: column; }
  .agency-switcher select { width: 100%; min-width: 0; }
  .device-auth-card { grid-template-columns: 1fr; }
  .dashboard-grid, .upload-grid { grid-template-columns: 1fr; }
  .integration-grid, .pricing-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .integration-catalog { grid-template-columns: 1fr; }
  .data-flow-panel { align-items: flex-start; flex-direction: column; }
  .model-grid, .goal-layout { grid-template-columns: 1fr; }
  .amo-mapping-head { display: none; }
  .amo-mapping-row { grid-template-columns: 1fr 1fr; }
  .amo-mapping-row > div { grid-column: 1 / -1; }
  .support-layout { grid-template-columns: 1fr; }
  .support-card { display: none; }
  .admin-grid { grid-template-columns: 1fr; }
  .operator-workspace { grid-template-columns: 220px minmax(400px, 1fr); overflow-x: auto; }
  .price-card.featured { transform: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .ad-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .ad-filters, .ad-detail-grid, .ai-analysis-form { grid-template-columns: 1fr; }
  .ai-columns, .ad-variant-grid { grid-template-columns: 1fr; }
  .audience-layout { grid-template-columns: 1fr; }
}

/* Единая панель фильтров: ровные controls в Safari, Chrome и Firefox. */
.filter-toolbar.ad-filters,
.filter-toolbar.placement-filters {
  display: grid;
  grid-template-columns: minmax(280px, 1.45fr) minmax(240px, 1fr) auto;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px;
}

.filter-toolbar.placement-filters {
  grid-template-columns: minmax(240px, 1.2fr) minmax(220px, 1fr) minmax(210px, .85fr) auto;
}

.filter-toolbar .filter-field {
  display: grid;
  min-width: 0;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 14px !important;
  font-weight: 750;
  line-height: 1.2;
}

.filter-toolbar .filter-field > span {
  min-height: 17px;
}

.filter-toolbar input[type="search"],
.filter-toolbar select {
  display: block;
  width: 100%;
  height: 48px;
  min-height: 48px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background-color: var(--surface);
  font: 500 15px/1.2 Inter, "Segoe UI", Arial, system-ui, sans-serif;
  text-overflow: ellipsis;
  transition: border-color .18s, box-shadow .18s, background-color .18s;
}

.filter-toolbar input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
  padding-left: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23757b8e' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
}

.filter-toolbar input[type="search"]::-webkit-search-cancel-button {
  opacity: .55;
  cursor: pointer;
}

.filter-toolbar select {
  padding-right: 36px;
  white-space: nowrap;
}

.filter-toolbar input[type="search"]::placeholder {
  color: #9a9faf;
  opacity: 1;
}

.filter-toolbar input[type="search"]:hover,
.filter-toolbar select:hover {
  border-color: #cbd0dc;
}

.filter-toolbar input[type="search"]:focus,
.filter-toolbar select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(34, 42, 91, .09);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.filter-actions .button {
  height: 48px;
  min-height: 48px;
  padding-inline: 17px;
  border-radius: 12px;
  white-space: nowrap;
}

.filter-actions .filter-reset {
  color: var(--muted);
  box-shadow: none;
}

.filter-actions .filter-reset:hover {
  color: var(--ink);
  border-color: #cbd0dc;
}

.agency-switcher select,
.leads-sort-form select {
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background-color: var(--surface);
}

@media (max-width: 1180px) {
  .filter-toolbar.ad-filters,
  .filter-toolbar.placement-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 680px) {
  .utm-attribution-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .utm-field-grid { grid-template-columns: 1fr; }
  .utm-scheme > code { white-space: normal; overflow-wrap: anywhere; }
  .writeback-form { padding: 16px; }
  .writeback-heading, .writeback-status { align-items: stretch; flex-direction: column; }
  .writeback-switch { justify-content: center; width: 100%; }
  .filter-toolbar.ad-filters,
  .filter-toolbar.placement-filters {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .filter-actions {
    grid-column: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .filter-actions .button {
    width: 100%;
  }

  .table-panel { padding: 18px 14px; }
  .table-scroll { overflow: visible; }
  table.responsive-table,
  table.responsive-table tbody,
  table.responsive-table tr,
  table.responsive-table td { display: block; width: 100%; min-width: 0; max-width: none; }
  table.responsive-table { border-collapse: separate; border-spacing: 0; }
  table.responsive-table thead { display: none; }
  table.responsive-table tbody { display: grid; gap: 12px; }
  table.responsive-table tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(24, 31, 63, .06);
  }
  table.responsive-table td {
    display: grid;
    grid-template-columns: minmax(112px, .42fr) minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: break-word;
    word-break: normal;
  }
  table.responsive-table td:first-child { min-width: 0; }
  table.responsive-table td:last-child { border-bottom: 0; }
  table.responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    line-height: 1.35;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  table.responsive-table td[data-label=""] { display: block; }
  table.responsive-table td[data-label=""]::before,
  table.responsive-table td[colspan]::before { display: none; }
  table.responsive-table td[colspan] { display: block; text-align: left; }
  table.responsive-table td form,
  table.responsive-table td .button { max-width: 100%; }
  table.responsive-table .ad-copy-cell,
  table.responsive-table.placement-control-table td:first-child,
  table.responsive-table.placement-control-table td:nth-child(2) { min-width: 0; max-width: none; }
  table.responsive-table .placement-domain { white-space: normal; }
}
@media (max-width: 520px) {
  .recommendation-basis { align-items: flex-start; flex-direction: column; }
  .analytics-quality { padding: 18px; }
  .quality-signals { grid-template-columns: 1fr; }
  .quality-signals > div { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; }
  .quality-signals span { margin: 0; }
  .quality-signals small { grid-column: 1 / -1; }
  .quality-action { align-items: flex-start; flex-direction: column; }
  .analytics-mode-grid { grid-template-columns: 1fr 1fr; }
  .savings-hero { gap: 20px; padding: 21px; border-radius: 18px; }
  .savings-hero-label { align-items: flex-start; flex-wrap: wrap; }
  .savings-amount { font-size: 34px; }
  .savings-metrics { grid-template-columns: 1fr; }
  .savings-metrics > div { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 14px; padding: 14px; }
  .savings-metrics span { margin: 0; }
  .savings-metrics small { grid-column: 1 / -1; margin: 0; }
  .savings-next-step a { width: 100%; min-width: 0; }
  .period-filter .period-dates, .period-filter em { display: none; }
  .period-filter.is-custom { align-items: stretch; flex-direction: column; }
  .period-custom-fields { align-items: stretch; flex-direction: column; width: 100%; }
  .period-custom-fields label, .period-custom-fields input { width: 100%; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi:last-child { grid-column: 1/-1; }
  .page-header .period-filter { width: 100%; justify-content: space-between; }
  .recommendation-list .recommendation { flex-wrap: wrap; }
  .network-summary { grid-template-columns: 1fr; }
  .rec-meta { align-items: flex-start; flex-direction: column; }
  .amo-mapping-row { grid-template-columns: 1fr; }
  .amo-mapping-row > div { grid-column: auto; }
  .amo-mapping-actions { align-items: stretch; flex-direction: column; }
  .attribution-alert { align-items: stretch; flex-direction: column; }
  .source-mapping-row { grid-template-columns: 1fr; gap: 12px; }
  .leads-panel-header { align-items: stretch; }
  .leads-sort-form { align-items: stretch; flex-direction: column; width: 100%; }
  .leads-sort-form select { width: 100%; }
  .help-steps, .help-source-grid, .term-grid, .help-toc { grid-template-columns: 1fr; }
  .help-toc strong { grid-column: auto; }
  .help-section, .help-start { padding: 19px; }
  .help-contact { align-items: stretch; flex-direction: column; }
  .potential { width: 100%; text-align: left; margin-left: 41px; }
  .auth-brand { left: 20px; top: 20px; }
  .auth-theme-toggle { top: 18px; right: 20px; }
  .auth-credit { bottom: 16px; width: calc(100% - 40px); justify-content: center; text-align: center; }
  .auth-privacy-link { right: 20px; bottom: 54px; left: 20px; text-align: center; }
  .auth-card { padding: 26px 20px; }
  .privacy-document { padding: 26px 20px; }
  .form-row, .setup-steps { grid-template-columns: 1fr; }
  .connection-card, .connection-card.onboarding { grid-template-columns: 1fr; }
  .connection-card form { grid-column: auto; }
  .chat-bubble { max-width: 90%; }
  .chat-compose { grid-template-columns: 1fr; }
  .chat-compose .button { width: 100%; }
  .chat-toolbar { align-items: flex-start; }
  .chat-secure { display: none; }
  .chat-history { height: 52vh; min-height: 360px; padding: 18px 14px; }
  .admin-kpis { grid-template-columns: 1fr 1fr; }
  .admin-kpi:last-child { grid-column: 1/-1; }
  .operator-header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .operator-workspace { display: block; min-height: 0; overflow: hidden; }
  .conversation-sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation-list { max-height: 240px; }
  .operator-history { height: 420px; }
  .operator-compose > div { align-items: stretch; flex-direction: column; }
  .data-flow-panel > div { width: 100%; overflow-x: auto; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f1f3fa;
  --muted: #a9b0c3;
  --line: #353c52;
  --surface: #1d2333;
  --surface-soft: #171c2a;
  --bg: #111624;
  --navy: #6674cb;
  --accent-soft: #42261f;
  --green: #57d2a4;
  --green-soft: #173b31;
  --yellow: #f0bd62;
  --yellow-soft: #3f3521;
  --red: #ff7774;
  --red-soft: #432525;
  --shadow: 0 12px 36px rgba(0, 0, 0, .22);
}
html[data-theme="dark"] body { background: var(--bg); }
html[data-theme="dark"] .sidebar { background: #0c1120; }
html[data-theme="dark"] .panel,
html[data-theme="dark"] .kpi,
html[data-theme="dark"] .recommendation,
html[data-theme="dark"] .period-filter,
html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .chat-toolbar,
html[data-theme="dark"] .chat-bubble,
html[data-theme="dark"] .chat-compose,
html[data-theme="dark"] .operator-chat-head,
html[data-theme="dark"] .operator-compose,
html[data-theme="dark"] .client-panel,
html[data-theme="dark"] .conversation-item:hover,
html[data-theme="dark"] .conversation-item.active,
html[data-theme="dark"] .integrations-count {
  background: var(--surface);
}
html[data-theme="dark"] .kpi-accent,
html[data-theme="dark"] .admin-kpi.attention,
html[data-theme="dark"] .chat-bubble.user {
  color: #fff;
  background: #38447f;
  border-color: #4b5796;
}
html[data-theme="dark"] .period-filter select,
html[data-theme="dark"] .period-custom-fields input,
html[data-theme="dark"] .stack-form input,
html[data-theme="dark"] .stack-form select,
html[data-theme="dark"] .stack-form textarea,
html[data-theme="dark"] .chat-compose textarea,
html[data-theme="dark"] .operator-compose textarea,
html[data-theme="dark"] .amo-mapping-row select,
html[data-theme="dark"] .inline-status select,
html[data-theme="dark"] .revenue-field input {
  color: var(--ink);
  background: #262d40;
  border-color: #434b64;
}
html[data-theme="dark"] .leads-sort-form select { color: var(--ink); background: #262d40; border-color: #434b64; }
html[data-theme="dark"] .sort-link:hover, html[data-theme="dark"] .sort-link.active { color: #c7d0ff; }
html[data-theme="dark"] .button-disabled,
html[data-theme="dark"] .help,
html[data-theme="dark"] code,
html[data-theme="dark"] .formula-preview,
html[data-theme="dark"] .goal-form,
html[data-theme="dark"] .depth-flow div,
html[data-theme="dark"] .action-box,
html[data-theme="dark"] .confidence,
html[data-theme="dark"] .icon-button {
  color: var(--muted);
  background: #282f43;
}
html[data-theme="dark"] .dropzone,
html[data-theme="dark"] .credential-section,
html[data-theme="dark"] .oauth-code-form {
  background: #191f2e;
  border-color: #414961;
}
html[data-theme="dark"] .dropzone:hover { background: #34231f; border-color: var(--accent); }
html[data-theme="dark"] .rec-evidence,
html[data-theme="dark"] .inline-alert,
html[data-theme="dark"] .credential-checkbox,
html[data-theme="dark"] .message {
  color: #c7d0ff;
  background: #263052;
}
html[data-theme="dark"] .message.success { color: var(--green); background: var(--green-soft); }
html[data-theme="dark"] .message.warning { color: var(--yellow); background: var(--yellow-soft); }
html[data-theme="dark"] .message.error { color: var(--red); background: var(--red-soft); }
html[data-theme="dark"] .conversation-sidebar { background: #171c2a; }
html[data-theme="dark"] .operator-chat { background: #141a28; }
html[data-theme="dark"] .conversation-title span { color: #c7d0ff; background: #293252; }
html[data-theme="dark"] td { border-bottom-color: #2d3448; }
html[data-theme="dark"] .hiqu-credit:not(.sidebar-credit):not(.auth-credit) img { filter: invert(1); }
html[data-theme="dark"] .help-note { color: #c7d0ff; background: #263052; }
html[data-theme="dark"] .help-warning { color: #f0bd62; }
.source-mapping-row label .field-tooltip-bubble { color: #fff; font-size: 11px; }
.help-source-grid i.metrika-logo { background: linear-gradient(145deg, #ff4f37, #9a48d0); }
.help-source-grid i.amo-logo { background: #2e5bff; }

/* Крупная типографика: основной текст не мельче 14px, служебные подписи — 12px. */
body { font-size: 17px; line-height: 1.5; }
.app-shell { grid-template-columns: 278px 1fr; }
.nav a { font-size: 16px; }
.sidebar-note, .account-links, .hiqu-credit { font-size: 14px; }
.account-card small { font-size: 13px !important; }
.eyebrow { font-size: 13px; }
.page-header p:not(.eyebrow),
.settings-intro,
.privacy-document p,
.privacy-document li { font-size: 16px; }
.button, .button-small, .operator-chat-head .button { font-size: 15px; }
.period-filter, .period-summary, .period-error { font-size: 14px; }
.kpi-label, .kpi-note { font-size: 14px; }
.panel-header p,
.panel-header a,
.section-heading a,
.legend,
.recommendation p,
.recommendation > div > strong,
.connection-card p,
.integration-aside p,
.token-panel p,
.check-list,
.setup-steps div,
.advanced-connection summary,
.advanced-connection > div > p,
.integration-tile > div > p:not(.eyebrow),
.data-flow-panel > p,
.placement-footnote,
.inline-alert,
.empty-inline,
.message,
.import-row,
.footer-privacy-link,
.auth-privacy-link { font-size: 14px; }
.recommendation h3 { font-size: 17px; }
.rec-level,
.badge,
.confidence,
.connection-status,
.placement-status,
.stage-badge,
.popular,
.flow-node,
.step-number,
.ad-id,
.ad-preview > span,
.ai-verdict span,
.ad-variant-grid article > span { font-size: 12px; }
table { font-size: 15px; }
th { font-size: 13px; }
td small { font-size: 13px; }
.stack-form label,
.ai-analysis-form label,
.placement-filters label,
.ad-filters label,
.consent-checkbox { font-size: 15px !important; }
.stack-form input,
.stack-form select,
.stack-form textarea,
.chat-compose textarea,
.operator-compose textarea,
.period-filter select,
.period-custom-fields input,
.placement-filters input,
.placement-filters select,
.ad-filters input,
.ad-filters select,
.inline-status select,
.amo-mapping-row select,
.leads-sort-form select { font-size: 16px; }
.stack-form small,
.stack-form .errorlist,
.oauth-step small,
.switch-row small,
.credential-heading small,
.flow-node small,
.depth-flow small,
.depth-card > p,
.goal-list small { font-size: 13px !important; }
.chat-toolbar small,
.chat-compose > small,
.operator-compose small,
.admin-list-row small,
.admin-list-row time,
.conversation-item p,
.conversation-item time,
.client-identity small,
.client-panel > p:not(.eyebrow),
.client-panel dt,
.client-panel dd { font-size: 14px; }
.chat-bubble strong, .chat-bubble time { font-size: 13px; }
.chat-bubble p, .chat-empty p { font-size: 15px; }
.field-tooltip-bubble,
.source-mapping-row label .field-tooltip-bubble { font-size: 13px; line-height: 1.5; }

/* Единая шкала для оставшихся специализированных компонентов. */
.period-filter em,
.ad-id,
.ad-preview > span,
.ai-verdict span,
.ad-variant-grid article > span,
.rec-level,
.step-number,
.action-box span,
.potential span,
.price-name,
.popular,
.stage-badge,
.amo-mapping-head,
.help-source-grid strong,
.attribution-example b { font-size: var(--type-caption); }

.ad-filters > a,
.ad-copy-cell b,
.ad-copy-cell p,
.back-link,
.ad-preview a,
.ad-result-card span,
.ai-columns ul,
.ai-columns ol,
.ad-variant-grid strong,
.copy-ad,
.audience-warning,
.rec-evidence,
.network-card > span,
.network-card > div,
.placement-reset,
.placement-api-state,
.pagination,
.oauth-safe-note,
.support-agent small,
.chat-secure,
.admin-kpi span,
.admin-kpi small,
.operator-online,
.conversation-title span,
.status-open,
.status-waiting,
.status-closed,
.revenue-field small,
.amo-mapping-row small,
.revenue-switch,
.amo-mapping-actions p,
.help-time,
.help-steps article > span,
.help-steps p,
.help-steps a,
.help-toc strong,
.help-toc a,
.help-source-grid p,
.help-note,
.help-warning,
.attribution-example span,
.term-grid p,
.help-section details p,
.help-contact p,
.source-mapping-row small,
.source-mapping-row label span,
.leads-sort-form,
.sort-link span { font-size: var(--type-secondary); }

.ad-variant-grid p,
.settings-intro,
.conversation-item strong,
.conversation-empty,
.admin-list-row strong,
.amo-mapping-row strong,
.help-section > p,
.help-list,
.term-grid strong { font-size: var(--type-body); }

.help-steps h3,
.help-source-grid h3,
.help-section summary,
.help-section > h3,
.ai-columns h3,
.ad-preview h3 { font-size: var(--type-heading-small); }

.panel-header h2,
.section-heading h2,
.upload-panel h2,
.guide-panel h2,
.connection-card h2,
.integration-aside h2,
.token-panel h2,
.settings-card h2,
.model-card h2,
.depth-card h2,
.goals-panel h2,
.chat-empty h2,
.modal-header h2,
.import-history h2,
.client-panel h2,
.privacy-document h2 { font-size: var(--type-heading-medium); }

.price-card h2 small { font-size: var(--type-secondary); }

.field-tooltip,
.help { width: 20px; height: 20px; font-size: var(--type-caption); }
.ai-insight-heading span, .ai-insight-heading small, .ai-insight-note { font-size: var(--type-caption); }
.ai-insight-main > p, .ai-insight-grid strong, .ai-insight li { font-size: var(--type-body); }
.ai-insight-grid span { font-size: var(--type-caption); }

@media (max-width: 820px) {
  .app-shell { display: block; }
  .field-tooltip-bubble { top: calc(100% + 10px); right: 0; left: auto; width: min(300px, 82vw); transform: translateY(5px); }
  .field-tooltip-bubble::after { right: 4px; bottom: 100%; top: auto; border-color: transparent; border-bottom-color: #171d43; transform: none; }
  .field-tooltip:hover .field-tooltip-bubble, .field-tooltip:focus-visible .field-tooltip-bubble, .field-tooltip[aria-expanded="true"] .field-tooltip-bubble { transform: translateY(0); }
}

/* Единый вид селектов во всех разделах. */
select:not([multiple]) {
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
  margin: 0;
  padding: 0 42px 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f7588' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 16px;
  font: 600 14px/1.2 Inter, "Segoe UI", Arial, system-ui, sans-serif;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s, background-color .18s;
}
select:not([multiple]):hover { border-color: #cbd0dc; }
select:not([multiple]):focus-visible {
  border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(34, 42, 91, .09);
}
select:not([multiple]):disabled {
  color: var(--muted);
  background-color: var(--bg);
  cursor: not-allowed;
  opacity: .72;
}
.period-filter select:not([multiple]) { min-height: 38px; height: 38px; }
.inline-status select:not([multiple]) { min-height: 38px; height: 38px; font-size: 12px; }

.help-steps article { align-items: stretch; }
.help-steps article > div {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}
.help-steps a { align-self: flex-start; margin-top: auto; padding-top: 6px; }

.recommendation-action {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  margin-top: 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}
.recommendation-action:hover { text-decoration: underline; text-underline-offset: 3px; }
.recommendation-action.button { color: var(--navy); text-decoration: none; }
.recommendation-action.button:hover { color: var(--accent); }

.filter-toolbar.bid-filters {
  display: grid;
  grid-template-columns: minmax(260px, 520px) auto;
  align-items: end;
  gap: 16px;
  margin: 18px 0;
  padding: 20px;
}

@media (max-width: 680px) {
  .filter-toolbar.bid-filters { grid-template-columns: 1fr; }
  .filter-toolbar.bid-filters .filter-actions,
  .filter-toolbar.bid-filters .button { width: 100%; }
}

/* Премиальные карточки быстрых решений на обзоре. */
.recommendation-showcase-heading {
  align-items: center;
  margin-top: 38px;
  margin-bottom: 17px;
}
.recommendation-showcase-heading h2 {
  margin: 0;
  font-size: clamp(24px, 2.4vw, 32px);
  letter-spacing: -.035em;
}
.recommendation-showcase-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 7px 22px rgba(28, 35, 66, .06);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  transition: color .18s, border-color .18s, transform .18s, box-shadow .18s;
}
.recommendation-showcase-link:hover {
  color: var(--accent);
  border-color: rgba(255, 92, 53, .32);
  box-shadow: 0 10px 26px rgba(28, 35, 66, .10);
  transform: translateY(-1px);
}
.recommendation-grid {
  align-items: stretch;
  gap: 18px;
}
.recommendation-grid .recommendation {
  isolation: isolate;
  display: flex;
  min-width: 0;
  min-height: 330px;
  padding: 24px;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left-width: 1px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 196, 87, .13), transparent 42%),
    var(--surface);
  box-shadow: 0 18px 46px rgba(24, 31, 63, .08);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.recommendation-grid .recommendation::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, #d99019, #ffc76e);
}
.recommendation-grid .recommendation.critical {
  background:
    radial-gradient(circle at 100% 0, rgba(204, 59, 57, .12), transparent 43%),
    var(--surface);
}
.recommendation-grid .recommendation.critical::before {
  background: linear-gradient(90deg, #c93642, #ff7a70);
}
.recommendation-grid .recommendation.success {
  background:
    radial-gradient(circle at 100% 0, rgba(22, 130, 93, .12), transparent 43%),
    var(--surface);
}
.recommendation-grid .recommendation.success::before {
  background: linear-gradient(90deg, #16825d, #55c69d);
}
.recommendation-grid .recommendation.info::before {
  background: linear-gradient(90deg, #416ab9, #80a8f1);
}
.recommendation-grid .recommendation:hover {
  border-color: #d9dde7;
  box-shadow: 0 24px 58px rgba(24, 31, 63, .13);
  transform: translateY(-3px);
}
.recommendation-grid .rec-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.recommendation-grid .rec-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55);
  font-size: 17px;
}
.recommendation-grid .rec-level {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .68);
  font-size: 10px;
  letter-spacing: .1em;
}
.recommendation-grid .rec-body {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}
.recommendation-grid .recommendation h3 {
  margin: 0 0 10px;
  font-size: 19px;
  line-height: 1.22;
  letter-spacing: -.025em;
}
.recommendation-grid .recommendation p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.58;
}
.recommendation-grid .recommendation .rec-body > strong {
  display: block;
  padding: 12px 13px;
  border: 1px solid rgba(111, 117, 136, .11);
  border-radius: 11px;
  color: var(--ink);
  background: rgba(244, 245, 248, .78);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.48;
}
.recommendation-grid .recommendation-action {
  justify-content: space-between;
  width: 100%;
  min-height: 43px;
  margin-top: auto;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--navy);
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(28, 35, 66, .05);
}
.recommendation-grid .recommendation-action:hover {
  color: var(--accent);
  border-color: rgba(255, 92, 53, .32);
  text-decoration: none;
}
html[data-theme="dark"] .recommendation-grid .rec-level,
html[data-theme="dark"] .recommendation-grid .recommendation-action {
  background: #293147;
}
html[data-theme="dark"] .recommendation-grid .recommendation .rec-body > strong {
  background: #252c40;
}

@media (max-width: 680px) {
  .recommendation-showcase-heading { align-items: flex-start; gap: 14px; }
  .recommendation-showcase-link { width: 100%; justify-content: center; }
  .recommendation-grid .recommendation { min-height: 0; padding: 20px; }
}
