/* shadcn/ui token layer for the Flask/Jinja interface */
:root {
  color-scheme: light;
  --background: 40 7% 95%;            /* #F4F3F1 — soft light gray workspace */
  --foreground: 0 0% 9%;             /* #161616 — premium near-black text */
  --card: 0 0% 100%;                 /* #FFFFFF */
  --card-foreground: 0 0% 9%;
  --popover: 0 0% 100%;
  --popover-foreground: 0 0% 9%;
  --primary: 21 100% 55%;            /* #FF6A1A — citrus orange */
  --primary-2: 25 100% 55%;          /* #FF7A1A — bright orange */
  --primary-foreground: 0 0% 100%;
  --secondary: 36 22% 93%;
  --secondary-foreground: 0 0% 9%;
  --muted: 33 18% 90%;
  --muted-foreground: 33 5% 41%;     /* #6F6A64 */
  --accent: 24 100% 96%;
  --accent-foreground: 24 90% 48%;   /* #E85A0C — deep orange accent */
  --destructive: 4 67% 51%;          /* #D63A2F */
  --destructive-foreground: 0 0% 100%;
  --border: 32 22% 88%;              /* #E7E1DA */
  --input: 32 22% 88%;
  --ring: 21 100% 55%;
  --radius: 0.5rem;

  --success: 21 100% 55%;
  --warning: 25 100% 55%;            /* #FF7A1A */
  --info: 21 100% 55%;
  --sidebar: 0 0% 7%;               /* #111111 — dark surface */
  --sidebar-foreground: 0 0% 96%;
  --sidebar-muted: 33 12% 69%;       /* #B9B1A8 — warm faint on dark */

  /* Motion tokens (Tremor-style easing from template-planner) */
  --ease-out-expo: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur-fast: 140ms;
  --dur-normal: 240ms;
  --dur-slow: 420ms;

  /* Corporate gradient + tinted depth shadows */
  --gradient-primary: linear-gradient(135deg, #FF8A2A 0%, #FF6A1A 45%, #FF5A00 100%);
  --gradient-sheen: linear-gradient(120deg, transparent 0%, hsl(0 0% 100% / .14) 50%, transparent 100%);

  --bg: hsl(var(--background));
  --bg-2: hsl(var(--muted));
  --surface: hsl(var(--card));
  --surface-2: hsl(var(--muted));
  --surface-3: hsl(var(--accent));
  --text: hsl(var(--foreground));
  --text-1: hsl(var(--foreground));
  --text-2: hsl(var(--muted-foreground));
  --text-3: hsl(var(--muted-foreground) / .68);
  --accent-color: hsl(var(--primary));
  --accent-hover: hsl(var(--primary) / .9);
  --accent-bg: hsl(var(--primary) / .1);
  --accent-text: hsl(var(--primary-foreground));
  --danger: hsl(var(--destructive));
  --danger-bg: hsl(var(--destructive) / .1);
  --danger-fg: hsl(var(--destructive));
  --success-bg: hsl(var(--success) / .1);
  --success-fg: hsl(var(--success));
  --warning-bg: hsl(var(--warning) / .12);
  --warning-fg: hsl(var(--warning));
  --panel-bg: hsl(var(--card));
  --panel-border: hsl(var(--border));
  --panel-radius: var(--radius);
  --panel-hdr-bg: hsl(var(--muted) / .58);
  --panel-shadow: 0 1px 2px hsl(var(--foreground) / .04);
  --inp-bg: hsl(var(--background));
  --inp-border: hsl(var(--input));
  --inp-text: hsl(var(--foreground));
  --inp-ph: hsl(var(--muted-foreground));
  --inp-focus: hsl(var(--ring));
  --inp-focus-ring: hsl(var(--ring) / .22);
  --tbl-hdr-bg: hsl(var(--muted) / .58);
  --tbl-hdr-text: hsl(var(--muted-foreground));
  --tbl-border: hsl(var(--border));
  --tbl-row-hover: hsl(var(--muted) / .62);
  --btn-1-bg: hsl(var(--primary));
  --btn-1-border: hsl(var(--primary));
  --btn-1-text: hsl(var(--primary-foreground));
  --btn-1-shadow: 0 8px 18px hsl(var(--primary) / .18);
  --btn-2-bg: hsl(var(--background));
  --btn-2-border: hsl(var(--border));
  --btn-2-text: hsl(var(--foreground));
  --btn-2-hover: hsl(var(--muted));
  --link: hsl(var(--primary));
  --link-hover: hsl(var(--primary) / .88);
  --shadow-sm: 0 1px 2px hsl(var(--primary) / .06);
  --shadow-md: 0 6px 20px hsl(var(--primary) / .1), 0 2px 6px hsl(var(--foreground) / .05);
  --shadow-lg: 0 20px 48px hsl(var(--primary) / .16), 0 6px 16px hsl(var(--foreground) / .08);
  --bdg-blue-bg: rgb(255 106 26 / .08);
  --bdg-blue-text: var(--ks-brand-orange-deep);
  --bdg-blue-bdr: rgb(255 106 26 / .28);
  --bdg-green-bg: hsl(var(--success) / .1);
  --bdg-green-text: hsl(var(--success));
  --bdg-green-bdr: hsl(var(--success) / .22);
  --bdg-yel-bg: hsl(var(--warning) / .12);
  --bdg-yel-text: hsl(var(--warning));
  --bdg-yel-bdr: hsl(var(--warning) / .24);
  --bdg-red-bg: hsl(var(--destructive) / .1);
  --bdg-red-text: hsl(var(--destructive));
  --bdg-red-bdr: hsl(var(--destructive) / .22);
  --bdg-gray-bg: hsl(var(--muted));
  --bdg-gray-text: hsl(var(--muted-foreground));
  --bdg-gray-bdr: hsl(var(--border));
  --alt-ok-bg: hsl(var(--success) / .1);
  --alt-ok-text: hsl(var(--success));
  --alt-ok-bdr: hsl(var(--success) / .24);
  --alt-er-bg: hsl(var(--destructive) / .1);
  --alt-er-text: hsl(var(--destructive));
  --alt-er-bdr: hsl(var(--destructive) / .24);
  --alt-in-bg: hsl(var(--primary) / .1);
  --alt-in-text: hsl(var(--primary));
  --alt-in-bdr: hsl(var(--primary) / .24);
  --sel-bar-bg: hsl(var(--primary) / .08);
  --sel-bar-border: hsl(var(--primary) / .22);
  --sb-bg: hsl(var(--sidebar));
  --sb-border: hsl(var(--border));
  --sb-text: hsl(var(--sidebar-muted));
  --sb-text-a: hsl(var(--sidebar-foreground));
  --sb-active-bg: hsl(var(--primary) / .1);
  --sb-hover-bg: hsl(var(--muted));
}


*,
*::before,
*::after { box-sizing: border-box; }

* { scrollbar-width: thin; scrollbar-color: hsl(var(--border)) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

html { min-height: 100%; background: hsl(var(--background)); }
body {
  margin: 0;
  min-height: 100vh;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: "Vela Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { letter-spacing: 0; }

.lucide-icon {
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: -0.125em;
}

/* Layout and navigation */
.layout { display: flex; min-height: 100vh; background: hsl(var(--background)); }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 244px;
  display: flex;
  flex-direction: column;
  border-right: 0;
  background:
    radial-gradient(circle at 18% 8%, rgba(255,106,26,.16), transparent 28%),
    linear-gradient(180deg, #111111 0%, #1F1A17 100%);
  color: hsl(var(--sidebar-foreground));
  overflow: hidden;
  transition: width .24s cubic-bezier(.2,.8,.2,1);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 84px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo-img {
  display: block;
  height: 60px;
  width: auto;
  max-width: 180px;
  min-width: 0;
  opacity: 1;
  transform: translateX(0);
  transition: opacity .18s ease, max-width .24s cubic-bezier(.2,.8,.2,1), transform .24s cubic-bezier(.2,.8,.2,1);
}
.sidebar-logo-img--light { display: none; }
.sidebar-logo-img--dark  { display: block; }
/* Emblem (favicon mark) shown only when the sidebar is collapsed. */
.sidebar-logo-emblem {
  display: none;
  height: 34px;
  width: auto;
  opacity: 1;
  filter: brightness(0) invert(1);
  transition: opacity .18s ease;
}
.sidebar-collapse-btn {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,.45);
  cursor: pointer;
  transition: color .16s ease, transform .18s ease;
}
.sidebar-collapse-btn:hover,
.sidebar-collapse-btn:focus-visible {
  outline: none;
  background: transparent;
  color: rgba(255,255,255,.9);
  transform: translateX(-2px);
}
.sidebar-collapse-btn:active { transform: translateX(-3px); }
.sidebar-collapse-btn svg { width: 22px; height: 22px; stroke-width: 1.9; }
.sidebar-collapse-icon {
  display: inline-flex;
  transition: transform .24s cubic-bezier(.2,.8,.2,1);
}
.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 18px 0 18px 14px;
  overflow: visible;
}
.sidebar-footer {
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-utility-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.sidebar-utility-link {
  min-height: 38px;
  margin-right: 0;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12.5px;
  color: hsl(var(--sidebar-muted));
}
.sidebar-utility-link.active {
  min-height: 38px;
  margin-right: 0;
  padding-left: 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.1);
  color: hsl(var(--sidebar-foreground));
}
.sidebar-utility-link.active::before,
.sidebar-utility-link.active::after {
  display: none;
}
.sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 12px;
  margin: 0 0 4px;
  min-width: 0;
}
.sidebar-account-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sidebar-account-org {
  font-size: 13.5px;
  font-weight: 600;
  color: hsl(var(--sidebar-foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-account-text,
.nav-label {
  opacity: 1;
  transform: translateX(0);
  transition: opacity .16s ease, transform .2s ease, max-width .24s cubic-bezier(.2,.8,.2,1);
}
.sidebar-account-user {
  font-size: 12px;
  color: hsl(var(--sidebar-muted));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Avatar capsule — round variant of the company-logo control (.cc-logo). */
.sidebar-avatar-wrap { position: relative; flex: 0 0 auto; }
.sidebar-avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  color: hsl(var(--sidebar-muted));
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-avatar-initial {
  font-size: 16px;
  font-weight: 700;
  color: hsl(var(--sidebar-foreground));
  text-transform: uppercase;
}
.sidebar-avatar:hover,
.sidebar-avatar:focus-visible {
  border-color: hsl(var(--primary) / .55);
  box-shadow: 0 0 0 3px hsl(var(--primary) / .18);
}
.sidebar-avatar:active { transform: translateY(1px); }
.sidebar-avatar-file { display: none; }
.sidebar-avatar-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.5);
  color: #fff;
  opacity: 0;
  transition: opacity .15s ease;
}
.sidebar-avatar:hover .sidebar-avatar-overlay,
.sidebar-avatar:focus-within .sidebar-avatar-overlay { opacity: 1; }
.sidebar-avatar-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 60;
  width: 168px;
  padding: 6px;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--popover));
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(4px) scale(.98);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.sidebar-avatar-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.sidebar-avatar-menu-item {
  position: relative;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: hsl(var(--foreground));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out-expo),
              color var(--dur-fast) var(--ease-out-expo),
              transform var(--dur-fast) var(--ease-out-expo);
}
.sidebar-avatar-menu-item svg {
  width: 16px;
  height: 16px;
  color: hsl(var(--muted-foreground));
  flex: 0 0 auto;
  transition: color var(--dur-fast) var(--ease-out-expo);
}
/* Reference-style filled hover, recoloured to the citrus palette. */
.sidebar-avatar-menu-item:hover,
.sidebar-avatar-menu-item:focus-visible {
  outline: none;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  transform: translate(1px, -1px);
}
.sidebar-avatar-menu-item:hover svg,
.sidebar-avatar-menu-item:focus-visible svg { color: hsl(var(--primary-foreground)); }
.sidebar-avatar-menu-item:active { transform: scale(.99); }
.sidebar-avatar-menu-item--danger:hover,
.sidebar-avatar-menu-item--danger:focus-visible {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}
.sidebar-avatar-menu-item--danger:hover svg,
.sidebar-avatar-menu-item--danger:focus-visible svg { color: hsl(var(--destructive-foreground)); }
/* Group separator before the account/danger cluster (Удалить · Выйти). */
#av-remove { margin-top: 7px; }
#av-remove::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: -4px;
  height: 1px;
  background: hsl(var(--border));
}
.sidebar-avatar-menu-item:disabled {
  color: hsl(var(--muted-foreground) / .55);
  cursor: not-allowed;
}
.sidebar-avatar-menu-item:disabled svg { color: hsl(var(--muted-foreground) / .45); }
.sidebar-avatar-menu-item:disabled:hover {
  background: transparent;
  color: hsl(var(--muted-foreground) / .55);
  transform: none;
}
.sidebar-avatar-menu-item:disabled:hover svg { color: hsl(var(--muted-foreground) / .45); }
@media (prefers-reduced-motion: reduce) {
  .sidebar-avatar-menu-item,
  .sidebar-avatar-menu-item:hover,
  .sidebar-avatar-menu-item:active { transform: none; }
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-right: 14px;
  padding: 0 14px;
  border-radius: 12px;
  color: hsl(var(--sidebar-muted));
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .18s, color .18s, min-height .24s cubic-bezier(.2,.8,.2,1), margin .24s cubic-bezier(.2,.8,.2,1), padding .24s cubic-bezier(.2,.8,.2,1), border-radius .24s cubic-bezier(.2,.8,.2,1);
  position: relative;
  overflow: visible;
}
.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: hsl(var(--sidebar-foreground));
}
.nav-item:not(.active):hover .nav-icon {
  transform: translateX(2px) scale(1.08);
  color: hsl(var(--primary) / .85);
}
.nav-icon { transition: transform var(--dur-normal) var(--ease-out-expo), color var(--dur-fast) ease; }
.nav-item.active {
  z-index: 2;
  min-height: 62px;
  margin-right: 0;
  padding-left: 18px;
  border-radius: 16px 0 0 16px;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: none;
}
.nav-item.active:hover {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}
.nav-item.active::before,
.nav-item.active::after {
  content: "";
  position: absolute;
  right: 0;
  width: 28px;
  height: 28px;
  pointer-events: none;
}
.nav-item.active::before {
  top: -28px;
  background: radial-gradient(circle at top left, transparent 27px, hsl(var(--background)) 28px);
}
.nav-item.active::after {
  bottom: -28px;
  background: radial-gradient(circle at bottom left, transparent 27px, hsl(var(--background)) 28px);
}
.nav-item.active .nav-icon { color: hsl(var(--primary)); }
.nav-item.logout { color: hsl(0 80% 65%); margin-right: 14px; }
.nav-item.logout:hover { background: rgba(239,68,68,.12); color: hsl(0 80% 72%); }
.nav-icon { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-icon svg { width: 18px; height: 18px; }
.sidebar-footer .sidebar-utility-link.active {
  min-height: 38px;
  margin-right: 0;
  padding-left: 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.1);
  color: hsl(var(--sidebar-foreground));
}
.sidebar-footer .sidebar-utility-link.active:hover {
  background: rgba(255,255,255,.14);
  color: hsl(var(--sidebar-foreground));
}
.sidebar-footer .sidebar-utility-link.active::before,
.sidebar-footer .sidebar-utility-link.active::after {
  display: none;
}

