/* ============================================================
   AUTOLEAD DASHBOARD — Unified TrafficHub Theme
   ============================================================ */

:root {
  --bg:          #090908;
  --bg2:         #111110;
  --bg3:         #1c1c1a;
  --bg-glass:    rgba(17, 17, 16, 0.92);
  --bg-glass2:   rgba(28, 28, 26, 0.96);
  --surface-soft: rgba(255, 255, 255, 0.01);
  --surface-hover: rgba(255, 255, 255, 0.05);
  --border:      #222220;
  --border-hi:   #333330;
  --border2:     rgba(255, 255, 255, 0.04);
  --text:        #ffffff;
  --text2:       #d4d4d0;
  --text3:       #8b8b84;
  --blue:        #40a9ff;
  --blue-dim:    rgba(64, 169, 255, 0.1);
  --blue-glow:   0 0 0 3px rgba(64, 169, 255, 0.12);
  --green:       #339c0d;
  --green-dim:   rgba(51, 156, 13, 0.15);
  --red:         #ff4d4f;
  --red-dim:     rgba(255, 77, 79, 0.1);
  --yellow:      #ffc069;
  --yellow-dim:  rgba(255, 192, 105, 0.1);
  --purple:      #b37feb;
  --purple-dim:  rgba(179, 127, 235, 0.12);
  --radius:      16px;
  --radius-sm:   12px;
  --shadow:      0 22px 52px rgba(0, 0, 0, 0.34);
  --shadow-sm:   0 12px 30px rgba(0, 0, 0, 0.2);
  --backdrop:    none;
  --font-mono:   "DM Mono", "Consolas", "Courier New", monospace;
  --font-sans:   "Space Grotesk", system-ui, -apple-system, sans-serif;
  --transition:  transform 0.16s ease, scale 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
  --top-glow:    rgba(51, 156, 13, 0.08);
  --bottom-glow: rgba(64, 169, 255, 0.06);
  color-scheme: dark;
}

body[data-theme="light"] {
  --bg:          #edf2e8;
  --bg2:         #f8faf6;
  --bg3:         #eef2ea;
  --bg-glass:    rgba(248, 250, 246, 0.92);
  --bg-glass2:   rgba(238, 242, 234, 0.96);
  --surface-soft: rgba(24, 26, 23, 0.02);
  --surface-hover: rgba(24, 26, 23, 0.05);
  --border:      #dbe2d3;
  --border-hi:   #c7d0bd;
  --border2:     rgba(24, 26, 23, 0.08);
  --text:        #181a17;
  --text2:       #485043;
  --text3:       #76806f;
  --shadow:      0 20px 44px rgba(53, 69, 45, 0.12);
  --shadow-sm:   0 10px 24px rgba(53, 69, 45, 0.08);
  --top-glow:    rgba(51, 156, 13, 0.1);
  --bottom-glow: rgba(232, 197, 78, 0.12);
  color-scheme: light;
}

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

html, body {
  height: 100%;
  background:
    radial-gradient(circle at top left, var(--top-glow), transparent 28%),
    radial-gradient(circle at bottom right, var(--bottom-glow), transparent 24%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, .page-title, .section-title, .login-box h1 {
  text-wrap: balance;
}

p, .subtitle, .empty, .crm-empty__hint, .maintenance-overlay__text, .maintenance-control__hint, .table-meta, .save-msg {
  text-wrap: pretty;
}

.kpi-card .value, .summary-card .value, .crm-stat-value, .offer-count, .pagination span, .log-time, .metric-number, td:nth-child(1), td:nth-child(5), .admin-license-table td:nth-child(6) {
  font-variant-numeric: tabular-nums;
}

img {
  outline: 1px solid rgba(255, 255, 255, 0.1);
  outline-offset: -1px;
}

body[data-theme="light"] img {
  outline-color: rgba(0, 0, 0, 0.1);
}

button, a, input, select, textarea {
  -webkit-tap-highlight-color: transparent;
}

button:active:not(:disabled),
a[role="button"]:active,
.btn-action:active:not(:disabled),
.btn-sm:active:not(:disabled),
.btn-logout:active,
.btn-stop:active:not(:disabled),
.theme-toggle:active,
.password-toggle:active {
  scale: 0.96;
}

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

.maintenance-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 26%, rgba(120, 28, 18, 0.18), transparent 34%),
    radial-gradient(circle at 80% 72%, rgba(255, 122, 24, 0.09), transparent 32%),
    rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(18px) saturate(0.78);
  -webkit-backdrop-filter: blur(18px) saturate(0.78);
}

.maintenance-overlay[hidden] {
  display: none !important;
}

.maintenance-overlay__panel {
  width: min(470px, calc(100vw - 40px));
  border: 1px solid rgba(255, 86, 86, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(21, 21, 20, 0.94), rgba(13, 13, 12, 0.96));
  box-shadow:
    0 28px 100px rgba(0, 0, 0, 0.62),
    0 0 80px rgba(108, 21, 21, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 32px 34px 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.maintenance-overlay__panel::before {
  content: "";
  position: absolute;
  inset: -32% auto auto -18%;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(214, 52, 52, 0.18), transparent 68%);
  pointer-events: none;
}

.maintenance-overlay__panel::after {
  content: "";
  position: absolute;
  inset: auto -20% -34% auto;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(255, 122, 24, 0.12), transparent 72%);
  pointer-events: none;
}

.maintenance-overlay__eyebrow {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 102, 102, 0.22);
  background: rgba(161, 45, 45, 0.22);
  color: #ffd0d0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.maintenance-overlay__title {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  font-size: clamp(40px, 5vw, 52px);
  font-weight: 900;
  line-height: 1;
  color: var(--text);
  text-wrap: balance;
}

.maintenance-overlay__text {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.55;
  max-width: 350px;
  margin-left: auto;
  margin-right: auto;
  text-wrap: balance;
}

.maintenance-overlay__actions {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.maintenance-overlay__actions button {
  border: 0;
  min-height: 44px;
  border-radius: 10px;
  padding: 13px 20px;
  min-width: 88px;
  background: linear-gradient(180deg, #2d2d2b, #20201f);
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 26px rgba(0, 0, 0, 0.24);
}

.maintenance-overlay__actions button:hover {
  background: linear-gradient(180deg, #3a3a38, #262625);
  transform: translateY(-1px);
}

.maintenance-overlay__actions button:active {
  scale: 0.96;
}

.sidebar-nav button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sidebar-nav button:disabled:hover {
  transform: none;
  border-color: var(--border);
  background: var(--bg-glass);
}
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--border2) 1px, transparent 1px),
    linear-gradient(90deg, var(--border2) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: .35;
}

#app, #login-overlay { position: relative; z-index: 1; }

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Login overlay ──────────────────────────────────────────────────────── */
#login-overlay {
  position: fixed; inset: 0; z-index: 999;
  background:
    radial-gradient(circle at top left, var(--top-glow), transparent 28%),
    radial-gradient(circle at bottom right, var(--bottom-glow), transparent 24%),
    var(--bg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
#login-overlay::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--border2) 1px, transparent 1px),
    linear-gradient(90deg, var(--border2) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.35;
}
.login-box {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 34px;
  width: 400px;
  box-shadow: var(--shadow);
  animation: slideUp 0.24s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.login-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  margin: 0 0 22px;
  border-radius: 999px;
  background: var(--bg3);
  color: var(--text2);
  box-shadow: inset 0 0 0 1px var(--border);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  transition: transform .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease;
}
.login-back-link:hover {
  background: var(--bg4);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-hi), var(--shadow-sm);
  transform: translateY(-1px);
}
.login-back-link:active {
  transform: translateY(0) scale(.97);
}

.login-box h1 {
  font-size: 28px; font-weight: 700;
  color: var(--text);
  margin-bottom: 6px; letter-spacing: -0.04em;
}
.login-brand span {
  color: var(--green);
  text-shadow: none;
}
.login-brand strong {
  color: var(--text2);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.login-box .subtitle { color: var(--text3); font-size: 13px; margin-bottom: 24px; }
.login-box .field { margin-bottom: 20px; }
.login-box label { display: block; font-size: 11px; color: var(--text3); margin-bottom: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.password-field {
  position: relative;
}
.login-box input {
  width: 100%; padding: 10px 12px;
  background: var(--bg3); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 15px;
  font-family: inherit;
  outline: none; transition: var(--transition);
}
.password-field input {
  padding-right: 46px;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: var(--transition);
}

.password-toggle:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.login-box input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(51, 156, 13, 0.1); }
.login-box input:-webkit-autofill,
.login-box input:-webkit-autofill:hover,
.login-box input:-webkit-autofill:focus,
.login-box input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text) !important;
  background-color: transparent !important;
  box-shadow: 0 0 0 1000px rgba(51, 156, 13, 0.22) inset !important, 0 0 0 3px rgba(51, 156, 13, 0.10) !important;
  -webkit-box-shadow: 0 0 0 1000px rgba(51, 156, 13, 0.22) inset !important, 0 0 0 3px rgba(51, 156, 13, 0.10) !important;
  border: 1.5px solid rgba(94, 179, 61, 0.65) !important;
  caret-color: var(--text) !important;
  transition: background-color 999999s ease-out 0s !important;
}
.login-box .err { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 20px; }
.login-box button[type=submit] {
  width: 100%; margin-top: 12px;
  padding: 12px 14px;
  background: var(--green);
  border: 1.5px solid var(--green); border-radius: var(--radius-sm);
  color: #fff; font-size: 14px; font-weight: 600; letter-spacing: 0.02em;
  cursor: pointer; transition: var(--transition);
  box-shadow: 0 10px 22px rgba(51, 156, 13, 0.18);
}
.login-box button[type=submit]:hover { 
  background: #2a8209;
  border-color: #2a8209;
  transform: translateY(-1px);
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
#app { display: none; flex-direction: column; height: 100%; }
.app-shell { display: flex; min-height: 0; flex: 1; }

header {
  display: flex; align-items: center; gap: 20px;
  padding: 0 28px; height: 64px;
  background: var(--bg-glass);
  border-bottom: 1.5px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  flex-shrink: 0; z-index: 10;
}
.home-arrow {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text2);
  background: var(--surface-soft);
  text-decoration: none;
  font-size: 21px;
  line-height: 1;
}
.home-arrow:hover { color: var(--text); border-color: var(--green); transform: translateX(-1px); }

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.brand-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 0 16px rgba(88, 255, 61, 0.22);
}
.logo { font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: -0.03em; }
.logo span { color: var(--green); text-shadow: none; }

.theme-toggle {
  width: 42px;
  height: 42px;
  margin-left: auto;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--surface-hover), var(--surface-soft));
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.theme-toggle:hover {
  transform: translateY(-1px) rotate(8deg);
  border-color: var(--border-hi);
  background: linear-gradient(180deg, var(--surface-hover), rgba(255,255,255,0.01));
}
.theme-icon {
  font-size: 17px;
  line-height: 1;
}

.mobile-menu-toggle,
.mobile-sidebar-logout {
  display: none;
}

.btn-logout {
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface-hover), var(--surface-soft));
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.03em;
}
.btn-logout:hover {
  transform: translateY(-1px);
  border-color: var(--border-hi);
  background: var(--bg3);
}

.status-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 15px; border-radius: 999px;
  background: var(--bg3); border: 1.5px solid var(--border);
  font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
  box-shadow: none;
}
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--text3); position: relative; }
.status-dot.idle { background: var(--green); box-shadow: 0 0 0 3px rgba(51,156,13,0.12); }
.status-dot.error { background: var(--red); box-shadow: 0 0 0 3px rgba(255,77,79,0.12); }
.status-dot.running,
.status-dot.stopping {
  width: 14px;
  height: 14px;
  background: transparent;
  border: 2px solid rgba(255,192,105,0.22);
  border-top-color: var(--yellow);
  border-right-color: rgba(255,192,105,0.7);
  box-shadow: none;
  animation: statusSpin .8s linear infinite;
}
.status-dot.stopping {
  border: 2px solid rgba(255,77,79,0.18);
  border-top-color: var(--red);
  border-right-color: rgba(255,77,79,0.65);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .6; transform: scale(1.1); }
}

