/* =========================================================
   Нежный плавный дизайн: пастель, стекло, мягкие тени, плавные анимации
   ========================================================= */
:root {
  --ink:        #4a4760;
  --ink-soft:   #6c6986;
  --muted:      #9b98b3;
  --line:       rgba(140, 120, 180, .14);
  --line-soft:  rgba(140, 120, 180, .08);

  /* нежная гамма: коралл → роза → лаванда */
  --accent:     #ff8fab;
  --accent-2:   #ffb6a0;
  --accent-3:   #c9a7ff;
  --grad:       linear-gradient(135deg, #ffb199 0%, #ff8fab 48%, #c9a7ff 100%);
  --grad-soft:  linear-gradient(135deg, #fff0f4, #f4eeff);

  --ok:         #34c79a;
  --ok-bg:      #e6f9f1;
  --no:         #ff7a9c;
  --no-bg:      #fff0f4;

  --ring:       0 0 0 4px rgba(255, 143, 171, .16);
  --shadow:     0 18px 50px -22px rgba(150, 120, 200, .40),
                0 4px 14px -8px rgba(150, 120, 200, .18);
  --shadow-sm:  0 8px 22px -14px rgba(150, 120, 200, .40);
  --radius:     22px;
  --radius-sm:  14px;
  --ease:       cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 8% -8%,  #ffe3ee 0%, transparent 58%),
    radial-gradient(1000px 680px at 102% 2%, #e4e6ff 0%, transparent 55%),
    radial-gradient(900px 640px at 50% 116%, #d9f5ff 0%, transparent 55%),
    linear-gradient(135deg, #fdf3fb 0%, #f4f0ff 50%, #eef7ff 100%);
  background-attachment: fixed;
  background-size: 160% 160%, 160% 160%, 160% 160%, 100% 100%;
  animation: drift 34s ease-in-out infinite alternate;
}
@keyframes drift {
  0%   { background-position: 0% 0%, 100% 0%, 50% 100%, 0 0; }
  100% { background-position: 12% 8%, 88% 6%, 46% 92%, 0 0; }
}

/* ----------  Шапка  ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: none; margin: 0; padding: 16px clamp(16px, 2.5vw, 44px);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.logo__pin { font-size: 22px; filter: drop-shadow(0 3px 6px rgba(255, 143, 171, .5)); }
.logo__text {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar__hint { color: var(--ink-soft); font-size: 14px; font-weight: 600; }

/* ----------  Раскладка  ---------- */
.container { max-width: none; margin: 0; padding: 26px clamp(16px, 2.5vw, 44px) 70px; }

.card {
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
  animation: card-in .6s var(--ease) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.hidden { display: none !important; }

/* ----------  Форма  ---------- */
.config__form {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 18px 20px;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field--keywords { grid-column: 1 / -1; }
.field > label { font-weight: 700; font-size: 13px; color: var(--ink); }
.field small, label small { color: var(--muted); font-weight: 600; }

input[type=text], input[type=number], input[type=password], input[type=search],
textarea, select {
  font: inherit; font-weight: 600; color: var(--ink);
  background: rgba(255, 255, 255, .85);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  width: 100%;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background .25s;
}
input::placeholder, textarea::placeholder { color: #b9b6cc; font-weight: 500; }
input:hover, textarea:hover, select:hover { border-color: rgba(255, 143, 171, .5); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  background: #fff; box-shadow: var(--ring);
}
textarea { resize: vertical; min-height: 70px; }

/* Сегментированный переключатель */
.segmented {
  display: inline-flex; background: rgba(244, 240, 255, .8);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 4px; gap: 4px;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  cursor: pointer; padding: 8px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 700; text-align: center; color: var(--muted);
  transition: background .3s var(--ease), color .3s var(--ease), box-shadow .3s var(--ease);
  line-height: 1.15;
}
.segmented label small { font-weight: 600; font-size: 11px; opacity: .8; }
.segmented input:checked + label {
  background: #fff; color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Дополнительно */
.advanced { grid-column: 1 / -1; border-top: 1px dashed var(--line); padding-top: 14px; }
.advanced summary {
  cursor: pointer; font-weight: 700; font-size: 13px; color: var(--ink-soft);
  list-style: none; transition: color .2s; display: inline-flex; align-items: center; gap: 6px;
}
.advanced summary::before { content: "⚙"; opacity: .7; }
.advanced summary:hover { color: var(--accent); }
.advanced__body { display: grid; gap: 14px; margin-top: 14px; max-width: 640px; animation: card-in .4s var(--ease) both; }
.checkbox { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }
code { background: rgba(244, 240, 255, .9); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

.config__actions { grid-column: 1 / -1; display: flex; gap: 12px; }

/* ----------  Кнопки  ---------- */
.btn {
  font: inherit; font-weight: 800; cursor: pointer; letter-spacing: .01em;
  border-radius: var(--radius-sm); padding: 13px 28px; border: 1.5px solid transparent;
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), background .25s, filter .25s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn--primary {
  background: var(--grad); background-size: 160% 160%; color: #fff;
  box-shadow: 0 12px 26px -10px rgba(255, 143, 171, .8);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -12px rgba(255, 143, 171, .9); filter: saturate(1.06); }
.btn--primary:disabled { filter: grayscale(.2) opacity(.7); cursor: default; transform: none; box-shadow: var(--shadow-sm); }
.btn--ghost { background: rgba(255, 255, 255, .8); border-color: var(--line); color: var(--ink-soft); }
.btn--ghost:hover { background: #fff; border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn--soft { background: rgba(255, 255, 255, .92); border-color: var(--accent); color: #d65f86; }
.btn--soft:hover { background: var(--grad); color: #fff; border-color: transparent; transform: translateY(-2px); box-shadow: 0 12px 24px -10px rgba(255, 143, 171, .8); }
.btn--link { background: transparent; border: none; color: var(--muted); }
.btn--link:hover { color: var(--no); }
.btn--sm { padding: 9px 16px; font-size: 13px; }
.saved-cities { width: auto; max-width: 300px; margin-left: auto; cursor: pointer; font-weight: 700; color: var(--ink-soft); }

/* ----------  Прогресс  ---------- */
.progress__bar { height: 10px; background: rgba(201, 167, 255, .18); border-radius: 99px; overflow: hidden; }
.progress__fill {
  height: 100%; width: 0; border-radius: 99px;
  background: var(--grad); background-size: 200% 100%;
  transition: width .5s var(--ease);
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer { to { background-position: 200% 0; } }
.progress__status { margin: 14px 0 16px; color: var(--ink-soft); font-size: 14px; font-weight: 600; min-height: 21px; }

.stats { display: flex; gap: 14px; flex-wrap: wrap; }
.stat {
  flex: 1 1 130px;
  background: rgba(255, 255, 255, .6);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat__num { font-size: 26px; font-weight: 800; line-height: 1.1; display: inline-block; }
.stat__label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.stat--ok .stat__num { color: var(--ok); }
.stat--no .stat__num { color: var(--no); }
.stat--builder .stat__num { color: #e8893a; }      /* янтарный — витрина */
.stat--constructor .stat__num { color: #5161e0; }  /* синий — конструктор */
.stat--social .stat__num { color: #0f9488; }       /* бирюзовый — соцсети */
.stat--muted .stat__num { color: var(--muted); }
.pop { animation: pop .45s var(--ease); }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.28); } 100% { transform: scale(1); } }

/* ----------  Ошибка  ---------- */
.error {
  display: flex; align-items: flex-start; gap: 12px;
  border: 1px solid #ffd0dc; background: rgba(255, 240, 244, .9); color: #b03a57; font-weight: 600;
}
.error__icon { font-size: 18px; }

/* ----------  Плашка кэша  ---------- */
.cache {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border: 1px solid rgba(201, 167, 255, .45);
  background: linear-gradient(135deg, rgba(255, 240, 246, .85), rgba(244, 238, 255, .85));
}
.cache__icon { font-size: 24px; filter: drop-shadow(0 3px 6px rgba(201, 167, 255, .5)); }
.cache__text { flex: 1 1 280px; font-weight: 600; color: var(--ink-soft); font-size: 14px; }
.cache__text b { color: var(--ink); font-weight: 800; }
.cache__text .cache__demo { color: var(--accent-3); font-weight: 800; }
.cache__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ----------  Результаты  ---------- */
.results__toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar__search { flex: 1 1 300px; }
.toolbar__select { flex: 0 0 auto; width: auto; cursor: pointer; }
.toolbar__count { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }

.table-wrap {
  overflow-x: auto; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: rgba(255, 255, 255, .5);
}
.grid { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 780px; table-layout: fixed; }
/* фиксированные пропорции колонок — ровная раскладка на любой ширине */
.grid th:nth-child(2), .grid td:nth-child(2) { width: 24%; }                        /* Название */
.grid th:nth-child(3), .grid td:nth-child(3) { width: 11%; }                        /* Категория */
.grid th:nth-child(4), .grid td:nth-child(4) { width: 14%; }                        /* Телефон */
.grid th:nth-child(5), .grid td:nth-child(5) { width: 21%; overflow-wrap: anywhere; } /* Сайт */
.grid th:nth-child(6), .grid td:nth-child(6) { width: 30%; }                        /* Адрес */
.grid thead th {
  position: sticky; top: 0; z-index: 1;
  background: rgba(252, 250, 255, .92);
  backdrop-filter: blur(6px);
  text-align: left; font-weight: 800; font-size: 12px; color: var(--muted);
  letter-spacing: .04em; text-transform: uppercase;
  padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.grid tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.grid tbody tr { transition: background .2s; cursor: pointer; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr:hover { background: rgba(255, 143, 171, .06); }
.col-idx { width: 46px; color: var(--muted); font-weight: 700; }

.row-enter { animation: row-in .45s var(--ease) both; }
@keyframes row-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.cell-name { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.cell-cat .tag {
  display: inline-block; background: rgba(201, 167, 255, .16); color: #7b5bb6;
  border-radius: 8px; padding: 3px 10px; font-size: 12.5px; font-weight: 700;
}
.cell-addr { color: var(--muted); font-weight: 600; overflow-wrap: anywhere; }
a.phone, a.site { color: #d65f86; text-decoration: none; font-weight: 700; transition: color .2s; }
a.phone:hover, a.site:hover { color: var(--accent-3); }

.badge-no {
  display: inline-block; background: var(--no-bg); color: var(--no);
  border-radius: 8px; padding: 3px 11px; font-size: 12px; font-weight: 800;
}
.badge-builder {
  display: inline-block; background: #fff3e6; color: #d9772a;
  border-radius: 8px; padding: 3px 9px; font-size: 12px; font-weight: 800; margin-right: 6px;
}
.badge-constructor {
  display: inline-block; background: #eef1ff; color: #5161e0;
  border-radius: 8px; padding: 3px 9px; font-size: 12px; font-weight: 800; margin-right: 6px;
}
.badge-social {
  display: inline-block; background: #e3f7f4; color: #0f9488;
  border-radius: 8px; padding: 3px 9px; font-size: 12px; font-weight: 800; margin-right: 6px;
}
.badge-yes-dot { color: var(--ok); margin-right: 6px; font-size: 10px; vertical-align: middle; }

.empty { padding: 38px; text-align: center; color: var(--muted); font-weight: 700; }

/* ----------  Скроллбары (мягкие)  ---------- */
.table-wrap::-webkit-scrollbar { height: 10px; }
.table-wrap::-webkit-scrollbar-thumb { background: rgba(201, 167, 255, .35); border-radius: 99px; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: rgba(201, 167, 255, .55); }

/* ----------  Адаптив  ---------- */
@media (max-width: 760px) {
  .config__form { grid-template-columns: 1fr; }
  .topbar__hint { display: none; }
  .card { padding: 18px; }
  .toolbar__count { margin-left: 0; width: 100%; }
}

/* ----------  Модалка карточки заведения  ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal.hidden { display: none !important; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(60, 50, 90, .45); backdrop-filter: blur(3px); }
.modal__box {
  position: relative; width: min(1200px, 94vw); height: min(820px, 88vh);
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
  animation: card-in .35s var(--ease) both;
}
.modal__head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal__title { font-weight: 800; font-size: 17px; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal__link { color: #d65f86; font-weight: 700; text-decoration: none; white-space: nowrap; font-size: 14px; }
.modal__link:hover { color: var(--accent-3); }
.modal__close {
  border: none; background: #f0f1f4; width: 36px; height: 36px; border-radius: 10px;
  cursor: pointer; font-size: 16px; color: var(--ink-soft); flex: 0 0 auto; transition: background .2s, color .2s;
}
.modal__close:hover { background: var(--no-bg); color: var(--no); }
.modal__body { flex: 1 1 auto; display: flex; min-height: 0; }
.modal__frame { border: 0; width: 100%; height: 100%; }
@media (max-width: 820px) {
  .modal { padding: 0; }
  .modal__box { width: 100vw; height: 100vh; border-radius: 0; }
}

/* ----------  Навигация в шапке  ---------- */
.topnav { margin-left: auto; display: flex; gap: 18px; align-items: center; }
.topnav a { color: var(--ink-soft); font-weight: 700; text-decoration: none; font-size: 14px; transition: color .2s; }
.topnav a:hover { color: var(--accent); }

/* ----------  Логин  ---------- */
.login { max-width: 520px; margin: 16vh auto 0; padding: 32px; }
.login__form { display: flex; flex-direction: column; gap: 16px; }
.login__form input { padding: 15px 16px; }
.login__form .btn { padding: 15px; }
.login__title { font-weight: 800; font-size: 20px; text-align: center; }
.login__err { background: var(--no-bg); color: var(--no); border-radius: 10px; padding: 9px 12px; font-weight: 700; text-align: center; }

/* ----------  Доска лидов (канбан)  ---------- */
.board-main { max-width: none; margin: 0; padding: 22px clamp(16px, 2.5vw, 44px) 30px; }
.board-config { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.board-config .field--city { flex-direction: row; align-items: center; gap: 8px; }
.board-config .field--city > label { font-size: 13px; }
.board-config__hint { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 700; }

.board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 16px; }
.col {
  flex: 1 1 0; min-width: 244px; background: rgba(255, 255, 255, .6);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  display: flex; flex-direction: column; max-height: calc(100vh - 230px);
  transition: border-color .2s, background .2s;
}
.col--over { border-color: var(--accent); background: rgba(255, 143, 171, .1); }
.col__head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.col__title { font-weight: 800; }
.col__count { margin-left: auto; background: #eef0f4; color: var(--ink-soft); border-radius: 99px; padding: 1px 9px; font-size: 12px; font-weight: 800; }
.col__list { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1 1 auto; min-height: 120px; }

.lead {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px;
  cursor: grab; box-shadow: var(--shadow-sm); transition: box-shadow .2s;
}
.lead:hover { box-shadow: 0 10px 22px -12px rgba(150, 120, 200, .5); }
.lead--drag { opacity: .45; }
.lead__name { font-weight: 800; font-size: 14px; margin-bottom: 6px; line-height: 1.25; }
.lead__meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.lead__phone { margin-top: 6px; font-size: 13px; }
.lead__note { margin-top: 8px; font-size: 12.5px; color: var(--ink-soft); background: #f7f8fa; border-radius: 8px; padding: 5px 8px; cursor: text; white-space: pre-wrap; word-break: break-word; }
.lead__note--empty { color: var(--muted); font-style: italic; }

@media (max-width: 760px) { .board { display: block; } .col { max-height: none; margin-bottom: 14px; } }

/* ----------  Уважение к настройкам анимации  ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