.content {
  min-width: 0;
  flex: 1;
  margin-left: 244px;
  padding: 24px;
  transition: margin-left .24s cubic-bezier(.2,.8,.2,1);
}

body.sidebar-collapsed .sidebar {
  width: 72px;
}
html.sidebar-collapsed-preload .sidebar {
  width: 72px;
}
html.sidebar-collapsed-preload .content {
  margin-left: 72px;
}
body.sidebar-collapsed .sidebar-logo {
  justify-content: center;
  padding: 0 14px;
}
html.sidebar-collapsed-preload .sidebar-logo {
  justify-content: center;
  padding: 0 14px;
}
body.sidebar-collapsed .sidebar-logo-img {
  max-width: 0;
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
}
html.sidebar-collapsed-preload .sidebar-logo-img {
  max-width: 0;
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
}
body.sidebar-collapsed .sidebar-collapse-icon {
  transform: rotate(180deg);
}
html.sidebar-collapsed-preload .sidebar-collapse-icon {
  transform: rotate(180deg);
}
/* Collapsed: keep the brand mark centered; reveal the expand arrow only on hover/focus. */
body.sidebar-collapsed .sidebar-logo,
html.sidebar-collapsed-preload .sidebar-logo {
  position: relative;
  gap: 0;
}
body.sidebar-collapsed .sidebar-logo-emblem,
html.sidebar-collapsed-preload .sidebar-logo-emblem {
  display: block;
}
body.sidebar-collapsed .sidebar-collapse-btn,
html.sidebar-collapsed-preload .sidebar-collapse-btn {
  position: absolute;
  inset: 0;
  display: inline-flex;
  width: 100%;
  height: 100%;
  border-radius: 0;
  opacity: 0;
  visibility: hidden;
  transform: none;
  transition: opacity .16s ease, visibility .16s ease;
}
body.sidebar-collapsed .sidebar-collapse-btn:hover,
body.sidebar-collapsed .sidebar-collapse-btn:active,
html.sidebar-collapsed-preload .sidebar-collapse-btn:hover {
  transform: none;
}
body.sidebar-collapsed .sidebar-logo:hover .sidebar-collapse-btn {
  opacity: 1;
  visibility: visible;
}
body.sidebar-collapsed .sidebar-logo:hover .sidebar-logo-emblem {
  opacity: .14;
}
body.sidebar-collapsed .sidebar-nav {
  align-items: center;
  padding: 18px 8px;
}
html.sidebar-collapsed-preload .sidebar-nav {
  align-items: center;
  padding: 18px 8px;
}
body.sidebar-collapsed .nav-item {
  width: 48px;
  min-height: 48px;
  justify-content: center;
  gap: 0;
  margin-right: 0;
  padding: 0;
  border-radius: 14px;
}
html.sidebar-collapsed-preload .nav-item {
  width: 48px;
  min-height: 48px;
  justify-content: center;
  gap: 0;
  margin-right: 0;
  padding: 0;
  border-radius: 14px;
}
body.sidebar-collapsed .nav-item.active {
  width: 48px;
  min-height: 48px;
  border-radius: 14px;
  background: rgba(255,255,255,.12);
  color: hsl(var(--sidebar-foreground));
}
html.sidebar-collapsed-preload .nav-item.active {
  width: 48px;
  min-height: 48px;
  border-radius: 14px;
  background: rgba(255,255,255,.12);
  color: hsl(var(--sidebar-foreground));
}
body.sidebar-collapsed .nav-item.active:hover {
  background: rgba(255,255,255,.16);
  color: hsl(var(--sidebar-foreground));
}
body.sidebar-collapsed .nav-item.active::before,
body.sidebar-collapsed .nav-item.active::after {
  display: none;
}
html.sidebar-collapsed-preload .nav-item.active::before,
html.sidebar-collapsed-preload .nav-item.active::after {
  display: none;
}
body.sidebar-collapsed .nav-label {
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
  overflow: hidden;
  pointer-events: none;
}
html.sidebar-collapsed-preload .nav-label {
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
  overflow: hidden;
  pointer-events: none;
}
body.sidebar-collapsed .sidebar-footer {
  padding: 10px 8px;
}
html.sidebar-collapsed-preload .sidebar-footer {
  padding: 10px 8px;
}
body.sidebar-collapsed .sidebar-account {
  justify-content: center;
  padding: 8px 0 12px;
}
html.sidebar-collapsed-preload .sidebar-account {
  justify-content: center;
  padding: 8px 0 12px;
}
body.sidebar-collapsed .sidebar-account-text {
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
  overflow: hidden;
  pointer-events: none;
}
html.sidebar-collapsed-preload .sidebar-account-text {
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
  overflow: hidden;
  pointer-events: none;
}
body.sidebar-collapsed .sidebar-avatar-menu {
  left: calc(100% + 8px);
  bottom: 0;
}
html.sidebar-collapsed-preload .sidebar-avatar-menu {
  left: calc(100% + 8px);
  bottom: 0;
}
body.sidebar-collapsed .nav-item.logout {
  margin-right: 0;
}
html.sidebar-collapsed-preload .nav-item.logout {
  margin-right: 0;
}
body.sidebar-collapsed .content {
  margin-left: 72px;
}
.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.content-header h1 {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: hsl(var(--foreground));
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}
.content-header-right,
.header-actions,
.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.header-tools {
  padding-left: 8px;
  border-left: 1px solid hsl(var(--border));
  flex-wrap: nowrap;
}
.header-tool-btn {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.header-tool-btn:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}
.top-account {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 42px;
  padding: 2px 14px 2px 2px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  box-shadow: var(--shadow-sm);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.top-account:hover {
  border-color: hsl(var(--primary) / .35);
  box-shadow: var(--shadow-md);
}
.top-avatar-wrap { position: relative; flex: 0 0 auto; }
.top-account .sidebar-avatar {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  border: 2px solid hsl(var(--card));
  background: var(--gradient-primary);
  color: hsl(var(--primary-foreground));
  box-shadow: 0 0 0 1px hsl(var(--border)), var(--shadow-sm);
}
.top-account .sidebar-avatar:hover,
.top-account .sidebar-avatar:focus-visible {
  border-color: hsl(var(--card));
  box-shadow: 0 0 0 1px hsl(var(--primary) / .55), 0 0 0 4px hsl(var(--primary) / .15);
}
.top-account .sidebar-avatar-initial {
  color: hsl(var(--primary-foreground));
  font-size: 15px;
  font-weight: 700;
}
.top-account .sidebar-avatar-menu {
  top: calc(100% + 8px);
  right: 0;
  bottom: auto;
  left: auto;
  z-index: 100;
}
.top-account .sidebar-avatar-menu-item {
  color: hsl(var(--foreground));
}
.top-account-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  max-width: 210px;
  color: hsl(var(--foreground));
  text-decoration: none;
}
.top-account-meta:hover .top-account-org,
.top-account-meta:focus-visible .top-account-org {
  color: hsl(var(--primary));
}
.top-account-org,
.top-account-user {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-account-org {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.top-account-user {
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.005em;
}
.sidebar-avatar-menu-link {
  text-decoration: none;
}
.sidebar-avatar-menu-link svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

/* Header logout button — expands on hover to reveal "Выход".
   Adapted from Uiverse "funny-kangaroo-70" to the app's tokens.
   Collapsed = 40px square that blends with the account pill; hover/focus
   widens it and fills with the destructive colour. The icon stays at the
   left edge while the label unfurls beside it, so no element overlaps and
   neighbours slide in sync with the single width transition (no jerk). */
.logout-btn {
  --logout-w: 42px;
  --logout-w-open: 126px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  width: var(--logout-w);
  height: 42px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: width .34s var(--ease-out-expo),
              background-color .2s ease,
              border-color .2s ease,
              color .2s ease,
              box-shadow .2s ease;
}
.logout-btn:hover,
.logout-btn:focus-visible {
  width: var(--logout-w-open);
  background: hsl(var(--destructive));
  border-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  box-shadow: var(--shadow-md);
}
.logout-btn:active { transform: translateY(1px); }
.logout-btn-icon {
  flex: 0 0 var(--logout-w);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.logout-btn-icon svg { width: 18px; height: 18px; }
.logout-btn-text {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 14px;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: .005em;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .2s ease .05s,
              transform .28s var(--ease-out-expo) .05s;
}
.logout-btn:hover .logout-btn-text,
.logout-btn:focus-visible .logout-btn-text {
  opacity: 1;
  transform: translateX(0);
}
@media (prefers-reduced-motion: reduce) {
  .logout-btn,
  .logout-btn-text { transition: background-color .2s ease, color .2s ease; }
  .logout-btn-text { transform: none; }
}

.header-tool-btn:focus-visible,
.btn:focus-visible,
.btn-icon:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--ring) / .28);
}

/* shadcn Button */
.btn,
.cc-btn,
.cand-btn,
.crp-btn,
.fp-reset-btn,
.fp-save-link,
.filter-menu-done,
.pg-btn,
.cp-tab,
.cp-seg,
.cmp-chip,
.cft,
.ft-toggle-btn,
.ft-panel-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease, opacity var(--dur-fast) ease, box-shadow var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out-expo);
}
.btn:hover,
.cc-btn:hover,
.cand-btn:hover,
.crp-btn:hover,
.fp-reset-btn:hover,
.filter-menu-done:hover,
.pg-btn:hover:not(:disabled),
.cp-tab:hover,
.cp-seg:hover,
.cmp-chip:hover,
.cft:hover,
.ft-toggle-btn:hover,
.ft-panel-clear:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  border-color: hsl(var(--primary) / .28);
}
.btn:active,
.cc-btn:active,
.cand-btn:active,
.crp-btn:active,
.pg-btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled,
.pg-btn:disabled,
.cc-btn:disabled,
.cand-btn:disabled,
.cp-delete-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.btn-primary,
.cc-btn-primary,
.cand-btn-ok,
.crp-btn-ok,
.pg-btn.current,
.pg-btn.curr,
.fp-mode-btn.active,
.search-mode-btn.active,
.fp-chip.on,
.cp-tab.active,
.cmp-chip.on,
.cft.on {
  border-color: hsl(var(--primary));
  background: var(--gradient-primary);
  color: hsl(var(--primary-foreground));
  box-shadow: 0 4px 12px hsl(var(--primary) / .28);
}
.btn-primary:hover:not(:disabled),
.cc-btn-primary:hover,
.cand-btn-ok:hover,
.crp-btn-ok:hover {
  border-color: hsl(var(--primary));
  background: var(--gradient-primary);
  color: hsl(var(--primary-foreground));
  box-shadow: 0 7px 18px hsl(var(--primary) / .4);
  transform: translateY(-1px);
}
.btn-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}
.btn-link {
  border-color: transparent;
  background: transparent;
  color: hsl(var(--primary));
  box-shadow: none;
}
.btn-link:hover {
  background: hsl(var(--primary) / .1);
  color: hsl(var(--primary));
  text-decoration: none;
}
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn-large { min-height: 44px; padding: 0 18px; font-size: 15px; }
.btn-full { width: 100%; }
.btn-icon,
.cc-close {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}
.btn-icon:hover,
.cc-close:hover {
  background: hsl(var(--destructive) / .1);
  color: hsl(var(--destructive));
}

