/* ===== Шрифты (self-hosted woff2: надёжно для РФ, работает офлайн через SW) ===== */
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/onest-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/onest-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+20BD, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/manrope-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+20BD, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  color-scheme: light;
  --bg: #f4f3ee;
  --bg-soft: #ebe9df;
  --surface: #ffffff;
  --surface-soft: #f8f7f2;
  --surface-strong: #eef4ef;
  --text: #17231f;
  --muted: #6b756f;
  --muted-strong: #48534d;
  --line: #dedbd0;
  --line-strong: #c9c5b8;
  /* Акцент: бренд-зелёный «Костюм» (роли/значения переопределяются в theme.css).
     --accent — яркий бренд-тон, --accent-strong — текст на светлом и заливка кнопок,
     --accent-deep — глубокий hover. */
  --accent: #2e8b5f;
  --accent-strong: #227a52;
  --accent-deep: #1b5c41;
  --accent-soft: #e6f0ea;
  --amber: #a86f21;
  --amber-soft: #fff4df;
  --red: #bd3f3a;
  --red-soft: #fff0ee;
  --blue: #2a668f;
  --blue-soft: #edf5fa;
  --shadow: 0 20px 48px rgba(29, 39, 34, 0.09);
  --shadow-soft: 0 10px 30px rgba(29, 39, 34, 0.06);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-width: 272px;
  --sidebar-collapsed: 76px;
  --focus: 0 0 0 3px rgba(46, 139, 95, 0.32);
  --green: #1f7a5c;
  --green-soft: #e6f1ec;
  --font-ui: "Manrope", "Aptos", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  /* motion (Emil Kowalski: быстро, ease-out, только transform/opacity) */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 130ms;
  --dur: 200ms;
  --dur-slow: 320ms;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(46, 139, 95, 0.05), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
button.is-loading {
  cursor: wait;
  opacity: 0.64;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  letter-spacing: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

[hidden],
.is-hidden {
  display: none !important;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(130% 90% at 50% -10%, rgba(46, 139, 95, 0.07), transparent 60%),
    var(--bg);
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: panel-in var(--dur-slow) var(--ease) both;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-lockup div {
  display: grid;
  min-width: 0;
  transition: opacity var(--dur-fast) var(--ease);
}

.nav-label {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity var(--dur-fast) var(--ease);
}

.brand-lockup strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.brand-lockup span:not(.brand-mark) {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
}
.brand-mark svg {
  width: 100%;
  height: 100%;
}

.auth-heading {
  display: grid;
  gap: 8px;
}

.auth-heading p {
  max-width: 34ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.auth-form {
  display: grid;
  gap: 13px;
}

.auth-form h2 {
  margin-top: 4px;
}

.auth-mode-login #register-form,
.auth-mode-register #login-form {
  display: none !important;
}

.auth-message {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  font-weight: 850;
}

.auth-message.is-info {
  color: var(--accent);
}

.auth-form-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.consent-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.consent-field input {
  margin-top: 2px;
}

.auth-legal {
  margin: 4px 0 0;
  font-size: 12px;
  text-align: center;
}

.auth-legal a {
  color: var(--muted);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns var(--dur-slow) var(--ease);
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  align-self: start;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow: visible;
}

.sidebar-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  padding: 0 4px 16px;
}

.sidebar-project-trigger {
  width: 100%;
  min-width: 0;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.sidebar-project-trigger:hover,
.sidebar-project-trigger[aria-expanded="true"] {
  border-color: var(--line);
  background: var(--surface-soft);
}

.sidebar-project-trigger:active {
  transform: translateY(1px);
}

.project-switcher {
  position: absolute;
  top: 74px;
  left: 12px;
  right: 12px;
  z-index: 30;
  display: grid;
  gap: 10px;
  max-height: min(620px, calc(100vh - 92px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 56px rgba(29, 39, 34, 0.15);
  overflow-y: auto;
  animation: menu-pop var(--dur) var(--ease) both;
}

.project-switcher-account {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 6px;
}

.project-switcher-account div,
.project-switcher-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.project-switcher-account strong,
.project-switcher-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-switcher-account span:not(.account-avatar),
.project-switcher-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-switcher-hub,
.project-switcher-create,
.project-switcher-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.project-switcher-hub {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 42px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  font-size: 13px;
  font-weight: 850;
}

.project-switcher-hub:hover,
.project-switcher-create:hover,
.project-switcher-item:hover,
.project-switcher-item.is-current {
  border-color: rgba(46, 139, 95, 0.24);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.project-switcher-search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-switcher-search input {
  min-height: 38px;
  padding: 0 10px;
  font-size: 13px;
  text-transform: none;
}

.project-switcher-list {
  display: grid;
  gap: 5px;
  max-height: 330px;
  overflow-y: auto;
}

.project-switcher-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 48px;
  padding: 7px;
  border-radius: var(--radius-sm);
}

.project-switcher-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent-strong);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.project-switcher-stat {
  justify-self: end;
  padding: 4px 6px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted-strong);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.project-switcher-create {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 7px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 850;
}

.project-switcher-create span {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
}

.project-switcher-empty {
  display: grid;
  gap: 4px;
  padding: 14px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.project-switcher-empty strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.sidebar-toggle svg {
  transition: transform var(--dur) var(--ease);
}

body.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

body.sidebar-collapsed .app-sidebar .brand-lockup div,
body.sidebar-collapsed .nav-label {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
}

/* Свёрнутое меню: аккаунт и выход остаются доступны, но компактно (только аватар + иконка). */
body.sidebar-collapsed .account-meta,
body.sidebar-collapsed .account-actions {
  display: none;
}

body.sidebar-collapsed .sidebar-footer {
  justify-content: center;
  padding-inline: 0;
}

body.sidebar-collapsed .app-sidebar {
  padding-inline: 10px;
}

body.sidebar-collapsed .sidebar-header {
  display: grid;
  justify-content: center;
  justify-items: center;
  padding-inline: 0;
}

body.sidebar-collapsed .sidebar-header .brand-lockup {
  display: inline-flex;
  justify-content: center;
  gap: 0;
  width: 48px;
  padding: 2px;
}

body.sidebar-collapsed .project-switcher {
  top: 14px;
  left: calc(100% + 8px);
  right: auto;
  width: 304px;
}

.tabs {
  display: grid;
  align-content: start;
  gap: 3px;
  padding-top: 2px;
  overflow-y: auto;
}

/* Заголовок секции навигации (как в референсе): мелкие заглавные, скупой цвет. */
.nav-group {
  margin: 0;
  padding: 14px 10px 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-group:first-child {
  padding-top: 4px;
}

.tab-button {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted-strong);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  transition:
    background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.tab-button:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.tab-button:active {
  transform: scale(0.99);
}

.tab-button.is-active {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--muted);
  transition: color var(--dur-fast) var(--ease);
}

.nav-icon svg {
  width: 19px;
  height: 19px;
}

.tab-button:hover .nav-icon {
  color: var(--text);
}

.tab-button.is-active .nav-icon {
  color: var(--accent-strong);
}

.agency-nav {
  display: none !important;
}

body.agency-hub-mode .agency-nav {
  display: block !important;
}

body.agency-hub-mode button.agency-nav {
  display: grid !important;
}

body.agency-hub-mode .project-nav {
  display: none !important;
}

body.sidebar-collapsed.agency-hub-mode button.agency-nav {
  display: flex !important;
}

body.sidebar-collapsed.agency-hub-mode .agency-nav.nav-group {
  display: none !important;
}

body.sidebar-collapsed .tabs {
  justify-items: center;
}

body.sidebar-collapsed .tab-button {
  display: flex;
  width: 44px;
  height: 42px;
  justify-content: center;
  align-items: center;
  padding: 0;
}

body.sidebar-collapsed .tab-button .nav-label {
  display: none;
}

body.sidebar-collapsed .nav-group {
  display: none;
}

/* Нижний бар аккаунта (структура референса): аватар + имя/почта + иконки. */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 12px 6px 4px;
  border-top: 1px solid var(--line);
}

.account-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.account-meta {
  display: grid;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 0;
  transition: opacity var(--dur-fast) var(--ease);
}

.account-meta strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.account-action {
  position: relative;
  width: 34px;
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.account-action:hover {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

#logout-button.account-action:hover {
  border-color: rgba(189, 63, 58, 0.22);
  background: var(--red-soft);
  color: var(--red);
}

.account-action svg {
  width: 18px;
  height: 18px;
}

.notif-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}

.app-main {
  min-width: 0;
  overflow-x: hidden;
  padding: 22px min(32px, 3vw) 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto 18px;
  max-width: 1440px;
}

.topbar-title,
.period-group,
.panel-heading,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-title {
  min-width: 0;
}

.topbar-title > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.page-subtitle {
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
}

.eyebrow {
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
}

/* Специфичность .topbar нужна, чтобы перебить .icon-button { display: inline-grid }. */
.topbar .mobile-menu-button {
  display: none;
}

body.agency-hub-mode .topbar {
  display: none;
}

main {
  width: min(100%, 1440px);
  max-width: 1440px;
  margin: 0 auto;
}

.control-panel,
.panel,
.metric-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  margin-bottom: 14px;
}

.period-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) max-content;
  align-items: end;
  min-width: 0;
}

.period-group label {
  min-width: 0;
}

.period-group .vat-field {
  justify-self: start;
  width: max-content;
  max-width: 100%;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  min-height: 43px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  padding: 9px 11px;
  outline: none;
  transition:
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    background var(--dur) var(--ease);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: var(--focus);
}