.mode-label {
  font-size: 12px; color: var(--blue); font-weight: 600;
  padding: 4px 10px; background: var(--blue-dim);
  border-radius: 6px; border: 1px solid rgba(56, 189, 248, 0.3);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.last-action { font-size: 12px; color: var(--text3); margin-left: auto; font-weight: 500; }

.btn-stop {
  padding: 10px 18px; background: var(--red-dim);
  border: 1.5px solid rgba(255, 77, 79, 0.35); border-radius: var(--radius-sm);
  color: var(--red); font-size: 12px; font-weight: 700;
  cursor: pointer; transition: var(--transition);
  letter-spacing: 0.5px;
}
.btn-stop:hover:not(:disabled) { background: var(--red); color: white; box-shadow: 0 10px 22px rgba(255, 77, 79, 0.18); transform: translateY(-1px); }
.btn-stop:disabled { opacity: .3; cursor: not-allowed; border-color: var(--text3); color: var(--text3); background: transparent; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: 268px;
  flex: 0 0 268px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0)), var(--bg2);
  border-right: 1.5px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.03);
}
.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 0;
}
.sidebar-group + .sidebar-group {
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 18px;
}
.sidebar-group-bottom {
  margin-top: auto;
}
.sidebar-label {
  padding: 0 10px;
  color: #7e8278;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.sidebar-userline {
  display: block;
  margin: -3px 10px 3px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  color: var(--text2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.25;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.sidebar-userline[data-admin-visible="false"] {
  display: none;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-expand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-nav button,
.sidebar-nav .nav-link-external {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1.5px solid color-mix(in srgb, var(--border) 45%, transparent);
  background: var(--surface-soft);
  color: var(--text3);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  line-height: 1.35;
  white-space: normal;
  transition: var(--transition);
}
.sidebar-nav button .nav-label,
.sidebar-nav .nav-link-external .nav-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.nav-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--text3);
  transition: color 0.16s ease;
}
.sidebar-nav button:hover .nav-icon,
.sidebar-nav .nav-link-external:hover .nav-icon,
.sidebar-nav button.active .nav-icon,
.sidebar-nav .nav-link-external.active .nav-icon,
.sidebar-parent.active .nav-icon {
  color: var(--text);
}
.sidebar-parent {
  justify-content: space-between;
  gap: 12px;
}
.sidebar-parent .nav-label {
  flex: 1 1 auto;
}
.sidebar-arrow {
  color: var(--text3);
  font-size: 12px;
  line-height: 1;
  padding-left: 8px;
  cursor: pointer;
  transition: transform 0.16s ease, color 0.16s ease;
  transform: rotate(-90deg);
}
.sidebar-arrow.open {
  color: var(--text2);
  transform: rotate(0deg);
}
.sidebar-subnav {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding-left: 16px;
  margin-left: 14px;
  border-left: 1px solid rgba(255,255,255,0.06);
}
.sidebar-subnav.open {
  display: flex;
}
.sidebar-subnav button {
  min-height: 34px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background: var(--surface-soft);
  color: var(--text3);
  font-size: 12.5px;
  line-height: 1.35;
  text-align: left;
  transition: var(--transition);
}
.sidebar-subnav button:hover {
  background: var(--surface-hover);
  color: var(--text2);
  border-color: color-mix(in srgb, var(--border) 65%, transparent);
  transform: translateX(2px);
}
.sidebar-subnav button.active {
  background: linear-gradient(90deg, rgba(51,156,13,0.14), rgba(255,255,255,0.04));
  color: var(--text);
  border-color: rgba(51,156,13,0.2);
  box-shadow: inset 2px 0 0 var(--green), 0 8px 18px rgba(0,0,0,0.12);
}
.sidebar-nav button:hover,
.sidebar-nav .nav-link-external:hover {
  background: var(--surface-hover);
  color: var(--text2);
  border-color: color-mix(in srgb, var(--border) 65%, transparent);
  transform: translateX(2px);
}
.sidebar-nav button.active,
.sidebar-nav .nav-link-external.active {
  background: linear-gradient(90deg, rgba(51,156,13,0.16), rgba(255,255,255,0.04));
  color: var(--text);
  border-color: rgba(51,156,13,0.18);
  box-shadow: inset 2px 0 0 var(--green), 0 10px 22px rgba(0,0,0,0.14);
}

/* ── Main content ───────────────────────────────────────────────────────── */
main { flex: 1; overflow-y: auto; padding: 32px; min-width: 0; }

.tab-pane { display: none; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.tab-pane.active { display: block; }

body[data-current-tab="admin"] main {
  overflow-y: auto;
  overflow-x: visible;
  padding-inline: clamp(18px, 2.4vw, 32px);
}

body[data-current-tab="admin"] #tab-admin.active {
  display: block;
  height: auto;
  min-height: 100%;
  overflow: visible;
}

body[data-current-tab="admin"] .admin-license-accounts {
  max-width: 100%;
  overflow: visible;
}
body[data-current-tab="admin"] .admin-license-accounts.table-wrap {
  overflow: visible;
  margin-bottom: 32px;
}
body[data-current-tab="admin"] .admin-license-accounts table {
  table-layout: auto;
}

body[data-current-tab="admin"] .admin-diagnostics-card {
  display: none;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.page-title {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.page-title-muted {
  font-size: 18px;
  color: var(--text3);
  font-weight: 500;
}
.page-subtitle {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text3);
  max-width: 680px;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1.5px solid rgba(51,156,13,0.25);
  background: rgba(51,156,13,0.12);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: none;
  animation: pulse 1.2s ease-in-out infinite;
}

.muted { color: var(--text2); }

.kv-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border2);
}

.kv-row span {
  color: var(--text2);
}

.kv-row strong {
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

/* ── KPI Cards ──────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px; margin-bottom: 28px;
}
@media (max-width: 1280px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative; overflow: hidden;
}
/* верхний блик */
.kpi-card::before {
  content: ''; position: absolute;
  top: 0; left: 15%; right: 15%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transition: opacity 0.3s ease;
}
/* нижнее цветное свечение (появляется при hover) */
.kpi-card::after {
  content: ''; position: absolute;
  inset: 0; border-radius: inherit;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05);
  opacity: 0; transition: opacity 0.3s ease;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hi);
  box-shadow: var(--shadow);
}
.kpi-card:hover::after { opacity: 1; }

.kpi-card .label {
  font-size: 11px; color: var(--text2); font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px;
}
.kpi-card .value {
  font-size: 34px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1.1;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}
body[data-theme="light"] #kpi-total {
  color: var(--blue);
  text-shadow: 0 8px 22px rgba(64, 169, 255, 0.22);
}
.kpi-card .value.green  { color: var(--green);  text-shadow: 0 0 20px rgba(16,185,129,0.4); }
.kpi-card .value.red    { color: var(--red);    text-shadow: 0 0 20px rgba(239,68,68,0.4); }
.kpi-card .value.yellow { color: var(--yellow); text-shadow: 0 0 20px rgba(245,158,11,0.4); }
.offer-list { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.offer-row  { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.offer-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70%; }
.offer-count{ color: var(--green); font-weight: 700; font-size: 15px; }

/* ── KPI прогресс-бар до цели ──────────────────────────────────────────── */
.kpi-goal {
  margin-top: 14px;
}
.kpi-goal-track {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.kpi-goal-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #38bdf8, #10b981);
  transition: width 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
  max-width: 100%;
  box-shadow: 0 0 8px rgba(56,189,248,0.5);
}
.kpi-goal-fill.warn  { background: linear-gradient(90deg, #f59e0b, #fbbf24); box-shadow: 0 0 8px rgba(245,158,11,0.5); }
.kpi-goal-fill.done  { background: linear-gradient(90deg, #10b981, #34d399); box-shadow: 0 0 8px rgba(16,185,129,0.6); }
.kpi-goal-label {
  font-size: 10px; color: var(--text3); margin-top: 5px;
  letter-spacing: 0.5px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.summary-card {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.summary-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hi);
  box-shadow: var(--shadow);
}
.summary-card .label {
  font-size: 11px;
  color: var(--text2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.summary-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}
.summary-card .value.green { color: var(--green); }
.summary-card .value.red { color: var(--red); }
.summary-card .value.yellow { color: var(--yellow); }
.summary-card .meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text3);
}
.summary-card.compact {
  padding: 14px 16px;
}
.summary-card.compact .value {
  font-size: 22px;
}
.stats-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}
.analytics-embedded-block {
  margin: 4px 0 28px;
}

/* ── Action buttons ─────────────────────────────────────────────────────── */
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.btn-action {
  padding: 12px 22px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-hover) 90%, transparent), color-mix(in srgb, var(--surface-soft) 100%, transparent)), var(--bg3);
  color: var(--text); font-family: var(--font-sans);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: var(--transition); display: flex; align-items: center; gap: 8px;
  min-height: 44px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
}
.btn-action:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--surface-hover), var(--surface-soft)), var(--bg3);
  border-color: var(--border-hi); color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.18);
}
.btn-action:active:not(:disabled) { transform: translateY(0); scale: 0.96; }
.btn-action:disabled { opacity: .35; cursor: not-allowed; }
.btn-action.primary {
  background: linear-gradient(180deg, #3eb111, #339c0d);
  border: 1.5px solid var(--green); color: #fff;
  text-shadow: none;
  box-shadow: 0 12px 24px rgba(51, 156, 13, 0.22);
}
.btn-action.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #46bf15, #2a8209);
  border-color: #2a8209;
  color: #fff;
}

/* ── Log terminal ───────────────────────────────────────────────────────── */
.log-panel {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.log-header {
  display: flex; align-items: center;
  padding: 12px 20px; background: var(--bg3);
  border-bottom: 1.5px solid var(--border); gap: 12px;
}
.log-header .log-title { font-size: 13px; font-weight: 600; color: var(--text); text-transform: uppercase; letter-spacing: 1px; flex: 1; }
.log-header .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.log-header .dot { box-shadow: none; }
.log-header .dot.off { background: var(--text3); box-shadow: none; }
.log-body {
  height: 360px; overflow-y: auto; padding: 16px 20px;
  font-family: var(--font-mono); font-size: 13px;
  line-height: 1.6;
}
.log-line {
  display: grid;
  grid-template-columns: 94px 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 6px 0;
  white-space: normal;
  word-break: break-word;
}
.log-line + .log-line {
  border-top: 1px dashed color-mix(in srgb, var(--border) 78%, transparent);
}
.log-ts {
  display: block;
  min-width: 94px;
  color: var(--text2);
  opacity: 0.92;
  font-variant-numeric: tabular-nums;
}
.log-marker {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  justify-self: center;
  border-radius: 999px;
  background: var(--text3);
}
.log-marker.log-emoji {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: inherit;
  font-size: 15px;
  line-height: 18px;
  text-align: center;
}
.log-msg {
  min-width: 0;
}
.log-line.INFO .log-msg    { color: var(--text2); }
.log-line.INFO .log-marker { background: var(--text3); }
.log-line.WARNING .log-msg { color: var(--yellow); }
.log-line.WARNING .log-marker { background: var(--yellow); }
.log-line.ERROR .log-msg   { color: var(--red); }
.log-line.ERROR .log-marker { background: var(--red); }
.log-line.DEBUG .log-msg   { color: var(--text3); }
.log-line.DEBUG .log-marker { background: var(--text3); }
.log-line.SUCCESS .log-msg { color: var(--green); }
.log-line.SUCCESS .log-marker { background: var(--green); }
.log-line.log-spinner {
  margin: 2px -10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--blue) 8%, transparent);
}
.log-line.log-spinner .log-ts {
  color: color-mix(in srgb, var(--blue) 68%, var(--text));
  opacity: 1;
}
.log-line.log-spinner .log-msg {
  color: var(--text);
}
.log-line.log-spinner .log-marker {
  position: relative;
  background: var(--blue);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent);
  animation: none;
}
.log-line.log-spinner .log-marker::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--blue) 40%, transparent);
  opacity: 0.72;
  animation: realtimeSpinnerDotPulse 1.15s ease-in-out infinite;
}
@keyframes realtimeSpinnerDotPulse {
  0%, 100% {
    opacity: 0.48;
    transform: scale(0.92);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.1);
  }
}
.log-line.ERROR.log-spinner {
  background: color-mix(in srgb, var(--red) 9%, transparent);
}
.log-line.ERROR.log-spinner .log-ts,
.log-line.ERROR.log-spinner .log-msg {
  color: color-mix(in srgb, var(--red) 72%, var(--text));
}
.log-line.ERROR.log-spinner .log-marker {
  background: var(--red);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 18%, transparent);
}
.log-line.ERROR.log-spinner .log-marker::after {
  border-color: color-mix(in srgb, var(--red) 42%, transparent);
}
.log-footer {
  display: flex; gap: 12px; padding: 10px 20px; background: var(--surface-soft);
  border-top: 1px solid var(--border);
}
.btn-sm {
  padding: 8px 14px; font-size: 12px; font-weight: 600;
  background: var(--bg3); border: 1.5px solid var(--border);
  border-radius: 999px; color: var(--text2);
  cursor: pointer; transition: var(--transition);
  min-height: 40px;
}