/* Cards, panels, alerts, badges */
.panel,
.dash-card,
.filters-panel,
.fp-panel,
.companies-panel,
.int-panel,
.cand-panel,
.ai-config-panel,
.ai-progress,
.cmp-filter-panel,
.cp-panel,
.table-wrapper,
.contact-stat-card,
.contacts-review-panel {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel { margin-bottom: 20px; }
.panel-header,
.dash-card-header,
.filters-panel-title,
.fp-panel-header,
.companies-panel-header,
.int-panel-header,
.cand-panel-hdr,
.ai-progress-header,
.cmp-filter-hdr,
.ft-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 14px 18px;
  border-bottom: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--foreground));
  font-size: 14px;
  font-weight: 600;
}
.panel-footer,
.form-actions,
.fp-footer,
.filter-menu-footer,
.companies-pagination,
.int-pagination,
.pagination,
.cp-selected-area,
.cc-save-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / .42);
}
/* Скрыт только бар сохранения карточки — его показывает .visible. */
.cc-save-bar { display: none; }
.cc-save-bar.visible { display: flex; }
.alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  font-size: 14px;
}
.alert-success { border-color: hsl(var(--success) / .25); background: hsl(var(--success) / .1); color: hsl(var(--success)); }
.alert-error { border-color: hsl(var(--destructive) / .25); background: hsl(var(--destructive) / .1); color: hsl(var(--destructive)); }
.alert-info { border-color: hsl(var(--primary) / .25); background: hsl(var(--primary) / .1); color: hsl(var(--primary)); }
.badge,
.count-badge,
.dash-badge,
.tbl-status,
.tbl-badge,
.cand-ds,
.cc-badge,
.notif-type-badge,
.cp-invalid-badge,
.crp-type,
.tbl-okved-code,
.tbl-code {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 0 9px;
  border: 1px solid hsl(var(--border));
  border-radius: 6px;
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.count-badge { margin-left: 0; color: hsl(var(--muted-foreground)); }
.badge-blue,
.dash-badge--blue,
.st-likely,
.ds-review,
.badge-reply { border-color: hsl(var(--primary) / .2); background: hsl(var(--primary) / .1); color: hsl(var(--primary)); }
.badge-green,
.dash-badge--green,
.st-verified,
.ds-new,
.badge-ooo { border-color: hsl(var(--success) / .22); background: hsl(var(--success) / .1); color: hsl(var(--success)); }
.badge-yellow,
.dash-badge--yellow,
.st-review,
.ds-possible,
.badge-gone { border-color: hsl(var(--warning) / .24); background: hsl(var(--warning) / .12); color: hsl(var(--warning)); }
.badge-red,
.dash-badge--red,
.st-conflict,
.ds-duplicate,
.badge-bounce { border-color: hsl(var(--destructive) / .22); background: hsl(var(--destructive) / .1); color: hsl(var(--destructive)); }
.badge-gray,
.st-default,
.ds-imported,
.ds-rejected { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}
.form-group,
.cc-field,
.count-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group--full,
.cc-field-wide { grid-column: 1 / -1; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}
.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: hsl(var(--primary));
}
.form-group label,
.cc-label,
.count-input-label,
.cmp-filter-label,
.fp-section-label,
.field-switches-title,
.contact-data-title,
.cc-okved-main-lbl,
.cc-okved-sec-lbl,
.cc-add-okved-title {
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}
.fp-section-label,
.field-switches-title,
.contact-data-title,
.cc-okved-main-lbl,
.cc-okved-sec-lbl,
.cc-add-okved-title,
.cmp-filter-label {
  text-transform: uppercase;
  letter-spacing: .04em;
}
.label-hint,
.hint-text,
.filter-note,
.filters-panel-hint,
.accordion-desc,
.cmp-filter-hdr-sub,
.mailing-stat-label,
.contact-stat-l,
.cell-sub,
.tbl-muted,
.cand-meta,
.cand-panel-inf,
.ai-progress-meta,
.cp-contact-sub,
.cp-batch,
.cc-company-legal,
.cc-okved-name,
.cc-save-hint {
  color: hsl(var(--muted-foreground));
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="search"],
select,
textarea,
.filter-input,
.filter-select,
.fp-input,
.fp-select,
.ai-select,
.ai-input-num,
.cmp-okved-input,
.cp-search,
.cp-manual-input,
.cc-input,
.cc-textarea,
.cc-add-ch input,
.cc-add-ch select,
.cc-okved-inp-wrap input,
.cc-add-okved-row select,
.count-input,
.okved-search-bar input {
  width: 100%;
  min-height: 40px;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  padding: 8px 12px;
  font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
textarea,
.cc-textarea { min-height: 92px; resize: vertical; }
input::placeholder,
textarea::placeholder { color: hsl(var(--muted-foreground)); opacity: .72; }

/* Settings service blocks: legal documents, support and contact placeholders */
.settings-service-grid,
.support-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.settings-service-grid { margin-top: 20px; }
.settings-service-panel,
.support-panel {
  margin-bottom: 0;
}
.settings-link-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 16px;
}
.settings-link-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 13px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  text-decoration: none;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out-expo);
}
.settings-link-card:hover,
.settings-link-card:focus-visible {
  outline: none;
  border-color: hsl(var(--primary) / .32);
  background: hsl(var(--accent));
}
.settings-link-card:active { transform: translateY(1px); }
.settings-link-icon {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: hsl(var(--primary) / .1);
  color: hsl(var(--primary));
}
.settings-link-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
  line-height: 1.3;
}
.settings-link-card small {
  display: block;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  line-height: 1.45;
}
.settings-contact-body,
.support-panel-body {
  padding: 18px;
}
.settings-contact-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.support-panel-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.support-panel-body--stack {
  flex-direction: column;
  gap: 14px;
}
.support-panel-body h2 {
  margin: 0 0 6px;
  color: hsl(var(--foreground));
  font-size: 18px;
  line-height: 1.3;
}
.support-panel-body p {
  margin: 0;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  line-height: 1.55;
}
.support-placeholder-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 12px;
  background: hsl(var(--primary) / .1);
  color: hsl(var(--primary));
}
.contact-channel-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.contact-channel-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
}
.contact-channel-btn:disabled {
  cursor: not-allowed;
  opacity: .72;
}
.contact-channel-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  color: hsl(var(--muted-foreground));
}
.contact-channel-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.contact-channel-state {
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 500;
}
input:focus,
select:focus,
textarea:focus,
.filter-input:focus,
.filter-select:focus,
.fp-input:focus,
.ai-select:focus,
.ai-input-num:focus,
.cp-search:focus,
.count-input:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / .24);
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: hsl(var(--primary));
}
.password-field,
.filter-bar,
.cmp-filter-row,
.ai-config-row,
.cp-controls,
.cp-footer,
.selection-bar,
.contact-stats-row,
.mailing-stats,
.ai-stats,
.cand-filter-tabs,
.template-selector,
.cc-actions,
.cc-add-ch,
.cc-add-okved-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-bar,
.selection-bar {
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
}
.filter-input--wide { flex: 1 1 240px; }
.filter-select { width: auto; min-width: 160px; }
.selection-bar {
  border-color: hsl(var(--primary) / .22);
  background: hsl(var(--primary) / .08);
}

/* Tables */
.table-wrapper,
.companies-tbl-wrap { overflow-x: auto; }
.table,
.dash-table,
.companies-tbl,
.int-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th,
.dash-table th,
.companies-tbl th,
.int-tbl th {
  padding: 11px 14px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / .5);
  color: hsl(var(--muted-foreground));
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.table td,
.dash-table td,
.companies-tbl td,
.int-tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  vertical-align: middle;
}
.table tr:last-child td,
.dash-table tr:last-child td,
.companies-tbl tr:last-child td,
.int-tbl tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td,
.dash-table tbody tr:hover td,
.companies-tbl tbody tr:hover td,
.int-tbl tbody tr:hover td { background: hsl(var(--muted) / .5); }
.th-check { width: 42px; }
.tbl-actions-head,
.tbl-actions-cell {
  width: 92px;
  text-align: right;
}
.tbl-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 76px;
}
.tbl-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease;
}
.tbl-action-btn:hover {
  border-color: hsl(var(--primary) / .35);
  background: hsl(var(--primary) / .08);
  color: hsl(var(--primary));
  transform: translateY(-1px);
}
.tbl-action-btn:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}
.cell-main,
.tbl-name,
.tbl-name-cell,
.cand-name,
.cc-camp-name,
.cc-hist-type,
.template-name,
.dash-action-title,
.crp-company,
.cp-contact-name {
  color: hsl(var(--foreground));
  font-weight: 600;
}
.tbl-inn,
.tbl-code,
.tbl-okved-code,
.crp-value,
.cc-okved-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.tbl-no,
.cc-value-empty { color: hsl(var(--muted-foreground)); }
.link,
.dash-link,
.template-preview-link { color: hsl(var(--primary)); text-decoration: none; }
.link:hover,
.dash-link:hover { text-decoration: underline; }

/* Dashboard */
.dash-top-row {
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(320px, 1.1fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}
.dash-right-stack { display: grid; gap: 20px; }
.dash-card { margin-bottom: 20px; }
.dash-card-title,
.fp-panel-title,
.cand-panel-ttl,
.ai-progress-title,
.cmp-filter-hdr-title {
  font-size: 15px;
  font-weight: 700;
}
.dash-pill-btn {
  display: inline-flex;
  min-height: 32px;
  gap: 6px;
  align-items: center;
  border: 1px solid hsl(var(--border));
  border-radius: 6px;
  padding: 0 14px;
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease,
              border-color var(--dur-fast) ease, box-shadow var(--dur-normal) var(--ease-out-expo),
              transform var(--dur-fast) var(--ease-out-expo);
}
.dash-pill-btn:hover {
  background: hsl(var(--card));
  color: hsl(var(--primary));
  border-color: hsl(var(--primary) / .35);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.dash-pill-btn:active { transform: translateY(0); }
.dash-pill-btn svg { transition: transform var(--dur-normal) var(--ease-out-expo); }
.dash-pill-btn:hover svg { transform: translateX(3px); }
.dash-pill-btn--expand {
  --expand-w: 36px;
  --expand-w-open: 120px;
  width: var(--expand-w);
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  justify-content: flex-start;
  transition: width .34s var(--ease-out-expo),
              background-color .2s ease,
              border-color .2s ease,
              color .2s ease,
              box-shadow .2s ease;
  transform: none;
}
.dash-pill-btn--expand:hover,
.dash-pill-btn--expand:focus-visible {
  width: var(--expand-w-open);
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
  color: hsl(0 0% 100%);
  box-shadow: var(--shadow-md);
  transform: none;
}
.dash-pill-btn--expand:active { transform: translateY(1px); }
.dash-pill-btn-icon {
  flex: 0 0 var(--expand-w);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.dash-pill-btn-text {
  flex: 1 1 auto;
  padding-right: 12px;
  font-size: 13px;
  font-weight: 650;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .2s ease .05s, transform .28s var(--ease-out-expo) .05s;
}
.dash-pill-btn--expand:hover .dash-pill-btn-text,
.dash-pill-btn--expand:focus-visible .dash-pill-btn-text {
  opacity: 1;
  transform: translateX(0);
}
.dash-pill-btn--expand svg { transition: none; }
.dash-pill-btn--expand:hover svg { transform: none; }
.dash-stat-rows,
.dash-list,
.dash-actions { padding: 8px 14px 14px; }
.dash-actions-section { margin-bottom: 20px; }
.dash-actions-section-title { font-size: .8125rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: hsl(var(--muted-foreground)); padding: 0 0 10px; }
.dash-actions-section .dash-actions { padding: 0; }
.dash-stat-row,
.dash-list-item,
.dash-info-row,
.dash-action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-radius: calc(var(--radius) - 4px);
  color: hsl(var(--foreground));
}
.dash-list-item,
.dash-info-row,
.dash-action-item {
  border-bottom: 1px solid hsl(var(--border));
  border-radius: 0;
}
.dash-list-item:last-child,
.dash-info-row:last-child,
.dash-action-item:last-child { border-bottom: 0; }
.dash-stat-row--light,
.dash-stat-row--purple { background: hsl(var(--muted) / .55); }
.dash-stat-icon,
.dash-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--primary) / .1);
  color: hsl(var(--primary));
}
.dash-stat-icon { width: 32px; height: 32px; }
.dash-action-icon { width: 42px; height: 42px; }
.dash-stat-label,
.dash-list-label,
.dash-info-key,
.dash-action-desc { color: hsl(var(--muted-foreground)); }
.dash-stat-value,
.dash-list-val,
.dash-info-val { margin-left: auto; font-weight: 700; color: hsl(var(--foreground)); }
.dash-empty,
.empty-state,
.cand-empty,
.tbl-empty td,
.tbl-empty-row td,
.cp-empty,
.cp-loading,
.cc-empty,
.notif-empty,
.fp-empty-tree {
  padding: 36px 20px;
  text-align: center;
  color: hsl(var(--muted-foreground));
}
.dash-action-item {
  color: inherit;
  text-decoration: none;
  transition: background .15s ease, transform var(--dur-normal) var(--ease-spring);
}
.dash-action-item:hover { background: hsl(var(--muted) / .5); }
.dash-action-item:hover .dash-action-icon { transform: scale(1.06); }
.dash-action-item:hover .dash-action-arrow { transform: translateX(3px); }
.dash-action-icon,
.dash-action-arrow { transition: transform var(--dur-normal) var(--ease-spring); }
.dash-action-body { min-width: 0; flex: 1; }
.dash-action-arrow { color: hsl(var(--muted-foreground)); }

.dash-workbench {
  display: grid;
  gap: 18px;
}
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--border));
  box-shadow: var(--shadow-sm);
}
.dash-kpi {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  min-height: 126px;
  padding: 18px 20px;
  border: 0;
  border-radius: 0;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  text-decoration: none;
  box-shadow: none;
  transition: background .15s ease, box-shadow .15s ease;
}
.dash-kpi:hover {
  background: hsl(var(--muted) / .32);
  box-shadow: inset 0 0 0 1px hsl(var(--primary) / .14);
}
.dash-kpi-icon,
.dash-attention-icon,
.dash-search-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 1px solid hsl(var(--primary) / .18);
  border-radius: 8px;
  background: hsl(var(--primary) / .08);
  color: hsl(var(--primary));
}
.dash-kpi--primary .dash-kpi-icon {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}
.dash-kpi--attention .dash-kpi-icon {
  background: hsl(var(--warning) / .12);
  color: hsl(var(--warning));
  border-color: hsl(var(--warning) / .24);
}
.dash-kpi-body {
  display: grid;
  gap: 7px;
  min-width: 0;
  flex: 1;
}
.dash-kpi-label {
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  font-weight: 650;
}
.dash-kpi-metric {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}
.dash-kpi strong {
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.dash-kpi small,
.dash-campaign-name small,
.dash-search-main small {
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  line-height: 1.35;
}

/* ── KPI small-box (стиль AdminLTE v4) ──────────────────────────────────────
   Сплошные цветные карточки: крупное число, подпись, крупная «выцветшая»
   иконка в углу и нижняя плашка «Подробнее». При наведении иконка
   увеличивается, а плашка темнеет — как в референсе AdminLTE. */
.ks-smallbox-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}
.ks-smallbox {
  --sb-bg: #FF6A1A;
  --sb-fg: #fff;
  --sb-icon: rgba(255, 255, 255, .30);
  --sb-badge-bg: rgba(255, 255, 255, .22);
  --sb-foot-bg: rgba(0, 0, 0, .12);
  --sb-foot-bg-hover: rgba(0, 0, 0, .20);
  --sb-foot-fg: rgba(255, 255, 255, .85);
  --sb-foot-fg-hover: #fff;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 132px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--sb-bg);
  color: var(--sb-fg);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 6px 16px -8px rgba(0, 0, 0, .28);
  transition: transform .25s var(--ease-out-expo), box-shadow .25s var(--ease-out-expo);
}
.ks-smallbox:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, .12), 0 18px 32px -12px rgba(0, 0, 0, .38);
}
.ks-smallbox-inner {
  position: relative;
  z-index: 2;
  flex: 1;
  /* запас справа под угловую иконку — текст не наезжает на неё */
  padding: 16px 92px 12px 18px;
  min-width: 0;
}
.ks-smallbox-value {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.ks-smallbox-label {
  margin-top: 5px;
  color: inherit;
  font-size: 15px;
  font-weight: 600;
  opacity: .96;
}
.ks-smallbox-sub {
  margin-top: 7px;
  color: inherit;
  font-size: 12px;
  line-height: 1.35;
  opacity: .82;
}
.ks-smallbox-icon {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  color: var(--sb-icon);
  pointer-events: none;
  transition: transform .3s var(--ease-out-expo);
}
.ks-smallbox-icon .lucide-icon {
  width: 70px;
  height: 70px;
  stroke-width: 1.6;
}
.ks-smallbox:hover .ks-smallbox-icon { transform: scale(1.12); }
.ks-smallbox-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--sb-foot-fg);
  background: var(--sb-foot-bg);
  transition: background .2s ease, color .2s ease;
}
.ks-smallbox:hover .ks-smallbox-footer {
  color: var(--sb-foot-fg-hover);
  background: var(--sb-foot-bg-hover);
}
.ks-smallbox-footer .lucide-icon { width: 14px; height: 14px; }

