:root {
  --bg: #0f1419;
  --card: #1a2332;
  --text: #e7ecf3;
  --muted: #8b9bb4;
  --accent: #5b9fd8;
  --border: #2a3545;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.top {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

body.list-scrolled .top {
  display: none;
}

.layout-spacer {
  display: block;
  width: 100%;
  flex-shrink: 0;
}

.top-filters-panel {
  margin-top: 0.75rem;
}

h1 {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
  font-weight: 600;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.toolbar-filters {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.filter-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.filter-num {
  width: 4.25rem;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
}

.filter-select {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  max-width: 12rem;
}

.filters-block {
  margin-top: 0.75rem;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--border);
  background: rgba(26, 35, 50, 0.35);
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  padding-bottom: 0.25rem;
}

.filters-title {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.u-hidden {
  display: none !important;
}

#q {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

button, .btn.link {
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

button:hover, .btn.link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.muted { color: var(--muted); font-size: 0.8rem; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.site-nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.site-nav a:hover {
  text-decoration: underline;
}

.site-nav .active {
  color: var(--text);
  pointer-events: none;
}

.site-nav .nav-logout {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.site-nav .nav-logout:hover {
  color: var(--accent);
}

.grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
}

.card {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  padding-top: 2.35rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  align-items: flex-start;
  position: relative;
  z-index: 0;
}

.card:hover {
  z-index: 25;
}

.card-score-corner {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  z-index: 3;
  text-align: right;
  max-width: 46%;
}

/* Обоснование балла при наведении (полный текст, не обрезает как title) */
.score-reason-tip {
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  max-width: min(22rem, 86vw);
  padding: 0.5rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text);
  background: #141c28;
  border: 1px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 60;
  transition: opacity 0.14s ease, visibility 0.14s ease;
}

.card-score-corner.has-score-reason:hover .score-reason-tip:not([hidden]),
.card-score-corner.has-score-reason:focus-within .score-reason-tip:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.card-score-corner.has-score-reason {
  cursor: help;
}

.card-score-corner.has-score-reason .score-num {
  cursor: help;
}

.score-reason-tip--hero {
  right: auto;
  left: 0;
  top: calc(100% + 0.3rem);
  max-width: min(28rem, 92vw);
}

.hero-score-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.hero-score-wrap.has-score-reason {
  cursor: help;
}

.hero-score-wrap.has-score-reason:hover .score-reason-tip:not([hidden]),
.hero-score-wrap.has-score-reason:focus-within .score-reason-tip:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.hero-score-wrap.has-score-reason .hero-score-num {
  cursor: help;
}

.score-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.85rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  border: 1px solid transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.score-num.is-empty {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(15, 20, 25, 0.65);
  border-color: var(--border);
  box-shadow: none;
}

.score-num.score-hi {
  background: linear-gradient(145deg, #1e4d2e, #2d6a45);
  color: #c8f5d4;
  border-color: #3d8f5c;
}

.score-num.score-mid {
  background: linear-gradient(145deg, #4a3d12, #6b5a1a);
  color: #f5e6a8;
  border-color: #a68b2a;
}

.score-num.score-low {
  background: linear-gradient(145deg, #4a2810, #6b3a18);
  color: #ffd4b8;
  border-color: #9a5528;
}

.score-num.score-weak {
  background: linear-gradient(145deg, #3a2433, #5a2a42);
  color: #f0c8dc;
  border-color: #7a4560;
}

.name-row {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin: 0 3.5rem 0.4rem 0;
}

.name-cabinet {
  flex: 1;
  min-width: 0;
  display: block;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  line-height: 1.3;
  cursor: pointer;
}

.name-cabinet:hover {
  color: var(--accent);
  text-decoration: underline;
}

.btn-copy-name {
  margin-top: 0.12rem;
}

.btn-icon:not(.linkedin):hover {
  color: var(--accent);
  border-color: rgba(91, 159, 216, 0.55);
  background: rgba(91, 159, 216, 0.12);
}

.btn-copy-name .copy-name-svg {
  display: block;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  text-decoration: none;
  flex-shrink: 0;
}

.btn-icon.linkedin {
  color: #0a66c2;
}

.btn-icon.linkedin:hover {
  border-color: #0a66c2;
  background: rgba(10, 102, 194, 0.12);
  color: #4a9eff;
}

.btn-icon.linkedin .linkedin-svg {
  display: block;
}

.photo-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #111820;
  border: 1px solid var(--border);
}

.photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo[src=""], .photo:not([src]) {
  display: none;
}

.photo-wrap:has(.photo[src=""]) .photo-fallback,
.photo-wrap:not(:has(.photo[src])) .photo-fallback {
  display: flex;
}

.photo-fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  padding: 0.35rem;
}

.body { flex: 1; min-width: 0; }

.name {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.meta {
  margin: 0.15rem 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.meta.added-at {
  margin: 0.35rem 0 0.15rem;
  color: inherit;
}

.added-at-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 0.3rem 0.7rem 0.32rem;
  border-radius: 999px;
  font-size: 0.78rem;
  line-height: 1.25;
  background: linear-gradient(
    155deg,
    rgba(91, 159, 216, 0.14) 0%,
    rgba(91, 159, 216, 0.05) 45%,
    rgba(15, 20, 25, 0.35) 100%
  );
  border: 1px solid rgba(91, 159, 216, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.18);
}

.added-label {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.added-label::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 0.85em;
  margin-left: 0.45rem;
  vertical-align: -0.1em;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(91, 159, 216, 0.55),
    transparent
  );
}

.added-time {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.02em;
}

.filter-select-pipeline {
  max-width: min(20rem, 100%);
}

.pipeline-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin-top: 0.65rem;
  padding-bottom: 0.35rem;
}

.pipeline-chip-label {
  font-size: 0.78rem;
  margin-right: 0.1rem;
}

.pipe-chip,
.cat-chip {
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
  font-family: inherit;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  line-height: 1.25;
}

.pipe-chip:hover,
.cat-chip:hover {
  color: var(--text);
  border-color: rgba(91, 159, 216, 0.55);
}

.pipe-chip.is-active,
.cat-chip.is-active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(91, 159, 216, 0.2);
  box-shadow: 0 0 0 1px rgba(91, 159, 216, 0.35);
}

.card-pipeline {
  margin: 0.2rem 3.5rem 0.35rem 0;
}

.not-fit-low-zone {
  margin: 0 3.5rem 0.45rem 0;
}

.plaque-not-fit-low {
  margin: 0 0 0.35rem;
  padding: 0.28rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #f0c8dc;
  background: rgba(90, 42, 66, 0.22);
  border: 1px solid #6a3a55;
  border-radius: 6px;
  max-width: 100%;
}

.select-pipeline-card {
  width: 100%;
  max-width: 100%;
  font-size: 0.78rem;
  padding: 0.28rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.btn-not-fit-quick {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0.22rem 0.5rem;
  font-size: 0.72rem;
  border-radius: 6px;
  border: 1px solid #7a4560;
  background: rgba(90, 42, 66, 0.28);
  color: #f0c8dc;
  cursor: pointer;
}

.btn-not-fit-quick:hover {
  border-color: #9a5580;
  background: rgba(90, 42, 66, 0.42);
}

/* `display: block` выше ломает стандартное скрытие по атрибуту hidden */
.btn-not-fit-quick[hidden] {
  display: none !important;
}

.hero-pipeline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  margin-top: 0.4rem;
  max-width: 100%;
}

.hero-pipeline-summary {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

.select-pipeline-inline {
  flex: 1 1 12rem;
  min-width: min(12rem, 100%);
  max-width: min(22rem, 100%);
  font-size: 0.82rem;
  padding: 0.3rem 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.hero-score-reason-panel {
  margin-top: 0.85rem;
  padding: 0.75rem 1rem 0.85rem;
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(91, 159, 216, 0.14), rgba(20, 28, 40, 0.92));
  border: 1px solid rgba(91, 159, 216, 0.4);
  border-left: 4px solid var(--accent);
  max-width: 42rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
}

.hero-score-reason-label {
  margin: 0 0 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
}

.hero-score-reason-body {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.52;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.pipeline-section .hint {
  margin-bottom: 0.5rem;
}

.select-pipeline-wide {
  width: 100%;
  max-width: 32rem;
  font-size: 0.88rem;
  padding: 0.42rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.pipeline-quick-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.65rem;
}

.pipeline-quick-sep {
  user-select: none;
  opacity: 0.55;
}

.location-extra {
  font-size: 0.78rem;
  color: var(--accent);
  opacity: 0.95;
}

/* Сокращённое описание; при наведении (или фокусе) — полный текст поверх карточки */
.about-wrap {
  position: relative;
  margin-top: 0.45rem;
  outline: none;
}

.about-wrap:not([hidden]) {
  min-height: calc(0.78rem * 1.45 * 3 + 1.1rem);
}

.about-label {
  margin: 0 0 0.2rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.about {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  word-break: break-word;
  border-radius: 6px;
  cursor: default;
}

.about-wrap:hover .about,
.about-wrap:focus-within .about {
  -webkit-line-clamp: unset;
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  max-height: min(70vh, 28rem);
  overflow: auto;
  overscroll-behavior: contain;
  z-index: 40;
  padding: 0.55rem 0.65rem;
  background: #141c28;
  border: 1px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.55);
  color: var(--text);
}

.about-wrap:hover .about-label,
.about-wrap:focus-within .about-label {
  color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.actions-linkedin-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.linkedin-hover-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.linkedin-copy-pop {
  position: absolute;
  z-index: 80;
  left: 0;
  top: 100%;
  padding-top: 0.3rem;
  min-width: 11rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    opacity 0.14s ease,
    visibility 0.14s ease,
    transform 0.14s ease;
  pointer-events: none;
}

.linkedin-hover-wrap:hover .linkedin-copy-pop,
.linkedin-hover-wrap:focus-within .linkedin-copy-pop {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.linkedin-copy-pop-inner {
  padding: 0.3rem;
  background: #141c28;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.btn-linkedin-copy-url {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.42rem 0.65rem;
  font-size: 0.78rem;
  font-family: inherit;
  border-radius: 6px;
  border: 1px solid transparent;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.btn-linkedin-copy-url:hover:not(:disabled) {
  border-color: rgba(91, 159, 216, 0.45);
  background: rgba(91, 159, 216, 0.12);
  color: var(--accent);
}

.btn-linkedin-copy-url:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.li-public-check[hidden] {
  display: none !important;
}

.li-public-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.li-public-check .li-public-check-svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.toast {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: #7dcea0;
}

/* Кабинет лида / задачи */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
}

.hero {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
}

.hero-photo {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #111820;
}

.hero-body h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.hero-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.hero-name-row h1 {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.hero-score-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.hero-score-num.is-empty {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(15, 20, 25, 0.65);
  border-color: var(--border);
}

.hero-score-num.score-hi {
  background: linear-gradient(145deg, #1e4d2e, #2d6a45);
  color: #c8f5d4;
  border-color: #3d8f5c;
}

.hero-score-num.score-mid {
  background: linear-gradient(145deg, #4a3d12, #6b5a1a);
  color: #f5e6a8;
  border-color: #a68b2a;
}

.hero-score-num.score-low {
  background: linear-gradient(145deg, #4a2810, #6b3a18);
  color: #ffd4b8;
  border-color: #9a5528;
}

.hero-score-num.score-weak {
  background: linear-gradient(145deg, #3a2433, #5a2a42);
  color: #f0c8dc;
  border-color: #7a4560;
}

.hero-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.hero-name-row .hero-copy .btn-icon {
  width: 2.1rem;
  height: 2.1rem;
}

.hero-linkedin-row {
  margin-top: 0.65rem;
}

.hero-linkedin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
}

.btn-hero-linkedin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.btn-hero-linkedin.is-disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.hero-li-public-check {
  flex-shrink: 0;
}

.btn-li-edit {
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  color: var(--muted);
}

.btn-li-edit:hover {
  color: var(--accent);
  border-color: rgba(91, 159, 216, 0.55);
}

.hero-link-edit-panel {
  margin-top: 0.65rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(26, 35, 50, 0.6);
}

.hero-link-edit-label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.hero-link-edit-panel .lead-link-input {
  width: 100%;
  margin-bottom: 0.6rem;
}

.hero-link-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-copy-profile-full .copy-profile-full-svg {
  display: block;
}

.btn-copy-profile-full:hover {
  color: var(--accent);
  border-color: rgba(91, 159, 216, 0.55);
  background: rgba(91, 159, 216, 0.12);
}

.toast-bar {
  margin: 0.5rem 1.5rem 0;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  background: #1e3d2a;
  color: #abebc6;
  font-size: 0.85rem;
}

.section-title-sm {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}

.link-bar .hint {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  max-width: 52rem;
}

.link-bar .hint code {
  font-size: 0.85em;
  background: #111820;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.link-save-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
  max-width: 52rem;
}

.ai-msg-section {
  border-color: rgba(91, 159, 216, 0.35);
}

.ai-msg-toolbar {
  margin-bottom: 0.5rem;
}

.ai-msg-body {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  max-height: 14rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
  background: #111820;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.ai-msg-schedule {
  margin-bottom: 0.75rem;
}

.datetime-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  grid-column: 1 / -1;
}

.datetime-field-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.datetime-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.25rem;
  padding: 0.75rem 1rem;
  background: rgba(15, 20, 25, 0.65);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-width: 28rem;
}

.datetime-picker-col {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 9rem;
}

.datetime-sublabel {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.input-date,
.input-time {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  min-height: 2.5rem;
  color-scheme: dark;
}

.input-date:focus,
.input-time:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(91, 159, 216, 0.2);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero-loc-tz-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  margin-top: 0.15rem;
  max-width: 100%;
}

.hero-tz-controls {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.select-tz-compact {
  font-size: 0.78rem;
  padding: 0.22rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  max-width: 7.25rem;
}

.btn-tz-save {
  font-size: 0.78rem;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
}

.hero-client-clock {
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin: 0;
  white-space: nowrap;
}

.clock-zone--green {
  color: #58d68d;
}

.clock-zone--orange {
  color: #f5b041;
}

.clock-zone--red {
  color: #ec7063;
}

.lead-link-input {
  flex: 1 1 16rem;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.9rem;
}

.section {
  margin-top: 1.75rem;
}

.section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.form-grid {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.form-grid textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.btn-primary {
  background: var(--accent);
  color: #0a0e14;
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover {
  filter: brightness(1.08);
  color: #0a0e14;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border);
  margin-left: 0.85rem;
}

.timeline li {
  position: relative;
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.45rem 0 0.55rem 0.85rem;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0.95rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--bg);
}

.tl-icon {
  flex: 0 0 2.1rem;
  width: 2.1rem;
  height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 10px;
  background: #111820;
  border: 1px solid var(--border);
}

.tl-body {
  flex: 1;
  min-width: 0;
}

.tl-kind {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  font-weight: 600;
}

.tl-sum {
  font-weight: 500;
  margin: 0.15rem 0;
}

.tl-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.reminder-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.reminder-row:last-child {
  border-bottom: none;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-pending { background: #2a3f55; color: #9cc8ff; }
.badge-done { background: #1e3d2a; color: #7dcea0; }
.badge-cancelled { background: #3d2a2a; color: #f5b7b1; }

.task-list article,
.task-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.task-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.65rem;
}

.task-lead-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.task-avatar-link {
  flex-shrink: 0;
  text-decoration: none;
}

.task-avatar-wrap {
  position: relative;
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.task-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.task-avatar-fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #aeb6bf;
  background: linear-gradient(145deg, #2c3e50, #1a252f);
}

.task-avatar-fallback.is-visible {
  display: flex;
}

.task-avatar-wrap:not(:has(.task-avatar)) .task-avatar-fallback {
  display: flex;
}

.task-lead-info {
  min-width: 0;
}

.task-lead-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
}

.task-lead-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}

.task-lead-name:hover {
  text-decoration: underline;
}

.task-lead-company {
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.task-pipe-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #d5dbdb;
  white-space: nowrap;
}

.task-pipe-label {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-due {
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #f0c674;
  text-align: right;
  line-height: 1.35;
}

.task-due.overdue {
  color: #f1948a;
}

.task-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}

.task-draft {
  margin-bottom: 0.5rem;
  white-space: pre-wrap;
}

.task-empty {
  padding: 1.5rem 0;
}

.task-actions {
  margin-top: 0.65rem;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.lead-category-line {
  margin: 0.28rem 0 0.12rem;
}

.lead-category-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c8e6ff;
  background: rgba(91, 159, 216, 0.14);
  border: 1px solid rgba(91, 159, 216, 0.28);
  border-radius: 999px;
}

.hero-category-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-top: 0.45rem;
}

.category-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin-top: 0.55rem;
  padding-bottom: 0.25rem;
}

.category-chip-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
  align-items: center;
}

/* Справка (help.html) */
.help-doc {
  padding-bottom: 3rem;
}

.help-intro {
  margin: 0.35rem 0 0;
  max-width: 52rem;
  line-height: 1.5;
}

.help-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  padding: 0.85rem 0 1.25rem;
  margin: 0 0 0.25rem;
  border-bottom: 1px solid var(--border);
}

.help-toc a {
  font-size: 0.88rem;
  color: var(--accent);
  text-decoration: none;
}

.help-toc a:hover {
  text-decoration: underline;
}

.help-section {
  padding: 1.35rem 0 0.25rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.help-section:first-of-type {
  border-top: none;
  padding-top: 0.5rem;
}

.help-section h2 {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
  font-weight: 600;
  scroll-margin-top: 5rem;
}

.help-h3 {
  margin: 1rem 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.help-section p {
  margin: 0 0 0.65rem;
  line-height: 1.55;
  max-width: 52rem;
}

.help-steps {
  margin: 0;
  padding-left: 1.2rem;
  max-width: 52rem;
  line-height: 1.55;
}

.help-steps li {
  margin: 0.4rem 0;
}

.help-steps li::marker {
  color: var(--muted);
  font-weight: 600;
}

.help-changelog {
  margin: 0 0 0.75rem;
  padding-left: 1.1rem;
  max-width: 52rem;
  line-height: 1.5;
}

.help-changelog li {
  margin: 0.5rem 0;
}

.help-changelog time {
  font-weight: 600;
  color: var(--accent);
  margin-right: 0.35rem;
}

.help-note {
  margin: 0;
  font-size: 0.84rem;
  max-width: 52rem;
}

.help-code {
  font-size: 0.88em;
}

/* —— Statistics —— */
.stats-page {
  padding: 1.25rem 1.5rem 2rem;
}

.stats-intro {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
}

.stats-toolbar {
  margin-top: 0.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}

.stat-card-accent {
  border-color: rgba(91, 159, 216, 0.45);
}

.stat-card-success {
  border-color: rgba(34, 197, 94, 0.4);
  background: linear-gradient(145deg, #1a2332, #152a22);
}

.stat-card-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat-card-pct {
  margin: 0.45rem 0 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}

.stat-card-pct-sub {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.2rem;
}

.stat-card-hint {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
}

.stats-meta {
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

.stats-subtitle {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.65rem;
}

.stats-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 28rem;
}

.stats-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.65rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
}

.stats-status-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

/* —— Phase 1: presets, advanced filters, bulk —— */
.filter-presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: flex-end;
  margin-top: 0.75rem;
  padding: 0.65rem 1.5rem;
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  border-top: 1px solid var(--border);
  background: rgba(26, 35, 50, 0.25);
}

.filter-text {
  min-width: 8rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
}

.filter-select-preset {
  min-width: 11rem;
}

.btn-muted {
  opacity: 0.85;
}

.filters-advanced {
  margin-top: 0.5rem;
}

.filters-advanced-summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.toolbar-filters-advanced {
  padding-bottom: 0.5rem;
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.35rem 0;
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.65rem 1.5rem;
  margin: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 1;
}

body.list-scrolled .bulk-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(15, 20, 25, 0.98);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.scroll-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.5rem;
  z-index: 210;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(91, 159, 216, 0.55);
  background: linear-gradient(145deg, #243447, #1a2a3d);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.scroll-to-top:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: #fff;
}

.scroll-to-top:active {
  transform: translateY(0);
}

.scroll-to-top[hidden] {
  display: none !important;
}

.bulk-count {
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 6rem;
}

.bulk-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.bulk-bar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.card-select-wrap {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 5;
  cursor: pointer;
}

.card-select {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.card.is-selected {
  border-color: rgba(91, 159, 216, 0.65);
  box-shadow: 0 0 0 1px rgba(91, 159, 216, 0.35);
}

/* Admin */
.admin-intro {
  margin-top: 0.35rem;
  max-width: 42rem;
}

.admin-gate {
  max-width: 22rem;
  margin: 1.5rem auto;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(91, 159, 216, 0.25);
  border-radius: 8px;
  background: rgba(26, 42, 61, 0.55);
}

.admin-gate-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
}

.admin-err {
  color: #f5a8a8;
  margin-top: 0.65rem;
  font-size: 0.88rem;
}

.admin-page {
  max-width: 52rem;
  margin: 0 auto 3rem;
}

.admin-warn {
  border-left: 3px solid #c0392b;
  padding-left: 0.75rem;
  margin-bottom: 1rem;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.admin-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.65rem;
  border-radius: 6px;
  background: rgba(15, 20, 25, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-stat-n {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th,
.admin-table td {
  padding: 0.4rem 0.55rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-op-card {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 8px;
  border: 1px solid rgba(200, 80, 80, 0.35);
  background: rgba(40, 18, 18, 0.35);
}

.admin-op-card--muted {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(15, 20, 25, 0.45);
}

.admin-op-title {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.admin-op-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin: 0.65rem 0;
}

.admin-op-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.btn-danger {
  background: linear-gradient(145deg, #8b2e2e, #6b1f1f) !important;
  border-color: #a04040 !important;
}

.btn-danger:hover {
  filter: brightness(1.08);
}

.admin-preview {
  white-space: pre-wrap;
  font-size: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-height: 16rem;
  overflow: auto;
}

.admin-logout-admin {
  margin-top: 1.5rem;
}

.site-nav a.nav-admin {
  color: #e8a87c;
}

/* Кабинет лида — вкладки */
.cabinet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 1.25rem 0 0;
  padding: 0.35rem 0.35rem 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 14, 18, 0.55);
  border-radius: 8px 8px 0 0;
}

.cabinet-tab {
  appearance: none;
  position: relative;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted, #8b98a8);
  border-radius: 6px 6px 0 0;
  padding: 0.55rem 0.95rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.cabinet-tab:hover:not(.is-active) {
  color: #dce6f0;
  background: rgba(255, 255, 255, 0.04);
}

.cabinet-tab.is-active {
  color: #fff;
  background: linear-gradient(180deg, rgba(91, 159, 216, 0.28) 0%, rgba(36, 52, 71, 0.95) 100%);
  border-color: rgba(91, 159, 216, 0.65);
  box-shadow:
    0 -2px 0 0 var(--accent, #5b9fd8) inset,
    0 4px 14px rgba(91, 159, 216, 0.2);
  z-index: 2;
}

.cabinet-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: 0.35rem;
  height: 2px;
  border-radius: 2px;
  background: var(--accent, #5b9fd8);
}

.cabinet-tab-panels {
  margin-top: 0;
  padding: 0.85rem 0.15rem 0;
  border: 1px solid rgba(91, 159, 216, 0.2);
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: rgba(15, 20, 25, 0.35);
}

.cabinet-tab-panel {
  margin-top: 0;
}

.cabinet-tab-panel.is-active {
  animation: cabinet-tab-in 0.18s ease-out;
}

@keyframes cabinet-tab-in {
  from { opacity: 0.55; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.cabinet-block-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #dce6f0;
}

.cabinet-block-title--list {
  margin-top: 1.5rem;
}

/* Напоминание / задача — компактная форма и список */
.rem-tab-head {
  margin-bottom: 0.75rem;
}

.rem-tab-hint {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
}

.rem-compose-card {
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(15, 20, 25, 0.5);
  margin-bottom: 1rem;
}

.rem-compose-card--single {
  margin-bottom: 1rem;
}

.rem-form-single {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.rem-form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.65rem;
  flex: 1 1 100%;
  min-width: 0;
}

.rem-form-row--actions {
  justify-content: flex-end;
  margin-top: 0.15rem;
}

.rem-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.rem-field--when {
  flex: 0 0 auto;
}

.rem-field--topic {
  flex: 1 1 10rem;
  min-width: 8rem;
}

.rem-field--text {
  flex: 1 1 100%;
}

.rem-field-lbl {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.rem-dt-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.rem-dt-inline .input-date,
.rem-dt-inline .input-time,
.rem-dt-inline .input-dt-eu {
  min-height: 2.15rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  width: auto;
}

.input-dt-eu {
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  color-scheme: dark;
}

.input-dt-eu--date {
  width: 6.5rem;
}

.input-dt-eu--time {
  width: 4.25rem;
}

.input-dt-eu:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(91, 159, 216, 0.25);
}

.input-dt-eu::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.rem-dt-pick-wrap {
  display: inline-flex;
  align-items: stretch;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  overflow: hidden;
}

.rem-dt-pick-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(91, 159, 216, 0.25);
}

.rem-dt-pick-wrap .input-dt-eu {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.rem-dt-pick-wrap .input-dt-eu:focus {
  box-shadow: none;
}

.rem-dt-pick-slot {
  position: relative;
  flex: 0 0 2.35rem;
  width: 2.35rem;
  min-height: 2.15rem;
  border-left: 1px solid var(--border);
  background: rgba(91, 159, 216, 0.12);
  cursor: pointer;
}

.rem-dt-pick-slot:hover {
  background: rgba(91, 159, 216, 0.22);
}

.rem-dt-pick-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  pointer-events: none;
}

.rem-dt-native-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  opacity: 0.001;
  cursor: pointer;
  font-size: 16px;
  color-scheme: dark;
  z-index: 2;
}

.rem-dt-native-overlay::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  cursor: pointer;
  opacity: 0;
}

.rem-field input[type="text"],
.rem-field textarea {
  min-height: 2.15rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.88rem;
}

.rem-field textarea {
  min-height: 3.2rem;
  resize: vertical;
}

.btn-rem-submit {
  flex: 0 0 auto;
  align-self: flex-end;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.rem-list-wrap {
  margin-top: 0.25rem;
}

.rem-list-compact {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rem-list-empty {
  margin: 0;
  padding: 0.65rem 0;
  font-size: 0.85rem;
}

.rem-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.rem-item:last-child {
  border-bottom: none;
}

.rem-item-main {
  flex: 1 1 auto;
  min-width: 0;
}

.rem-item-line {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.35;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.35rem;
}

.rem-item-when {
  font-variant-numeric: tabular-nums;
  color: #9cc8ff;
  font-weight: 600;
  white-space: nowrap;
}

.rem-item-sep {
  color: var(--muted);
  opacity: 0.65;
}

.rem-item-topic {
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.rem-item-badge {
  margin-left: auto;
  flex-shrink: 0;
}

.rem-item-text {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rem-item-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.25rem;
  padding-top: 0.1rem;
}

.btn-rem-icon {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(91, 159, 216, 0.45);
  background: rgba(36, 52, 71, 0.8);
  color: #abebc6;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.btn-rem-icon:hover {
  border-color: var(--accent);
  background: rgba(91, 159, 216, 0.2);
}

.btn-rem-icon--muted {
  color: #d4a5a5;
  border-color: rgba(255, 255, 255, 0.15);
  background: transparent;
}

.cabinet-tab-panel[hidden] {
  display: none !important;
}

.cabinet-subsection-title {
  margin-top: 1.75rem;
}

.cabinet-empty-hint {
  margin: 0.5rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  background: rgba(15, 20, 25, 0.45);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  font-size: 0.88rem;
}

#tabPanelStart .ai-msg-section {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.status-workflow-host {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.status-workflow-current {
  margin: 0;
  font-size: 1.05rem;
}

.status-workflow-hint {
  margin: 0;
}

.status-workflow-sales {
  margin-top: 0.25rem;
  padding: 1rem 1.1rem;
  border-radius: 8px;
  background: rgba(15, 20, 25, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-workflow-sales .section-title-sm {
  margin: 0 0 0.5rem;
}

.status-workflow-sales-body {
  margin: 0.5rem 0 0;
  max-height: 14rem;
  overflow: auto;
}

.status-workflow-action {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
}

.status-workflow-next-hint {
  margin: 0;
  font-size: 0.88rem;
}

/* —— Lead folders —— */
.folders-intro {
  margin: 0.25rem 0 0;
  max-width: 40rem;
}

.folders-layout {
  display: grid;
  grid-template-columns: minmax(12rem, 16rem) 1fr;
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto 2.5rem;
  padding: 0 1rem;
  align-items: start;
}

.folders-sidebar {
  position: sticky;
  top: 0.75rem;
  border: 1px solid rgba(91, 159, 216, 0.22);
  border-radius: 8px;
  padding: 0.75rem;
  background: rgba(18, 32, 48, 0.75);
}

.folder-create-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.folder-create-form input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  box-sizing: border-box;
}

.folder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: calc(100vh - 12rem);
  overflow-y: auto;
}

.folder-list-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.folder-list-item:hover {
  background: rgba(91, 159, 216, 0.12);
}

.folder-list-item.is-active {
  border-color: rgba(91, 159, 216, 0.45);
  background: rgba(91, 159, 216, 0.18);
}

.folder-list-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-list-count {
  flex-shrink: 0;
  font-size: 0.82rem;
}

.folder-list-empty {
  padding: 0.35rem 0;
  font-size: 0.88rem;
}

.folders-main {
  min-width: 0;
}

.folder-empty {
  padding: 2rem 1rem;
  text-align: center;
  border: 1px dashed rgba(91, 159, 216, 0.25);
  border-radius: 8px;
}

.folder-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.folder-title {
  margin: 0;
  font-size: 1.35rem;
}

.folder-head-actions {
  margin-left: auto;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn-danger-muted {
  color: #f5a8a8;
  border-color: rgba(192, 57, 43, 0.45);
}

.folder-toolbar {
  margin-bottom: 0.5rem;
}

.folder-pipe-chips {
  margin-bottom: 0.65rem;
}

.folder-bulk-bar {
  position: static;
  margin-bottom: 0.75rem;
  border-radius: 8px;
}

.folder-grid {
  margin-top: 0.25rem;
}

.folder-lead-card .actions {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

@media (max-width: 768px) {
  .folders-layout {
    grid-template-columns: 1fr;
  }

  .folders-sidebar {
    position: static;
    max-height: none;
  }

  .folder-list {
    max-height: 12rem;
  }
}