.btn-sm:hover { color: var(--text); background: var(--surface-hover); border-color: var(--border-hi); transform: translateY(-1px); }

/* ── Leads table ────────────────────────────────────────────────────────── */
.filters {
  display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; align-items: center;
}
.filters input, .filters select {
  padding: 9px 12px; background: var(--bg3);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; outline: none; transition: var(--transition);
  font-family: var(--font-sans);
}
.filters input:focus, .filters select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(51,156,13,0.1); }
.filters input[type=search] { width: 260px; }
.table-meta {
  margin: -4px 0 12px;
  font-size: 12px;
  color: var(--text3);
}

.table-wrap {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
  overflow-x: auto; margin-bottom: 16px;
}
#messages-wrap td:nth-child(3) {
  white-space: normal;
  min-width: 280px;
  max-width: 560px;
  overflow-wrap: anywhere;
}
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { background: var(--bg3); }
th {
  padding: 14px 16px; font-size: 12px; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1.5px solid var(--border); white-space: nowrap;
}
td {
  padding: 12px 16px; border-bottom: 1px solid var(--border2);
  font-size: 14px; color: var(--text);
}
tbody tr { transition: background-color 0.2s; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-hover) 100%, transparent); }
tbody tr.offer-row-disabled td { color: var(--text3); opacity: .72; }
tbody tr.offer-row-disabled td strong { color: var(--text2); }


/* Offers: one long vacancy binding must not stretch a whole table row. */
#offers-table-wrap .offers-data-table {
  table-layout: fixed;
}
#offers-table-wrap .offers-data-table tbody tr {
  height: 76px;
}
#offers-table-wrap .offers-data-table td {
  vertical-align: middle;
}
#offers-table-wrap .offers-data-table th:nth-child(1),
#offers-table-wrap .offers-data-table td:nth-child(1) { width: 52px; }
#offers-table-wrap .offers-data-table th:nth-child(2),
#offers-table-wrap .offers-data-table td:nth-child(2) { width: 16%; }
#offers-table-wrap .offers-data-table th:nth-child(3),
#offers-table-wrap .offers-data-table td:nth-child(3) { width: 12%; }
#offers-table-wrap .offers-data-table th:nth-child(4),
#offers-table-wrap .offers-data-table td:nth-child(4) { width: 10%; }
#offers-table-wrap .offers-data-table th:nth-child(5),
#offers-table-wrap .offers-data-table td:nth-child(5) { width: 30%; }
#offers-table-wrap .offers-data-table th:nth-child(6),
#offers-table-wrap .offers-data-table td:nth-child(6) { width: 132px; }
#offers-table-wrap .offers-data-table th:nth-child(7),
#offers-table-wrap .offers-data-table td:nth-child(7) {
  width: 116px;
  white-space: nowrap;
}
#offers-table-wrap .offer-vacancies {
  max-height: 48px;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  line-height: 1.45;
  padding-right: 4px;
  scrollbar-width: thin;
}

.badge {
  display: inline-block; padding: 4px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
}
.badge.new    { background: var(--blue-dim);   color: var(--blue); border: 1.5px solid rgba(64, 169, 255, 0.2); }
.badge.scheduled { background: rgba(255, 184, 77, 0.12); color: #ffc46b; border: 1.5px solid rgba(255, 184, 77, 0.24); }
.badge.sent   { background: var(--green-dim);  color: var(--green); border: 1.5px solid rgba(51, 156, 13, 0.22); }
.badge.error  { background: var(--red-dim);    color: var(--red); border: 1.5px solid rgba(255, 77, 79, 0.22); }
.badge.dup    { background: var(--bg3); color: var(--text2); border: 1.5px solid var(--border); }

.pagination { display: flex; align-items: center; gap: 12px; justify-content: flex-end; }
.pagination span { font-size: 14px; color: var(--text2); font-weight: 500; }
.pagination button {
  padding: 6px 14px;
  min-height: 40px;
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text2); cursor: pointer; font-size: 14px;
  transition: var(--transition);
}
.pagination button:hover:not(:disabled) { color: var(--text); border-color: var(--blue); background: rgba(255,255,255,0.1); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ── Charts ─────────────────────────────────────────────────────────────── */
.chart-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 28px; }
@media (max-width: 1200px) { .chart-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 768px)  { .chart-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.chart-card::before {
  content: ''; position: absolute;
  top: 0; left: 20%; right: 20%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
}
.chart-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hi);
  box-shadow: var(--shadow);
}
.chart-card h3 {
  font-size: 13px; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 20px;
}
.chart-wrap { position: relative; height: 200px; width: 100%; }
.chart-card canvas { width: 100% !important; height: 100% !important; }

.network-balances {
  margin: 18px 32px 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: start;
}

.network-balances[hidden] {
  display: none !important;
}

.network-balance-panel {
  min-width: 0;
  padding: 16px;
  background: rgba(17, 17, 16, 0.72);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--border), 0 10px 28px rgba(0, 0, 0, 0.12);
}

.network-balance-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.network-balance-kicker {
  display: block;
  color: var(--text3);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.network-balance-head h2 {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.2;
  text-wrap: balance;
}

.network-balance-status {
  flex: none;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text3);
  font-size: 10px;
  font-weight: 700;
}

.network-balance-status.is-ok { color: var(--green); background: rgba(58, 210, 92, 0.08); }
.network-balance-status.is-error { color: var(--red); background: rgba(255, 86, 86, 0.08); }

.network-balance-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.network-balance-card {
  min-width: 0;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.025);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--border);
}

.network-balance-card .label {
  display: block;
  margin-bottom: 3px;
  color: var(--text3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.network-balance-card .value {
  display: block;
  color: var(--green);
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.network-balances-refresh {
  width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 4px;
  background: rgba(17, 17, 16, 0.72);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--text2);
  cursor: pointer;
  transition: opacity 160ms ease, transform 160ms ease;
}

.network-balances-refresh:hover {
  opacity: 0.85;
}

.network-balances-refresh:active { transform: scale(0.96); }

@media (max-width: 900px) {
  .network-balances { grid-template-columns: 1fr; margin-inline: 20px; }
  .network-balances-refresh { width: 100%; }
}

@media (max-width: 560px) {
  .network-balance-values { grid-template-columns: 1fr; }
}

.crm-section-grid,
.crm-section-body {
  width: 100%;
}

.crm-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 1180px) { .crm-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .crm-cards-grid { grid-template-columns: 1fr; } }

.crm-stat-card {
  min-width: 0;
  min-height: 126px;
  padding: 18px 18px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0)),
    var(--bg2);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: grid;
  align-content: space-between;
}

.crm-stat-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-hi);
  box-shadow: var(--shadow);
}

.crm-stat-label {
  margin-bottom: 12px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.crm-stat-value {
  color: var(--text);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.crm-stat-hint {
  margin-top: 8px;
  color: var(--text3);
  font-size: 12px;
}

.crm-table-shell {
  display: grid;
  gap: 10px;
}

.crm-table-wrap {
  border-radius: var(--radius);
  margin-bottom: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.crm-table-wrap td {
  vertical-align: middle;
}

.crm-table-note {
  color: var(--text3);
  font-size: 12px;
}

.crm-settings-form {
  display: grid;
  gap: 16px;
}

.crm-settings-toolbar,
.crm-settings-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0)),
    var(--bg2);
  box-shadow: var(--shadow-sm);
}

.crm-settings-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.crm-settings-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.crm-settings-subtitle,
.crm-settings-card__hint,
.crm-settings-help,
.crm-settings-muted {
  color: var(--text3);
  font-size: 12px;
  text-wrap: pretty;
}

.crm-settings-card {
  display: grid;
  gap: 16px;
  padding: 18px 20px;
}

.crm-settings-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.crm-settings-card__title {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

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

.crm-settings-field {
  display: grid;
  gap: 7px;
}

.crm-settings-field--wide {
  grid-column: 1 / -1;
}

.crm-settings-field label {
  color: var(--text2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.crm-settings-input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg3);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.crm-settings-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(51,156,13,0.1);
}

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

.crm-postback-row {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.crm-postback-input {
  color: var(--text2);
  font-family: var(--font-mono);
  font-size: 12px;
}

@media (max-width: 920px) {
  .crm-settings-toolbar,
  .crm-settings-card__head {
    align-items: stretch;
    flex-direction: column;
  }

  .crm-settings-grid,
  .crm-postback-row {
    grid-template-columns: 1fr;
  }
}

.crm-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.crm-status--ok {
  color: var(--green);
  background: var(--green-dim);
  border-color: rgba(51, 156, 13, .24);
}

.crm-status--warn {
  color: var(--yellow);
  background: var(--yellow-dim);
  border-color: rgba(255, 192, 105, .24);
}

.crm-status--bad {
  color: var(--red);
  background: var(--red-dim);
  border-color: rgba(255, 77, 79, .24);
}

.crm-status--muted {
  color: var(--text3);
  background: var(--bg3);
}

.crm-count-badge {
  display: inline-flex;
  min-width: 42px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(58, 210, 92, 0.08);
  box-shadow: inset 0 0 0 1px rgba(58, 210, 92, 0.16);
  color: var(--green);
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.crm-link-cell {
  display: inline-block;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.crm-empty {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 220px;
  padding: 42px 24px;
  border: 1.5px dashed var(--border-hi);
  border-radius: 8px;
  background: rgba(255,255,255,0.015);
  text-align: center;
}

.crm-empty__title {
  color: var(--text2);
  font-size: 16px;
  font-weight: 700;
}

.crm-empty__hint {
  max-width: 520px;
  color: var(--text3);
  font-size: 13px;
}

@media (max-width: 1280px) {
  .crm-cards-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}

@media (max-width: 760px) {
  .crm-cards-grid { grid-template-columns: 1fr; }
  .crm-link-cell { max-width: 220px; }
}

.vacancies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.vacancy-card {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background-image: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
}

.vacancy-card:hover {
  border-color: var(--border-hi);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.vacancy-card-header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.vacancy-card-id {
  font-size: 12px;
  color: var(--text2);
  font-weight: 600;
  flex-shrink: 0;
}

.vacancy-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.vacancy-card-heading {
  display: grid;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.vacancy-card-state {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(64, 169, 255, 0.12);
  border: 1px solid rgba(64, 169, 255, 0.18);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

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

.vacancy-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
}

.vacancy-stat-label {
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vacancy-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.vacancy-stat-value.green {
  color: var(--green);
}

.vacancy-stat-value.accent {
  color: var(--blue);
}

.vacancy-invite-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.vacancy-invite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text2);
  font-size: 12px;
}

.vacancy-invite-row strong {
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 14px;
}

.vacancy-invite-count {
  color: var(--text);
  font-size: 12px;
}

.vacancy-invite-label {
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.vacancy-invite-range {
  width: 100%;
  accent-color: var(--green);
}

.vacancy-invite-message {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  resize: vertical;
  min-height: 88px;
  line-height: 1.45;
}

.vacancy-invite-message:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(51,156,13,0.1);
}

.vacancy-invite-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid rgba(98, 190, 62, 0.28);
  border-radius: 14px;
  background: linear-gradient(180deg, #4cbc1e, #2f8c0d);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 12px 24px rgba(51, 156, 13, 0.22);
  transition: var(--transition);
}

.vacancy-invite-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(51, 156, 13, 0.28);
  filter: brightness(1.04);
}

.vacancy-invite-btn:disabled {
  opacity: 0.75;
  cursor: wait;
}

@media (max-width: 640px) {
  .vacancy-card-stats {
    grid-template-columns: 1fr;
  }
}

/* ── Sessions table ─────────────────────────────────────────────────────── */
.section-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  letter-spacing: 0.5px; margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Settings form ──────────────────────────────────────────────────────── */
#settings-form {
  max-width: 1120px;
}

.settings-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  max-width: 100%;
}

.settings-toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 100%; margin-bottom: 24px;
}
@media (max-width: 768px) { .settings-grid { grid-template-columns: 1fr; } }


[hidden] {
  display: none !important;
}

.settings-card {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius); padding: 24px;
  min-width: 0;
  overflow: hidden;
  position: relative;
}
.settings-card::before {
  content: ''; position: absolute;
  top: 0; left: 20%; right: 20%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}