/* Цветовые варианты (палитра референса) */
.ks-smallbox--blue  { --sb-bg: #FF6A1A; }
.ks-smallbox--green { --sb-bg: #E85A0C; }
.ks-smallbox--teal  { --sb-bg: #FF7A1A; }
.ks-smallbox--red   { --sb-bg: #D63A2F; }
.ks-smallbox--amber {
  --sb-bg: #f4b400;
  --sb-fg: #20242c;
  --sb-icon: rgba(0, 0, 0, .17);
  --sb-badge-bg: rgba(0, 0, 0, .12);
  --sb-foot-bg: rgba(0, 0, 0, .08);
  --sb-foot-bg-hover: rgba(0, 0, 0, .15);
  --sb-foot-fg: rgba(0, 0, 0, .6);
  --sb-foot-fg-hover: #20242c;
}

@media (max-width: 1240px) { .ks-smallbox-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px)  { .ks-smallbox-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px)  { .ks-smallbox-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .ks-smallbox, .ks-smallbox-icon { transition: none; }
  .ks-smallbox:hover { transform: none; }
  .ks-smallbox:hover .ks-smallbox-icon { transform: none; }
}
.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: max-content;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.stat-badge .lucide-icon {
  flex: 0 0 auto;
  margin-left: -2px;
}
.stat-badge--up,
.stat-badge--success {
  border-color: hsl(var(--success) / .18);
  background: hsl(var(--success) / .1);
  color: hsl(var(--success));
}
.stat-badge--down,
.stat-badge--danger {
  border-color: hsl(var(--destructive) / .18);
  background: hsl(var(--destructive) / .1);
  color: hsl(var(--destructive));
}
.stat-badge--warning {
  border-color: hsl(var(--warning) / .22);
  background: hsl(var(--warning) / .12);
  color: hsl(var(--warning));
}
.stat-badge--neutral,
.stat-badge--primary,
.stat-badge--muted {
  border-color: hsl(var(--border));
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}
.dash-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
  grid-template-rows: auto auto;
  gap: 18px;
  align-items: start;
}
/* Wrappers dissolve so their children become direct grid items, letting the
   bottom cards (funnel / quality) share one row regardless of the height of
   the top blocks (buttons / donut). */
.dash-main-col,
.dash-side-col {
  display: contents;
}
.dash-cell--buttons {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  margin-bottom: 0;
}
.dash-cell--funnel {
  grid-column: 1;
  grid-row: 2;
}
.dash-cell--donut {
  grid-column: 2;
  grid-row: 1;
}
.dash-cell--quality {
  grid-column: 2;
  grid-row: 2;
}
.dash-lower-grid {
  display: grid;
  gap: 18px;
}
.dash-lower-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, .85fr);
  align-items: start;
}
.dash-card--flush {
  margin-bottom: 0;
}
.dash-card--bare {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}
.dash-card--bare .dash-card-header {
  background: transparent;
  border-bottom: none;
  padding-left: 0;
  padding-right: 0;
}
.dash-card-header .dash-pill-btn {
  gap: 6px;
  font-weight: 650;
}
button.dash-pill-btn {
  font-family: inherit;
  cursor: pointer;
}
.dash-attention-list {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
}
.dash-attention-item {
  --tone: var(--primary);
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px 16px 20px;
  border: 1px solid hsl(var(--tone) / .16);
  border-radius: var(--radius);
  background: hsl(var(--tone) / .07);
  color: hsl(var(--foreground));
  text-decoration: none;
  overflow: hidden;
  transition: transform var(--dur-normal) var(--ease-spring),
              box-shadow var(--dur-normal) var(--ease-out-expo),
              background .15s ease;
}
.dash-attention-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: hsl(var(--tone));
}
.dash-attention-item:hover {
  transform: translateY(-2px);
  background: hsl(var(--tone) / .1);
  box-shadow: 0 8px 22px -12px hsl(var(--tone) / .55);
}
.dash-attention-item:active {
  transform: translateY(0);
}
.dash-attention-item .dash-attention-icon {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
  border: 0;
  background: hsl(var(--tone) / .14);
  color: hsl(var(--tone));
}
.dash-attention-item:hover .dash-attention-icon {
  transform: scale(1.06);
}
.dash-attention-item--danger { --tone: var(--destructive); }
.dash-attention-item--warning { --tone: var(--warning); --attention-fg: hsl(222 47% 10%); }
.dash-attention-item--success { --tone: var(--success); }
.dash-attention-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.dash-attention-body strong,
.dash-good-state strong,
.dash-empty-action strong,
.dash-search-main strong {
  font-weight: 750;
}
.dash-attention-body small,
.dash-good-state p {
  color: hsl(var(--muted-foreground));
  line-height: 1.35;
}
.dash-attention-value {
  min-width: 34px;
  padding-left: 10px;
  text-align: right;
  color: hsl(var(--tone));
  font-size: 1.45rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  line-height: 1;
}
.dash-good-state,
.dash-empty-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 150px;
  padding: 24px;
  color: hsl(var(--muted-foreground));
}
.dash-good-state span,
.dash-empty-action span {
  display: inline-grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: hsl(var(--success) / .1);
  color: hsl(var(--success));
}
.dash-good-state p {
  margin: 3px 0 0;
}
.dash-empty-action {
  flex-direction: column;
  text-align: center;
}
.dash-empty-action span {
  background: hsl(var(--primary) / .09);
  color: hsl(var(--primary));
}
.dash-actions--work {
  display: grid;
  gap: 14px;
  padding: 16px;
}
.dash-actions--work .dash-action-item {
  --action-bg: hsl(var(--primary));
  --action-fg: hsl(var(--primary-foreground));
  --action-muted: hsl(var(--primary-foreground) / .78);
  --action-shadow: hsl(var(--primary) / .26);
  position: relative;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 18px;
  min-height: 118px;
  padding: 22px 24px;
  border: 1px solid hsl(0 0% 100% / .2);
  border-radius: var(--radius);
  background: var(--action-bg);
  color: var(--action-fg);
  overflow: hidden;
  box-shadow: 0 10px 24px -18px var(--action-shadow), var(--shadow-sm);
  transition: transform var(--dur-normal) var(--ease-out-expo),
              box-shadow var(--dur-normal) var(--ease-out-expo),
              filter var(--dur-fast) ease;
}
.dash-actions--work .dash-action-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-sheen);
  opacity: 0;
  transform: translateX(-32%);
  transition: opacity var(--dur-normal) ease,
              transform var(--dur-slow) var(--ease-out-expo);
  pointer-events: none;
}
.dash-actions--work:hover > .dash-action-item:not(:hover) {
  filter: blur(6px);
  transform: scale(0.94);
  opacity: .7;
}
.dash-actions--work .dash-action-item:hover {
  transform: scale(1.03);
  filter: saturate(1.03);
  box-shadow: 0 18px 34px -20px var(--action-shadow), var(--shadow-md);
}
.dash-actions--work .dash-action-item:hover::after {
  opacity: 1;
  transform: translateX(22%);
}
.dash-actions--work .dash-action-item:active {
  transform: translateY(-1px);
}
.dash-actions--work .dash-action-icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  color: currentColor;
  transition: transform var(--dur-normal) var(--ease-spring);
}
.dash-actions--work .dash-action-body {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  min-width: 0;
}
.dash-actions--work .dash-action-title {
  color: currentColor;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.12;
}
.dash-actions--work .dash-action-desc {
  color: var(--action-muted);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.28;
}
.dash-actions--work .dash-action-arrow {
  position: relative;
  z-index: 1;
  justify-self: end;
  color: currentColor;
  opacity: .72;
  transition: transform var(--dur-normal) var(--ease-spring),
              opacity var(--dur-fast) ease;
}
.dash-actions--work .dash-action-item:hover .dash-action-icon {
  transform: scale(1.08) rotate(-2deg);
}
.dash-actions--work .dash-action-item:hover .dash-action-arrow {
  opacity: 1;
  transform: translateX(5px);
}
.dash-actions--work .dash-action-item--amber {
  --action-bg: hsl(43 96% 52%);
  --action-fg: hsl(222 47% 10%);
  --action-muted: hsl(222 35% 18% / .74);
  --action-shadow: hsl(43 96% 34% / .42);
}
.dash-actions--work .dash-action-item--green {
  --action-bg: hsl(152 64% 34%);
  --action-fg: hsl(0 0% 100%);
  --action-muted: hsl(0 0% 100% / .82);
  --action-shadow: hsl(152 64% 24% / .46);
}
.dash-actions--work .dash-action-item--cyan {
  --action-bg: hsl(189 78% 49%);
  --action-fg: hsl(222 47% 9%);
  --action-muted: hsl(222 35% 16% / .76);
  --action-shadow: hsl(189 78% 32% / .42);
}
.dash-actions--work .dash-action-item--rose {
  --action-bg: hsl(352 74% 54%);
  --action-fg: hsl(0 0% 100%);
  --action-muted: hsl(0 0% 100% / .82);
  --action-shadow: hsl(352 74% 34% / .46);
}
.dash-action-item--primary {
  box-shadow: 0 14px 30px -20px var(--action-shadow), var(--shadow-md);
}
.dash-action-item--primary .dash-action-icon {
  transform: scale(1.02);
}
.dash-mailing-panel,
.dash-search-summary {
  display: grid;
  gap: 14px;
  padding: 18px;
}
.dash-mailing-total {
  display: grid;
  gap: 4px;
}
.dash-mailing-total span {
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 650;
}
.dash-mailing-total strong {
  font-size: 34px;
  line-height: 1;
}
.dash-mailing-total small {
  color: hsl(var(--muted-foreground));
}
.dash-meter {
  display: flex;
  width: 100%;
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: hsl(var(--muted));
}
.dash-meter {
  box-shadow: inset 0 1px 2px hsl(var(--foreground) / .06);
}
.dash-meter span {
  display: block;
  background: linear-gradient(90deg, hsl(var(--success)) 0%, hsl(var(--success) / .72) 100%);
  transition: width var(--dur-slow) var(--ease-out-expo);
}
.dash-meter i {
  display: block;
  background: linear-gradient(90deg, hsl(var(--warning)) 0%, hsl(var(--warning) / .72) 100%);
  transition: width var(--dur-slow) var(--ease-out-expo);
}
.dash-mini-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--border));
}
.dash-mini-stats div {
  min-width: 0;
  padding: 12px;
  border: 0;
  border-radius: 0;
  background: hsl(var(--card));
  position: relative;
  transition: background var(--dur-fast) ease;
  cursor: default;
}
.dash-mini-stats div::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dur-normal) var(--ease-out-expo);
}
.dash-mini-stats div:hover { background: hsl(var(--primary) / .06); }
.dash-mini-stats div:hover::before { transform: scaleX(1); }
.dash-mini-stats div:hover strong { color: hsl(var(--primary)); }
.dash-mini-stats strong {
  display: block;
  font-size: 19px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: color var(--dur-fast) ease;
}
.dash-mini-stats span {
  display: block;
  margin-top: 5px;
  color: hsl(var(--muted-foreground));
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-list--queue {
  padding: 0;
  margin-top: 12px;
}
.dash-list--queue .dash-list-item {
  padding: 10px 12px;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease,
              box-shadow var(--dur-normal) var(--ease-out-expo);
}
.dash-list--queue .dash-list-item:hover {
  border-color: hsl(var(--primary) / .32);
  background: hsl(var(--primary) / .04);
  box-shadow: var(--shadow-sm);
}
.dash-list--queue .dash-list-item:hover .dash-list-val { color: hsl(var(--primary)); }
.dash-list--queue .dash-list-val { transition: color var(--dur-fast) ease; }

/* ── Очередь рассылки: donut ──────────────────────────────────────────── */
/* Намеренная тёплая палитра data-viz (single source of truth для кольца и
   легенды). Своя, потому что брендовый --success в shadcn-overrides.css
   переопределён в тот же оранжевый, что и --primary. */
.dash-mailing-panel--chart {
  gap: 16px;
  --donut-sent: 21 100% 55%;      /* отправлено — #FF6A1A (доминанта) */
  --donut-remaining: 156 28% 43%; /* осталось — muted green #4F8B73 */
  --donut-excluded: 4 67% 51%;    /* исключено — #D63A2F */
}
/* Блок очереди — без фоновой капсулы (плоский, на фоне страницы).
   Класс .dash-card--plain + высокая специфичность перебивают
   body.dash-page .dash-card { background/shadow } из shadcn-overrides.css
   (без :has() — для совместимости со всеми браузерами). */
body.dash-page .dash-card.dash-card--plain,
body.dash-page .dash-card.dash-card--plain .dash-card-header {
  background: transparent !important;
  background-image: none !important;
  border: none !important;
  box-shadow: none !important;
}
body.dash-page .dash-card.dash-card--plain .dash-card-header {
  padding-left: 0;
  padding-right: 0;
}
.dash-donut {
  position: relative;
  width: 100%;
  height: 340px;
  margin: 8px 0 10px;
}
.dash-donut-canvas { width: 100%; height: 100%; }
.dash-donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
  transition: opacity var(--dur-fast) ease;
}
.dash-donut-center.is-hidden { opacity: 0; }
.dash-donut-center strong {
  display: block;
  font-size: 30px;
  line-height: 1;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--foreground));
}
.dash-donut-center span {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: hsl(var(--muted-foreground));
}
/* Метрики — в строку: три равных колонки, в каждой dot+подпись сверху и
   значение снизу. */
.dash-donut-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.dash-donut-legend li {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "dot name"
    "val val";
  justify-content: center;
  align-items: center;
  gap: 3px 7px;
  padding: 10px 6px;
  border-radius: calc(var(--radius) - 2px);
  cursor: default;
  outline: none;
  transition: background var(--dur-fast) ease;
}
.dash-donut-legend li:hover,
.dash-donut-legend li:focus-visible {
  background: hsl(var(--primary) / .06);
}
.dash-donut-dot {
  grid-area: dot;
  width: 10px;
  height: 10px;
  border-radius: 4px;
}
.dash-donut-dot--sent { background: hsl(var(--donut-sent)); }
.dash-donut-dot--remaining { background: hsl(var(--donut-remaining)); }
.dash-donut-dot--excluded { background: hsl(var(--donut-excluded)); }
.dash-donut-name {
  grid-area: name;
  font-size: 12.5px;
  color: hsl(var(--muted-foreground));
}
.dash-donut-legend strong {
  grid-area: val;
  font-size: 20px;
  line-height: 1;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--foreground));
}
.dash-donut-empty {
  display: grid;
  gap: 4px;
  padding: 28px 18px;
  text-align: center;
}
.dash-donut-empty span {
  font-size: 15px;
  font-weight: 650;
  color: hsl(var(--foreground));
}
.dash-donut-empty small { color: hsl(var(--muted-foreground)); }