.data-freshness {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(168, 111, 33, 0.24);
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

/* Сегментированный переключатель НДС в фильтрах. */
.vat-toggle {
  display: inline-flex;
  gap: 2px;
  width: max-content;
  max-width: 100%;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}

.vat-option {
  min-height: 35px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  transition:
    background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.vat-option:hover {
  color: var(--text);
}

.vat-option.is-active {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: var(--shadow-soft);
}

.vat-option:focus-visible {
  box-shadow: var(--focus);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber);
  animation: status-breathe 1.8s ease-in-out infinite;
}

.tab-panel {
  display: none;
  animation: panel-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.tab-panel.is-active {
  display: block;
}

.agency-project-hub {
  display: grid;
  gap: 14px;
}

.agency-hub-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(46, 139, 95, 0.1), transparent 44%),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.agency-hub-hero > div {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.agency-hub-hero h2 {
  font-size: 26px;
  line-height: 1.05;
}

.agency-hub-hero p:not(.eyebrow) {
  max-width: 620px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
  line-height: 1.45;
}

.agency-create-form {
  animation: panel-in var(--dur) var(--ease) both;
}

.agency-project-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.agency-project-toolbar > div {
  display: grid;
  gap: 4px;
}

.agency-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.agency-project-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition:
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.agency-project-card:hover {
  border-color: rgba(46, 139, 95, 0.32);
  box-shadow: 0 14px 28px rgba(29, 39, 34, 0.08);
  transform: translateY(-1px);
}

.agency-project-card-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.agency-project-card-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.agency-project-card-head strong,
.agency-project-card-head span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agency-project-card-head strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.agency-project-card-head span:not(.badge) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.project-avatar {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 900;
}

.agency-project-id {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
}

.agency-project-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.agency-project-stats span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.agency-project-stats strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
}

.agency-client-invite {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px dashed rgba(46, 139, 95, 0.26);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.agency-client-invite span {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.agency-client-invite code {
  min-width: 0;
  overflow: hidden;
  padding: 7px 8px;
  border: 1px solid rgba(46, 139, 95, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agency-client-invite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agency-project-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.agency-empty {
  grid-column: 1 / -1;
}

.action-center {
  display: grid;
  gap: 13px;
  min-width: 0;
  margin-bottom: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(46, 139, 95, 0.08), transparent 42%),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.action-center-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.action-center-heading > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.action-center-heading h2 {
  font-size: 22px;
}

.action-center-heading p {
  max-width: 660px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
  line-height: 1.45;
}

.action-center-heading > .action-center-metrics {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 150px;
}

.action-center-count {
  display: inline-grid;
  place-items: center;
  flex: 0 0 58px;
  width: 58px;
  min-height: 58px;
  border: 1px solid rgba(46, 139, 95, 0.22);
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.report-accuracy {
  --accuracy: 0;
  --accuracy-color: var(--accent-strong);
  position: relative;
  display: grid;
  flex: 0 0 82px;
  place-items: center;
  align-content: center;
  gap: 1px;
  width: 82px;
  height: 82px;
  padding: 10px;
  border-radius: 50%;
  background: conic-gradient(
    var(--accuracy-color) calc(var(--accuracy) * 1%),
    var(--surface-strong) 0
  );
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(23, 35, 31, 0.07);
}

.report-accuracy::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  background: var(--surface);
}

.report-accuracy span,
.report-accuracy strong {
  position: relative;
  z-index: 1;
  text-align: center;
}

.report-accuracy span {
  max-width: 58px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  line-height: 1.15;
  text-transform: uppercase;
}

.report-accuracy strong {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.report-accuracy.is-loading {
  --accuracy-color: var(--line-strong);
}

.action-scope {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  margin-top: 4px;
  padding: 5px 8px;
  border: 1px solid rgba(46, 139, 95, 0.2);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.action-list {
  display: grid;
  gap: 9px;
}

.action-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.78);
  transition:
    border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.action-item:hover {
  border-color: rgba(46, 139, 95, 0.3);
  box-shadow: 0 10px 24px rgba(29, 39, 34, 0.06);
  transform: translateY(-1px);
}

.action-item.is-critical {
  border-color: rgba(168, 111, 33, 0.28);
  background: linear-gradient(90deg, rgba(255, 244, 223, 0.8), rgba(255, 255, 255, 0.8));
}

.action-item.is-done {
  grid-template-columns: minmax(0, 1fr) auto;
  border-color: rgba(31, 122, 92, 0.22);
  background: linear-gradient(90deg, rgba(230, 241, 236, 0.86), rgba(255, 255, 255, 0.82));
}

.action-item.is-empty {
  border-style: dashed;
}

.action-count {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--muted-strong);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 900;
}

.action-item.is-critical .action-count {
  background: var(--amber-soft);
  color: var(--amber);
}

.action-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.action-copy strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.action-copy p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
  line-height: 1.45;
}

.action-button {
  min-width: 168px;
}

.action-state {
  justify-self: end;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.kpi-context-empty {
  margin-bottom: 14px;
  border-style: dashed;
  background: var(--surface-soft);
}

.lead-form-context-empty {
  border-style: dashed;
  background: var(--surface-soft);
}

.lead-entry-section {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.lead-intake-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.lead-intake-panel > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.lead-intake-panel p {
  max-width: 820px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.45;
}

.lead-import-panel {
  display: grid;
  gap: 14px;
}

.lead-import-panel.is-hidden {
  display: none;
}

.lead-import-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.lead-import-head > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.lead-import-head p,
.lead-import-summary {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.45;
}

.lead-import-file {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.lead-import-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.lead-import-section-title {
  margin-bottom: 8px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.lead-import-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 10px;
}

.lead-import-map-row {
  display: grid;
  gap: 6px;
}

.lead-import-map-row span {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 850;
}

.lead-import-map-row select {
  width: 100%;
}

.lead-import-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.lead-import-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  background: var(--surface);
}

.lead-import-table th,
.lead-import-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12px;
  vertical-align: top;
}

.lead-import-table th {
  color: var(--muted-strong);
  font-weight: 900;
  background: var(--surface-soft);
}

.lead-import-table tr:last-child td {
  border-bottom: 0;
}

.lead-import-actions {
  display: flex;
  justify-content: flex-end;
}

.lead-import-report {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lead-import-report span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 800;
}

.lead-import-report strong {
  color: var(--text);
}

.lead-import-error,
.lead-import-errors {
  color: var(--danger);
  font-size: 13px;
  font-weight: 760;
}

.lead-import-errors {
  margin: 10px 0 0;
  padding-left: 18px;
}

.kpi-context-empty .panel-heading,
.lead-form-context-empty .panel-heading {
  margin-bottom: 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 116px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

/* Hero-карточка — единственное место, где акцент звучит в полную силу. */
.metric-card-primary {
  border-color: transparent;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(46, 139, 95, 0.2);
}

.metric-card-primary span,
.metric-card-primary small {
  color: rgba(255, 255, 255, 0.82);
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric-card strong {
  align-self: end;
  overflow: hidden;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card-primary strong {
  font-size: 31px;
}

.metric-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.metric-placeholder strong {
  color: var(--muted-strong);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 14px;
  margin-bottom: 14px;
}

.workspace-grid > *,
.kpi-grid > * {
  min-width: 0;
}

.integration-overview {
  margin-bottom: 14px;
}

.integration-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.integration-empty-panel {
  grid-column: 1 / -1;
}

.integration-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 146px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow-soft);
  transition:
    transform var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.integration-card:hover {
  transform: translateY(-2px);
  border-color: rgba(46, 139, 95, 0.32);
  box-shadow: var(--shadow);
}

.integration-card:focus-visible {
  outline: none;
  box-shadow: var(--focus), var(--shadow);
}

.integration-card-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 950;
}

.integration-card-body {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.integration-card-topline {
  display: grid;
  gap: 7px;
}

.integration-card-topline strong {
  font-size: 15px;
  line-height: 1.25;
}

.integration-card-summary {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.integration-card-action {
  grid-column: 1 / -1;
  align-self: end;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 950;
}

.integration-admin-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
}

#tab-leads .lead-form-panel,
#tab-leads .lead-form-context-empty {
  grid-column: 1 / -1;
}

.client-mode .specialist-only {
  display: none !important;
}

.client-mode .workspace-grid {
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  padding: 16px;
}

.panel-heading {
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-heading > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.panel-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  margin-top: 14px;
}

.primary-button,
.danger-button,
.ghost-button,
.icon-button,
.copy-webhook,
.delete-lead,
.edit-lead,
.touchpoints-toggle {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 900;
  transition:
    transform var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.primary-button,
.danger-button,
.ghost-button,
.icon-button {
  min-height: 42px;
}

.primary-button {
  width: auto;
  background: var(--accent-strong);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.primary-button:hover {
  background: var(--accent-deep);
}

.ghost-button,
.icon-button {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(23, 35, 31, 0.14);
  color: var(--text);
  padding: 0 12px;
}

.ghost-button:hover,
.icon-button:hover {
  border-color: rgba(46, 139, 95, 0.28);
  background: #ffffff;
  color: var(--accent-strong);
}

.primary-button:active,
.ghost-button:active,
.icon-button:active,
.copy-webhook:active,
.delete-lead:active,
.edit-lead:active,
.touchpoints-toggle:active {
  transform: translateY(1px) scale(0.99);
}

.primary-button:focus-visible,
.danger-button:focus-visible,
.ghost-button:focus-visible,
.icon-button:focus-visible,
.link-button:focus-visible,
.copy-webhook:focus-visible,
.delete-lead:focus-visible,
.edit-lead:focus-visible,
.touchpoints-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  padding: 0;
}

.link-button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 900;
  text-align: left;
  padding: 0;
}

.link-button:hover {
  color: var(--accent-strong);
}

.danger-button,
.delete-lead {
  background: var(--red-soft);
  border-color: rgba(189, 63, 58, 0.2);
  color: var(--red);
}

.copy-webhook,
.edit-lead,
.touchpoints-toggle {
  min-height: 31px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.copy-webhook,
.edit-lead {
  border: 1px solid rgba(46, 139, 95, 0.18);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.touchpoints-toggle {
  border: 1px solid rgba(23, 35, 31, 0.14);
  background: #ffffff;
  color: var(--text);
}

.client-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.client-list,
.yandex-account-list,
.lead-list,
.sa-list {
  display: grid;
  gap: 10px;
}

.client-list,
.yandex-account-list {
  margin-top: 12px;
}

.client-item,
.yandex-account-item,
.lead-item,
.sa-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.client-item,
.yandex-account-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
}

.client-main,
.client-project,
.yandex-account-item div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.client-item span,
.yandex-account-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.client-item strong,
.yandex-account-item strong {
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.client-webhook,
.client-yandex,
.client-metrika,
.client-metrika-goals,
.client-signals,
.client-telegram {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.client-webhook {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.client-webhook code,
.client-telegram a {
  min-width: 0;
  overflow: hidden;
  padding: 6px 8px;
  border: 1px solid rgba(46, 139, 95, 0.18);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-yandex span,
.client-metrika span,
.client-metrika-goals span,
.client-signals span,
.client-telegram span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.client-telegram-header,
.client-telegram-invite,
.client-yandex-header,
.client-yandex-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.client-yandex-history {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(23, 35, 31, 0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.client-yandex-subtitle {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text, #17231f);
}

.direct-history-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.direct-history-range {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.direct-history-range label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 760;
  color: var(--muted);
}

.direct-history-range input[type="date"] {
  padding: 8px 10px;
  border: 1px solid rgba(23, 35, 31, 0.16);
  border-radius: 8px;
  font: inherit;
}

.direct-history-status {
  margin: 0;
  min-height: 18px;
  font-size: 13px;
  color: var(--muted);
}

.signal-rules-list {
  display: grid;
  gap: 8px;
}

.signal-rule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 220px);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.64);
}

.signal-rule-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.signal-rule-row strong {
  font-size: 14px;
}

.signal-token-field,
.signal-snippet-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.signal-token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.signal-token-row code,
.signal-snippet-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(46, 139, 95, 0.22);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.45;
}

.signal-token-row code {
  overflow: hidden;
  padding: 8px 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-snippet-field textarea {
  resize: vertical;
}

.client-yandex-header strong {
  display: block;
  margin-top: 2px;
}

.client-yandex-note,
.client-yandex-error,
.yandex-account-details p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.client-yandex-error,
.yandex-account-details .yandex-status-error {
  color: var(--red);
}

.client-yandex-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.client-yandex-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.integration-search-input {
  width: 100%;
}

.integration-helper {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.35;
}

/* Вкладка «Настройки»: цели аналитики + сигналы + скрипт. */
.project-settings {
  display: grid;
  gap: 16px;
}

.project-main-settings {
  display: grid;
  gap: 14px;
}

.project-settings .client-metrika-goals,
.project-settings .client-signals {
  border-top: 0;
  padding-top: 0;
}

.settings-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.4;
}

.metrika-goal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.metrika-goal-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.signal-quality {
  display: grid;
  gap: 10px;
}

.signal-quality .is-bot-warn td {
  color: var(--red);
  font-weight: 850;
}

.metrika-goal-actions {
  display: flex;
  align-items: end;
}

.client-yandex-actions {
  grid-template-columns: repeat(3, minmax(0, max-content));
  justify-content: start;
}

.metrika-goal-section {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.58);
}

.metrika-goal-section summary {
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.metrika-goal-list {
  display: grid;
  gap: 8px;
}

.metrika-goal-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.metrika-goal-row.is-recommended {
  border-color: rgba(46, 139, 95, 0.34);
  background: var(--accent-soft);
}

.metrika-goal-row.is-missing {
  border-color: rgba(214, 77, 77, 0.3);
  background: var(--red-soft);
}

.metrika-goal-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.metrika-goal-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.metrika-goal-copy strong {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.metrika-goal-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.metrika-goal-tag {
  display: inline-flex;
  width: max-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e9f8ef;
  color: #11713a;
  font-size: 11px;
  font-weight: 900;
}

.metrika-goal-tag.is-error {
  background: var(--red-soft);
  color: var(--red);
}

.yandex-status-pill {
  display: inline-flex;
  width: max-content;
  align-items: center;
  justify-content: center;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.yandex-status-pill.is-ok {
  background: #e9f8ef;
  color: #11713a;
}

.yandex-status-pill.is-warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.yandex-status-pill.is-error {
  background: var(--red-soft);
  color: var(--red);
}

.yandex-status-pill.is-neutral {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.yandex-account-main,
.yandex-account-actions {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.yandex-account-actions {
  justify-items: end;
}

.yandex-account-details {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.yandex-mini-list,
.account-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.yandex-mini-list span,
.account-preview-list span {
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid rgba(46, 139, 95, 0.18);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

.account-preview-list span {
  border-radius: var(--radius-sm);
}

.account-preview-more {
  background: var(--surface-muted) !important;
  color: var(--muted) !important;
}

.account-preview-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.specialist-client-line {
  color: var(--text);
  font-weight: 850;
}

.data-quality-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.data-quality-score {
  display: inline-flex;
  min-width: 76px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 22px;
  font-weight: 950;
}

.data-quality-panel.is-high .data-quality-score {
  background: var(--green-soft);
  color: var(--green);
}

.data-quality-panel.is-medium .data-quality-score {
  background: var(--amber-soft);
  color: var(--amber);
}

.data-quality-panel.is-low .data-quality-score {
  background: var(--red-soft);
  color: var(--red);
}

.data-quality-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.data-quality-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-strong);
  transition: width var(--dur) var(--ease);
}

.data-quality-panel.is-high .data-quality-meter span {
  background: var(--green);
}

.data-quality-panel.is-medium .data-quality-meter span {
  background: var(--amber);
}

.data-quality-panel.is-low .data-quality-meter span {
  background: var(--red);
}

.data-quality-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.data-quality-list li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 14px;
  font-weight: 850;
}

.data-quality-marker {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 950;
}

.table-panel {
  margin-bottom: 14px;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.campaign-client-control {
  display: grid;
  max-width: 360px;
  gap: 6px;
  margin-bottom: 12px;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

.compact-table {
  min-width: 720px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  font-size: 14px;
  font-weight: 760;
}

td strong {
  color: var(--text);
}

.empty-row {
  position: sticky;
  left: 0;
  background: var(--surface);
  color: var(--muted);
  text-align: left;
}

.lead-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px;
}

.lead-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
  font-weight: 900;
}
/* Имя контакта рядом с типом заявки — выделяем акцентом, чтобы сразу читалось. */
.lead-name {
  color: var(--accent-strong);
}

.lead-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.48;
}

/* Drill-down по кампаниям: кампания → группа → объявления/ключи */
.drill-name {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.drill-name--l1 {
  padding-left: 22px;
}

.drill-name--l2 {
  padding-left: 44px;
}

.drill-toggle {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.drill-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.drill-spacer {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
}

.drill-row--group > td {
  background: var(--surface-soft);
}

.drill-row--item > td {
  background: var(--surface-strong);
}

.drill-row--modes > td {
  background: var(--surface-strong);
  padding-top: 6px;
  padding-bottom: 6px;
}

.drill-modes {
  display: flex;
  gap: 8px;
  padding-left: 44px;
}

.drill-mode {
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 13px;
  cursor: pointer;
}

.drill-mode.is-active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
  .drill-toggle {
    transition: none;
  }
}

/* Сквозной отчёт: строка «заявки есть, договоров нет» — кандидат на оптимизацию */
.analytics-row.is-leaky > td,
.drill-row.is-leaky > td {
  background: #fbf1e4;
  box-shadow: inset 3px 0 0 #d9a34a;
}

/* Конструктор отчёта: панель выбора колонок и статусов */
.panel-heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.grouping-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted-strong);
}

.grouping-control select {
  padding: 6px 10px;
}

/* Дашборд-конструктор: вкл/выкл виджетов + перестановка */
.widget-hidden {
  display: none !important;
}

.dashboard-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.dashboard-config {
  margin: 0 0 14px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.dashboard-config.is-hidden {
  display: none;
}

.dashboard-config-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.dashboard-config-item:last-child {
  border-bottom: none;
}

.dashboard-config-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

/* Общая «своя» галочка для конструктора дашборда и конструктора отчёта:
   квадратная 16px, нарисованная галка, без стандартной обводки браузера.
   Селектор input[type="checkbox"].lf-check специально приоритетнее глобального
   правила input/select/textarea (min-height:43px, padding) — иначе галочка
   растягивалась бы в высокий прямоугольник. Сбрасываем min-height и padding явно. */
input[type="checkbox"].lf-check {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: none;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  vertical-align: middle;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

input[type="checkbox"].lf-check::before {
  content: "";
  width: 9px;
  height: 9px;
  transform: scale(0);
  transition: transform 0.12s ease-in-out;
  background: #ffffff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

input[type="checkbox"].lf-check:checked {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

input[type="checkbox"].lf-check:checked::before {
  transform: scale(1);
}

/* Без обводки при клике мышью; аккуратное кольцо только при навигации с клавиатуры. */
input[type="checkbox"].lf-check:focus {
  outline: none;
  box-shadow: none;
  background: var(--surface);
}

input[type="checkbox"].lf-check:checked:focus {
  background: var(--accent-strong);
}

input[type="checkbox"].lf-check:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-color: var(--accent-strong);
}

.dashboard-config-move {
  display: flex;
  gap: 6px;
}

.dashboard-config-move button {
  padding: 4px 10px;
  min-width: 36px;
}

.dashboard-config-move button[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Виджет-воронка: ступени Показы → Клики → Заявки → Целевые → Договоры */
.funnel-panel {
  margin-bottom: 14px;
}

.funnel-panel .panel-heading {
  margin-bottom: 16px;
}

.funnel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.funnel-step {
  width: 100%;
  display: flex;
  justify-content: center;
}

.funnel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-sizing: border-box;
  min-width: 132px;
  max-width: 100%;
  height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(23, 35, 31, 0.12);
  transition: width 0.45s ease;
}

.funnel-bar-label {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.funnel-bar-value {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.funnel-gap {
  padding: 5px 0;
  line-height: 1;
}

.funnel-gap span {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.funnel-footer {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}

.funnel-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.funnel-metric span {
  font-size: 11px;
  color: var(--muted);
}

.funnel-metric strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.funnel-metric-romi strong {
  color: var(--accent-deep);
}

.funnel-metric strong.is-negative {
  color: var(--danger);
}

.funnel-empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .funnel-bar {
    transition: none;
  }
}

/* Виджет «Тренд по дням»: нативный SVG-столбчатый график + переключатель метрики */
.trend-panel {
  margin-bottom: 14px;
}

/* .panel-heading — иначе правило ".panel-heading > div { display:grid }" ставит кнопки столбиком. */
.panel-heading .trend-switch {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.trend-switch-btn {
  border: none;
  background: transparent;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 12px;
  min-height: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.trend-switch-btn:hover {
  color: var(--text);
}

.trend-switch-btn.is-active {
  background: var(--accent-strong);
  color: #ffffff;
}

.trend-chart-wrap {
  margin-top: 4px;
}

.trend-chart {
  display: block;
  width: 100%;
  height: auto;
}

.trend-bar {
  fill: var(--accent);
  transition: fill 0.15s ease;
}

.trend-bar:hover {
  fill: var(--accent-deep);
}

.trend-baseline {
  stroke: var(--line);
  stroke-width: 1;
}

.trend-x-label {
  fill: var(--muted);
  font-size: 13px;
}

.trend-summary {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

.trend-summary strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.trend-empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* --- Мини-CRM: переключатель вида + доска «Канбан» (task 036) --- */
.panel-heading .leads-view-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
.panel-heading .leads-view-switch {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}
.panel-heading .leads-view-switch.is-hidden {
  display: none;
}
/* Левая группа заголовка «Заявки» + кнопка «+ Этап». .panel-heading — чтобы обойти
   правило ".panel-heading > div { display:grid }" (иначе заголовок и кнопка встают столбиком). */
.panel-heading .leads-heading-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.leads-heading-main > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.lead-search-control {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.lead-search-control input {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.lead-search-control input:focus {
  outline: none;
  border-color: rgba(46, 139, 95, 0.55);
  box-shadow: var(--focus);
}

.kanban-add-stage-top {
  min-height: 0;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(46, 139, 95, 0.18);
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.kanban-add-stage-top:hover {
  background: var(--accent-strong);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(46, 139, 95, 0.28);
}
.leads-view-btn {
  border: none;
  background: transparent;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 14px;
  min-height: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.leads-view-btn:hover {
  color: var(--text);
}
.leads-view-btn.is-active {
  background: var(--accent-strong);
  color: #ffffff;
}

.kanban-board.is-hidden,
.lead-list.is-hidden {
  display: none;
}

.kanban-board {
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
/* В режиме канбана убираем нижние отступы под доской, чтобы прокрутка страницы
   останавливалась ровно на шапках этапов, а колонки доходили до низа экрана. */
.panel.table-panel:has(> #kanban-board:not(.is-hidden)) {
  margin-bottom: 0;
  padding-bottom: 0;
}
.app-main:has(#kanban-board:not(.is-hidden)) {
  padding-bottom: 0;
}

.kanban-empty {
  text-align: center;
  padding: 32px 16px;
}
.kanban-empty-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}
.kanban-empty-hint {
  margin: 0 auto 16px;
  max-width: 460px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.kanban-stage-warning {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(190, 129, 38, 0.28);
  border-radius: 10px;
  background: rgba(255, 248, 232, 0.82);
  color: #8a5a12;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.kanban-columns {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  /* Высоту доски задаёт JS (layoutKanbanBoard): доска занимает экран до низа,   */
  /* колонки скроллятся внутри себя, а сама доска (по горизонтали) статична.       */
  /* Scroll-snap НЕ используем: он отменял программный авто-скролл боковых зон.     */
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  padding-bottom: 6px;
}
.kanban-scroll-zone {
  position: absolute;
  top: var(--kanban-scroll-zone-top, 0);
  bottom: var(--kanban-scroll-zone-bottom, 6px);
  z-index: 6;
  width: 64px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}
.kanban-scroll-zone.is-left {
  left: 0;
  background: linear-gradient(90deg, rgba(250, 249, 245, 0.72), rgba(250, 249, 245, 0));
}
.kanban-scroll-zone.is-right {
  right: 0;
  background: linear-gradient(270deg, rgba(250, 249, 245, 0.72), rgba(250, 249, 245, 0));
}
.kanban-board.can-scroll-left .kanban-scroll-zone.is-left,
.kanban-board.can-scroll-right .kanban-scroll-zone.is-right {
  opacity: 0.88;
  pointer-events: auto;
}
/* Стрелку держим по центру ЭКРАНА, а не доски: JS кладёт координату в     */
/* --kanban-arrow-y, поэтому подсказка всегда в поле зрения при прокрутке.   */
.kanban-scroll-zone::before,
.kanban-scroll-zone::after {
  position: absolute;
  left: 50%;
  top: var(--kanban-arrow-y, 50%);
  transform: translate(-50%, -50%);
  transition: opacity 0.16s ease, transform 0.16s ease, color 0.16s ease;
}
.kanban-scroll-zone::before {
  content: "";
  width: 42px;
  height: 86px;
  border: 1px solid rgba(46, 139, 95, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 14px 32px rgba(23, 35, 31, 0.14);
  backdrop-filter: blur(8px);
  opacity: 0.78;
}
.kanban-scroll-zone::after {
  color: rgba(46, 139, 95, 0.86);
  font-size: 38px;
  font-weight: 850;
  line-height: 1;
}
.kanban-scroll-zone.is-left::after {
  content: "\2039";
}
.kanban-scroll-zone.is-right::after {
  content: "\203A";
}
.kanban-scroll-zone:hover::before,
.kanban-board.is-auto-scroll-left .kanban-scroll-zone.is-left::before,
.kanban-board.is-auto-scroll-right .kanban-scroll-zone.is-right::before {
  opacity: 0.98;
  transform: translate(-50%, -50%) scale(1.03);
}
.kanban-scroll-zone:hover::after,
.kanban-board.is-auto-scroll-left .kanban-scroll-zone.is-left::after,
.kanban-board.is-auto-scroll-right .kanban-scroll-zone.is-right::after {
  color: var(--accent-strong);
  transform: translate(-50%, -50%) scale(1.05);
}
/* На сенсорных устройствах боковые зоны-стрелки не нужны: доска скроллится пальцем. */
@media (hover: none) {
  .kanban-scroll-zone {
    display: none;
  }
}
.kanban-col {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}
.kanban-col.is-won {
  border-color: var(--accent);
  background: var(--accent-soft);
}
/* «Не разобрано» — входящая колонка, требует внимания в первую очередь: акцент амбер. */
.kanban-col.is-inbox {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(168, 111, 33, 0.12);
}
.kanban-col.is-inbox .kanban-col-head {
  background: var(--amber-soft);
}
.kanban-col.is-inbox .kanban-col-name {
  color: var(--amber);
}
.kanban-col.is-drop-target {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(46, 139, 95, 0.14);
}
.kanban-col.is-stage-dragging {
  opacity: 0.55;
  transform: scale(0.99);
}
.kanban-col.is-stage-drop-target {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(15, 111, 95, 0.16);
}
.kanban-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-height: 44px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  background: var(--kanban-stage-color, transparent);
  color: var(--kanban-stage-text, var(--text));
  transition: background-color 0.15s ease, color 0.15s ease;
}
.kanban-col-head[data-stage-drag-handle] {
  cursor: grab;
}
.kanban-col-head[data-stage-drag-handle]:active {
  cursor: grabbing;
}
.kanban-col-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  font-size: 14px;
  color: var(--kanban-stage-text, var(--text));
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kanban-col-count {
  margin-left: auto;
  min-width: 22px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--kanban-stage-text, var(--muted-strong));
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 999px;
  padding: 1px 7px;
}
.kanban-stage-actions {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.kanban-stage-actions button {
  min-height: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--kanban-stage-text, var(--muted-strong));
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.kanban-stage-actions button:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.78);
  color: var(--kanban-stage-text, var(--accent-strong));
}
.kanban-stage-actions button:disabled {
  opacity: 0.4;
  cursor: default;
}
.kanban-stage-form {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.kanban-stage-form.is-add {
  border-bottom: none;
}
.kanban-stage-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.kanban-stage-form input,
.kanban-stage-form select {
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.kanban-stage-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.kanban-col-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  flex: 1 1 auto;
  min-height: 0;
  /* Карточки этапа скроллятся внутри колонки по вертикали, доска остаётся статичной. */
  overflow-y: auto;
  /* Курсор внутри колонки со своим скроллом → крутим ТОЛЬКО колонку; докрутив до края,
     не «пробрасываем» прокрутку на всю страницу. Колонки без своего скролла (мало карточек)
     скролл-границы не имеют → колесо как и раньше двигает всю страницу. */
  overscroll-behavior-y: contain;
  /* Тонкий аккуратный скроллбар. */
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 35, 31, 0.22) transparent;
  /* Фон за карточками темнее самой колонки — белые карточки не сливаются. */
  background: var(--bg-soft);
  border-radius: 0 0 12px 12px;
}
/* Тонкие аккуратные полосы прокрутки в канбане (колонки — вертикаль, доска — горизонталь). */
.kanban-col-body::-webkit-scrollbar {
  width: 6px;
}
.kanban-columns::-webkit-scrollbar {
  height: 8px;
}
.kanban-col-body::-webkit-scrollbar-thumb,
.kanban-columns::-webkit-scrollbar-thumb {
  background: rgba(23, 35, 31, 0.2);
  border-radius: 999px;
}
.kanban-col-body::-webkit-scrollbar-thumb:hover,
.kanban-columns::-webkit-scrollbar-thumb:hover {
  background: rgba(23, 35, 31, 0.32);
}
.kanban-col-body::-webkit-scrollbar-track,
.kanban-columns::-webkit-scrollbar-track {
  background: transparent;
}
.kanban-columns {
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 35, 31, 0.22) transparent;
}
.kanban-col-empty {
  margin: 6px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.kanban-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px;
  box-shadow: 0 1px 2px rgba(23, 35, 31, 0.06);
  cursor: grab;
  transition: opacity 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.kanban-card:active {
  cursor: grabbing;
}
.kanban-card.is-dragging {
  opacity: 0.45;
  transform: scale(0.98);
  border-color: var(--accent);
}
.kanban-board.is-dragging .kanban-col-body {
  min-height: 118px;
}
.kanban-card-main {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0;
  min-height: 0;
  cursor: pointer;
}
.kanban-card-main:hover .kanban-card-title {
  color: var(--accent-strong);
}
.kanban-card-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.kanban-card-reminder {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-strong);
}
.kanban-card-money {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}
.kanban-col-sum {
  align-self: center;
  flex-shrink: 0;
  margin: 10px auto 2px;
  padding: 6px 10px;
  border: 1px solid rgba(23, 35, 31, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 1px 2px rgba(23, 35, 31, 0.04);
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kanban-col-sum.is-real {
  border-color: rgba(15, 111, 95, 0.2);
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-strong);
}
.kanban-card-sub {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
}
/* Блок «Как пришёл клиент» в модалке заявки */
.lead-history-block {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf9f5;
}
.lead-history-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}
.lead-history-empty {
  font-size: 13px;
  color: var(--muted);
}
.lead-history-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
}
.lead-history-item {
  display: grid;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.lead-history-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.lead-history-when,
.lead-history-who {
  font-size: 11px;
  color: var(--muted);
}

.activity-feed-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 420px;
  overflow-y: auto;
}
.activity-feed-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "when lead" "what what" "who who";
  gap: 2px 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.activity-feed-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.activity-feed-when {
  grid-area: when;
  font-size: 11px;
  color: var(--muted);
}
.activity-feed-lead {
  grid-area: lead;
  font-weight: 600;
}
.activity-feed-what {
  grid-area: what;
}
.activity-feed-who {
  grid-area: who;
  font-size: 11px;
  color: var(--muted);
}
.activity-feed-empty {
  font-size: 13px;
  color: var(--muted);
  list-style: none;
}

.lead-source-block {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf9f5;
}
.lead-source-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}
.lead-source-rows {
  display: grid;
  gap: 6px;
}
.lead-source-rows > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
}
.lead-source-rows > div > span {
  color: var(--muted);
  flex: 0 0 auto;
}
.lead-source-rows > div > b {
  color: var(--text);
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}
.kanban-card-revenue {
  margin-left: 8px;
  font-weight: 700;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}
.kanban-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.kanban-move,
.kanban-close {
  min-height: 0;
  width: 30px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.kanban-move:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}
.kanban-move-spacer {
  width: 30px;
}
.kanban-close {
  margin-left: auto;
}
.kanban-close:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.kanban-reasons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.kanban-reasons.is-hidden {
  display: none;
}
.kanban-reasons-title {
  width: 100%;
  font-size: 12px;
  color: var(--muted);
}
.kanban-reasons button {
  min-height: 0;
  padding: 4px 9px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted-strong);
  cursor: pointer;
}
.kanban-reasons button:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.kanban-add-stage-panel {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid rgba(23, 35, 31, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
}
.kanban-add-stage-panel .kanban-stage-form {
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 180px) auto;
  align-items: end;
  gap: 10px;
  padding: 0;
  border-bottom: none;
}

.deal-amount-dialog {
  max-width: 380px;
}
.deal-amount-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.deal-amount-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.report-config {
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.report-config.is-hidden {
  display: none;
}

.report-config-section {
  margin-bottom: 18px;
}

.report-config-section:last-of-type {
  margin-bottom: 8px;
}

.report-config-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted-strong);
  margin-bottom: 6px;
}

.report-config-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.report-config-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
}

.report-config-hint {
  margin: -2px 0 8px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
  max-width: 720px;
}

.report-config-actions {
  display: flex;
  justify-content: flex-end;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
  align-content: start;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.neutral {
  background: var(--surface-strong);
  color: var(--muted-strong);
}

.badge.good {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.badge.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.danger {
  background: var(--red-soft);
  color: var(--red);
}

.badge.muted {
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--muted-strong);
}

.badge.spam {
  background: var(--sidebar);
  color: #ffffff;
}

.badge.unconfirmed {
  border: 1px solid #ded4bf;
  background: #f3ead7;
  color: #80612f;
}

/* Договор — закрытая «выигранная» заявка: сплошная зелёная заливка (акцент скуп, но заметен). */
.badge.deal {
  background-color: var(--accent);
  background-image: var(--brand-gradient);
  color: #ffffff;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 40px 24px;
  text-align: center;
}

.empty-state-icon {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 2px;
  border-radius: 13px;
  background: var(--surface-strong);
  color: var(--accent);
}

.empty-state-icon svg {
  width: 22px;
  height: 22px;
}

.empty-state-title {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.empty-state-hint {
  margin: 0;
  max-width: 360px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.touchpoints-panel {
  grid-column: 1 / -1;
  display: grid;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.touchpoint-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.touchpoint-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.touchpoint-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 900;
}

.touchpoint-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.touchpoint-copy strong {
  color: var(--text);
  font-size: 13px;
}

.touchpoint-copy span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.placeholder-box {
  display: grid;
  gap: 8px;
  min-height: 120px;
  align-content: center;
  padding: 16px;
  border: 1px dashed rgba(46, 139, 95, 0.26);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
  font-weight: 760;
}

.placeholder-box strong {
  color: var(--text);
  font-size: 16px;
}

.yandex-status {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.yandex-status-error {
  margin-top: 2px;
  font-size: 12px;
  color: var(--red);
  word-break: break-word;
}

.sa-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  padding: 11px 13px;
}

.sa-item .sa-item-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sa-item .sa-item-sub {
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.sa-item .sa-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sa-feedback-item {
  align-items: flex-start;
}

.sa-feedback-item .sa-item-main {
  width: 100%;
}

.sa-feedback-message {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sa-feedback-message.is-muted {
  color: var(--muted);
}

.sa-empty {
  color: var(--muted);
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 35, 31, 0.42);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  width: min(760px, 100%);
  max-height: min(92vh, 840px);
  overflow: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: panel-in var(--dur) var(--ease) both;
}

.lead-modal-dialog .lead-form-panel {
  margin: 0;
  padding: 18px;
  box-shadow: none;
}

.integration-modal-dialog {
  width: min(860px, 100%);
}

.stage-settings-modal-dialog {
  width: min(520px, 100%);
}

.stage-settings-panel {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 18px;
  box-shadow: none;
}

.stage-settings-heading {
  padding-right: 48px;
}

.stage-settings-panel .kanban-stage-form {
  gap: 12px;
  padding: 0;
  border-bottom: none;
}

.kanban-color-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.kanban-color-row input[type="color"] {
  width: 52px;
  height: 38px;
  min-height: 38px;
  padding: 3px;
}

.kanban-color-preview {
  display: block;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.kanban-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kanban-color-swatch {
  width: 30px;
  height: 30px;
  min-height: 0;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(23, 35, 31, 0.12);
  cursor: pointer;
}

.kanban-color-swatch.is-active {
  border-color: var(--accent-strong);
}

.stage-settings-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
}

.stage-settings-order {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.integration-modal-panel {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 18px;
  box-shadow: none;
}

.integration-modal-heading {
  padding-right: 48px;
}

.integration-modal-stack {
  display: grid;
  gap: 12px;
}

.integration-modal-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.integration-code-line {
  display: block;
  min-width: 0;
  overflow: hidden;
  padding: 9px 10px;
  border: 1px solid rgba(46, 139, 95, 0.2);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.webhook-source-list {
  display: grid;
  gap: 8px;
}

.webhook-source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(23, 35, 31, 0.09);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.webhook-source-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.webhook-source-row strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.webhook-source-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.integration-oauth-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, auto);
  gap: 12px;
  align-items: center;
}

.integration-oauth-row > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.integration-oauth-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.integration-settings-link {
  margin-top: 10px;
}

.integration-picker {
  display: grid;
  gap: 10px;
}

.integration-picker label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.integration-choice-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.integration-choice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(23, 35, 31, 0.09);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.integration-choice-row:hover {
  border-color: rgba(46, 139, 95, 0.34);
  background: var(--accent-soft);
}

.integration-choice-row.is-selected {
  border-color: rgba(46, 139, 95, 0.52);
  background: var(--accent-soft);
}

.integration-choice-row > span:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.integration-choice-row strong,
.integration-choice-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-choice-row strong {
  font-size: 14px;
}

.integration-choice-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.integration-choice-state {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 950;
}

.integration-choice-empty {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed rgba(23, 35, 31, 0.14);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.4;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  background: var(--surface);
}

.feedback-widget {
  position: fixed;
  right: 18px;
  bottom: 20px;
  z-index: 80;
  display: grid;
  justify-items: end;
}

.feedback-toggle {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  background: var(--accent-strong);
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(34, 112, 76, 0.28);
  transition:
    transform var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.feedback-toggle svg {
  width: 23px;
  height: 23px;
}

.feedback-toggle:hover {
  transform: translateY(-2px);
  background: var(--accent-deep);
  box-shadow: 0 16px 34px rgba(34, 112, 76, 0.34);
}

.feedback-toggle:focus-visible,
.feedback-option:focus-visible,
.feedback-rating button:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.feedback-panel {
  position: absolute;
  right: 0;
  bottom: 64px;
  width: min(360px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 110px));
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: panel-in var(--dur) var(--ease) both;
}

.feedback-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.feedback-panel-header h2 {
  margin: 2px 0 0;
  font-size: 20px;
  line-height: 1.25;
}

.feedback-eyebrow {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.feedback-close {
  flex: 0 0 auto;
}

.feedback-options {
  display: grid;
  gap: 8px;
}

.feedback-option {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
  transition:
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.feedback-option:hover {
  border-color: rgba(46, 139, 95, 0.38);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.feedback-option > span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.feedback-option strong {
  font-size: 14px;
}

.feedback-option small {
  color: var(--muted);
  font-size: 12px;
}

.feedback-option-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.feedback-option-icon svg {
  width: 19px;
  height: 19px;
}

.feedback-form {
  display: grid;
  gap: 14px;
}

.feedback-form h3 {
  margin: 0;
  font-size: 17px;
}

.feedback-form p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.feedback-message-label {
  display: grid;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 700;
}

.feedback-message-label textarea {
  min-height: 116px;
  resize: vertical;
}

.feedback-rating {
  display: grid;
  grid-template-columns: repeat(5, 40px);
  gap: 7px;
}

.feedback-rating button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: #9aa19d;
  font-size: 23px;
  line-height: 1;
  transition:
    color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}

.feedback-rating button:hover,
.feedback-rating button.is-selected {
  border-color: #d6a52f;
  background: #fff7df;
  color: #c88c13;
}

.feedback-form-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
}

.feedback-form-actions .primary-button {
  min-width: 0;
}

.feedback-widget:not(.is-hidden) ~ .toast {
  right: 86px;
}

/* ===== Ребрендинг «Костюм» · Фаза 2 ===== */
.irid {
  background-image: var(--brand-gradient);
  background-size: 220% 220%;
}

.irid-anim {
  animation: suit-sheen 7s linear infinite alternate;
}

@keyframes suit-sheen {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

.ic {
  display: block;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primg {
  cursor: pointer;
  transition:
    filter var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.primg:hover:not(:disabled) {
  filter: brightness(1.07) saturate(1.04);
}

.primg:active:not(:disabled) {
  transform: scale(0.98);
}

.ghost2 {
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}

.ghost2:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-deep);
}

.del {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 0;
  padding: 8px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}

.del:hover:not(:disabled) {
  background: var(--danger-soft);
  color: var(--danger);
}

.iconbtn,
.icon-button {
  border-radius: 2px;
}

.chev {
  width: 16px;
  height: 16px;
  transition: transform var(--dur) var(--ease);
}

details[open] .chev {
  transform: rotate(180deg);
}

summary {
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

body {
  font-size: 13px;
}

h1,
h2,
h3,
.metric-card strong {
  letter-spacing: 0;
}

h1 {
  font-size: 26px;
  font-weight: 800;
}

h2 {
  font-weight: 700;
}

.app-main {
  padding-top: 18px;
}

.topbar {
  margin-bottom: 14px;
}

.panel,
.control-panel,
.metric-card,
.action-center,
.agency-project-card,
.integration-card {
  border-color: var(--line);
  box-shadow: none;
}

.panel,
.control-panel,
.action-center {
  border-radius: 10px;
}

.panel {
  padding: 15px 17px;
}

.panel-heading {
  margin-bottom: 12px;
}

.panel-heading h2 {
  font-size: 15px;
  line-height: 1.2;
}

.panel-note {
  font-size: 11.5px;
  font-weight: 500;
}

/* Графитовый «пиджак» навигации. */
.app-sidebar {
  border-right-color: rgba(255, 255, 255, 0.08);
  background: var(--sidebar);
  color: var(--nav-ink);
}

.app-sidebar .brand-lockup strong,
.app-sidebar .account-meta strong {
  color: var(--nav-ink);
}

.app-sidebar .brand-lockup span:not(.brand-mark),
.app-sidebar .account-meta span,
.app-sidebar .nav-group {
  color: var(--nav-muted);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.auth-card .brand-mark {
  width: 56px;
  height: 56px;
}

.sidebar-project-trigger {
  border-radius: 6px;
}

.sidebar-project-trigger:hover,
.sidebar-project-trigger[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-toggle,
.app-sidebar .account-action {
  border-color: transparent;
  background: transparent;
  color: var(--nav-muted);
}

.sidebar-toggle:hover,
.app-sidebar .account-action:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--nav-ink);
}

.app-sidebar #logout-button.account-action:hover {
  border-color: rgba(192, 85, 75, 0.38);
  background: rgba(192, 85, 75, 0.14);
  color: #ffd9d4;
}

.sidebar-footer {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.app-sidebar .account-avatar {
  background-image: var(--brand-gradient);
}

.tab-button {
  min-height: 38px;
  border-radius: 6px;
  color: var(--nav-muted);
  font-size: 13px;
  font-weight: 600;
}

.tab-button .nav-icon,
.tab-button:hover .nav-icon,
.tab-button.is-active .nav-icon {
  color: inherit;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.7;
}

.tab-button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--nav-ink);
}

.tab-button.is-active {
  border-color: transparent;
  background: linear-gradient(90deg, rgba(46, 139, 95, 0.34), rgba(31, 138, 122, 0.17));
  box-shadow: inset 2px 0 0 var(--accent);
  color: var(--nav-ink);
}

.project-switcher-mark,
.project-switcher-create span {
  background-color: var(--accent);
  background-image: var(--brand-gradient);
}

/* Кнопки: почти прямые углы, ширина по содержимому. */
.primary-button,
button.primg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  max-width: 100%;
  min-height: 38px;
  padding: 10px 16px;
  border: 0;
  border-radius: 2px;
  background-color: var(--accent);
  background-image: var(--brand-gradient);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(34, 112, 76, 0.2);
}

.primary-button:hover:not(:disabled) {
  background-color: var(--accent);
  background-image: var(--brand-gradient);
}

.ghost-button,
.copy-webhook,
.edit-lead,
.touchpoints-toggle,
button.ghost2,
label.ghost2 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: auto;
  min-height: 36px;
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}

.copy-webhook,
.edit-lead {
  color: var(--accent-deep);
  font-weight: 700;
}

.ghost-button:hover:not(:disabled),
.copy-webhook:hover:not(:disabled),
.edit-lead:hover:not(:disabled),
.touchpoints-toggle:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--accent-deep);
}

.icon-button {
  width: 36px;
  min-height: 36px;
  padding: 8px;
}

.project-delete-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid var(--danger);
  border-radius: 2px;
  background: transparent;
  color: var(--danger);
  font: 700 12px/1 var(--font-ui);
}

.project-delete-button:hover,
.danger-button:hover {
  background: var(--danger-soft);
}

button:disabled,
button.is-loading,
.primary-button:disabled,
.ghost-button:disabled,
.copy-webhook:disabled,
.edit-lead:disabled {
  border-color: transparent;
  background: var(--surface2);
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
  filter: none;
  opacity: 1;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.auth-form .primary-button {
  justify-self: stretch;
}

.feedback-form-actions .primary-button {
  width: 100%;
}

/* Поля и сегменты. */
input,
select,
textarea {
  min-height: 40px;
  border-color: var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
}

.period-group label,
.grouping-control,
.lead-search-control {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.period-group input,
.period-group select,
.grouping-control select,
.lead-search-control input {
  font-size: 12.5px;
  text-transform: none;
}

.vat-toggle,
.panel-heading .leads-view-switch,
.panel-heading .trend-switch {
  gap: 0;
  padding: 0;
  border-color: var(--line-strong);
  border-radius: 2px;
  background: var(--surface);
  overflow: hidden;
}

.vat-option,
.leads-view-btn,
.trend-switch-btn {
  min-height: 34px;
  padding: 8px 13px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.vat-option.is-active,
.leads-view-btn.is-active,
.trend-switch-btn.is-active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent-deep);
  font-weight: 700;
  box-shadow: none;
}

.vat-option:not(.is-active):hover,
.leads-view-btn:not(.is-active):hover,
.trend-switch-btn:not(.is-active):hover {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: var(--accent-deep);
}

.control-panel {
  padding: 12px 14px;
}

.data-freshness {
  min-height: 36px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
}

/* KPI: одна плотная лента, первая карточка — брендовый hero. */
.kpi-grid {
  grid-template-columns: repeat(8, minmax(128px, 1fr));
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 3px;
}

.metric-card {
  min-height: 94px;
  padding: 13px 14px;
  border-radius: 10px;
}

.metric-card-primary {
  border-color: transparent;
  background-color: var(--accent);
  background-image: var(--brand-gradient);
  box-shadow: 0 8px 20px rgba(34, 112, 76, 0.22);
}

.metric-card span {
  font-size: 10.5px;
  font-weight: 600;
}

.metric-card strong,
.metric-card-primary strong {
  font-size: 23px;
  font-weight: 700;
}

.metric-card small {
  font-size: 9.5px;
  font-weight: 500;
}

#kpi-target,
#kpi-deals,
#kpi-revenue,
#kpi-romi {
  color: var(--accent-deep);
}

#kpi-spend,
#kpi-cpl,
#kpi-cac {
  color: var(--money-deep);
}

#kpi-romi.is-negative {
  color: var(--danger);
}

/* Клиент: кольцо точности. */
.report-accuracy {
  --accuracy: 0;
  --accuracy-color: var(--info);
  display: flex;
  align-items: center;
  gap: 10px;
  width: auto;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.report-accuracy::before {
  display: none;
}

.report-accuracy-ring {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: conic-gradient(from -90deg, var(--accuracy-color) 0 calc(var(--accuracy) * 1%), var(--line) 0 100%);
}

.report-accuracy-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--surface);
}

.report-accuracy strong {
  position: relative;
  z-index: 1;
  max-width: none;
  color: var(--info-deep);
  font: 800 15px/1 var(--font-mono);
}

.report-accuracy-label {
  max-width: 74px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.3;
  text-transform: none;
}

.action-center {
  padding: 15px 17px;
  background: var(--surface);
}

.action-center-heading h2 {
  font-size: 17px;
}

.action-center-heading p {
  font-size: 12px;
  font-weight: 500;
}

.action-center-count {
  flex-basis: 46px;
  width: 46px;
  min-height: 46px;
  border-radius: 8px;
  font-size: 18px;
}

.action-item {
  padding: 10px 11px;
  border-radius: 6px;
  background: var(--surface);
}

.action-button .ic,
.integration-card-action .ic,
.primary-button .ic,
.ghost-button .ic,
.project-delete-button .ic {
  width: 16px;
  height: 16px;
}

/* Специалист: отдельная полоса качества, всегда в информационном цвете. */
.data-quality-panel {
  gap: 10px;
}

.data-quality-score-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.data-quality-score-wrap small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.data-quality-score,
.data-quality-panel.is-high .data-quality-score,
.data-quality-panel.is-medium .data-quality-score,
.data-quality-panel.is-low .data-quality-score {
  min-width: 0;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: var(--info-deep);
  font: 700 24px/1 var(--font-mono);
}

.data-quality-meter {
  height: 7px;
  border: 0;
  background: var(--surface2);
}

.data-quality-meter span,
.data-quality-panel.is-high .data-quality-meter span,
.data-quality-panel.is-medium .data-quality-meter span,
.data-quality-panel.is-low .data-quality-meter span {
  background: linear-gradient(90deg, #0e6f82, var(--info) 52%, #3a53b8);
}

.data-quality-list {
  gap: 6px;
}

.data-quality-list li {
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.data-quality-marker {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: var(--info-soft);
  color: var(--info);
}

.data-quality-marker.is-warning {
  background: var(--money-soft);
  color: var(--money);
}

.data-quality-marker .ic {
  width: 15px;
  height: 15px;
}

/* Статусы заявок: восемь фиксированных ролей. */
.badge {
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.badge.status-new {
  border: 1px solid var(--line-strong);
  background: var(--surface2);
  color: #5c6862;
}

.badge.status-work {
  border: 0;
  background: var(--info-soft);
  color: var(--info-deep);
}

.badge.status-target {
  border: 0;
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.badge.status-deal {
  border: 0;
  background-color: var(--accent);
  background-image: var(--brand-gradient);
  color: #ffffff;
}

.badge.status-no-answer {
  border: 0;
  background: var(--money-soft);
  color: var(--money-deep);
}

.badge.status-non-target {
  border: 0;
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.status-lost {
  border: 1px solid #e6bdb7;
  background: transparent;
  color: var(--danger);
}

.badge.status-spam {
  border: 0;
  background: var(--sidebar);
  color: #ffffff;
}

/* Проекты, заявки и интеграции: плоская плотная подача. */
.agency-project-grid {
  gap: 10px;
}

.agency-project-card {
  gap: 10px;
  padding: 13px;
  border-radius: 10px;
}

.agency-project-card:hover,
.integration-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.project-avatar {
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.agency-project-stats span {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface2);
  font-size: 10.5px;
  font-weight: 500;
}

.agency-project-stats strong {
  font-size: 15px;
  font-weight: 700;
}

.lead-list,
.sa-list {
  gap: 6px;
}

.lead-item,
.sa-item,
.client-item,
.yandex-account-item {
  border-radius: 6px;
}

.lead-item {
  gap: 10px;
  padding: 10px 12px;
  transition: background var(--dur-fast) var(--ease);
}

.lead-item:hover {
  background: var(--surface2);
}

.lead-title {
  gap: 6px;
  margin-bottom: 5px;
  font-size: 12.5px;
  font-weight: 700;
}

.lead-name {
  color: var(--text);
}

.lead-meta {
  font-size: 11.5px;
  line-height: 1.45;
}

.lead-phone,
.lead-date-badge,
.lead-money,
.activity-feed-when,
.lead-history-when {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.lead-money {
  color: var(--accent-deep);
  font-weight: 700;
}

.lead-money-missing {
  color: var(--money-deep);
}

.badge-row {
  gap: 5px;
}

.integration-card-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 9px;
}

.integration-card {
  min-height: 132px;
  padding: 13px;
  border-radius: 10px;
  box-shadow: none;
}

.integration-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  color: var(--accent-deep);
}

.integration-card-topline strong {
  font-size: 13px;
}

.integration-card-summary {
  font-size: 11.5px;
  font-weight: 500;
}

.integration-card-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-deep);
  font-size: 11.5px;
  font-weight: 700;
}

.yandex-status-pill {
  min-height: 22px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
}

.yandex-status-pill.is-ok {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.yandex-status-pill.is-neutral {
  border: 1px solid var(--line-strong);
  background: var(--surface2);
  color: var(--muted);
}

.yandex-status-pill.is-warn {
  background: var(--money-soft);
  color: var(--money-deep);
}

.yandex-status-pill.is-error {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Тяжёлые блоки и таблицы. */
.table-panel {
  overflow: hidden;
}

.report-details {
  padding: 0;
}

.report-details-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 13px 16px;
  cursor: pointer;
}

.report-details-summary > div {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.report-details-summary h2 {
  margin: 0;
  font-size: 14px;
}

.report-details-body {
  display: grid;
  gap: 12px;
  padding: 0 16px 15px;
  border-top: 1px solid var(--line);
}

.report-details-actions {
  justify-content: flex-end;
  padding-top: 12px;
}

table {
  border: 1px solid var(--line);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 6px;
}

th,
td {
  padding: 9px 10px;
}

th {
  background: var(--surface2);
  font-size: 9.5px;
  font-weight: 700;
}

td {
  font-size: 11.5px;
  font-weight: 500;
}

.metrika-goal-section {
  border-radius: 6px;
}

.metrika-goal-section > summary {
  position: relative;
  padding-right: 34px;
}

.metrika-goal-section > summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 13px;
  width: 7px;
  height: 7px;
  border-right: 1.8px solid var(--muted);
  border-bottom: 1.8px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  transition: transform var(--dur) var(--ease);
}

.metrika-goal-section[open] > summary::after {
  transform: translateY(-30%) rotate(225deg);
}

/* Воронка и тренд следуют смысловым цветам. */
.funnel-bar {
  height: 40px;
  border-radius: 4px;
  box-shadow: none;
}

.funnel-bar-label {
  font-size: 12px;
}

.funnel-bar-value,
.funnel-gap span,
.funnel-metric strong,
.trend-summary strong {
  font-family: var(--font-mono);
}

.trend-bar {
  fill: var(--accent);
}

.trend-bar.is-peak {
  fill: var(--accent-deep);
}

.trend-panel.is-money .trend-bar {
  fill: #cb9f45;
}

.trend-panel.is-money .trend-bar.is-peak {
  fill: #a9742a;
}

.trend-panel.is-money .trend-summary strong {
  color: var(--money-deep);
}

/* Канбан сохраняет механику, но получает геометрию темы. */
.panel-heading .leads-view-switch,
.kanban-add-stage-top,
.kanban-col,
.kanban-col-head,
.kanban-col-body,
.kanban-card,
.kanban-stage-actions button,
.kanban-move,
.kanban-close {
  border-radius: 4px;
}

.kanban-add-stage-top {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--accent-deep);
  box-shadow: none;
}

.kanban-add-stage-top:hover {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--accent-deep);
  box-shadow: none;
}

.kanban-card {
  box-shadow: none;
}

.kanban-card-money,
.kanban-col-sum,
.kanban-card-revenue {
  font-family: var(--font-mono);
}

.kanban-col-sum {
  border-radius: 4px;
  box-shadow: none;
}

.feedback-toggle {
  background-color: var(--accent);
  background-image: var(--brand-gradient);
}

.feedback-toggle:hover {
  background-color: var(--accent);
  background-image: var(--brand-gradient);
  filter: brightness(1.06);
}

/* Тост в стиле Sonner: светлая карточка, slide-up + лёгкий scale, мягкая тень. */
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  max-width: min(360px, calc(100% - 32px));
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transform-origin: bottom right;
  pointer-events: none;
  transition:
    opacity var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.sidebar-scrim {
  display: none;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes menu-pop {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes status-breathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.72;
  }
  50% {
    transform: scale(1.28);
    opacity: 1;
  }
}

@media (max-width: 1180px) {
  .control-panel {
    grid-template-columns: 1fr;
  }

  .period-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .period-group .vat-field,
  .data-freshness {
    justify-self: start;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .integration-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .app-shell,
  body.sidebar-collapsed .app-shell {
    display: block;
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(292px, calc(100vw - 42px));
    transform: translateX(-105%);
    box-shadow: var(--shadow);
    transition: transform var(--dur-slow) var(--ease);
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: block;
    background: rgba(23, 35, 31, 0.34);
    opacity: 0;
    visibility: hidden;
    transition:
      opacity var(--dur) var(--ease),
      visibility var(--dur) var(--ease);
  }

  body.sidebar-open .sidebar-scrim {
    opacity: 1;
    visibility: visible;
  }

  body.sidebar-collapsed .app-sidebar .brand-lockup div,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .account-meta {
    opacity: 1;
    pointer-events: auto;
    width: auto;
  }

  body.sidebar-collapsed .account-meta {
    display: grid;
  }

  body.sidebar-collapsed .account-actions {
    display: flex;
  }

  body.sidebar-collapsed .nav-group {
    display: block;
  }

  body.sidebar-collapsed .sidebar-footer {
    justify-content: flex-start;
    padding: 12px 6px 4px;
  }

  body.sidebar-collapsed .tab-button {
    grid-template-columns: 22px minmax(0, 1fr);
    justify-content: stretch;
    padding: 0 11px;
  }

  body.sidebar-collapsed .sidebar-header .brand-lockup {
    display: flex;
  }

  .project-switcher,
  body.sidebar-collapsed .project-switcher {
    top: 74px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100dvh - 96px);
  }

  .sidebar-toggle {
    display: none;
  }

  .topbar .mobile-menu-button {
    display: inline-grid;
  }

  .app-main {
    padding: 14px 12px 32px;
  }

  .control-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .agency-hub-hero,
  .agency-project-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .period-group,
  .form-grid,
  .kanban-add-stage-panel .kanban-stage-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .action-center-heading,
  .action-item,
  .lead-intake-panel {
    grid-template-columns: 1fr;
  }

  .action-center-metrics {
    justify-content: flex-start;
    min-width: 0;
  }

  .action-center-count {
    flex: 1 1 120px;
    min-height: 50px;
  }

  .report-accuracy {
    width: 76px;
    height: 76px;
  }

  .action-button,
  .action-state {
    justify-self: stretch;
  }

  .data-freshness {
    justify-content: flex-start;
    white-space: normal;
  }

  .lead-item,
  .client-item,
  .yandex-account-item {
    grid-template-columns: 1fr;
  }

  .client-webhook,
  .client-telegram-header,
  .client-telegram-invite,
  .client-yandex-header,
  .client-yandex-grid,
  .client-yandex-actions,
  .integration-oauth-row,
  .webhook-source-row,
  .signal-rule-row,
  .signal-token-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .client-yandex-actions {
    justify-content: stretch;
  }

  .client-yandex-actions button,
  .metrika-goal-actions button,
  .yandex-account-actions button {
    width: 100%;
  }

  .copy-webhook {
    justify-self: start;
  }

  .badge-row {
    justify-content: flex-start;
  }

  .form-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 26px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 104px;
  }

  .integration-card-grid {
    grid-template-columns: 1fr;
  }

  .integration-card {
    min-height: 132px;
  }

  .panel,
  .control-panel {
    padding: 13px;
  }

  .feedback-widget {
    right: 12px;
    bottom: 14px;
  }

  .feedback-panel {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 92px);
  }

  .feedback-widget:not(.is-hidden) ~ .toast {
    right: 12px;
    bottom: 80px;
  }
}

/* KPI остаются одной лентой на узких экранах; карточки прокручиваются горизонтально. */
@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(8, minmax(128px, 1fr));
  }

  .integration-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .integration-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-details-actions {
    justify-content: flex-start;
  }

  .report-accuracy {
    width: auto;
    height: auto;
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: repeat(8, minmax(116px, 1fr));
  }

  .integration-card-grid {
    grid-template-columns: 1fr;
  }

  .report-details-summary > div {
    display: grid;
    gap: 3px;
  }
}

/* ===== Motion foundation (LidFlow v0) ===== */
@keyframes lf-panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.tab-panel.is-active {
  animation: lf-panel-in var(--dur) var(--ease) both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== Срочная доводка к прототипу "Костюм" ===== */
:root {
  --bg: #eff2ee;
  --bg-soft: #e6ebe4;
  --surface: #ffffff;
  --surface2: #eef1ec;
  --line: #e2e7e1;
  --line-strong: #d3dad2;
  --text: #23282b;
  --muted: #6b746e;
  --muted-strong: #46514b;
  --accent: #2e8b5f;
  --accent-strong: #227a52;
  --accent-deep: #1f6244;
  --accent-soft: #e6f0ea;
  --sidebar: #2b3036;
  --nav-ink: #eef1ee;
  --nav-muted: #93a09a;
  --radius: 10px;
  --radius-sm: 4px;
  --sidebar-width: 264px;
  --sidebar-collapsed: 70px;
  --font-ui: "Onest", "Manrope", "Aptos", "Segoe UI", sans-serif;
}

body {
  background: var(--bg) !important;
  color: var(--text);
  font: 500 13px/1.35 var(--font-ui);
}

.app-main {
  padding: 22px 22px 40px;
}

main,
.topbar {
  width: 100%;
  max-width: none;
}

.topbar {
  margin-bottom: 14px;
}

.topbar-title > div {
  gap: 4px;
}

h1 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.05;
}

.page-subtitle {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.app-sidebar {
  grid-template-rows: auto auto auto 1fr auto;
  padding: 16px 13px;
  background: var(--sidebar);
}

.sidebar-header {
  min-height: 36px;
  padding: 0 0 12px;
}

.sidebar-project-trigger {
  padding: 0;
  border-radius: 4px;
}

.brand-lockup {
  gap: 10px;
}

.brand-lockup strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.app-sidebar .brand-lockup span:not(.brand-mark) {
  margin-top: 2px;
  color: var(--nav-muted);
  font-size: 10.5px;
  font-weight: 500;
}

.brand-mark,
.account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

.sidebar-toggle,
.app-sidebar .account-action {
  width: 36px;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 2px;
}

.sidebar-current-project {
  display: grid;
  gap: 6px;
  width: 100%;
  margin: 4px 0 12px;
  padding: 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--nav-ink);
  text-align: left;
}

.sidebar-current-project:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-current-project span {
  color: var(--nav-muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar-current-project strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 800;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.tabs {
  gap: 3px;
}

.nav-group {
  padding: 11px 11px 5px;
  color: var(--nav-muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.tab-button {
  min-height: 38px;
  padding: 0 11px;
  border-radius: 6px;
  color: var(--nav-muted);
  font-size: 13px;
  font-weight: 650;
}

.tab-button.is-active {
  background: rgba(46, 139, 95, 0.28);
  box-shadow: inset 2px 0 0 var(--accent);
  color: #f0fdf8;
}

.sidebar-footer {
  padding: 12px 0 0;
}

.account-meta strong {
  color: #ffffff;
  font-size: 12.5px;
}

.account-meta span {
  color: var(--nav-muted);
  font-size: 10px;
}

.project-workspace {
  display: flex;
  flex-direction: column;
}

.control-panel {
  order: 1;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: none;
}

#action-center {
  order: 2;
}

#tab-overview {
  order: 3;
}

.project-workspace > .tab-panel {
  order: 3;
}

.period-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.period-group label {
  min-width: 132px;
}

.period-group label,
.lead-search-control,
.grouping-control {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input,
select,
textarea {
  min-height: 36px;
  border-radius: 2px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
}

.primary-button,
button.primg {
  min-height: 38px;
  border-radius: 2px;
  font-size: 12.5px;
}

.ghost-button,
button.ghost2,
label.ghost2,
.copy-webhook,
.edit-lead,
.touchpoints-toggle {
  min-height: 36px;
  border-radius: 2px;
  box-shadow: none;
  font-size: 12.5px;
}

.panel,
.control-panel,
.action-center,
.metric-card,
.integration-card,
.agency-project-card {
  border-color: var(--line);
  box-shadow: none;
}

.panel,
.action-center {
  border-radius: 10px;
  padding: 16px 18px;
}

.panel-heading {
  margin-bottom: 12px;
}

.panel-heading h2 {
  font-size: 15px;
  font-weight: 700;
}

.panel-note {
  font-size: 11.5px;
  font-weight: 500;
}

.action-center {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 18px;
  margin-bottom: 16px;
  align-items: start;
}

.action-center-heading {
  grid-column: 1;
}

.action-center-heading > div {
  grid-column: 1;
}

.action-center-heading h2 {
  font-size: 17px;
  font-weight: 800;
}

.action-center-heading p {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.action-center-metrics {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 116px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

/* Агрегатный счётчик убран: у каждой строки-сигнала свой бейдж (как в прототипе). */
.action-center-count {
  display: none;
}

.action-list {
  grid-column: 1;
  gap: 4px;
}

.action-item {
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 4px 0;
  border: 0;
  background: transparent;
}

.action-item:hover {
  box-shadow: none;
  transform: none;
}

.action-count {
  width: 30px;
  min-height: 30px;
  border-radius: 4px;
  font-size: 13px;
}

.action-copy strong {
  font-size: 13px;
}

.action-copy p {
  font-size: 11.5px;
  font-weight: 500;
}

.report-accuracy {
  justify-content: center;
  flex-direction: column;
  gap: 6px;
}

/* Кружок точности — ровный круг: перебиваем общий .report-accuracy span{max-width:58px}
   (кольцо — тоже span), иначе ширина режется до 58, а высота 84 → овал. */
.report-accuracy .report-accuracy-ring {
  flex: none;
  width: 84px;
  height: 84px;
  max-width: none;
}

.report-accuracy strong {
  font-size: 18px;
}

.report-accuracy-label {
  max-width: 92px;
  text-align: center;
}

#tab-overview.is-active {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.05fr) minmax(220px, 0.62fr);
  gap: 16px;
}

#tab-overview > .dashboard-toolbar,
#tab-overview > .dashboard-config,
#tab-overview > .kpi-context-empty,
#tab-overview > .kpi-grid,
#tab-overview > .report-details {
  grid-column: 1 / -1;
}

#funnel-widget {
  grid-column: 1;
}

#trend-widget {
  grid-column: 2;
}

#data-quality-panel {
  grid-column: 3;
}

.dashboard-toolbar {
  margin-bottom: -6px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 0;
  margin-bottom: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.metric-card {
  min-height: 98px;
  padding: 14px 14px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.metric-card:last-child {
  border-right: 0;
}

.metric-card-primary {
  border-radius: 10px 0 0 10px;
  background-color: var(--accent);
  background-image: var(--brand-gradient);
  color: #ffffff;
}

.metric-card-primary span,
.metric-card-primary small,
.metric-card-primary strong {
  color: #ffffff;
}

.metric-card span {
  font-size: 10.5px;
  font-weight: 700;
}

.metric-card strong,
.metric-card-primary strong {
  font-size: 23px;
  font-weight: 750;
}

.metric-card small {
  font-size: 10px;
}

.funnel-panel,
.trend-panel,
.data-quality-panel,
.table-panel {
  margin-bottom: 0;
}

.funnel {
  align-items: stretch;
  gap: 10px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 72px minmax(96px, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.funnel-row-label {
  color: var(--muted-strong);
  font-size: 12px;
}

.funnel-track {
  height: 26px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface2);
}

.funnel-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
}

.funnel-row-value {
  min-width: 58px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.funnel-gap {
  display: none;
}

.funnel-footer {
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
}

.trend-chart-wrap {
  margin-top: 2px;
}

.trend-chart {
  max-height: 218px;
}

.trend-bar {
  fill: #caa04a;
}

.trend-bar.is-peak {
  fill: #a8791f;
}

.data-quality-panel {
  align-content: start;
}

.data-quality-list li {
  border: 0;
  background: transparent;
  padding: 4px 0;
}

.integration-card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.integration-card {
  min-height: 176px;
  padding: 18px;
}

.integration-card-icon {
  border-radius: 4px;
}

.lead-entry-section {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.lead-entry-section > .panel {
  padding: 18px;
  min-height: 114px;
}

.lead-intake-panel,
.lead-import-head {
  gap: 18px;
}

.lead-intake-panel p,
.lead-import-head p,
.lead-import-summary {
  max-width: 620px;
  font-size: 13px;
  line-height: 1.35;
}

.lead-import-panel {
  gap: 10px;
}

.lead-intake-panel,
.lead-import-panel {
  min-height: 124px;
  align-content: center;
}

.lead-import-summary:empty,
.lead-import-mapping:empty,
.lead-import-preview:empty,
.lead-import-result:empty {
  display: none;
}

.lead-form-context-empty {
  grid-column: 1 / -1;
}

.table-panel > .panel-heading {
  align-items: center;
}

.lead-search-control {
  margin: 10px 0 16px;
}

.lead-search-control input {
  border-radius: 0;
  background: var(--surface2);
}

.lead-item {
  min-height: 90px;
  padding: 13px 14px;
  border-radius: 6px;
}

.lead-title {
  font-size: 13px;
}

.lead-meta {
  font-size: 11.5px;
}

.activity-feed-panel {
  max-width: 1200px;
}

.activity-feed-list {
  max-height: none;
}

.activity-feed-item {
  grid-template-columns: 160px minmax(0, 1fr);
  grid-template-areas:
    "when lead"
    "when what"
    "when who";
  gap: 4px 26px;
  padding: 14px 0;
}

.activity-feed-when {
  font-size: 12px;
}

.project-settings {
  gap: 16px;
}

.settings-block-head h2,
.project-main-settings h2 {
  font-size: 15px;
}

.signal-rule-row {
  border-radius: 6px;
  background: var(--surface);
}

.signal-rule-row select {
  background: var(--surface2);
}

body.sidebar-collapsed .sidebar-current-project {
  display: none;
}

@media (max-width: 1180px) {
  #tab-overview.is-active {
    grid-template-columns: 1fr 1fr;
  }

  #funnel-widget,
  #trend-widget,
  #data-quality-panel {
    grid-column: auto;
  }

  #data-quality-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .app-main {
    padding: 14px 12px 32px;
  }

  #tab-overview.is-active,
  .lead-entry-section,
  .control-panel {
    grid-template-columns: 1fr;
  }

  #funnel-widget,
  #trend-widget,
  #data-quality-panel {
    grid-column: 1;
  }

  .action-center,
  .action-item {
    grid-template-columns: 1fr;
  }

  .action-center-heading {
    display: grid;
  }

  .action-center-metrics,
  .action-list {
    grid-column: 1;
    grid-row: auto;
    padding-left: 0;
    border-left: 0;
  }

  .integration-card-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Фаза 2 · доводка (Claude): карточка проекта по прототипу
   + меню «три точки» (пригласить клиента / удалить проект)
   ============================================================ */
.agency-project-grid .agency-project-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 18px;
  display: grid;
  gap: 13px;
  box-shadow: none;
}
.agency-project-grid .agency-project-card-head {
  display: flex;
  align-items: center;
  gap: 11px;
}
.agency-project-grid .agency-project-card-head .project-avatar {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  display: grid;
  place-items: center;
  font: 700 13px/1 var(--font-mono);
  flex: none;
}
.agency-project-title {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}
.agency-project-title strong {
  font-size: 14px;
  font-weight: 700;
}
.agency-project-title span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agency-project-grid .agency-project-card-head .badge {
  flex: none;
}
.agency-project-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted);
}
.agency-project-meta .dot-sep {
  color: var(--line-strong);
}
.agency-project-grid .agency-project-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.agency-project-grid .agency-project-stats span {
  background: var(--surface2);
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  display: grid;
  gap: 3px;
  font-size: 10px;
  color: var(--muted);
}
.agency-project-grid .agency-project-stats span strong {
  font: 700 18px/1 var(--font-mono);
  color: var(--text);
}
.agency-project-grid .agency-project-actions {
  display: flex;
  gap: 8px;
}
.agency-project-grid .agency-project-actions .primary-button {
  flex: 1;
  justify-content: center;
}

/* меню «три точки» */
.apc-menu {
  position: relative;
  flex: none;
}
.apc-menu-btn {
  width: 30px;
  height: 30px;
  min-height: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.apc-menu-btn:hover,
.apc-menu.is-open .apc-menu-btn {
  color: var(--accent-deep);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.apc-menu-btn .ic {
  width: 16px;
  height: 16px;
}
.apc-menu-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  min-width: 194px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: var(--shadow-soft);
  flex-direction: column;
  gap: 2px;
}
.apc-menu.is-open .apc-menu-panel {
  display: flex;
}
.apc-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: 600 12.5px/1 var(--font-ui);
  text-align: left;
  cursor: pointer;
}
.apc-menu-item:hover {
  background: var(--surface2);
}
.apc-menu-item .ic {
  width: 15px;
  height: 15px;
  color: var(--muted);
  flex: none;
}
.apc-menu-item.danger {
  color: var(--danger);
}
.apc-menu-item.danger:hover {
  background: var(--danger-soft);
}
.apc-menu-item.danger .ic {
  color: var(--danger);
}

/* активная ссылка-приглашение внутри карточки */
.agency-project-grid .agency-client-invite {
  display: grid;
  gap: 7px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}
.agency-project-grid .agency-client-invite > span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.agency-project-grid .agency-client-invite code {
  font: 500 11px/1.4 var(--font-mono);
  color: var(--text);
  word-break: break-all;
}
.agency-project-grid .agency-client-invite-actions {
  display: flex;
  gap: 8px;
}
.agency-project-grid .agency-client-invite-actions button {
  min-height: 0;
  border-radius: 2px;
  font: 700 11px/1 var(--font-ui);
  padding: 7px 10px;
}

/* ============================================================
   Фаза 2 · доводка (Claude): экран «Заявки» — компактная кнопка
   «Касания» + выравнивание карточки «Добавить заявку»/импорта
   ============================================================ */
.touchpoints-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 0;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface);
  color: var(--muted);
  font: 700 11px/1 var(--font-mono);
  cursor: pointer;
}
.touchpoints-toggle:hover {
  color: var(--accent-deep);
  border-color: var(--accent);
}
.touchpoints-toggle .ic {
  width: 14px;
  height: 14px;
}
.touchpoints-toggle[aria-expanded="true"] {
  color: var(--accent-deep);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lead-intake-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.lead-intake-panel > div {
  min-width: 0;
}
.lead-intake-panel .primary-button {
  flex: none;
  white-space: nowrap;
}
.lead-import-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  /* место под крестик закрытия (position:absolute в правом верхнем углу), иначе «Выбрать CSV» наезжает */
  padding-right: 44px;
}
.lead-import-head .lead-import-file {
  flex: none;
  white-space: nowrap;
}
/* Крестик и «Выбрать CSV» — ровная пара: крестик на том же уровне, что и кнопка
   (кнопка прижата к верху шапки на уровне внутреннего отступа окна 20px). */
.lead-import-modal-dialog .modal-close {
  top: 20px;
}
.lead-import-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.lead-import-card > div {
  min-width: 0;
}
.lead-import-card .ghost-button {
  flex: none;
  white-space: nowrap;
}
.lead-import-modal-dialog {
  width: min(1120px, 96vw);
  max-width: none;
  max-height: 88vh;
  /* Вбок окно НЕ едет — горизонтальная прокрутка только у таблицы колонок. */
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.lead-import-modal-dialog .lead-import-panel {
  border: 0;
  box-shadow: none;
  padding: 0;
  background: transparent;
}
/* Grid-дети по умолчанию min-width:auto → таблица распирала окно. Разрешаем сжиматься,
   чтобы .lead-import-table-wrap скроллил колонки внутри себя, а не двигал всё окно. */
.lead-import-panel > *,
.lead-import-mapping,
.lead-import-table-wrap {
  min-width: 0;
}

/* Заявки: строки и действия выровнены по верхней части.
   Компактность по прототипу (lrow): высота по контенту, а не фикс. 90px —
   иначе короткие заявки «раздуваются» пустотой. */
.lead-item {
  align-items: start;
  min-height: 0;
  padding: 12px 13px;
}
.lead-item .badge-row {
  align-items: flex-start;
}

/* Правило UI kit: вторичные кнопки — приглушённый прозрачный зелёный,
   чтобы не перетягивать акцент у первичной (градиентной) кнопки */
.ghost2:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line-strong));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent-deep);
}

/* Сайдбар: футер прижат к низу (был grid, футер уезжал вверх) */
.app-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.sidebar-footer {
  margin-top: auto;
}

/* Настройки: селект правила сигналов — цвет по выбранному значению */
.signal-rule-select {
  font-weight: 600;
}
.signal-rule-select[data-mode="lead"] {
  color: var(--accent-deep);
}
.signal-rule-select[data-mode="confirm"] {
  color: var(--money-deep);
}
.signal-rule-select[data-mode="analytics"] {
  color: var(--muted);
}
.signal-rule-select[data-mode="ignore"] {
  color: var(--danger);
}

/* Аналитика: тулбар — кнопки подняты на уровень фильтра + «Обновлено ЧЧ:ММ» */
.control-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
}
.control-panel .period-group {
  flex: 1 1 auto;
}
.control-panel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}
.analytics-updated {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.analytics-updated.is-hidden {
  display: none;
}
/* Индикатор свежести статистики: зелёный < 24 ч, охра — пора обновить. */
.status-dot.is-fresh {
  background: var(--accent);
}
.status-dot.is-stale {
  background: var(--money);
}
.control-panel-actions .freshness-note {
  font-size: 11px;
  color: var(--muted);
}
.control-panel-actions .analytics-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.control-panel-actions .analytics-actions.is-hidden {
  display: none;
}

/* Качество данных: число и «из 100» — в одну строку по базовой линии (не переносить) */
#data-quality-panel .data-quality-score-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}
#data-quality-panel .data-quality-score-wrap small {
  white-space: nowrap;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

/* hero-шапка «Проекты»: чистый заголовок, без панели-коробки (как в прототипе) */
.agency-hub-hero {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  align-items: start;
}
.agency-hub-hero h2 {
  font-weight: 800;
  letter-spacing: -0.02em;
}
.agency-hub-hero p:not(.eyebrow) {
  font-weight: 500;
  font-size: 13px;
}

/* KPI: денежные карточки — меньший кегль, чтобы крупные суммы (напр. «1 000 000 ₽»)
   влезали без обрезки «…». Числовые карточки (Заявки/Целевые/Договоры) не трогаем. */
.kpi-grid .metric-card.metric-placeholder strong {
  font-size: 18px;
}

/* Первичная зелёная карточка: без своего радиуса — сетка (overflow-x:auto) сама скругляет
   угол клипом. Свой border-radius недо-заливал угол → была белая полоса. */
.kpi-grid .metric-card-primary {
  border-radius: 0;
}

/* Тренд — единый охровый (money) тон: все кнопки-метрики и столбцы охра.
   Отделяем trend-switch от vat/leads (те остаются зелёными). */
.trend-switch-btn.is-active {
  background: color-mix(in srgb, var(--money) 16%, transparent);
  color: var(--money-deep);
}
.trend-switch-btn:not(.is-active):hover {
  background: color-mix(in srgb, var(--money) 8%, transparent);
  color: var(--money-deep);
}
.trend-bar {
  fill: #caa04a;
}
.trend-bar.is-peak {
  fill: #a8791f;
}

/* Цифры дашборда — обычный шрифт (Onest) с табличными цифрами: чистые нули без «точек»
   (у JetBrains Mono нолик с точкой). Выравнивание колонок сохраняется через tabular-nums. */
.metric-card strong,
.funnel-metric strong,
.funnel-row-value,
.trend-summary strong {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
}

/* ── Строка заявки: компактный ряд действий ────────────────────────────────
   Единый размер, без рамок (как у корзины), подсветка по наведению.
   Статус атрибуции — цветная точка с подсказкой по наведению (title). */
.lead-item .badge-row {
  align-items: center;
  gap: 3px;
}
.lead-attr {
  position: relative;
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: 3px;
  border-radius: 999px;
  background: var(--muted);
  cursor: help;
}
/* Быстрый тултип (нативный title тормозит ~1 с): появляется почти сразу. */
.lead-attr::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 5px;
  background: var(--text);
  color: var(--surface);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.1s ease;
  z-index: 40;
}
.lead-attr:hover::after,
.lead-attr:focus-visible::after {
  opacity: 1;
  visibility: visible;
}
.lead-attr.good {
  background: var(--accent);
}
.lead-attr.warn {
  background: var(--money);
}
.lead-attr.danger {
  background: var(--danger);
}
.lead-attr.neutral {
  background: var(--line-strong);
}
.lead-item .edit-lead,
.lead-item .delete-lead,
.lead-item .touchpoints-toggle {
  min-height: 30px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.lead-item .edit-lead {
  gap: 5px;
  padding: 0 10px;
  color: var(--muted-strong);
}
.lead-item .edit-lead .ic,
.lead-item .delete-lead .ic,
.lead-item .touchpoints-toggle .ic {
  width: 15px;
  height: 15px;
}
.lead-item .edit-lead:hover:not(:disabled),
.lead-item .touchpoints-toggle:hover {
  border: 0;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-deep);
}
.lead-item .delete-lead {
  color: var(--muted);
}
.lead-item .delete-lead:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ── Директ-модалка: иерархия кнопок и выделение аккаунта ─────────────────── */
.client-yandex-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
/* «Снять привязку» — просто текст, но геометрия (высота 36px, углы 2px, паддинги)
   как у соседних кнопок → красная подсветка при наведении ровно совпадает по форме. */