.settings-card pre,
.settings-card code { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
#git-status-block { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.settings-card h3 {
  font-size: 14px; font-weight: 600; color: var(--text);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border2);
}
.form-row { margin-bottom: 18px; }
.form-row label {
  display: block; font-size: 13px; color: var(--text2); font-weight: 500; margin-bottom: 8px;
}
.form-row input[type=text], .form-row input[type=password], .form-row input[type=number], .form-row select, .form-row textarea {
  width: 100%; padding: 10px 14px;
  background: var(--bg3); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 14px; outline: none; transition: var(--transition);
  font-family: var(--font-sans);
}
.settings-card:hover {
  border-color: var(--border-hi);
  box-shadow: var(--shadow);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(51,156,13,0.1); background: var(--bg3); }

.form-row.checkbox-row { display: flex; align-items: center; gap: 12px; }
.form-row.checkbox-row label { margin-bottom: 0; cursor: pointer; color: var(--text); }
.form-row.checkbox-row input[type=checkbox] {
  width: 18px; height: 18px; cursor: pointer; accent-color: var(--blue);
  border-radius: 4px; border: 1px solid var(--border);
}
.form-row.checkbox-row-paired {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
}
.checkbox-control {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg3);
  line-height: 1.35;
  color: var(--text);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}
.checkbox-control:hover {
  border-color: var(--border-hi);
  background: var(--bg4);
}
.checkbox-control:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(64, 169, 255, 0.12);
}
.checkbox-control input[type=checkbox] {
  flex: 0 0 18px;
  margin: 1px 0 0;
}
.checkbox-control span {
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  text-wrap: pretty;
}
@media (max-width: 560px) {
  .form-row.checkbox-row-paired { grid-template-columns: 1fr; }
}

.readonly-info {
  background: color-mix(in srgb, var(--bg3) 85%, transparent); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); padding: 16px;
  font-size: 13px; color: var(--text2);
}
.readonly-info div { margin-bottom: 8px; }
.readonly-info div:last-child { margin-bottom: 0; }
.readonly-info span { color: var(--text); font-family: var(--font-mono); background: var(--surface-hover); padding: 2px 6px; border-radius: 6px; }

.diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.diagnostics-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.diagnostics-card h3 { margin-bottom: 0; }
.diagnostics-card-wide { grid-column: 1 / -1; }
.diagnostics-hint {
  color: var(--text3);
  font-size: 13px;
  max-width: 780px;
}
.diagnostics-output {
  min-height: 120px;
  white-space: pre-wrap;
  overflow: auto;
  font-family: var(--font-mono);
  line-height: 1.55;
}
.diagnostics-output-small { min-height: 48px; }
.diagnostics-actions { margin: 0; }
.diagnostics-command {
  padding: 13px 15px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg3) 88%, transparent);
  color: var(--text);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}
.diagnostics-inline-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.diagnostics-inline-form input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.diagnostics-inline-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(51,156,13,0.1); }

@media (max-width: 980px) {
  .diagnostics-grid { grid-template-columns: 1fr; }
  .diagnostics-inline-form { grid-template-columns: 1fr; }
}

.save-row { margin-top: 24px; display: flex; align-items: center; gap: 16px; }
.save-msg { font-size: 14px; color: var(--green); font-weight: 500; }
.save-msg.err { color: var(--red); }

.maintenance-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg3) 78%, transparent);
}
.maintenance-control__label {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}
.maintenance-control__hint {
  color: var(--text3);
  font-size: 12px;
  line-height: 1.35;
}
.toggle-switch {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.toggle-switch__track {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 104px;
  height: 42px;
  padding: 0 13px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg3) 82%, #000);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
  transition: var(--transition);
}
.toggle-switch__thumb {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--text3);
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
  transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
  z-index: 1;
}
.toggle-switch__off,
.toggle-switch__on {
  position: absolute;
  z-index: 2;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}
.toggle-switch__off { color: var(--text); right: 12px; }
.toggle-switch__on { color: rgba(255,255,255,0.92); opacity: 0; left: 15px; }
.toggle-switch input:checked + .toggle-switch__track {
  border-color: color-mix(in srgb, var(--green) 70%, #fff);
  background: linear-gradient(135deg, #1b680d, var(--green));
}
.toggle-switch input:checked + .toggle-switch__track .toggle-switch__thumb {
  transform: translateX(64px);
  background: #fff;
}
.toggle-switch input:checked + .toggle-switch__track .toggle-switch__off { opacity: 0; }
.toggle-switch input:checked + .toggle-switch__track .toggle-switch__on { opacity: 1; }
.toggle-switch input:disabled + .toggle-switch__track {
  opacity: .62;
  cursor: wait;
}
.offer-toggle .toggle-switch__track {
  width: 86px;
  height: 34px;
  padding: 0 10px;
}
.offer-toggle .toggle-switch__thumb {
  width: 26px;
  height: 26px;
}
.offer-toggle .toggle-switch__off,
.offer-toggle .toggle-switch__on {
  font-size: 9px;
}
.offer-toggle .toggle-switch__off { right: 10px; }
.offer-toggle .toggle-switch__on { left: 12px; }
.offer-toggle input:checked + .toggle-switch__track .toggle-switch__thumb {
  transform: translateX(52px);
}

.admin-license-table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}
.admin-license-table th,
.admin-license-table td {
  vertical-align: middle;
  padding: 10px 12px;
}
.admin-license-table th:nth-child(1),
.admin-license-table td:nth-child(1) {
  width: clamp(150px, 17vw, 260px);
  overflow-wrap: anywhere;
}
.admin-license-table th:nth-child(2),
.admin-license-table td:nth-child(2) {
  width: 120px;
  white-space: nowrap;
}
.admin-license-table th:nth-child(3),
.admin-license-table td:nth-child(3) {
  width: clamp(170px, 16vw, 240px);
}
.admin-license-table th:nth-child(4),
.admin-license-table td:nth-child(4) {
  width: 120px;
  white-space: nowrap;
}
.admin-license-table th:nth-child(5),
.admin-license-table td:nth-child(5) {
  width: clamp(360px, 31vw, 520px);
}
.admin-license-table th:nth-child(6),
.admin-license-table td:nth-child(6) {
  width: 170px;
  white-space: normal;
}
.admin-license-table th:last-child,
.admin-license-table td:last-child {
  width: 68px;
  text-align: center;
  white-space: nowrap;
}
.admin-license-input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 6px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
}
.admin-license-client,
.admin-license-password {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-license-password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px 58px 58px;
  align-items: center;
  gap: 6px;
}
.admin-license-password-row .admin-license-password {
  min-width: 0;
}
.admin-license-icon-btn,
.admin-license-action-btn,
.admin-license-delete-btn {
  min-width: 40px;
  min-height: 40px;
  padding: 4px 8px;
}
.admin-license-action-btn {
  width: 58px;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}
@media (max-width: 1180px) {
  .admin-license-password-row {
    grid-template-columns: minmax(0, 1fr) 40px;
  }

  .admin-license-password-row .admin-license-action-btn {
    grid-column: span 2;
  }
}
.admin-license-icon-btn {
  min-width: 40px;
  padding: 4px;
}
.admin-license-delete-btn {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 48%, var(--border));
}
.admin-license-delete-btn:hover {
  background: color-mix(in srgb, var(--red) 10%, var(--surface-hover));
  border-color: color-mix(in srgb, var(--red) 72%, var(--border));
}



.manual-lead-form {
  margin: 14px 0 18px;
  padding: 18px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface-soft) 82%, transparent));
  box-shadow: 0 18px 52px rgba(0,0,0,.18);
}
.manual-lead-form__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.manual-lead-form__title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.manual-lead-form__hint {
  margin-top: 4px;
  color: var(--text3);
  font-size: 12px;
  text-wrap: pretty;
}
.manual-lead-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.manual-lead-grid label {
  display: grid;
  gap: 7px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 800;
}
.manual-lead-grid input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg3);
  color: var(--text);
  outline: none;
  transition-property: border-color, box-shadow, background;
  transition-duration: .18s;
}
.manual-lead-grid input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}
.manual-lead-grid__wide {
  grid-column: span 2;
}
.manual-lead-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}
@media (max-width: 1180px) {
  .manual-lead-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .manual-lead-grid { grid-template-columns: 1fr; }
  .manual-lead-grid__wide { grid-column: auto; }
  .manual-lead-form__head { flex-direction: column; }
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty {
  text-align: center; padding: 60px 20px;
  color: var(--text3); font-size: 15px; font-weight: 500;
}


.va-inline-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition);
}

.va-source-name {
  padding: 10px 12px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  background: color-mix(in srgb, var(--surface-soft) 78%, transparent);
  overflow-wrap: anywhere;
}

.vacancy-alias-input:focus,
.va-inline-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(51,156,13,0.1);
}

.vacancy-alias-add-btn {
  justify-content: center;
  min-height: 44px;
}

.vacancy-alias-msg {
  min-height: 20px;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--text2);
}

.va-row td {
  vertical-align: middle;
}

.va-actions-cell {
  width: 64px;
  text-align: right;
  white-space: nowrap;
}

.va-delete-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 77, 79, 0.22);
  border-radius: 999px;
  background: rgba(255, 77, 79, 0.08);
  color: var(--red);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.va-delete-btn:hover {
  background: rgba(255, 77, 79, 0.16);
  border-color: rgba(255, 77, 79, 0.36);
  transform: translateY(-1px);
}

#toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  min-width: 240px;
  max-width: 380px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: transform .18s ease, opacity .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease;
  z-index: 9999;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ── Utility ────────────────────────────────────────────────────────────── */