.dash-funnel {
  display: grid;
  gap: 11px;
  padding: 16px 18px 18px;
}
.dash-funnel-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 5px 8px;
  margin: 0 -8px;
  border-radius: 9px;
  cursor: default;
  transition: background var(--dur-fast) ease;
}
.dash-funnel-row:hover { background: hsl(var(--primary) / .055); }
.dash-funnel-row span {
  color: hsl(var(--muted-foreground));
  transition: color var(--dur-fast) ease;
}
.dash-funnel-row:hover span { color: hsl(var(--foreground)); }
.dash-funnel-row strong {
  text-align: right;
  transition: color var(--dur-fast) ease;
}
.dash-funnel-row:hover strong { color: hsl(var(--primary)); }
.dash-funnel-bar {
  height: 8px;
  border-radius: 4px;
  background: hsl(var(--muted));
  overflow: hidden;
  box-shadow: inset 0 1px 2px hsl(var(--foreground) / .05);
}
.dash-funnel-bar i {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: hsl(var(--primary));
  transform-origin: left center;
  animation: dash-bar-grow var(--dur-slow) var(--ease-out-expo) both;
  transition: filter var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.dash-funnel-row:hover .dash-funnel-bar i {
  filter: brightness(1.08) saturate(1.12);
  box-shadow: 0 0 10px currentColor;
}
.dash-funnel-bar i.dash-funnel-bar--blue   { background: #FF6A1A; }
.dash-funnel-bar i.dash-funnel-bar--indigo { background: #E85A0C; }
.dash-funnel-bar i.dash-funnel-bar--teal   { background: #FF7A1A; }
.dash-funnel-bar i.dash-funnel-bar--amber  { background: #FF7A1A; }
.dash-funnel-bar i.dash-funnel-bar--green  { background: #E85A0C; }
.dash-funnel-bar i.dash-funnel-bar--red    { background: #D63A2F; }
.dash-funnel-bar i.dash-funnel-bar--gray   { background: hsl(var(--muted-foreground) / .5); }
.dash-funnel-row:hover .dash-funnel-bar--blue   { color: #FF6A1A; }
.dash-funnel-row:hover .dash-funnel-bar--indigo { color: #E85A0C; }
.dash-funnel-row:hover .dash-funnel-bar--teal   { color: #FF7A1A; }
.dash-funnel-row:hover .dash-funnel-bar--amber  { color: #FF7A1A; }
.dash-funnel-row:hover .dash-funnel-bar--green  { color: #E85A0C; }
.dash-funnel-row:hover .dash-funnel-bar--red    { color: #E53935; }
.dash-funnel-row:hover .dash-funnel-bar--gray   { color: hsl(var(--muted-foreground)); }
@keyframes dash-bar-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* Воронка компаний — центрированные скруглённые сегменты (адаптация funnel
   из gentelella; сужение книзу, hover-подсветка, ступенчатое появление). */
.dash-funnel-rb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 16px 20px;
}
.dash-funnel-seg {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38%;
  max-width: 100%;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  color: #fff;
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(40, 16, 8, .45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18),
              0 1px 2px rgba(40, 16, 8, .12);
  cursor: default;
  opacity: 0;
  transform: translateY(9px) scale(.985);
  transform-origin: center;
  animation: dash-seg-in .52s var(--ease-out-expo) forwards;
  animation-delay: calc(var(--i, 0) * 60ms);
  transition: filter var(--dur-fast) ease,
              transform var(--dur-fast) var(--ease-out-expo),
              box-shadow var(--dur-fast) ease;
}
.dash-funnel-seg:hover {
  filter: brightness(1.06) saturate(1.05);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22),
              0 6px 16px rgba(40, 16, 8, .2);
}
.dash-funnel-seg-val {
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.dash-funnel-seg-val::before {
  content: "·";
  margin: 0 7px;
  opacity: .6;
  font-weight: 600;
}
@keyframes dash-seg-in {
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .dash-funnel-seg { animation: none; opacity: 1; transform: none; }
}
.dash-funnel-seg--new      { background: #FF6A1A; }
.dash-funnel-seg--sent     { background: #E85A0C; }
.dash-funnel-seg--opened   { background: #FF7A1A; }
.dash-funnel-seg--progress { background: #4F8B73; } /* muted green — в работе */
.dash-funnel-seg--won      { background: #2F6F5E; } /* deep teal — успех */
.dash-funnel-seg--failed   { background: #D63A2F; }
.dash-funnel-seg--lost     { background: #B9B1A8; }
.dash-funnel-tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(20, 16, 14, .92);
  color: #fff;
  font-size: 12.5px;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(20, 16, 14, .28);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-fast) ease;
}
.dash-funnel-tip.is-visible {
  opacity: 1;
  visibility: visible;
}
.dash-funnel-tip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}
.dash-funnel-tip b { font-weight: 800; }
.dash-funnel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 200px;
  padding: 24px;
  text-align: center;
}
.dash-funnel-empty span {
  font-size: 14px;
  font-weight: 650;
  color: hsl(var(--foreground));
}
.dash-funnel-empty small {
  font-size: 12.5px;
  color: hsl(var(--muted-foreground));
  max-width: 28ch;
  line-height: 1.45;
}
.dash-quality-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px 18px;
  background: transparent;
  border-top: 1px solid hsl(var(--border));
}
.dash-quality-item {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px 15px 15px;
  border-radius: 12px;
  background: transparent;
  position: relative;
  transition: background var(--dur-fast) ease,
              transform var(--dur-normal) var(--ease-out-expo);
  cursor: default;
}
.dash-quality-item::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: hsl(var(--muted-foreground) / .35);
  margin-bottom: 3px;
}
.dash-quality-item:nth-child(1)::before,
.dash-quality-item:nth-child(2)::before { background: hsl(var(--success)); opacity: .8; }
.dash-quality-item:nth-child(3)::before,
.dash-quality-item:nth-child(6)::before { background: hsl(var(--warning)); opacity: .85; }
.dash-quality-item:nth-child(5)::before { background: hsl(var(--destructive)); opacity: .8; }
.dash-quality-item:hover {
  background: hsl(var(--primary) / .06);
  transform: translateY(-1px);
}
.dash-quality-item:hover strong { color: hsl(var(--primary)); }
.dash-quality-item strong { transition: color var(--dur-fast) ease; }
.dash-quality-label {
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  font-weight: 650;
}
.dash-quality-item strong {
  font-size: 26px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.dash-quality-item small {
  color: hsl(var(--muted-foreground));
  line-height: 1.3;
}
.dash-search-main {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-search-main > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.dash-campaign-name {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.dash-table--campaigns td {
  vertical-align: top;
}

/* Dashboard admin-card refresh: clean data surfaces with colored accents. */
.dash-workbench .dash-card {
  border-radius: var(--radius);
  background: hsl(var(--card));
  box-shadow: 0 1px 2px hsl(var(--foreground) / .06);
  transition: transform var(--dur-normal) var(--ease-out-expo),
              box-shadow var(--dur-normal) var(--ease-out-expo),
              border-color var(--dur-fast) ease;
}
.dash-workbench .dash-card:hover {
  border-color: hsl(var(--primary) / .18);
  box-shadow: 0 14px 30px -24px hsl(var(--primary) / .30), var(--shadow-md);
}
.dash-workbench .dash-card-header {
  min-height: 58px;
  padding: 16px 20px;
  background: transparent;
}
.dash-workbench .dash-card-title {
  color: hsl(var(--foreground));
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}
.dash-workbench .dash-pill-btn {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 6px;
  background: hsl(var(--muted) / .45);
  color: hsl(var(--muted-foreground));
}
.dash-workbench .dash-pill-btn:hover {
  background: hsl(var(--primary) / .08);
  color: hsl(var(--primary));
}

.dash-attention-list {
  gap: 12px;
  padding: 18px;
}
.dash-attention-item {
  --tone: var(--primary);
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px 18px;
  border-color: hsl(var(--border));
  background: hsl(var(--card));
  box-shadow: 0 1px 2px hsl(var(--foreground) / .04);
}
.dash-attention-item::before {
  width: 5px;
  border-radius: 999px;
}
.dash-attention-item:hover {
  border-color: hsl(var(--tone) / .24);
  background: hsl(var(--tone) / .035);
  box-shadow: 0 14px 28px -24px hsl(var(--tone) / .48), var(--shadow-sm);
}
.dash-attention-item.dash-attention-item--danger {
  --tone: var(--destructive);
}
.dash-attention-item.dash-attention-item--warning {
  --tone: var(--warning);
  --attention-fg: hsl(222 47% 10%);
}
.dash-attention-item.dash-attention-item--success {
  --tone: var(--success);
}
.dash-attention-item .dash-attention-icon {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  border-radius: calc(var(--radius) + 2px);
  background: hsl(var(--tone));
  color: var(--attention-fg, hsl(var(--primary-foreground)));
}
.dash-attention-item--warning .dash-attention-icon {
  color: hsl(222 47% 10%);
}
.dash-attention-body strong {
  color: hsl(var(--foreground));
  font-size: 15px;
}
.dash-attention-value {
  color: hsl(var(--tone));
  font-size: 1.8rem;
}

.dash-mailing-panel,
.dash-search-summary {
  gap: 16px;
  padding: 20px;
}
.dash-mailing-total {
  position: relative;
  padding-left: 18px;
}
.dash-mailing-total::before {
  content: "";
  position: absolute;
  inset: 3px auto 3px 0;
  width: 5px;
  border-radius: 999px;
  background: hsl(var(--success));
}
.dash-mailing-total span,
.dash-mailing-total small {
  color: hsl(var(--muted-foreground));
  font-weight: 650;
}
.dash-mailing-total strong {
  color: hsl(var(--foreground));
  font-size: 38px;
  font-weight: 850;
  letter-spacing: 0;
}
.dash-meter {
  height: 12px;
  background: linear-gradient(180deg, hsl(var(--muted)) 0%, hsl(var(--border)) 100%);
}
.dash-meter span,
.dash-meter i {
  min-width: 4px;
}
.dash-mini-stats {
  gap: 0;
  border-radius: var(--radius);
}
.dash-mini-stats div {
  padding: 15px 16px;
}
.dash-mini-stats strong {
  color: hsl(var(--foreground));
  font-size: 21px;
  font-weight: 850;
}
.dash-mini-stats span {
  font-size: 12px;
  text-transform: none;
}
.dash-list--queue {
  margin-top: 0;
}
.dash-list--queue .dash-list-item {
  min-height: 50px;
  padding: 12px 14px;
  background: hsl(var(--muted) / .42);
}

.dash-funnel {
  gap: 14px;
  padding: 20px;
}
.dash-funnel-row {
  grid-template-columns: 112px minmax(0, 1fr) 52px;
  min-height: 36px;
  padding: 7px 8px;
}
.dash-funnel-row span {
  font-size: 14px;
  font-weight: 650;
}
.dash-funnel-row strong {
  color: hsl(var(--foreground));
  font-size: 14px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.dash-funnel-bar {
  height: 10px;
  border-radius: 999px;
  background: hsl(var(--muted));
}
.dash-funnel-bar i {
  min-width: 5px;
}

.dash-quality-grid {
  border-top: 1px solid hsl(var(--border));
}
.dash-quality-item {
  gap: 10px;
  padding: 22px 20px;
  transition: background var(--dur-fast) ease,
              transform var(--dur-normal) var(--ease-out-expo);
}
.dash-quality-item::before {
  left: 20px;
  right: auto;
  top: 18px;
  width: 36px;
  height: 4px;
  border-radius: 999px;
  transform: none;
  background: hsl(var(--primary));
  opacity: .8;
}
.dash-quality-item:nth-child(1)::before,
.dash-quality-item:nth-child(2)::before { background: hsl(var(--success)); }
.dash-quality-item:nth-child(3)::before,
.dash-quality-item:nth-child(6)::before { background: hsl(var(--warning)); }
.dash-quality-item:nth-child(5)::before { background: hsl(var(--destructive)); }
.dash-quality-item:hover {
  transform: translateY(-2px);
  background: hsl(var(--primary) / .035);
}
.dash-quality-label {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 750;
}
.dash-quality-item strong {
  font-size: 32px;
  font-weight: 850;
}
.dash-quality-item small {
  min-height: 34px;
  font-size: 13px;
}

.dash-search-main {
  gap: 16px;
  padding: 2px 0;
}
.dash-search-icon {
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  border-radius: calc(var(--radius) + 2px) !important;
  background: hsl(var(--primary)) !important;
  color: hsl(var(--primary-foreground)) !important;
}
.dash-search-main strong {
  color: hsl(var(--foreground));
  font-size: 17px;
}
.dash-search-summary .dash-mini-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dash-table--campaigns {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.dash-table-scroll {
  width: 100%;
  overflow-x: auto;
}
.dash-table--campaigns th {
  height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-align: left;
  white-space: nowrap;
}
.dash-table--campaigns th:nth-child(1) { width: 150px; }
.dash-table--campaigns th:nth-child(2) { width: min(44%, 480px); }
.dash-table--campaigns th:nth-child(3),
.dash-table--campaigns th:nth-child(4),
.dash-table--campaigns th:nth-child(5) { width: 112px; }
.dash-table--campaigns th:nth-child(6) { width: 130px; }
.dash-table--campaigns th:nth-child(7) { width: 96px; }
.dash-table--campaigns tbody {
  background: hsl(var(--card));
}
.dash-table--campaigns tbody tr {
  position: relative;
  background: hsl(var(--card));
  transition: background var(--dur-fast) ease,
              box-shadow var(--dur-normal) var(--ease-out-expo),
              transform var(--dur-normal) var(--ease-out-expo);
}
.dash-table--campaigns tbody tr:nth-child(even) {
  background: hsl(var(--muted) / .58);
}
.dash-table--campaigns tbody tr:hover {
  background: hsl(var(--primary) / .055);
  box-shadow: inset 3px 0 0 hsl(var(--primary));
  transform: translateX(2px);
}
.dash-table--campaigns td {
  height: 66px;
  padding: 12px 16px;
  border-bottom: 1px solid hsl(var(--border) / .55);
  color: hsl(var(--foreground));
  font-size: 15px;
  font-weight: 650;
  vertical-align: middle;
}
.dash-table--campaigns tbody tr:last-child td {
  border-bottom: 0;
}
.dash-campaign-name .dash-badge {
  width: fit-content;
  min-height: 26px;
  padding-inline: 11px;
  justify-content: flex-start;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}
.dash-campaign-name small {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-table--campaigns td:last-child {
  text-align: right;
}
.dash-table--campaigns .dash-link {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  color: hsl(var(--primary));
  font-weight: 700;
  text-decoration: none;
  transition: background var(--dur-fast) ease,
              color var(--dur-fast) ease,
              transform var(--dur-normal) var(--ease-spring);
}
.dash-table--campaigns .dash-link:hover {
  background: hsl(var(--primary) / .1);
  color: hsl(var(--primary));
  text-decoration: none;
  transform: translateX(2px);
}
.dash-table--campaigns td > .dash-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  padding-inline: 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}

/* Filters, tabs, accordions, chips */
.research-columns,
.search-body,
.companies-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.fp-sidebar,
.search-sidebar {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.fp-section,
.accordion,
.field-switches,
.contact-data-card {
  padding: 14px 16px;
  border-bottom: 1px solid hsl(var(--border));
}
.fp-section:last-child,
.accordion:last-of-type { border-bottom: 0; }

.fp-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font-size: .8125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  cursor: pointer;
  text-align: left;
  gap: 8px;
}
.fp-section-toggle:hover { color: hsl(var(--primary)); }
.fp-toggle-arrow {
  flex-shrink: 0;
  transition: transform 200ms ease;
  color: hsl(var(--muted-foreground));
}
.fp-section-toggle--open .fp-toggle-arrow { transform: rotate(180deg); }
.fp-okved-body { margin-top: 10px; }

.fp-mode,
.search-mode-bar,
.cp-tabs,
.okved-type-bar {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--muted) / .48);
}
.search-mode-bar { margin-bottom: 20px; width: fit-content; }
.fp-mode-btn,
.search-mode-btn,
.okved-type-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  cursor: pointer;
}
.search-mode-btn { min-height: 48px; padding: 6px 16px; }
.mode-sub { display: block; color: hsl(var(--muted-foreground)); font-size: 11px; font-weight: 400; }
.search-mode-btn.active .mode-sub { color: hsl(var(--primary-foreground) / .75); }
.fp-chips,
.cmp-chips,
.cp-segs,
.ai-stats,
.cand-filter-tabs,
.picker-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fp-chip,
.picker-tag,
.cp-chip,
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid hsl(var(--border));
  border-radius: 6px;
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  font-size: 13px;
  font-weight: 500;
}
.fp-chip { cursor: pointer; }
.fp-chip:hover { border-color: hsl(var(--primary)); color: hsl(var(--primary)); }
.fp-tree,
.filter-menu-list,
.okved-tree-wrap,
.cp-list,
.ai-log,
.cand-list,
.notif-list,
.cc-body {
  overflow-y: auto;
}
.fp-tree { max-height: 280px; }
.fp-tree-row,
.filter-menu-row,
.accordion-header,
.contact-data-row,
.picker-row,
.okved-item-row,
.cp-list-head,
.cp-contact-row,
.cc-tab,
.cc-okved-drop-item,
.notif-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  border-radius: calc(var(--radius) - 4px);
  color: hsl(var(--foreground));
  cursor: pointer;
}
.fp-tree-row,
.filter-menu-row,
.okved-item-row,
.cp-contact-row,
.cc-okved-drop-item,
.notif-item { padding: 8px 10px; }
.fp-tree-row:hover,
.filter-menu-row:hover,
.accordion-header:hover,
.contact-data-row:hover,
.picker-row:hover,
.okved-item-row:hover,
.cp-contact-row:hover,
.cc-tab:hover,
.cc-okved-drop-item:hover,
.notif-item:hover { background: hsl(var(--muted) / .55); }
.fp-tree-chk,
.filter-menu-check,
.ft-check,
.contact-radio-mark {
  position: relative;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 6px);
  background: hsl(var(--background));
}
.fp-tree-chk.on,
.filter-menu-row input:checked + .filter-menu-check,
.ft-check[data-state="all"] {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary));
}
.fp-tree-chk.on::after,
.filter-menu-row input:checked + .filter-menu-check::after,
.ft-check[data-state="all"]::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: solid hsl(var(--primary-foreground));
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.fp-tree-arr,
.accordion-chevron,
.picker-row-arrow,
.contact-data-chevron,
.cp-invalid-chevron {
  color: hsl(var(--muted-foreground));
  transition: transform .15s ease;
}
.fp-tree-arr.open,
.accordion--open .accordion-chevron { transform: rotate(90deg); }
.fp-tree-lbl,
.filter-menu-label,
.picker-row-label { min-width: 0; flex: 1; }
.fp-chip-n,
.ft-toggle-badge { color: hsl(var(--muted-foreground)); font-size: 12px; }
.fp-toggle,
.filter-toggle,
.field-switch,
.contact-data-row--switch,
.contact-radio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  color: hsl(var(--foreground));
  cursor: pointer;
}
.fp-toggle input[type="checkbox"],
.filter-toggle input,
.field-switch input,
.contact-data-row--switch input {
  width: 38px;
  height: 22px;
  appearance: none;
  border-radius: 999px;
  background: hsl(var(--muted-foreground) / .28);
  position: relative;
}
.fp-toggle input[type="checkbox"]::after,
.filter-toggle input::after,
.field-switch input::after,
.contact-data-row--switch input::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 3px;
  left: 3px;
  border-radius: 999px;
  background: hsl(var(--background));
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease;
}
.fp-toggle input[type="checkbox"]:checked,
.filter-toggle input:checked,
.field-switch input:checked,
.contact-data-row--switch input:checked { background: hsl(var(--primary)); }
.fp-toggle input[type="checkbox"]:checked::after,
.filter-toggle input:checked::after,
.field-switch input:checked::after,
.contact-data-row--switch input:checked::after { transform: translateX(16px); }

/* Campaigns and contact picker */
.mailing-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 1px;
  overflow: hidden;
  padding: 0;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--border));
}
.mailing-stats .mailing-stat {
  border: 0;
  border-radius: 0;
  background: hsl(var(--card));
  padding: 16px 18px;
}
.mailing-stat,
.cmp-audience-result,
.cc-value,
.cc-okved-main,
.cc-ch-row,
.stat-pill {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--muted) / .42);
  padding: 12px;
}
.mailing-stat-value,
.contact-stat-n,
.cmp-audience-n,
.stat-pill-n {
  color: hsl(var(--foreground));
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
}
.mailing-offer { padding: 0 18px 14px; color: hsl(var(--muted-foreground)); }
/* ── Template cards ─────────────────────────────────────────────── */
.tpl-card {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.tpl-card:hover {
  border-color: hsl(var(--primary) / .5);
  background: hsl(var(--primary) / .03);
}
.tpl-card--active {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / .06);
  box-shadow: 0 0 0 3px hsl(var(--primary) / .12);
}
.tpl-card-radio { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.tpl-card-radio-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid hsl(var(--border));
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s;
}
.tpl-card--active .tpl-card-radio-dot {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary));
}
.tpl-card--active .tpl-card-radio-dot::after {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: hsl(var(--background));
}
.tpl-card-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.tpl-card--active .tpl-card-icon {
  background: hsl(var(--primary) / .12);
  color: hsl(var(--primary));
}
.tpl-card-body { flex: 1; min-width: 0; }
.tpl-card-name {
  font-size: 14px; font-weight: 600; line-height: 1.3;
  color: hsl(var(--foreground));
  transition: color .15s;
}
.tpl-card--active .tpl-card-name { color: hsl(var(--primary)); }
.tpl-card-subject {
  font-size: 12.5px; font-weight: 400; line-height: 1.35;
  color: hsl(var(--foreground) / .7);
  margin-top: 3px;
}
.tpl-card-meta {
  font-size: 11px; font-weight: 400; line-height: 1.3;
  color: hsl(var(--muted-foreground));
  margin-top: 4px;
  letter-spacing: 0.01em;
}
.tpl-card-preview {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  text-decoration: none;
  transition: color .15s, border-color .15s, background .15s;
}
.tpl-card-preview:hover {
  color: hsl(var(--primary));
  border-color: hsl(var(--primary) / .4);
  background: hsl(var(--primary) / .06);
}
.send-result {
  margin: 14px 18px;
  padding: 12px 14px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}
.send-result--ok { border-color: hsl(var(--success) / .25); background: hsl(var(--success) / .1); color: hsl(var(--success)); }
.send-result--error { border-color: hsl(var(--destructive) / .25); background: hsl(var(--destructive) / .1); color: hsl(var(--destructive)); }
.cp-controls,
.cp-list-head {
  padding: 12px 14px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / .42);
}
.cp-list { max-height: 300px; }
.cp-contact-row { border-bottom: 1px solid hsl(var(--border)); border-radius: 0; }
.cp-contact-info { min-width: 0; flex: 1; }
.cp-contact-name,
.cp-contact-sub,
.cp-contact-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-selected-area { display: block; }
.cp-chips { min-height: 32px; margin-bottom: 10px; }
.cp-no-sel { color: hsl(var(--muted-foreground)); line-height: 32px; }
.cp-manual-wrap { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px dashed hsl(var(--border)); }
.cp-manual-input { border: 0; border-bottom: 1px solid hsl(var(--border)); border-radius: 0; background: transparent; }
.cp-invalid-wrap { border-top: 1px solid hsl(var(--warning) / .25); background: hsl(var(--warning) / .08); }
.cp-invalid-header,
.cp-invalid-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.cp-delete-btn { border-color: hsl(var(--destructive) / .25); color: hsl(var(--destructive)); }