.binding-unlink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  margin-left: auto;
  min-height: 36px;
  padding: 9px 13px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.binding-unlink:hover {
  background: var(--danger-soft);
  color: var(--danger);
}
/* «Загрузить статистику» — по содержимому, не на всю ширину */
.client-yandex-history .primary-button {
  align-self: flex-start;
  width: auto;
}
/* Подключённый/выбранный аккаунт — заметнее: акцентная рамка + полоса слева */
.integration-choice-row.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  box-shadow: inset 3px 0 0 var(--accent);
}

/* ============================================================
   Единая логика модальных окон
   ------------------------------------------------------------
   • у каждой модалки сплошная поверхность (страховка от «прозрачных» окон);
   • крестик закрытия — одинаковая иконка в правом верхнем углу;
   • заголовок не заезжает под крестик.
   ============================================================ */
.modal-dialog {
  background: var(--surface);
}
/* Иконка-крестик одинаковая во всех модалках */
.modal-close svg {
  width: 18px;
  height: 18px;
}
/* Окно «Сумма договора»: своя поверхность-отступы (внутри нет .panel) */
.deal-amount-dialog {
  padding: 20px;
}
.deal-amount-heading {
  padding-right: 40px;
}
.deal-amount-heading h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

/* ============================================================
   Проект-свитчер (выпадашка) — более «дорогой» вид
   ------------------------------------------------------------
   Раньше: плоская стопка одинаковых строк, разнобой скруглений,
   всё жирным (850–900) → выглядело дёшево.
   Теперь: шапка аккаунта = отдельная мягкая карточка, единые
   скругления 10px, спокойнее насыщенность шрифта.
   ============================================================ */