.notification-widget { position: fixed; right: 22px; bottom: 82px; z-index: 9998; }
.notification-bell { position: relative; display: grid; width: 44px; height: 44px; place-items: center; color: var(--text); background: var(--bg2); border: 1.5px solid var(--border); border-radius: 50%; box-shadow: var(--shadow-sm); cursor: pointer; transition: var(--transition); }
.notification-bell:hover, .notification-bell[aria-expanded="true"] { color: var(--green); border-color: var(--green); transform: translateY(-1px); }
.notification-bell svg { width: 20px; height: 20px; }
.notification-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; color: #fff; background: var(--red); border: 2px solid var(--bg); border-radius: 999px; font-size: 10px; font-weight: 800; }
.notification-panel { position: absolute; right: 0; bottom: 54px; left: auto; width: min(360px, calc(100vw - 44px)); overflow: hidden; background: var(--bg2); border: 1.5px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.notification-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.notification-panel-head button { padding: 0; color: var(--text3); background: transparent; border: 0; cursor: pointer; font: inherit; }
.notification-panel-head button:hover { color: var(--text); }
.notification-list { max-height: min(340px, 55vh); overflow-y: auto; }
.notification-empty { padding: 18px 14px; color: var(--text3); font-size: 13px; }
.notification-item { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.4; }
.notification-item:last-child { border-bottom: 0; }
.notification-item.error { border-left: 3px solid var(--red); }
.notification-item.warning { border-left: 3px solid var(--yellow); }
.notification-time { display: block; margin-bottom: 3px; color: var(--text3); font-size: 11px; }
@media (max-width: 760px) { .notification-widget { right: 18px; bottom: 76px; } }
.mb-16 { margin-bottom: 16px; }
.text-sm { font-size: 13px; color: var(--text2); }


/* ══════════════════════════════════════════════════════════════════════════
   АДАПТИВНОСТЬ — Мобильные устройства и маленькие экраны
   ══════════════════════════════════════════════════════════════════════════ */

/* Таблеты и маленькие экраны (1024px) */
@media (max-width: 1024px) {
  header {
    padding: 0 16px; gap: 12px;
  }
  .brand-icon { width: 28px; height: 28px; flex-basis: 28px; border-radius: 7px; }
  .logo { font-size: 16px; }
  .last-action { display: none; }

  .sidebar {
    width: 228px;
    flex-basis: 228px;
  }

  main { padding: 16px; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .kpi-card { padding: 16px; }
  .kpi-card .label { font-size: 12px; }
  .kpi-card .value { font-size: 24px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }

  .offer-form { max-width: 100%; }
}

/* Мобильные устройства (768px) */
@media (max-width: 768px) {
  body { font-size: 13px; }

  header {
    padding: 0 12px; height: 56px; gap: 8px;
  }
  .brand-link { gap: 8px; }
  .brand-icon { width: 26px; height: 26px; flex-basis: 26px; }
  .logo { font-size: 14px; }
  .status-badge { font-size: 11px; padding: 4px 10px; }
  .btn-logout { padding: 6px 12px; font-size: 11px; }
  .btn-stop { padding: 6px 12px; font-size: 11px; }

  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1.5px solid var(--border);
    padding: 10px 12px;
  }
  .sidebar-group { gap: 8px; }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sidebar-nav button,
  .sidebar-nav .nav-link-external {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 11px;
  }

  main {
    padding: 12px; overflow-y: auto;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 16px;
  }

  .page-title { font-size: 20px; }

  .kpi-grid { grid-template-columns: 1fr; gap: 10px; }
  .kpi-card { padding: 12px; }
  .kpi-card .label { font-size: 11px; }
  .kpi-card .value { font-size: 20px; }
  .summary-grid,
  .stats-strip { grid-template-columns: 1fr; gap: 10px; }

  .table-wrapper { overflow-x: auto; }
  table { font-size: 12px; }
  .form-row { margin-bottom: 12px; }
  .form-row input, .form-row select, .form-row textarea {
    padding: 8px 10px; font-size: 13px;
  }

  .offer-form {
    max-width: 100%;
  }

  .offer-form h3 {
    font-size: 14px;
    margin-bottom: 12px;
  }

  .save-row {
    margin-top: 16px; flex-direction: column; gap: 8px;
  }
  .save-row button {
    width: 100%;
  }

  .modal { width: 90vw; max-height: 90vh; }
  .modal-content { padding: 16px; }

  .login-box {
    width: 90vw; max-width: 400px;
    padding: 32px 20px;
  }
  .login-box h1 { font-size: 24px; }
  .login-box .subtitle { font-size: 12px; }
  .login-box input { padding: 10px 12px; }

  /* Скрыть лишние колонки в таблицах */
  table tr th:nth-child(n+5),
  table tr td:nth-child(n+5) {
    display: none;
  }

  /* Сделать кнопки более доступными */
  button { min-height: 40px; }

  /* Обеспечить видимость кнопок */
  .btn-logout,
  .btn-stop {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* Очень маленькие экраны (480px) */
@media (max-width: 480px) {
  header { 
    gap: 4px; 
    padding: 0 8px;
  }
  .brand-link { gap: 6px; }
  .brand-icon { width: 22px; height: 22px; flex-basis: 22px; border-radius: 6px; }
  .logo { font-size: 12px; }
  .status-badge { display: none; }

  .sidebar { padding: 8px; }
  .sidebar-label { padding: 0 4px; }
  .sidebar-userline { margin-inline: 4px; max-width: calc(100% - 8px); }
  .sidebar-nav button, .sidebar-nav .nav-link-external { padding: 6px 8px; font-size: 10px; }

  main { 
    padding: 8px; 
    min-height: calc(100% - 56px);
    overflow-y: auto;
  }

  .kpi-grid { gap: 8px; }
  .kpi-card { padding: 10px; }
  .kpi-card .value { font-size: 18px; }
  .offer-form h3 { font-size: 13px; }

  /* Модальное окно полноэкранным */
  .modal { width: 100%; max-height: 100%; border-radius: 0; }

  .btn-logout,
  .btn-stop { font-size: 10px; padding: 5px 8px; }

  .save-row {
    flex-direction: column;
  }
  .save-row button {
    width: 100%;
  }
}


/* Offer editor modal: laptop-safe viewport layout */
.offer-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(10px, 3dvh, 28px) 16px;
  background: rgba(0, 0, 0, .68);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.offer-modal-card {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100dvh - clamp(20px, 6dvh, 56px));
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 28px 30px 0;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,.06);
}

.offer-modal-title {
  margin: 0 48px 18px 0;
  text-wrap: balance;
}

.offer-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: var(--text2);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition-property: transform, background-color, color, box-shadow;
  transition-duration: .16s;
  transition-timing-function: ease;
}

.offer-modal-close:hover {
  background: rgba(255,255,255,.12);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}

.offer-modal-close:active {
  transform: scale(.96);
}

.offer-modal-body {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.offer-modal-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  padding: 16px 0 22px;
  margin-top: 6px;
  background: linear-gradient(to bottom, rgba(17,17,17,0), var(--bg2) 28%);
}

.offer-modal-actions .btn-action {
  min-height: 44px;
}

@media (max-height: 760px) {
  .offer-modal-overlay { padding-block: 8px; }
  .offer-modal-card { max-height: calc(100dvh - 16px); padding: 20px 24px 0; }
  .offer-modal-title { margin-bottom: 12px; }
  .offer-modal-actions { padding-bottom: 14px; }
  .offer-modal-card .form-row { margin-bottom: 10px; }
}

@media (max-width: 560px) {
  .offer-modal-overlay { padding-inline: 0; padding-block: 0; }
  .offer-modal-card {
    width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
    padding-inline: 18px;
  }
  .offer-modal-actions { flex-direction: column; }
  .offer-modal-actions .btn-action { width: 100%; }
}

/* ── Дополнительные адаптивные улучшения ─────────────────────────────────── */

@media (max-width: 768px) {
  #app {
    z-index: auto;
  }

  /* Кнопка "Добавить оффер" и подобные */
  div[style*="justify-content: space-between"] {
    flex-wrap: wrap !important;
    gap: 12px !important;
    align-items: flex-start !important;
  }

  .section-title {
    min-width: 100%;
    flex-basis: 100%;
  }

  .btn-action {
    font-size: 12px;
    padding: 8px 12px;
    min-height: 36px;
  }

  .btn-action.primary {
    width: 100%;
  }

  .va-actions-cell {
    width: 52px;
  }
}

@media (max-width: 1023px) {
  header {
    padding: 0 16px;
    gap: 12px;
  }

  .sidebar {
    width: 228px;
    flex-basis: 228px;
  }
}

@media (max-width: 767px) {
  body.mobile-sidebar-open {
    overflow: hidden;
  }

  body.mobile-sidebar-open::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.58);
  }

  header {
    height: 56px;
    padding: 0 12px;
    gap: 8px;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, var(--surface-hover), var(--surface-soft));
    color: var(--text);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition);
  }

  .mobile-menu-toggle:active {
    background: var(--bg3);
  }

  .brand-link {
    gap: 7px;
    min-width: 0;
    flex: 1 1 auto;
  }

  .brand-icon {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }

  .logo {
    font-size: 15px;
    white-space: nowrap;
  }

  .status-badge {
    display: flex;
    gap: 6px;
    padding: 4px 8px;
    font-size: 10px;
    letter-spacing: 0.03em;
  }

  .status-dot {
    width: 7px;
    height: 7px;
  }

  .theme-toggle {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    margin-left: 0;
  }

  header > .btn-logout {
    display: none;
  }

  .btn-stop {
    width: 44px;
    min-height: 44px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    text-indent: -999px;
    flex: 0 0 44px;
    position: relative;
  }

  .btn-stop::after {
    content: '■';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-indent: 0;
    font-size: 13px;
  }

  .app-shell {
    flex-direction: row;
  }

  .sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    left: 0;
    z-index: 30;
    width: min(82vw, 320px);
    height: auto;
    padding: 16px;
    overflow-y: auto;
    border-right: 1.5px solid var(--border);
    border-bottom: 0;
    box-shadow: var(--shadow);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

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

  .sidebar-group {
    gap: 8px;
  }

  .sidebar-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .sidebar-nav button,
  .sidebar-nav .nav-link-external,
  .sidebar-subnav button {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 13px;
  }

  .mobile-sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    width: 100%;
    margin-top: 12px;
  }

  main {
    padding: 16px;
    width: 100%;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-actions,
  .actions,
  .log-footer,
  .save-row {
    gap: 8px;
  }

  .page-title {
    font-size: 22px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
    max-width: none;
    gap: 16px;
  }

  .settings-card {
    padding: 18px;
  }

  .login-box {
    width: 100%;
    max-width: 400px;
    padding: 24px;
  }

  .filters {
    flex-wrap: wrap;
    gap: 8px;
  }

  .filters input,
  .filters select,
  .filters input[type=search],
  .filters button {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  .filters .btn-sm {
    margin-left: 0 !important;
  }

  .table-wrap,
  .table-wrapper {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 760px;
  }

  table tr th:nth-child(n+5),
  table tr td:nth-child(n+5) {
    display: table-cell;
  }

  th,
  td {
    min-width: 120px;
    white-space: nowrap;
  }

  td {
    white-space: normal;
  }

  button,
  .btn-sm,
  .btn-action,
  .pagination button,
  .lovko-refresh-btn,
  .login-box button[type=submit] {
    min-height: 44px;
  }

  .btn-action {
    padding: 10px 14px;
    font-size: 13px;
  }

  input,
  select,
  textarea,
  .form-row input[type=text],
  .form-row input[type=password],
  .form-row input[type=number],
  .form-row select,
  .form-row textarea,
  .login-box input {
    font-size: 16px;
  }
}

@keyframes statusSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}


/* UI polish: make-interfaces-feel-better */
.page-title, .section-title, .card-title, .modal-title { text-wrap: balance; }
.page-subtitle, .muted, .setting-help, .crm-settings-card__hint, .crm-settings-subtitle { text-wrap: pretty; }
.stat-value, .mono, table td, .crm-status, .job-timer { font-variant-numeric: tabular-nums; }
img, .avatar, .brand-icon { outline: 1px solid rgba(255, 255, 255, 0.1); outline-offset: -1px; }
body[data-theme="light"] img, body[data-theme="light"] .avatar, body[data-theme="light"] .brand-icon { outline-color: rgba(0, 0, 0, 0.1); }
button, .btn-sm, .btn-action, .btn-logout, .btn-stop, .theme-toggle, .password-toggle { transition-property: transform, scale, background-color, color, box-shadow, border-color, opacity; transition-duration: 0.16s; transition-timing-function: ease; }

.page-head, .crm-section-head { align-items: flex-start; }
.crm-stat-label { min-height: 28px; text-wrap: balance; }
.crm-stat-value { font-variant-numeric: tabular-nums; }
.table-wrap { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-wrap table { width: 100%; }
.table-wrap:not(.admin-license-accounts) table { table-layout: fixed; }


/* Leads table: keep dense CRM data readable on laptop widths. */
#leads-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 330px);
  min-height: 280px;
  scrollbar-gutter: stable;
}

#leads-table-wrap .leads-data-table {
  min-width: 1320px;
  table-layout: fixed;
}

.leads-data-table th,
.leads-data-table td {
  vertical-align: middle;
  line-height: 1.45;
}

.leads-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg3);
}

.leads-data-table .lead-cell-id,
.leads-data-table .lead-cell-phone,
.leads-data-table .lead-cell-age,
.leads-data-table .lead-cell-source,
.leads-data-table .lead-cell-status,
.leads-data-table .lead-cell-date,
.leads-data-table .lead-cell-action {
  white-space: nowrap;
}