/* Search / AI candidate surfaces */
.search-main,
.companies-main,
.results-panel { min-width: 0; }
.ai-config-panel { padding: 16px; margin-bottom: 16px; }
.ai-progress { margin-bottom: 16px; display: none; }
.ai-bar-wrap { height: 6px; background: hsl(var(--muted)); }
.ai-bar { height: 100%; width: 0; background: hsl(var(--primary)); transition: width .25s ease; }
.ai-log { max-height: 180px; padding: 12px 16px; color: hsl(var(--muted-foreground)); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; }
.ai-log-line.ok { color: hsl(var(--success)); }
.ai-log-line.err { color: hsl(var(--destructive)); }
.cand-list { padding: 10px; }
.cand-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  margin-bottom: 8px;
}
.cand-card:hover { border-color: hsl(var(--primary)); box-shadow: 0 0 0 3px hsl(var(--primary) / .1); }
.cand-body { min-width: 0; flex: 1; }
.cand-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.stat-pill.s-new { border-color: hsl(var(--success) / .2); background: hsl(var(--success) / .1); }
.stat-pill.s-dup { border-color: hsl(var(--destructive) / .2); background: hsl(var(--destructive) / .1); }
.stat-pill.s-pos { border-color: hsl(var(--warning) / .24); background: hsl(var(--warning) / .12); }
.stat-pill.s-rev { border-color: hsl(var(--primary) / .2); background: hsl(var(--primary) / .1); }