.project-switcher {
  gap: 8px;
  padding: 12px;
  border-color: var(--line-strong);
}
/* Шапка «кто ты» — отдельная секция-карточка сверху */
.project-switcher-account {
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--surface-soft);
}
.project-switcher-account strong {
  font-size: 14px;
  font-weight: 800;
}
.project-switcher-account span:not(.account-avatar) {
  font-weight: 600;
}
/* «Панель управления» — заметная строка-действие с тонкой обводкой */
.project-switcher-hub {
  min-height: 44px;
  border-color: var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 750;
}
/* Единые скругления и спокойнее шрифт у строк */
.project-switcher-item {
  border-radius: 10px;
}
.project-switcher-item strong {
  font-weight: 750;
}
.project-switcher-mark {
  border-radius: 9px;
  font-weight: 800;
}
.project-switcher-create {
  margin-top: 2px;
  border-top-color: transparent;
  border-radius: 10px;
  font-weight: 750;
}
/* Бейдж «N новых» — на Onest с табличными цифрами (как остальные числа) */
.project-switcher-stat {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  font-weight: 700;
}

/* ============================================================
   Настройки → «Цели»: компактный блок + модалка полного выбора
   ============================================================ */
.metrika-goals-modal-dialog {
  width: min(640px, 100%);
}
.metrika-goals-panel {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 18px;
  box-shadow: none;
}
.metrika-goals-panel .panel-heading {
  padding-right: 48px;
}
/* Компактный блок в Настройках: выбранные цели — чипами */
.metrika-goal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.metrika-goal-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}
.metrika-goal-chip.is-missing {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line-strong));
  color: var(--danger);
}