.leads-data-table .lead-cell-phone,
.leads-data-table .lead-cell-id,
.leads-data-table .lead-cell-date {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.leads-data-table .lead-cell-email,
.leads-data-table .lead-cell-resume {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leads-data-table .lead-cell-name,
.leads-data-table .lead-cell-vacancy,
.leads-data-table .lead-cell-city {
  overflow-wrap: anywhere;
}

.leads-data-table th:nth-child(1), .leads-data-table td:nth-child(1) { width: 72px; }
.leads-data-table th:nth-child(2), .leads-data-table td:nth-child(2) { width: 155px; }
.leads-data-table th:nth-child(3), .leads-data-table td:nth-child(3) { width: 102px; }
.leads-data-table th:nth-child(4), .leads-data-table td:nth-child(4) { width: 170px; }
.leads-data-table th:nth-child(5), .leads-data-table td:nth-child(5) { width: 175px; }
.leads-data-table th:nth-child(6), .leads-data-table td:nth-child(6) { width: 100px; }
.leads-data-table th:nth-child(7), .leads-data-table td:nth-child(7) { width: 112px; }
.leads-data-table th:nth-child(8), .leads-data-table td:nth-child(8) { width: 72px; }
.leads-data-table th:nth-child(9), .leads-data-table td:nth-child(9) { width: 88px; }
.leads-data-table th:nth-child(10), .leads-data-table td:nth-child(10) { width: 92px; }
.leads-data-table th:nth-child(11), .leads-data-table td:nth-child(11) { width: 92px; }
.leads-data-table th:nth-child(12), .leads-data-table td:nth-child(12) { width: 105px; }
.leads-data-table th:nth-child(13), .leads-data-table td:nth-child(13) { width: 55px; }

@media (max-height: 760px) {
  #leads-table-wrap {
    max-height: calc(100vh - 260px);
    min-height: 220px;
  }
}


/* Messenger CRM table: fixed tracks prevent account paths from colliding with channel/status columns. */
.crm-messengers-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.crm-messengers-stats .crm-stat-card {
  min-height: 124px;
  border-radius: 22px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.08),
    0 16px 34px rgba(0,0,0,.18);
}
.crm-messengers-stats .crm-stat-value {
  font-size: clamp(32px, 4vw, 42px);
  letter-spacing: -.04em;
}
.crm-messengers-wrap {
  margin-top: 0;
  border-radius: 24px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.075),
    0 24px 54px rgba(0,0,0,.22);
}
.crm-messengers-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.crm-messengers-table .crm-col-id { width: 72px; }
.crm-messengers-table .crm-col-account { width: 38%; }
.crm-messengers-table .crm-col-channel { width: 142px; }
.crm-messengers-table .crm-col-status { width: 150px; }
.crm-messengers-table .crm-col-dialogs { width: 126px; }
.crm-messengers-table .crm-col-checked { width: 230px; }
.crm-messengers-table th,
.crm-messengers-table td {
  overflow: hidden;
  vertical-align: middle;
}
.crm-messengers-table th {
  height: 58px;
  color: rgba(255,255,255,.68);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.crm-messengers-table td {
  padding-top: 17px;
  padding-bottom: 17px;
}
.crm-messengers-table tbody tr {
  background: rgba(255,255,255,0);
  transition-property: background-color, box-shadow;
  transition-duration: .16s;
  transition-timing-function: ease;
}
.crm-messengers-table tbody tr:hover {
  background: rgba(51,156,13,.045);
  box-shadow: inset 3px 0 0 rgba(51,156,13,.85);
}
.crm-cell-account {
  min-width: 0;
  padding-right: 24px;
}
.crm-account-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: -.01em;
}
.crm-account-path {
  max-width: 100%;
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  margin-top: 7px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  color: rgba(255,255,255,.66);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.2;
}
.crm-account-path__label {
  color: var(--green);
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.crm-account-path__value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
  text-align: left;
}
.crm-channel-badge {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(64,169,255,.10);
  color: #54b6ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(64,169,255,.28);
}
.crm-channel-badge--max {
  background: rgba(255,184,77,.10);
  color: #ffc46b;
  box-shadow: inset 0 0 0 1px rgba(255,184,77,.26);
}
.crm-cell-channel,
.crm-cell-number,
.crm-cell-id,
.crm-cell-checked {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.crm-cell-number {
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.03em;
}
.crm-cell-checked {
  color: rgba(255,255,255,.82);
}
.crm-cell-error {
  color: var(--red);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 1180px) {
  .crm-messengers-table { min-width: 1060px; }
  .crm-messengers-wrap { overflow-x: auto; }
}

.notification-item.error { position: relative; padding-right: 136px; }
.notification-report { position:absolute; right:10px; top:50%; transform:translateY(-50%); padding:5px 7px; color:var(--red); border:1px solid var(--red); border-radius:6px; background:transparent; font-size:10px; line-height:1.15; cursor:pointer; }
.notification-report:disabled { opacity:.55; cursor:wait; }
@media (max-width: 420px) { .notification-item.error { padding-right:14px; } .notification-report { position:static; transform:none; display:block; margin-top:8px; } }

/* Reference dashboard shell and leads composition (1280x720 target). */
:root{--bg:#03070b;--bg2:#060b10;--bg3:#0a1016;--surface-soft:rgba(255,255,255,.012);--surface-hover:rgba(124,255,0,.045);--border:#131b22;--border-hi:#26343e;--border2:rgba(255,255,255,.045);--text:#edf2f4;--text2:#a5adb3;--text3:#68737b;--green:#7cff00;--green-dim:rgba(124,255,0,.1);--yellow:#ffb000;--radius:10px;--radius-sm:8px;--shadow:0 14px 34px rgba(0,0,0,.34);--shadow-sm:0 7px 20px rgba(0,0,0,.22)}
html,body{background:radial-gradient(circle at 72% 0,rgba(124,255,0,.025),transparent 26%),#03070b;font-size:12px;line-height:1.45}
#app{position:relative;background:#03070b}.app-shell{margin-left:195px}
header{height:59px;min-height:59px;margin-left:195px;padding:0 13px 0 18px;background:rgba(3,7,11,.96);border-bottom:1px solid #10171d;box-shadow:none}header .brand-link,header .home-arrow{display:none}header .status-badge{margin-right:auto}
.sidebar{position:fixed;inset:0 auto 0 0;z-index:20;width:195px;height:100vh;flex-basis:195px;padding:14px 11px 11px;gap:9px;background:linear-gradient(180deg,rgba(124,255,0,.012),transparent 32%),#04090d;border-right:1px solid #141c22;box-shadow:10px 0 34px rgba(0,0,0,.18)}
.sidebar-brand{display:flex;align-items:center;gap:9px;min-height:41px;padding:2px 7px 9px;color:var(--text);text-decoration:none}.sidebar-brand__icon{width:30px;height:30px;border-radius:7px;box-shadow:0 0 16px rgba(124,255,0,.14)}.sidebar-brand__name{font-size:18px;font-weight:700;letter-spacing:-.04em}.sidebar-brand__name span{color:var(--green)}
.sidebar-group{gap:4px;padding-top:1px}.sidebar-group+.sidebar-group{padding-top:7px;border-top:0}.sidebar-label{padding:0 7px;font-size:9px;letter-spacing:.09em;color:#69737a}.sidebar-nav,.sidebar-expand{gap:3px}.sidebar-nav button,.sidebar-nav .nav-link-external{min-height:35px;padding:7px 10px;border-radius:8px;border-width:1px;color:#aab2b7;background:rgba(255,255,255,.012);font-size:11px}.sidebar-nav button.active,.sidebar-nav .nav-link-external.active,.sidebar-parent.active{color:#eef3f5;border-color:rgba(124,255,0,.13);background:linear-gradient(90deg,rgba(124,255,0,.075),rgba(124,255,0,.018));box-shadow:inset 2px 0 var(--green),0 0 16px rgba(124,255,0,.025)}.sidebar-nav button.active .nav-icon,.sidebar-parent.active .nav-icon{color:var(--green)}.sidebar-subnav{gap:2px;margin-left:8px;padding-left:11px;border-left-color:#1b252b}.sidebar-subnav button{min-height:27px;padding:5px 9px;border-radius:6px;font-size:10px}.nav-icon{width:14px;height:14px;flex-basis:14px}
main{padding:16px 18px 25px}.tab-pane{animation-duration:.18s}.page-head{margin-bottom:13px;align-items:center}.page-title{font-size:23px;letter-spacing:-.035em}.page-title-muted{color:var(--green);font-size:15px}.page-subtitle{margin-top:3px;font-size:10px}
.status-badge{min-width:108px;padding:6px 11px;border:1px solid #151e25;border-radius:8px;background:#070c11;font-size:10px}.status-dot{width:6px;height:6px}.status-dot.idle{box-shadow:0 0 8px rgba(124,255,0,.55)}.theme-toggle,.btn-logout,.btn-stop,.btn-sm,.btn-action{border-width:1px;border-radius:8px}.theme-toggle{width:34px;height:34px}.btn-logout,.btn-stop{padding:8px 13px;font-size:10px}
#tab-leads .kpi-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-bottom:11px}#tab-leads .kpi-card{min-height:109px;padding:13px 15px;border-width:1px;border-radius:9px;background:linear-gradient(145deg,rgba(255,255,255,.018),transparent 55%),#070c11;box-shadow:inset 0 1px rgba(255,255,255,.018),0 6px 20px rgba(0,0,0,.19)}#tab-leads .kpi-card::before{left:10%;right:10%;background:linear-gradient(90deg,transparent,rgba(124,255,0,.12),transparent)}#tab-leads .kpi-card .label{margin-bottom:10px;font-size:9px;letter-spacing:.05em}#tab-leads .kpi-card .value{font-size:27px;line-height:1}#tab-leads .kpi-card .value.green,#kpi-total{color:var(--green);text-shadow:0 0 18px rgba(124,255,0,.19)}#tab-leads .kpi-card .value.yellow{color:var(--yellow);text-shadow:0 0 16px rgba(255,176,0,.15)}.offer-row{font-size:10px}.offer-count{font-size:11px}.kpi-goal{margin-top:8px}.kpi-goal-track{height:5px;background:#10171d}.kpi-goal-fill{background:var(--green);box-shadow:0 0 8px rgba(124,255,0,.35)}.kpi-goal-label{margin-top:5px;font-size:9px}
#tab-leads>.actions{gap:8px;margin-bottom:9px}.btn-action{min-height:33px;padding:7px 14px;font-size:10px;text-transform:uppercase;letter-spacing:.035em}.btn-action.primary{color:#071000;background:var(--green);border-color:var(--green);box-shadow:0 0 15px rgba(124,255,0,.15)}
.log-panel,.table-wrap,.settings-card,.crm-stat-card,.chart-card{border-width:1px;border-radius:9px;background:#070c11;box-shadow:0 5px 18px rgba(0,0,0,.2)}#tab-leads .log-panel{margin-bottom:10px}.log-header{min-height:36px;padding:5px 9px;border-bottom-color:#111920}.log-header .log-title{font-size:10px;letter-spacing:.055em}.log-header .dot{background:var(--green)}#tab-leads .log-body{height:130px;padding:6px 10px;font-size:9px;line-height:1.3}.log-line{min-height:17px;padding:2px 0}.log-footer{min-height:23px;padding:3px 10px}.section-title{font-size:12px}.filters{gap:6px;margin:8px 0}.filters input,.filters select{min-height:31px;padding:5px 8px;border-radius:7px;font-size:10px}.table-wrap th{padding:7px 8px;font-size:8px;letter-spacing:.05em}.table-wrap td{padding:7px 8px;font-size:9px}
@media(max-width:980px){.app-shell,header{margin-left:0}.sidebar{width:220px;transform:translateX(-100%)}.sidebar.open{transform:translateX(0)}.kpi-grid,#tab-leads .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}header .mobile-menu-toggle{display:inline-flex}}
@media(max-width:560px){main{padding:13px 10px 24px}.kpi-grid,#tab-leads .kpi-grid{grid-template-columns:1fr}header .btn-logout{display:none}}

/* Reference dashboard v2: real-state header and mailing composition. */
.header-range,.header-user{display:flex;align-items:center;gap:7px;height:34px;padding:0 10px;border:1px solid #151e25;border-radius:8px;background:#070c11;color:var(--text2);font-size:10px}.header-range{margin-left:auto}.header-range__icon{color:var(--text3)}.header-user{max-width:150px}.header-user__avatar{display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:#111820;color:var(--text);font-size:9px;font-weight:700}.header-user #header-user-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.notification-widget:not([hidden]){position:fixed;z-index:35;top:12px;right:235px}.notification-bell{width:34px;height:34px;border-radius:8px;background:#070c11;border-color:#151e25}.notification-panel{top:40px}
.mailing-overview{display:grid;grid-template-columns:345px minmax(0,1fr);min-height:155px;margin-bottom:9px;border:1px solid #131b22;border-radius:9px;background:#070c11;overflow:hidden}.mailing-overview__summary{display:grid;grid-template-columns:120px 1fr;grid-template-rows:auto 1fr;padding:11px 12px;border-right:1px solid #131b22}.mailing-overview__heading{grid-column:1/-1;display:flex;align-items:center;gap:7px;font-size:11px;font-weight:700;text-transform:uppercase}.mailing-overview__icon{color:var(--green)}.mailing-donut{position:relative;display:grid;place-items:center;width:103px;height:103px;margin-top:6px;border-radius:50%;background:conic-gradient(var(--green) var(--mailing-progress),#182027 0);box-shadow:0 0 18px rgba(124,255,0,.06)}.mailing-donut::before{content:"";position:absolute;width:78px;height:78px;border-radius:50%;background:#070c11}.mailing-donut>div{position:relative;z-index:1;display:flex;flex-direction:column;align-items:center}.mailing-donut strong{font-size:18px}.mailing-donut span{font-size:8px;color:var(--text3)}.mailing-metrics{display:grid;gap:6px;align-content:center}.mailing-metrics>div{display:flex;align-items:baseline;justify-content:space-between;padding:7px 8px;border:1px solid #121a20;border-radius:7px;background:#090f14}.mailing-metrics strong{color:var(--green);font-size:13px}.mailing-metrics span{color:var(--text3);font-size:8px;text-transform:uppercase}.mailing-recent{padding:11px 13px}.mailing-recent__head{display:flex;justify-content:space-between;padding-bottom:8px;border-bottom:1px solid #121a20}.mailing-recent__head strong{font-size:10px;text-transform:uppercase}.mailing-recent__head span{font-size:8px;color:var(--green)}.mailing-recent__table{min-height:105px;display:grid;place-items:center}.mailing-empty{color:var(--text3);font-size:9px;text-align:center}
#tab-leads .log-body{height:92px}.section-title[style]{margin-top:13px!important}
@media(max-width:980px){.header-range{display:none}.notification-widget:not([hidden]){right:170px}.mailing-overview{grid-template-columns:1fr}.mailing-overview__summary{border-right:0;border-bottom:1px solid #131b22}}
@media(max-width:560px){.header-user{display:none}.mailing-overview__summary{grid-template-columns:110px 1fr}}

/* Reference dashboard v2 audit completion. */
header .notification-widget{position:relative;z-index:35;top:auto;right:auto}header .notification-bell{display:grid;place-items:center}.notification-panel{top:40px;right:0}
.page-actions .btn-stop{height:34px;padding:0 14px}.kpi-sparkline{position:absolute;inset:auto 10px 8px 10px;height:28px;opacity:.55;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 30'%3E%3Cpath d='M0 25 L20 20 L38 23 L57 12 L76 17 L96 7 L116 15 L136 11 L158 20 L180 8' fill='none' stroke='%237cff00' stroke-width='1.4'/%3E%3C/svg%3E") center/100% 100% no-repeat;mask-image:linear-gradient(90deg,transparent,#000 15%,#000 85%,transparent)}#tab-leads .kpi-card:nth-child(3) .kpi-sparkline{filter:hue-rotate(295deg)}#tab-leads .kpi-card .value,#tab-leads .offer-list{position:relative;z-index:1}#kpi-sheets-card{grid-column:1/-1;min-height:auto!important}
.sidebar-health{display:flex;align-items:center;gap:8px;margin:5px 2px 3px;padding:9px 10px;border:1px solid #121b21;border-radius:8px;background:#070c11}.sidebar-health__pulse{width:14px;height:14px;border:2px solid var(--green);border-radius:50%;box-shadow:0 0 10px rgba(124,255,0,.28)}.sidebar-health span:last-child{display:flex;flex-direction:column}.sidebar-health strong{font-size:9px}.sidebar-health small{color:var(--green);font-size:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:125px}

/* Reference dashboard v3: collision-free mailing grid and 720px rhythm. */
.sidebar-expand:has(.sidebar-parent.active)>.sidebar-subnav,.sidebar-subnav.open{display:flex}.system-health-card{flex:0 0 auto}
.mailing-overview{grid-template-columns:360px minmax(0,1fr);min-height:142px}.mailing-overview__summary{display:flex;flex-direction:column;min-width:0;padding:9px 11px}.mailing-overview__body{display:grid;grid-template-columns:112px minmax(0,1fr);gap:10px;align-items:center;min-width:0}.mailing-donut{width:96px;height:96px;margin:4px auto 0}.mailing-donut::before{width:72px;height:72px}.mailing-metrics{min-width:0;gap:5px}.mailing-metrics>div{min-width:0;padding:6px 7px}.mailing-metrics span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mailing-recent{min-width:0;padding:9px 12px}.mailing-recent__table{display:block;min-height:100px}.mailing-table-row{display:grid;grid-template-columns:minmax(105px,1.5fr) minmax(68px,.8fr) minmax(75px,.9fr) minmax(70px,.8fr) minmax(62px,.7fr) 45px;gap:8px;align-items:center;padding:7px 8px}.mailing-table-head{color:var(--text3);font-size:8px;text-transform:uppercase;border-bottom:1px solid #121a20}.mailing-table-row>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mailing-empty{grid-column:1/-1;padding:28px 8px 12px;text-align:center}.mailing-recent__head{padding-bottom:6px}#tab-leads .log-panel{margin-bottom:22px}#tab-leads .log-body{height:84px}#tab-leads>.section-title{margin-top:24px!important}
@media(max-width:1180px){.mailing-overview{grid-template-columns:335px minmax(0,1fr)}.mailing-table-row{grid-template-columns:minmax(90px,1.3fr) 60px 66px 64px 55px 38px;gap:5px}}

/* Reference dashboard v4: exact 1280x720 vertical geometry. */
.header-user__copy{display:flex;min-width:0;flex-direction:column;line-height:1.05}.header-user__copy small{margin-top:3px;color:var(--text3);font-size:8px;text-transform:capitalize}.header-user__copy #header-user-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#tab-leads .kpi-card{min-height:126px}#tab-leads .kpi-grid{margin-bottom:13px}#tab-leads>.actions{margin-bottom:10px}.mailing-overview{min-height:170px}.mailing-recent__table{min-height:125px}#tab-leads .log-panel{min-height:195px;margin-bottom:25px}#tab-leads .log-body{height:141px}#tab-leads>.section-title{margin-top:28px!important}

/* Reference polish: KPI hierarchy, action strip and live terminal state. */
#tab-leads .kpi-card{overflow:hidden}#tab-leads .kpi-card .label{position:relative;padding-left:34px;min-height:24px;display:flex;align-items:center}#tab-leads .kpi-card .label::before{content:"";position:absolute;left:0;top:50%;width:24px;height:24px;transform:translateY(-50%);border:1px solid rgba(124,255,0,.2);border-radius:6px;background:rgba(124,255,0,.045);box-shadow:inset 0 0 12px rgba(124,255,0,.035)}#tab-leads .kpi-card .label::after{position:absolute;left:7px;top:50%;transform:translateY(-54%);color:var(--green);font-size:15px;line-height:1}#tab-leads .kpi-card:nth-child(1) .label::after{content:"◌"}#tab-leads .kpi-card:nth-child(2) .label::after{content:"◎"}#tab-leads .kpi-card:nth-child(3) .label::before{border-color:rgba(255,176,0,.25);background:rgba(255,176,0,.045)}#tab-leads .kpi-card:nth-child(3) .label::after{content:"▣";color:var(--yellow)}#tab-leads .kpi-card:nth-child(4) .label::after{content:"◇"}.kpi-comparison{position:absolute;left:15px;right:15px;bottom:8px;color:var(--text3);font-size:9px;letter-spacing:.01em;z-index:2}.kpi-comparison::before{content:"↗";margin-right:5px;color:var(--green);font-size:11px}#tab-leads .kpi-card .kpi-sparkline{bottom:28px;height:22px}#tab-leads .kpi-card:has(.kpi-goal) .kpi-sparkline{display:none}#tab-leads>.actions{display:flex;align-items:center;width:100%}.actions-refresh{margin-left:auto;color:var(--green)!important}.mailing-overview__heading{letter-spacing:.03em}.mailing-overview__icon{display:grid;place-items:center;width:23px;height:23px;border:1px solid rgba(124,255,0,.18);border-radius:6px;background:rgba(124,255,0,.045);font-size:13px}.mailing-metrics>div::before{content:"";width:6px;height:6px;margin-right:7px;border:1px solid var(--green);border-radius:50%;box-shadow:0 0 8px rgba(124,255,0,.4)}.mailing-metrics>div:nth-child(2)::before{border-radius:2px}.mailing-metrics>div:nth-child(3)::before{border-color:var(--yellow);box-shadow:0 0 8px rgba(255,176,0,.25)}.mailing-metrics>div strong{margin-right:auto}.mailing-metrics>div span{margin-left:8px}.log-footer{display:flex;align-items:center;justify-content:space-between}.log-connection-state{display:inline-flex;align-items:center;gap:6px;color:var(--green);font-size:9px}.log-connection-state::before{content:"";width:5px;height:5px;border-radius:50%;background:currentColor;box-shadow:0 0 8px currentColor}@media(max-width:560px){.actions-refresh{margin-left:0}.kpi-comparison{font-size:8px}}

/* Flat reference sidebar navigation. */
.sidebar-nav-reference{display:flex;flex-direction:column;gap:3px;padding:8px 2px}.sidebar-nav-reference button{min-height:39px;background:transparent;border-color:transparent;color:#d2d8dc;font-size:13px}.sidebar-nav-reference button:hover{background:rgba(255,255,255,.025);border-color:rgba(255,255,255,.04)}.sidebar-nav-reference button.active{border-color:rgba(124,255,0,.36);background:linear-gradient(90deg,rgba(124,255,0,.10),rgba(124,255,0,.025));box-shadow:inset 2px 0 var(--green),0 0 16px rgba(124,255,0,.04);color:#f2f6f2}.sidebar-nav-reference .nav-ref-icon{display:inline-grid;place-items:center;width:20px;color:#d9e0e2;font-size:20px;line-height:1}.sidebar-nav-reference button.active .nav-ref-icon{color:var(--green)}.sidebar-nav-reference .nav-label{gap:12px}.sidebar .sidebar-group-bottom{margin-top:auto}
/* Flat reference sidebar navigation. */
.sidebar-nav-reference{display:flex;flex-direction:column;gap:3px;padding:8px 2px}.sidebar-nav-reference button{min-height:39px;background:transparent;border-color:transparent;color:#d2d8dc;font-size:13px}.sidebar-nav-reference button:hover{background:rgba(255,255,255,.025);border-color:rgba(255,255,255,.04)}.sidebar-nav-reference button.active{border-color:rgba(124,255,0,.36);background:linear-gradient(90deg,rgba(124,255,0,.10),rgba(124,255,0,.025));box-shadow:inset 2px 0 var(--green),0 0 16px rgba(124,255,0,.04);color:#f2f6f2}.sidebar-nav-reference .nav-ref-icon{display:inline-grid;place-items:center;width:20px;color:#d9e0e2;font-size:20px;line-height:1}.sidebar-nav-reference button.active .nav-ref-icon{color:var(--green)}.sidebar-nav-reference .nav-label{gap:12px}.sidebar .sidebar-group-bottom{margin-top:auto}


/* Theme-safe navigation polish. */
:root { --ui-card: #070c11; --ui-nav: #04090d; --ui-border: #18232c; --ui-shadow: 0 1px 2px rgba(0,0,0,.18),0 10px 28px rgba(0,0,0,.18); }
.sidebar-nav-reference{display:flex;flex-direction:column;gap:4px;padding:8px 2px}.sidebar-nav-reference button{min-height:40px;padding:8px 10px;background:transparent;border:1px solid transparent;border-radius:9px;color:var(--text2);font-size:13px;transition:background-color .16s ease,box-shadow .16s ease,color .16s ease}.sidebar-nav-reference button:hover{background:var(--surface-hover);border-color:var(--border2);color:var(--text)}.sidebar-nav-reference button.active{color:var(--text);border-color:color-mix(in srgb,var(--green) 36%,transparent);background:linear-gradient(90deg,color-mix(in srgb,var(--green) 12%,transparent),transparent);box-shadow:inset 2px 0 var(--green),0 5px 16px color-mix(in srgb,var(--green) 7%,transparent)}.sidebar-nav-reference .nav-label{display:flex;align-items:center;gap:12px}.sidebar-nav-reference .nav-ref-icon{width:19px;height:19px;flex:0 0 19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;color:var(--text2)}.sidebar-nav-reference button.active .nav-ref-icon{color:var(--green)}.ui-empty-state{display:grid;align-content:center;min-height:180px}.ui-empty-state p{text-wrap:pretty;max-width:44ch}.page-title{text-wrap:balance}.kpi-card,.crm-stat-card,.settings-card,.table-wrap,.log-panel{box-shadow:var(--ui-shadow)}body{font-variant-numeric:tabular-nums;-webkit-font-smoothing:antialiased}@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;transition-duration:.01ms!important}}
body[data-theme="light"]{--bg:#f5f6f2;--bg2:#eef0eb;--bg3:#e5e8e1;--surface-soft:rgba(16,28,38,.035);--surface-hover:rgba(73,150,0,.09);--border:#d9ded5;--border-hi:#c4cbbf;--border2:rgba(16,28,38,.10);--text:#172027;--text2:#4f5b62;--text3:#6d7876;--green:#4c9b00;--green-dim:rgba(76,155,0,.12);--yellow:#b57600;--ui-card:#ffffff;--ui-nav:#f9faf6;--ui-border:#d7ddd3;--ui-shadow:0 1px 2px rgba(20,32,27,.05),0 10px 25px rgba(20,32,27,.06)}
body[data-theme="light"],body[data-theme="light"] #app{background:radial-gradient(circle at 72% 0,rgba(76,155,0,.07),transparent 30%),var(--bg);color:var(--text)}body[data-theme="light"] header,body[data-theme="light"] .sidebar{background:var(--ui-nav);border-color:var(--ui-border);box-shadow:none}body[data-theme="light"] .status-badge,body[data-theme="light"] .header-range,body[data-theme="light"] .header-user,body[data-theme="light"] .theme-toggle,body[data-theme="light"] .btn-logout,body[data-theme="light"] .btn-stop,body[data-theme="light"] .btn-sm,body[data-theme="light"] .btn-action,body[data-theme="light"] .kpi-card,body[data-theme="light"] .mailing-overview,body[data-theme="light"] .settings-card,body[data-theme="light"] .log-panel,body[data-theme="light"] .table-wrap{background:var(--ui-card);border-color:var(--ui-border);color:var(--text);box-shadow:var(--ui-shadow)}body[data-theme="light"] .mailing-donut::before{background:var(--ui-card)}body[data-theme="light"] .sidebar-nav-reference button{color:var(--text2)}body[data-theme="light"] .sidebar-nav-reference button:hover{background:var(--surface-hover)}body[data-theme="light"] .sidebar-nav-reference button.active{color:var(--text);background:linear-gradient(90deg,rgba(76,155,0,.13),rgba(76,155,0,.02))}body[data-theme="light"] .sidebar-nav-reference .nav-ref-icon{color:var(--text2)}body[data-theme="light"] .sidebar-nav-reference button.active .nav-ref-icon{color:var(--green)}body[data-theme="light"] .mailing-metrics>div,body[data-theme="light"] .kpi-goal-track{background:#edf0ea;border-color:#dfe4da}body[data-theme="light"] .log-header,body[data-theme="light"] .mailing-recent__head,body[data-theme="light"] .mailing-overview__summary{border-color:var(--ui-border)}

.kpi-sparkline{background:none!important}.kpi-sparkline__line{fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 0 4px currentColor)}.kpi-sparkline__line--green{stroke:var(--green);color:var(--green)}.kpi-sparkline__line--yellow{stroke:var(--yellow);color:var(--yellow)}.kpi-sparkline__dot{stroke:var(--bg);stroke-width:1;filter:drop-shadow(0 0 3px currentColor)}.kpi-sparkline__dot--green{fill:var(--green);color:var(--green)}.kpi-sparkline__dot--yellow{fill:var(--yellow);color:var(--yellow)}.btn-action .action-icon{display:inline-grid;place-items:center;width:15px;margin-right:7px;font-size:15px;line-height:1;vertical-align:-1px}.btn-action{display:inline-flex;align-items:center;justify-content:center}


/* Header polish: compact, resilient controls without horizontal clipping. */
header { gap: 10px; min-width: 0; overflow: hidden; }
header > * { flex: 0 0 auto; }
.header-range, .header-user, header .notification-bell, .theme-toggle, header .btn-logout { box-shadow: var(--ui-shadow); }
.header-range { min-width: 0; max-width: 166px; }
.header-range__icon { width: 14px; height: 14px; flex: 0 0 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#header-date-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.header-user { width: 112px; max-width: 112px; }
header .notification-bell, .theme-toggle { width: 40px; height: 40px; border-radius: 9px; }
header .btn-logout { min-height: 40px; padding: 0 14px; }
header .notification-bell:hover, .theme-toggle:hover, header .btn-logout:hover { transform: translateY(-1px); }
@media (max-width: 840px) {
  header { padding-inline: 12px; gap: 8px; }
  .header-range { display: none; }
  .header-user { width: 104px; max-width: 104px; }
}
@media (max-width: 640px) {
  .header-user { display: none; }
  header .btn-logout { min-width: 40px; padding-inline: 10px; font-size: 0; }
  header .btn-logout::before { content: "\21AA"; font-size: 17px; line-height: 1; }
}


/* Leads overview redesign: clear hierarchy, fewer competing surfaces. */
#tab-leads { max-width: 1480px; margin-inline: auto; }
#tab-leads .page-head { padding: 6px 0 18px; margin-bottom: 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 74%, transparent); }
#tab-leads .page-title { font-size: clamp(28px, 2.1vw, 34px); font-weight: 750; line-height: 1; letter-spacing: -.052em; }
#tab-leads .page-subtitle { margin-top: 8px; font-size: 12px; color: var(--text3); }
#tab-leads .kpi-grid { grid-template-columns: minmax(285px, 1.25fr) repeat(3, minmax(190px, 1fr)); gap: 14px; margin: 20px 0 16px; }
#tab-leads .kpi-card { min-height: 152px; padding: 18px 19px; border: 1px solid color-mix(in srgb, var(--border) 88%, white 12%); border-radius: 14px; background: linear-gradient(135deg, rgba(255,255,255,.028), rgba(255,255,255,0) 48%), var(--ui-card); box-shadow: 0 10px 26px rgba(0,0,0,.16); transition-property: transform, box-shadow, border-color; transition-duration: 150ms; transition-timing-function: ease-out; }
#tab-leads .kpi-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--green) 30%, var(--border)); box-shadow: 0 14px 32px rgba(0,0,0,.24); }
#tab-leads .kpi-card .label { min-height: 30px; margin: 0 0 14px; padding-left: 0; color: var(--text2); font-size: 11px; font-weight: 700; letter-spacing: .075em; }
#tab-leads .kpi-card .label::before, #tab-leads .kpi-card .label::after { content: none; }
.kpi-label-icon { width: 22px; height: 22px; margin-right: 9px; padding: 4px; border: 1px solid color-mix(in srgb, var(--green) 32%, transparent); border-radius: 7px; color: var(--green); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; box-sizing: content-box; }
#tab-leads .kpi-card .value { color: var(--text); font-size: clamp(31px, 2.15vw, 38px); font-weight: 720; letter-spacing: -.055em; text-shadow: none; }
#tab-leads .kpi-card--total { overflow: hidden; border-color: color-mix(in srgb, var(--green) 30%, var(--border)); background: radial-gradient(circle at 78% 116%, rgba(124,255,0,.13), transparent 38%), linear-gradient(135deg, rgba(124,255,0,.065), transparent 45%), var(--ui-card); }
#tab-leads .kpi-card--total .kpi-sparkline { right: 18px; bottom: 36px; left: 18px; height: 35px; opacity: .88; }
#tab-leads .kpi-card--total .kpi-comparison { right: 19px; bottom: 15px; left: 19px; color: var(--text3); font-size: 10px; }
#tab-leads .kpi-card--total .kpi-comparison::before { font-size: 13px; }
#tab-leads > .actions { display: flex; align-items: center; gap: 9px; margin: 0 0 18px; padding: 0; }
#tab-leads .btn-action { min-height: 42px; padding: 0 17px; border-radius: 10px; font-size: 11px; letter-spacing: .02em; }
#tab-leads .actions-refresh { margin-left: auto; }
.mailing-overview { min-height: 184px; border-color: color-mix(in srgb, var(--border) 88%, white 12%); border-radius: 14px; box-shadow: 0 10px 26px rgba(0,0,0,.16); }
.mailing-overview__summary, .mailing-recent { padding: 16px 18px; }
.mailing-overview__heading, .mailing-recent__head strong { font-size: 12px; letter-spacing: .045em; }
.mailing-metrics > div { min-height: 36px; padding: 8px 10px; border-radius: 9px; }
.mailing-metrics strong { font-size: 15px; }
#tab-leads .log-panel { margin-top: 16px; border-radius: 14px; box-shadow: 0 10px 26px rgba(0,0,0,.14); }
#tab-leads .log-header { min-height: 48px; padding-inline: 16px; }
#tab-leads .log-body { height: 156px; padding: 10px 16px; font-size: 11px; }
@media (max-width: 1180px) { #tab-leads .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { #tab-leads .kpi-grid { grid-template-columns: 1fr; } #tab-leads .page-head { align-items: flex-start; } #tab-leads > .actions { align-items: stretch; flex-wrap: wrap; } #tab-leads .btn-action { flex: 1 1 calc(50% - 5px); } #tab-leads .actions-refresh { margin-left: 0; } }


/* KPI labels: retire legacy pseudo-icons before the new label system. */
#tab-leads .kpi-card .label::before,
#tab-leads .kpi-card .label::after { display: none !important; }
#tab-leads .kpi-card--total .label { display: flex; align-items: center; }
#tab-leads .kpi-label-icon { display: block; flex: 0 0 22px; }

/* Header controls: theme, notifications, then the account menu. */
.header-controls { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.header-controls .theme-toggle { order: 1; margin-left: 0; }
.header-controls .notification-widget { order: 2; flex: 0 0 auto; }
.header-account { position: relative; order: 3; }
.header-controls .theme-toggle,
.header-controls .notification-bell { width: 40px; height: 40px; border-radius: 50%; }
.header-controls .theme-toggle:hover { transform: translateY(-1px); }
.header-controls .header-user {
  display: flex;
  width: 132px;
  max-width: 132px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-card);
  color: var(--text);
  box-shadow: var(--ui-shadow);
  cursor: pointer;
}
.header-user__copy { flex: 1 1 auto; text-align: left; }
.header-user__avatar { flex: 0 0 24px; }
.header-user__chevron { width: 14px; height: 14px; flex: 0 0 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--text3); transition: rotate .16s ease; }
.header-user[aria-expanded="true"] .header-user__chevron { rotate: 180deg; }
.header-account-menu { position: absolute; top: 46px; right: 0; z-index: 40; min-width: 132px; padding: 5px; border: 1px solid var(--ui-border); border-radius: 9px; background: var(--ui-card); box-shadow: var(--ui-shadow); }
.header-account-menu button { width: 100%; min-height: 36px; padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text2); text-align: left; cursor: pointer; }
.header-account-menu button:hover { background: var(--surface-hover); color: var(--text); }

@media (max-width: 640px) {
  .header-controls { gap: 8px; }
  .header-controls .header-user { display: flex; width: 62px; max-width: 62px; }
  .header-controls .header-user__copy { display: none; }
}

/* Deterministic outline theme icon; avoids platform-dependent text glyphs. */
.theme-icon { display: grid; place-items: center; width: 20px; height: 20px; }
.theme-icon svg { grid-area: 1 / 1; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon__moon { display: none; }
body[data-theme="light"] .theme-icon__sun { display: none; }
body[data-theme="light"] .theme-icon__moon { display: block; }


/* Authenticated header reference: compact identity controls without heavy chrome. */
.header-controls { gap: 6px; }
.header-controls .notification-widget:not([hidden]) {
  position: relative;
  inset: auto;
  z-index: 35;
  display: block;
}
.header-controls .notification-badge[hidden] {
  display: none;
}
.header-controls .theme-toggle,
.header-controls .notification-bell,
.header-controls .header-user {
  color: var(--text2);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  transition-property: background-color, border-color, color, transform;
  transition-duration: .14s, .14s, .14s, .08s;
  transition-timing-function: ease;
}
.header-controls .theme-toggle,
.header-controls .notification-bell { border-radius: 10px; }
.header-controls .header-user { width: auto; max-width: 168px; padding: 0 6px; border-radius: 10px; }
.header-controls .header-user__avatar { width: 32px; height: 32px; flex-basis: 32px; background: #303943; color: #fff; font-size: 10px; }
.header-controls .header-user__copy { min-width: 74px; }
.header-controls .header-user__copy #header-user-name { color: var(--text); font-size: 11px; font-weight: 650; }
.header-controls .header-user__copy small { margin-top: 2px; font-size: 9px; text-transform: none; }
.header-controls .theme-toggle:hover,
.header-controls .notification-bell:hover,
.header-controls .notification-bell[aria-expanded="true"],
.header-controls .header-user:hover,
.header-controls .header-user[aria-expanded="true"] { background: var(--surface-hover); border-color: transparent; color: var(--text); transform: none; }
.header-controls .theme-toggle:active,
.header-controls .notification-bell:active,
.header-controls .header-user:active { transform: scale(.96); }
.header-controls .theme-toggle:focus-visible,
.header-controls .notification-bell:focus-visible,
.header-controls .header-user:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.header-controls .theme-toggle svg,
.header-controls .notification-bell svg,
.header-controls .header-user__chevron { color: currentColor; }
.header-controls .notification-badge { top: 1px; right: 1px; min-width: 17px; height: 17px; padding-inline: 3px; color: #071108; background: var(--green); border-color: var(--bg); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .header-controls .theme-toggle, .header-controls .notification-bell, .header-controls .header-user { min-width: 44px; min-height: 44px; }
  .header-controls .header-user { width: 44px; max-width: 44px; padding: 0 6px; }
  .header-controls .header-user__copy, .header-controls .header-user__chevron { display: none; }
}