/* Dialogs, popovers, notifications */
.modal,
.cc-backdrop,
.notif-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: hsl(222.2 47.4% 4% / .62);
  backdrop-filter: blur(6px);
}
.modal.open,
.cc-backdrop.open { display: flex; }
.modal-box,
.cc-modal,
.notif-panel,
.contact-phone-popover,
.cc-okved-drop {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  box-shadow: var(--shadow-lg);
}
.modal-box,
.cc-modal,
.notif-panel {
  width: min(720px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  overflow: hidden;
}
.modal-box { overflow-y: auto; }
.modal-header,
.cc-head,
.notif-panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / .42);
}
.cc-backdrop { display: flex; opacity: 0; pointer-events: none; transition: opacity .18s ease; padding: 0; left: 0; z-index: 1100; }
.cc-backdrop.open { opacity: 1; pointer-events: auto; }
.cc-modal { display: flex; flex-direction: row; width: 100%; height: 100vh; max-height: 100vh; border-radius: 0; border: none; }
.cc-head {
  flex-shrink: 0;
  background: hsl(var(--popover));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cc-head-top { display: flex; align-items: flex-start; justify-content: flex-end; gap: 16px; }
.cc-warn-chips:empty { display: none; }
.cc-ch-list,
.cc-hist-list,
.cc-camp-list { display: flex; gap: 8px; flex-wrap: wrap; }
.cc-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cc-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 4px;
  padding: 0 18px;
  border-bottom: 1px solid hsl(var(--border));
}
.cc-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
  transition: color var(--duration-fast,150ms) ease;
}
.cc-tab:hover { color: hsl(var(--foreground)); background: transparent; }
.cc-tab.active {
  color: hsl(var(--primary));
  box-shadow: inset 0 -2px 0 hsl(var(--primary));
}
.cc-body { padding: 18px; flex: 1; width: 100%; overflow-y: auto; }
.cc-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cc-contact-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cc-contact-primary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.cc-contact-group {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  overflow: hidden;
  min-width: 0;
}
.cc-contact-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / .28);
}
.cc-contact-group-head h3 {
  margin: 0;
  color: hsl(var(--foreground));
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}
.cc-contact-group-head p {
  margin: 3px 0 0;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  line-height: 1.35;
}
.cc-contact-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 700;
}
.cc-contact-empty {
  padding: 14px 16px;
  color: hsl(var(--muted-foreground));
  font-size: 13px;
}
.cc-ch-list,
.cc-hist-list,
.cc-camp-list { flex-direction: column; }
.cc-contact-group .cc-ch-list {
  gap: 0;
}
.cc-contact-group .cc-ch-row {
  border-width: 0;
  border-radius: 0;
  background: transparent;
}
.cc-contact-group .cc-ch-row + .cc-ch-row {
  border-top: 1px solid hsl(var(--border));
}
.cc-ch-row,
.cc-hist-row,
.cc-camp-row,
.cc-okved-add-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cc-ch-val,
.cc-okved-add-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-ch-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cc-ch-main .cc-ch-val {
  flex: 0 1 auto;
}
.cc-ch-type {
  color: hsl(var(--muted-foreground));
  font-size: 11px;
  line-height: 1.2;
}
.cc-ch-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: hsl(var(--muted-foreground));
}
.cc-ch-icon svg { width: 16px; height: 16px; }
.cc-ch-btns { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.cc-ch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: background var(--duration-fast,150ms) ease, color var(--duration-fast,150ms) ease;
}
.cc-ch-btn:hover { background: hsl(var(--muted) / .7); color: hsl(var(--foreground)); }
.cc-ch-btn.cc-ch-ok:hover { color: hsl(var(--success)); }
.cc-ch-btn.cc-ch-del:hover { color: hsl(var(--destructive)); }
.cc-ch-badge { display: inline-flex; align-items: center; line-height: 1.4; border-radius: 6px; padding: 2px 8px; font-size: 11px; }
.cc-st-active { background: hsl(var(--success) / .1); color: hsl(var(--success)); }
.cc-st-inactive { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.cc-st-bounced { background: hsl(var(--destructive) / .1); color: hsl(var(--destructive)); }
.cc-st-review { background: hsl(var(--warning) / .12); color: hsl(var(--warning)); }
.cc-add-ch {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
}
.cc-add-ch select { flex: 0 1 180px; }
.cc-add-ch input { flex: 1 1 260px; }
@media (max-width: 980px) {
  .cc-contact-primary-grid {
    grid-template-columns: 1fr;
  }
}
/* Funnel status badges */
.cc-funnel-badge { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:36px; padding:0 14px; border-radius:calc(var(--radius) - 2px); font-size:14px; font-weight:500; white-space:nowrap; border:1px solid hsl(var(--border)); cursor:pointer; transition:filter var(--duration-fast,150ms) var(--ease-out-expo,ease); font-family:inherit; }
.cc-funnel-badge:hover { filter:brightness(0.96); }
.cc-funnel-caret { display:inline-flex; transform:rotate(90deg); transition:transform var(--duration-fast,150ms) var(--ease-out-expo,ease); opacity:.7; }
.cc-funnel-picker:has(.cc-funnel-menu.open) .cc-funnel-caret { transform:rotate(-90deg); }
.cc-fs-new         { background:#E7E1DA; color:#6F6760; }
.cc-fs-sent        { background:#DDEBE5; color:#2F6F5E; }
.cc-fs-opened      { background:#FFF0DE; color:#B65300; }
.cc-fs-in-progress { background:#FFF0DE; color:#9B4A00; }
.cc-fs-won         { background:#FFF3EC; color:#E85A0C; }
.cc-fs-failed      { background:#F7E9E6; color:#D63A2F; }
.cc-fs-lost        { background:#D7CEC5; color:#4D4640; }
.tbl-funnel { display:inline-flex; align-items:center; padding:2px 8px; border-radius:6px; font-size:.7rem; font-weight:600; }
/* Funnel status dropdown */
.cc-funnel-picker { position:relative; display:inline-flex; }
.cc-funnel-menu { position:absolute; top:calc(100% + 6px); left:0; z-index:50; min-width:220px; background:hsl(var(--card)); border:1px solid hsl(var(--border)); border-radius:10px; box-shadow:0 10px 30px rgba(0,0,0,.15); padding:6px; display:flex; flex-direction:column; gap:2px; opacity:0; visibility:hidden; transform:translateY(-4px); transition:opacity var(--duration-fast,150ms) var(--ease-out-expo,ease), transform var(--duration-fast,150ms) var(--ease-out-expo,ease), visibility var(--duration-fast,150ms); }
.cc-funnel-menu.open { opacity:1; visibility:visible; transform:translateY(0); }
.cc-funnel-menu-item { display:flex; align-items:center; gap:8px; width:100%; text-align:left; border:none; background:none; padding:7px 10px; border-radius:7px; font-size:.82rem; font-weight:600; cursor:pointer; color:var(--foreground); font-family:inherit; }
.cc-funnel-menu-item:hover { background:hsl(var(--muted)); }
.cc-funnel-menu-item.active { background:hsl(var(--muted)); }
.cc-funnel-menu-item svg { flex:none; }
.cc-funnel-menu-spacer { display:inline-block; width:14px; flex:none; }
.cc-comment-meta { margin-top:6px; font-size:.78rem; color:hsl(var(--muted-foreground)); }
.cc-hist-section-title { font-size:.75rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted-foreground); padding:8px 0 4px; }
.cc-hist-by { font-size:.75rem; color:var(--muted-foreground); font-weight:400; }
.cc-okved-drop {
  position: absolute;
  z-index: 1200;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 240px;
  overflow-y: auto;
  display: none;
}
.cc-okved-inp-wrap { position: relative; flex: 1; min-width: 220px; }
.notif-backdrop { z-index: 9990; }
.notif-backdrop.visible { display: block; }
.notif-panel {
  position: fixed;
  z-index: 9999;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.98);
  display: none;
  flex-direction: column;
  min-height: 420px;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}
.notif-panel.open {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.notif-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notif-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.notif-read-all,
.notif-clear-history {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.notif-read-all:hover,
.notif-clear-history:hover { background: hsl(var(--muted)); }
.notif-clear-history {
  color: hsl(var(--muted-foreground));
}
.notif-clear-history:hover {
  border-color: hsl(var(--destructive) / .28);
  background: hsl(var(--destructive) / .08);
  color: hsl(var(--destructive));
}
.notif-list { flex: 1; }
.notif-item { border-bottom: 1px solid hsl(var(--border)); border-radius: 0; }
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: hsl(var(--primary));
  flex: 0 0 auto;
}
.notif-dot.read { background: transparent; border: 1px solid hsl(var(--border)); }
/* Непрочитанные выделены тёплой подложкой и акцентной полосой; прочитанные — спокойнее. */
.notif-item.unread { background: hsl(var(--primary) / .06); box-shadow: inset 2px 0 0 hsl(var(--primary)); }
.notif-item.unread:hover { background: hsl(var(--primary) / .1); }
.notif-item:not(.unread) .notif-summary { font-weight: 400; color: hsl(var(--muted-foreground)); }
.notif-body { min-width: 0; flex: 1; }
.notif-summary { font-weight: 500; }
.notif-item.unread .notif-summary { font-weight: 600; }
.notif-meta,
.notif-detail { color: hsl(var(--muted-foreground)); font-size: 12px; }
.notif-detail {
  display: none;
  margin-top: 8px;
  padding: 10px;
  border-radius: calc(var(--radius) - 4px);
  background: hsl(var(--muted) / .55);
  white-space: pre-wrap;
}
.notif-item.expanded .notif-detail { display: block; }
.notif-count {
  position: absolute;
  top: -4px;
  right: -4px;
  display: flex;
  min-width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border: 2px solid hsl(var(--background));
  border-radius: 999px;
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  font-size: 10px;
  font-weight: 700;
}

/* Loading and skeleton */
.tbl-spinner,
.tbl-spin,
.ai-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border: 2px solid hsl(var(--muted));
  border-top-color: hsl(var(--primary));
  border-radius: 999px;
  animation: spin .8s linear infinite;
  vertical-align: middle;
}
.ai-spinner { border-top-color: hsl(var(--primary-foreground)); }
.cc-sk-line,
.skeleton {
  height: 14px;
  border-radius: calc(var(--radius) - 4px);
  background: linear-gradient(90deg, hsl(var(--muted)), hsl(var(--muted) / .55), hsl(var(--muted)));
  background-size: 220% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes skeleton { to { background-position-x: -220%; } }

/* Petal spinner — for block-level wait states (AI search, contact loading, file check).
   --dot-size is the nominal unit; the visible ring is roughly 6× that value. */
.dot-spinner {
  --dot-size: 7px;
  --dot-color: hsl(var(--primary));
  position: relative;
  display: inline-block;
  width: var(--dot-size);
  height: var(--dot-size);
  flex: none;
  vertical-align: middle;
}
.dot-spinner > i {
  position: absolute;
  left: 25%;
  top: -25%;
  width: 50%;
  height: 150%;
  border-radius: 999px;
  background: var(--dot-color);
  transform: rotate(calc(var(--rot) * 1deg)) translate(0, 150%);
  animation: dot-spinner-wave 1s calc(var(--del) * 1s) infinite ease;
}
.dot-spinner > i:nth-child(1)  { --del: .1; --rot: 36;  }
.dot-spinner > i:nth-child(2)  { --del: .2; --rot: 72;  }
.dot-spinner > i:nth-child(3)  { --del: .3; --rot: 108; }
.dot-spinner > i:nth-child(4)  { --del: .4; --rot: 144; }
.dot-spinner > i:nth-child(5)  { --del: .5; --rot: 180; }
.dot-spinner > i:nth-child(6)  { --del: .6; --rot: 216; }
.dot-spinner > i:nth-child(7)  { --del: .7; --rot: 252; }
.dot-spinner > i:nth-child(8)  { --del: .8; --rot: 288; }
.dot-spinner > i:nth-child(9)  { --del: .9; --rot: 324; }
.dot-spinner > i:nth-child(10) { --del: 1;  --rot: 360; }
@keyframes dot-spinner-wave {
  0%, 10%, 20%, 30%, 50%, 60%, 70%, 80%, 90%, 100% {
    transform: rotate(calc(var(--rot) * 1deg)) translate(0, 150%);
  }
  50% {
    transform: rotate(calc(var(--rot) * 1deg)) translate(0, 200%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .dot-spinner > i { animation-duration: 0s; opacity: .55; }
}

/* Login */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(135deg, hsl(var(--background)) 0%, hsl(var(--muted)) 48%, hsl(199 89% 96%) 100%);
}
.auth-shell {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 480px);
  gap: 24px;
  align-items: stretch;
}
.auth-shell--compact {
  width: min(480px, 100%);
  display: block;
}
.login-box {
  width: min(480px, 100%);
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 4px);
  background: hsl(var(--card));
  padding: 28px;
  box-shadow: var(--shadow-md);
}
.auth-card {
  width: 100%;
  align-self: center;
}
.auth-card--centered {
  margin: 0 auto;
}
.auth-card--register {
  padding: 28px;
}
.auth-brand-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  min-height: 640px;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 40px;
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(circle at 18% 12%, rgba(255,106,26,.28), transparent 34%),
    linear-gradient(145deg, #111111 0%, #1A1A1A 58%, #1F1A17 100%);
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-lg);
}
.auth-brand-logo img {
  display: block;
  width: 190px;
  max-width: 100%;
  height: auto;
}
.auth-brand-panel h1 {
  margin: 0 0 12px;
  font-size: 44px;
  line-height: 1.05;
  font-weight: 800;
}
.auth-brand-panel p {
  max-width: 560px;
  margin: 0;
  color: rgba(255,255,255,.78);
  font-size: 17px;
}
.auth-benefits {
  display: grid;
  gap: 12px;
}
.auth-benefit {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  background: rgba(255,255,255,.07);
}
.auth-benefit > span,
.auth-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: hsl(var(--primary) / .14);
  color: hsl(var(--primary));
}
.auth-benefit > span {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.auth-benefit strong {
  display: block;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.auth-benefit small {
  display: block;
  margin-top: 2px;
  color: rgba(255,255,255,.7);
  font-size: 13px;
}
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: hsl(var(--foreground));
  font-size: 22px;
  font-weight: 800;
}
.login-logo-img {
  display: block;
  width: 176px;
  max-width: 100%;
  height: auto;
}
.login-logo svg rect { fill: hsl(var(--primary)); }
.login-logo svg rect:nth-child(2),
.login-logo svg rect:nth-child(3) { opacity: .36; }
.login-logo svg rect:nth-child(4) { fill: hsl(var(--success)); }
.login-subtitle {
  margin: 6px 0 24px;
  color: hsl(var(--muted-foreground));
  text-align: center;
}
.login-box .form-group { margin-bottom: 14px; }
.auth-logo-stack {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-bottom: 22px;
  text-align: center;
}
.auth-logo-stack .login-logo-img {
  width: 154px;
}
.auth-logo-stack h1 {
  margin: 0;
  color: hsl(var(--foreground));
  font-size: 22px;
  line-height: 1.2;
  font-weight: 800;
}
.auth-logo-stack p {
  max-width: 360px;
  margin: 6px auto 0;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
}
.auth-form {
  margin-top: 0;
}
.auth-social-btn {
  display: flex;
  min-height: 44px;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-weight: 700;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.auth-social-btn:hover,
.auth-social-btn:focus-visible {
  border-color: hsl(var(--primary) / .42);
  background: hsl(var(--primary) / .045);
  box-shadow: 0 0 0 3px hsl(var(--primary) / .1);
  outline: none;
}
.auth-social-btn:active {
  transform: translateY(1px);
}
.auth-google-mark {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.auth-google-mark svg {
  width: 20px;
  height: 20px;
  display: block;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 600;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: hsl(var(--border));
}
.auth-divider span {
  white-space: nowrap;
}
.auth-card-heading {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 22px;
}
.auth-card-heading h1,
.auth-card-heading h2 {
  margin: 0;
  color: hsl(var(--foreground));
  font-size: 22px;
  line-height: 1.2;
}
.auth-card-heading p {
  margin: 4px 0 0;
  color: hsl(var(--muted-foreground));
}
.auth-field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.auth-consent {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 2px 0 16px;
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  line-height: 1.45;
}
.auth-consent input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: hsl(var(--primary));
}
.auth-consent a,
.auth-alt-link a,
.auth-policy-note a {
  color: hsl(var(--primary));
  font-weight: 600;
  text-decoration: none;
}
.auth-consent a:hover,
.auth-alt-link a:hover,
.auth-policy-note a:hover {
  color: hsl(var(--primary) / .85);
  text-decoration: underline;
}
.auth-policy-note {
  margin: 14px 0 0;
  color: hsl(var(--muted-foreground));
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}
.auth-alt-link {
  margin-top: 18px;
  color: hsl(var(--muted-foreground));
  text-align: center;
  font-size: 14px;
}
.legal-card {
  width: min(560px, 100%);
}
.legal-placeholder-text {
  margin: 0;
  color: hsl(var(--foreground));
  font-size: 15px;
}
body.login-page .btn:disabled {
  cursor: wait;
  opacity: .78;
}
@media (max-width: 900px) {
  body.login-page {
    align-items: flex-start;
    padding: 18px;
  }
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-brand-panel {
    min-height: auto;
    padding: 28px;
  }
  .auth-brand-panel h1 {
    font-size: 34px;
  }
}
@media (max-width: 560px) {
  body.login-page {
    padding: 12px;
  }
  .login-box,
  .auth-card--register {
    padding: 22px;
  }
  .auth-brand-panel {
    padding: 22px;
  }
  .auth-brand-panel h1 {
    font-size: 30px;
  }
  .auth-brand-panel p {
    font-size: 15px;
  }
  .auth-field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .auth-benefit {
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 12px;
  }
  .auth-benefit > span,
  .auth-card-icon {
    width: 36px;
    height: 36px;
  }
}

/* Misc utility compatibility */
.contact-stats-row {
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 1px;
  align-items: stretch;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--border));
  box-shadow: var(--shadow-sm);
}
.contact-stat-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 16px 18px;
  border: 0;
  border-radius: 0;
  background: hsl(var(--card));
  box-shadow: none;
}
.contact-stat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.contact-stat-pct {
  flex: 0 0 auto;
}
.contact-stat-l {
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}
.contact-stat-n span {
  margin-left: 8px;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 650;
}
.contacts-review-panel { margin-bottom: 16px; display: none; }
.crp-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid hsl(var(--border)); background: hsl(var(--warning) / .08); }
.crp-list { display: grid; gap: 8px; padding: 10px; }
.crp-row { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); }
.crp-acts { display: flex; gap: 6px; margin-left: auto; }
.cmp-filter-body { padding: 16px; }
.cmp-audience-row { display: flex; gap: 16px; flex-wrap: wrap; }
.contact-phone-popover {
  position: absolute;
  z-index: 100;
  display: none;
  width: min(280px, calc(100vw - 48px));
  padding: 12px;
}
.contact-phone-popover--open { display: block; }
.filter-menu-row input { display: none; }
.filter-menu-list { max-height: 360px; padding: 8px; }
.filter-menu-marker { width: 24px; color: hsl(var(--muted-foreground)); }
.filter-menu-footer { justify-content: space-between; }
.filter-menu-search { flex: 1; min-width: 160px; display: flex; align-items: center; gap: 8px; }
.filter-menu-search input { min-height: 36px; }
.count-input { max-width: 220px; font-size: 18px; font-weight: 700; }
.log-console {
  height: 280px;
  overflow-y: auto;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--ks-brand-obsidian, #111111);
  color: var(--ks-brand-faint, #B9B1A8);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}
.run-summary { padding: 12px 16px; border-top: 1px solid hsl(var(--success) / .2); background: hsl(var(--success) / .1); color: hsl(var(--success)); }
.open-badge { color: hsl(var(--success)); }
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.toolbar-row--padded,
.section-pad { padding: 0 18px 18px; }
.section-label {
  margin-top: 18px;
  margin-bottom: 6px;
  color: hsl(var(--foreground));
  font-size: 13px;
  font-weight: 600;
}
.stack-gap { margin-bottom: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.text-muted { color: hsl(var(--muted-foreground)); font-size: 12px; }
.text-success { color: hsl(var(--success)); }
.text-warning { color: hsl(var(--warning)); }
.text-danger { color: hsl(var(--destructive)); }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-industry { max-width: 150px; font-size: 12px; color: hsl(var(--muted-foreground)); }
.inline-muted { font-size: 12px; color: hsl(var(--muted-foreground)); }
.hint-small { font-size: 11px; color: hsl(var(--muted-foreground)); font-weight: 400; }
.tag-new {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: hsl(var(--primary) / .12);
  color: hsl(var(--primary));
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}
.loading-block {
  padding: 64px;
  color: hsl(var(--muted-foreground));
  text-align: center;
}
.loading-spinner {
  width: 24px;
  height: 24px;
  margin: 0 auto 12px;
  border: 2px solid hsl(var(--border));
  border-top-color: hsl(var(--primary));
  border-radius: 999px;
  animation: spin .7s linear infinite;
}
.progress-strip { display: none; padding: 12px 16px 0; }
.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.progress-track {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: hsl(var(--muted));
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: hsl(var(--primary));
  transition: width .4s ease;
}
.progress-label {
  min-width: 110px;
  color: hsl(var(--foreground));
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.progress-sub {
  margin-bottom: 8px;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}
.dedupe-note { margin-left: 6px; font-size: 11px; color: hsl(var(--muted-foreground)); opacity: .78; }
.source-muted { opacity: .68; }
.link,
.icon-link {
  color: hsl(var(--primary));
  text-decoration: none;
  transition: color .15s ease;
}
.link:hover,
.icon-link:hover { color: hsl(var(--primary) / .82); text-decoration: underline; }
.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
}
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  padding: 9px 20px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
}
.toast-success {
  border-color: hsl(var(--primary) / .3);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.toast-error {
  border-color: hsl(var(--destructive) / .3);
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}
.form-actions--plain {
  border-top: 0;
  background: transparent;
  padding-top: 0;
}
.form-actions--flush { margin-top: 0; }
.ts-leg-dot--success { background: hsl(var(--success)); }
.ts-leg-dot--danger { background: hsl(var(--destructive)); }
.ts-leg-dot--warning { background: hsl(var(--warning)); }
.ts-ring-label--warning { color: hsl(var(--warning)); }
.ts-ring-label--primary { color: hsl(var(--primary)); }
.ts-ring-label--info { color: hsl(var(--info)); }
.ts-ring-label--muted { color: hsl(var(--muted-foreground)); }
.btn-pause,
.btn-finish,
.btn-icon-danger {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  padding: 0 14px;
  cursor: pointer;
}
.btn-icon-danger {
  width: 36px;
  padding: 0;
  color: hsl(var(--destructive));
}
.btn-pause:hover,
.btn-finish:hover,
.btn-icon-danger:hover {
  background: hsl(var(--accent));
}
.standalone-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.unsub-box {
  width: min(420px, 100%);
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 4px);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  padding: 36px 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.unsub-icon {
  display: inline-flex;
  width: 64px;
  height: 64px;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  border-radius: 999px;
  background: hsl(var(--primary) / .1);
  color: hsl(var(--primary));
}
.unsub-icon--done {
  background: hsl(var(--success) / .1);
  color: hsl(var(--success));
}
.unsub-icon--invalid {
  background: hsl(var(--destructive) / .1);
  color: hsl(var(--destructive));
}
.unsub-title {
  color: hsl(var(--foreground));
  font-size: 20px;
  font-weight: 700;
}
.unsub-email {
  margin-top: 8px;
  margin-bottom: 20px;
  color: hsl(var(--muted-foreground));
  word-break: break-word;
}
.unsub-desc {
  margin-bottom: 24px;
  color: hsl(var(--muted-foreground));
}
.unsub-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

@media (max-width: 1180px) {
  .research-columns,
  .search-body,
  .companies-layout,
  .dash-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fp-sidebar,
  .search-sidebar { position: static; max-height: none; }
  .dash-main-grid,
  .dash-lower-grid { grid-template-columns: 1fr; }
  /* Collapse to a single column: drop explicit cell placement so blocks stack
     in source order (buttons → funnel → donut → quality). */
  .dash-main-grid { grid-template-rows: none; }
  .dash-cell--buttons,
  .dash-cell--funnel,
  .dash-cell--donut,
  .dash-cell--quality {
    grid-column: auto;
    grid-row: auto;
    align-self: auto;
  }
}
@media (max-width: 900px) {
  /* Sidebar mobile behaviour (off-canvas drawer) lives in responsive.css. */
  .cc-backdrop { left: 0; }
  .cc-modal { flex-direction: column; }
  .cc-profile {
    width: 100%;
    max-height: 40vh;
    border-right: 0;
    border-bottom: 1px solid hsl(var(--border));
  }
  .content-header { flex-direction: column; align-items: stretch; }
  .content-header-right { justify-content: space-between; }
  .dash-top-row,
  .dashboard-grid,
  .dash-kpi-grid,
  .dash-quality-grid { grid-template-columns: 1fr; }
  .mailing-stats,
  .form-grid,
  .settings-service-grid,
  .support-page-grid,
  .cc-field-grid { grid-template-columns: 1fr; }
  .dash-mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .content { padding: 14px; }
  .content-header h1 { font-size: 21px; }
  .header-actions,
  .form-actions,
  .selection-bar,
  .filter-bar { align-items: stretch; }
  .header-actions > *,
  .form-actions > .btn,
  .selection-bar > .btn,
  .filter-bar > .btn,
  .filter-bar > .filter-select,
  .filter-bar > .filter-input { width: 100%; }
  .tpl-card,
  .cand-card,
  .crp-row { flex-direction: column; align-items: stretch; }
  .modal-box,
  .cc-modal,
  .notif-panel { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .dash-kpi,
  .dash-attention-item,
  .dash-search-main { align-items: flex-start; }
  .dash-attention-item {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .dash-attention-value {
    grid-column: 2;
    text-align: left;
  }
  .dash-funnel-row {
    grid-template-columns: 78px minmax(0, 1fr) 38px;
  }
  .dash-table--campaigns {
    min-width: 760px;
  }
  .dash-actions--work {
    padding: 14px;
  }
  .dash-actions--work .dash-action-item {
    grid-template-columns: 58px minmax(0, 1fr) 22px;
    gap: 14px;
    min-height: 104px;
    padding: 18px;
  }
  .dash-actions--work .dash-action-icon {
    width: 52px;
    height: 52px;
  }
  .dash-actions--work .dash-action-icon .lucide-icon {
    width: 28px;
    height: 28px;
  }
  .dash-actions--work .dash-action-title {
    font-size: 17px;
  }
  .dash-actions--work .dash-action-desc {
    font-size: 13.5px;
  }
  .settings-link-card,
  .support-panel-body {
    padding: 14px;
  }
  .contact-channel-list,
  .contact-channel-btn {
    width: 100%;
  }
  .contact-channel-btn {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .contact-channel-state {
    flex-basis: 100%;
    padding-left: 28px;
  }
}

/* ============================================================
   Interaction utilities — consistent motion across all pages
   ============================================================ */

/* Generic card hover-lift: opt-in via .lift on any surface */
.lift {
  transition: transform var(--dur-normal) var(--ease-out-expo),
              box-shadow var(--dur-normal) var(--ease-out-expo),
              border-color var(--dur-fast) ease;
  will-change: transform;
}
.lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: hsl(var(--primary) / .28);
}

/* Dashboard KPI tiles: lift + accent ring on hover (used on /dashboard) */
.dash-kpi { transition: background var(--dur-fast) ease, box-shadow var(--dur-normal) var(--ease-out-expo), transform var(--dur-normal) var(--ease-out-expo); }
.dash-kpi:hover { transform: translateY(-2px); }
.dash-kpi:hover .dash-kpi-icon { transform: scale(1.06); }
.dash-kpi-icon, .dash-attention-icon, .dash-search-icon { transition: transform var(--dur-normal) var(--ease-spring); }

/* Staggered entrance for grids of cards */
@keyframes ks-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ks-stagger > * {
  animation: ks-rise var(--dur-slow) var(--ease-out-expo) both;
}
.ks-stagger > *:nth-child(1) { animation-delay: 0ms; }
.ks-stagger > *:nth-child(2) { animation-delay: 45ms; }
.ks-stagger > *:nth-child(3) { animation-delay: 90ms; }
.ks-stagger > *:nth-child(4) { animation-delay: 135ms; }
.ks-stagger > *:nth-child(5) { animation-delay: 180ms; }
.ks-stagger > *:nth-child(6) { animation-delay: 225ms; }
.ks-stagger > *:nth-child(7) { animation-delay: 270ms; }
.ks-stagger > *:nth-child(8) { animation-delay: 315ms; }

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .lift:hover, .dash-kpi:hover, .btn-primary:hover { transform: none; }
}

/* ── Upcoming features section (dashboard) ─────────────────────── */
.dash-section { margin-top: 4px; }
.dash-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: hsl(var(--muted-foreground));
  margin: 0 0 12px;
}
.dash-upcoming-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.dash-upcoming-card {
  padding: 20px 22px; border: 1.5px solid hsl(var(--border));
  border-radius: var(--radius); background: hsl(var(--card));
  display: flex; flex-direction: column; gap: 8px;
}
.dash-upcoming-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dash-upcoming-title { font-size: 15px; font-weight: 700; color: hsl(var(--foreground)); }
.dash-upcoming-badge {
  padding: 2px 9px; border-radius: 20px; font-size: 10px; font-weight: 700;
  letter-spacing: .05em; background: hsl(var(--primary) / .1); color: hsl(var(--primary));
  white-space: nowrap;
}
.dash-upcoming-date { font-size: 11.5px; color: hsl(var(--muted-foreground)); }
.dash-upcoming-desc { font-size: 13px; color: hsl(var(--muted-foreground)); line-height: 1.55; }
.dash-upcoming-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.dash-upcoming-form input[type="email"] {
  flex: 1 1 160px; padding: 7px 10px;
  border: 1.5px solid hsl(var(--border)); border-radius: calc(var(--radius) - 2px);
  font-family: inherit; font-size: 13px;
  background: hsl(var(--background)); color: hsl(var(--foreground));
  transition: border-color 150ms;
}
.dash-upcoming-form input[type="email"]:focus { outline: none; border-color: hsl(var(--primary)); }

/* ── Public footer — login, register, legal pages ───────────────────── */
.site-footer {
  --footer-text: hsl(0 0% 68%);
  --footer-muted: hsl(0 0% 46%);
  --footer-accent: hsl(var(--primary));
  width: 100%;
  position: relative;
  background: hsl(var(--sidebar));
  color: var(--footer-text);
  font-size: 13px;
  line-height: 1.5;
}
/* Gradient accent top border */
.site-footer::before {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    hsl(var(--primary) / .6) 30%,
    hsl(var(--primary) / .9) 50%,
    hsl(var(--primary) / .6) 70%,
    transparent 100%
  );
}
.site-footer-inner {
  max-width: none;
  margin: 0;
  padding: 28px clamp(1.5rem, 1rem + 4vw, 4rem) 24px;
}

/* Main row: brand left, nav right */
.footer-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.footer-logo-link {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  opacity: 1;
  transition: opacity .16s ease;
}
.footer-logo-link:hover { opacity: .75; }
.footer-logo {
  display: block;
  height: 24px;
  width: auto;
  /* wh.png уже белый с прозрачным фоном — инверсия не нужна. */
}
/* Vertical separator between logo and tagline */
.footer-brand::after {
  content: '';
  display: block;
  width: 1px;
  height: 28px;
  background: hsl(0 0% 100% / .12);
  flex: 0 0 auto;
}
.footer-tagline {
  margin: 0;
  color: var(--footer-muted);
  font-size: 12px;
  letter-spacing: .01em;
  line-height: 1.45;
  white-space: nowrap;
}

/* Nav links inline with dot separator */
.footer-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.footer-nav-link {
  color: var(--footer-text);
  font-size: 12.5px;
  text-decoration: none;
  letter-spacing: .01em;
  transition: color .15s ease;
  white-space: nowrap;
}
.footer-nav-link:hover,
.footer-nav-link:focus-visible { color: var(--footer-accent); }
.footer-nav-link:focus-visible { outline: none; text-decoration: underline; text-underline-offset: 3px; }
.footer-nav-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: hsl(0 0% 100% / .25);
  flex: 0 0 auto;
}

/* Bottom bar: copyright left, social right */
.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid hsl(0 0% 100% / .07);
}
.footer-copy {
  margin: 0;
  color: var(--footer-muted);
  font-size: 11.5px;
  letter-spacing: .02em;
}

/* ── Social buttons (Telegram / Instagram) ───────────────────────────
   White rounded buttons that expand into a labelled pill on hover.
   Brand-coloured glyphs (Telegram blue / Instagram gradient).
   Adapted from a Uiverse hover-expand button (Pradeepsaranbishnoi). */
.social-btns {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  width: 46px;
  padding: 0;
  border: 1px solid hsl(0 0% 100% / .14);
  border-radius: 13px;
  background: hsl(0 0% 100% / .06);
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
  cursor: pointer;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  font-weight: 700;
  transition:
    width .3s var(--ease-out-expo),
    border-radius .3s var(--ease-out-expo),
    background .3s var(--ease-out-expo),
    border-color .3s var(--ease-out-expo),
    box-shadow .3s var(--ease-out-expo);
}
.social-btn-icon {
  display: flex;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
}
.social-btn-icon svg { width: 24px; height: 24px; display: block; fill: currentColor; }
.social-btn-label {
  width: 0;
  overflow: hidden;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
  transition:
    width .3s var(--ease-out-expo),
    margin-left .3s var(--ease-out-expo);
}
.social-btn:hover,
.social-btn:focus-visible {
  width: 150px;
  border-radius: 11px;
  box-shadow: 0 14px 26px rgba(0, 0, 0, .45);
  outline: none;
}
.social-btn:hover .social-btn-label,
.social-btn:focus-visible .social-btn-label {
  width: 84px;
  margin-left: 8px;
}
/* Brand accent appears only on hover, so the resting state stays in the
   footer palette. */
.social-btn--tg:hover,
.social-btn--tg:focus-visible {
  background: #229ED9;
  border-color: #229ED9;
}
.social-btn--ig:hover,
.social-btn--ig:focus-visible {
  background: linear-gradient(45deg, #feda75 0%, #fa7e1e 22%, #d62976 52%, #962fbf 76%, #4f5bd5 100%);
  border-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
  .social-btn,
  .social-btn-label { transition: none; }
}

/* Sidebar placement: left-aligned so the pill grows into the rail, not shifting siblings */
.sidebar-footer .social-btns {
  justify-content: flex-start;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 8px 2px;
  border-top: 1px solid hsl(0 0% 100% / .08);
}

/* Collapsed sidebar: stack as squares, no pill expansion */
body.sidebar-collapsed .sidebar-footer .social-btns,
html.sidebar-collapsed-preload .sidebar-footer .social-btns {
  flex-direction: column;
  gap: 8px;
}
body.sidebar-collapsed .sidebar-footer .social-btn:hover,
body.sidebar-collapsed .sidebar-footer .social-btn:focus-visible,
html.sidebar-collapsed-preload .sidebar-footer .social-btn:hover {
  width: 50px;
  border-radius: 12px;
}
body.sidebar-collapsed .sidebar-footer .social-btn-label,
html.sidebar-collapsed-preload .sidebar-footer .social-btn-label { display: none; }

/* Narrow public footer */
@media (max-width: 640px) {
  .footer-bar {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 12px;
  }
}

body.login-page.has-site-footer {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
}
body.login-page.has-site-footer .auth-orb { z-index: 0; }
body.login-page.has-site-footer .auth-shell {
  margin: auto;
  padding: clamp(1.25rem, .5rem + 3vw, 2.5rem);
  position: relative;
  z-index: 1;
}
body.login-page.has-site-footer .site-footer {
  position: relative;
  z-index: 1;
}

@media (max-width: 760px) {
  .footer-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .footer-nav { justify-content: flex-start; }
  .footer-tagline { white-space: normal; }
}