/* ============================================================
   Сворачиваемая секция настроек (напр. «Правила сигналов»)
   ============================================================ */
.settings-collapsible-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  cursor: pointer;
}
.settings-collapsible-summary::-webkit-details-marker {
  display: none;
}
.settings-collapsible-summary > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.settings-collapsible-summary h2 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}
.settings-collapsible-chevron {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  color: var(--muted);
  transition: transform var(--dur) var(--ease);
}
.settings-collapsible-chevron svg {
  width: 18px;
  height: 18px;
}
.settings-collapsible[open] .settings-collapsible-chevron {
  transform: rotate(180deg);
}
.settings-collapsible-summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius-sm);
}
.settings-collapsible-body {
  margin-top: 14px;
}

/* ============================================================
   Импорт заявок — колонко-ориентированный маппинг (стиль Unisender)
   ============================================================ */
.lead-import-map-hint {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.lead-import-req-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.lead-import-req {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
}
.lead-import-req.is-ok {
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.lead-import-req.is-missing {
  background: var(--danger-soft);
  color: var(--danger);
}
.lead-import-map-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}
.lead-import-map-table th {
  min-width: 160px;
  padding: 9px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
  text-align: left;
  vertical-align: top;
  background: var(--surface-soft);
}
.lead-import-col-select {
  width: 100%;
  min-height: 34px;
}
.lead-import-col-name {
  display: block;
  max-width: 220px;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lead-import-map-table td {
  max-width: 220px;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lead-import-map-table th:last-child,
.lead-import-map-table td:last-child {
  border-right: 0;
}
.lead-import-map-table tbody tr:last-child td {
  border-bottom: 0;
}
.lead-import-more-row td {
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

/* ============================================================
   Суперадмин — единый стиль карточек (аватарки, плашки, чипы)
   ============================================================ */
.sa-item .sa-item-id {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sa-item .sa-item-id > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.sa-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.sa-item-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sa-stat {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.sa-stat strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.sa-item-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.sa-feedback-pill {
  align-self: flex-start;
  margin-bottom: 3px;
}

/* Знак бренда: нейтрализуем глобальное svg{stroke:currentColor}, иначе залитые
   стрелка и точка получают лишнюю тёмную обводку. Дуги задают свой stroke инлайн и не страдают. */
.brand-mark svg {
  stroke: none;
}
.brand-mark svg [fill]:not([stroke]) {
  stroke: none;
}

/* Бренд в сайдбаре (тёмный фон) — знак на фоне сайдбара, REZONNO по мастеру бренда, без слогана */
.app-sidebar .brand-lockup {
  gap: 11px;
}
.app-sidebar .brand-lockup strong {
  font-size: 22px;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: 0.02em;
}

/* Логотип REZONNO на странице входа (белый фон) — пропорции и цвета из мастера бренда */
.auth-card .brand-lockup {
  gap: 15px;
  align-items: center;
}
.auth-card .brand-lockup strong {
  font-size: 32px;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: 0.004em;
  color: #17231f;
}
.auth-card .brand-lockup span:not(.brand-mark) {
  margin-top: 0.28em;
  color: #2e8b5f;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.005em;
}

/* ── KPI: числа на одной линии + подпись под числом ──────────────────────────
   Карточка = 3 строки: подпись / число / доп.текст (низ добирается 1fr).
   Число во всех карточках встаёт на одну высоту, даже если доп.текста нет. */
.kpi-grid .metric-card {
  grid-template-rows: auto auto 1fr;
  align-content: start;
  gap: 4px;
}
.kpi-grid .metric-card strong,
.kpi-grid .metric-card small {
  align-self: start;
}

/* Точность отчёта ещё не посчитана (report-accuracy скрыт) — правую колонку
   сигналов не показываем, иначе висит пустая рамка-разделитель. */
.action-center:has(#report-accuracy.is-hidden) .action-center-metrics {
  display: none;
}

/* Кабинет клиента: один проект и нет панели управления — плашку
   «Текущий проект / Выберите проект» и переключатель проектов прячем. */
.client-mode .sidebar-current-project {
  display: none;
}
.client-mode .sidebar-project-trigger {
  pointer-events: none;
}

/* Кабинет клиента: импорта из CSV нет — блок «Добавить заявку» на всю ширину,
   без пустой второй колонки. */
.client-mode .lead-entry-section {
  grid-template-columns: 1fr;
}
