/* =====================================================================
   Ahrefs Donors — liquid glass
   1. Токены (светлая / тёмная)      6. Кабинет: шапка, навигация
   2. База                             7. Проверка: загрузка, список, теги
   3. Стеклянные поверхности           8. Дашборд
   4. Кнопки, поля, переключатели      9. Настройки
   5. Лендинг и вход                   10. Тосты, поповеры, адаптив
   ===================================================================== */

/* ================================================================
   1. ДИЗАЙН-ТОКЕНЫ
   ================================================================ */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);

  --page-gap: 20px;
  --cell-gap: 16px;
  --card-pad-x: 20px;
  --col-dr: 72px;
  --col-lang: 84px;
  --col-urls: 72px;
  /* Стартовые ширины колонки кнопок; после отрисовки JS подставляет точную (--col-actions) */
  --col-actions-dist: 390px;
  --col-actions-wl: 230px;
  --col-actions-bl: 250px;

  --r-panel: 28px;
  --r-card: 22px;
  --r-inner: 14px;
}

/* ---------- Светлая тема ---------- */
:root,
:root[data-theme="light"] {
  color-scheme: light;

  --scene-base: #dfe3e9;
  --scene:
    radial-gradient(55% 45% at 80% 2%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(97deg,
      rgba(0, 0, 0, 0) 12%, rgba(112, 124, 148, 0.16) 19%, rgba(0, 0, 0, 0) 27%,
      rgba(0, 0, 0, 0) 51%, rgba(112, 124, 148, 0.13) 58%, rgba(0, 0, 0, 0) 66%),
    linear-gradient(180deg,
      rgba(0, 0, 0, 0) 26%, rgba(112, 124, 148, 0.11) 34%, rgba(0, 0, 0, 0) 43%),
    radial-gradient(42% 32% at 28% 46%, rgba(178, 200, 232, 0.38) 0%, rgba(178, 200, 232, 0) 70%),
    linear-gradient(180deg, #eef0f4 0%, #e1e5eb 45%, #d2d7df 100%);

  --text-primary: #111317;
  --text-secondary: #565e6c;
  --text-muted: #6f7886;

  --glass-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.64) 0%, rgba(255, 255, 255, 0.36) 100%);
  --glass-bg-hover: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.52) 100%);
  --glass-blur: blur(22px) saturate(150%);
  --rim: linear-gradient(160deg,
    rgba(255, 255, 255, 1) 0%,
    rgba(255, 255, 255, 0.55) 30%,
    rgba(255, 255, 255, 0.3) 62%,
    rgba(255, 255, 255, 0.95) 100%);
  --glass-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.9),
    inset 0 -10px 18px -12px rgba(110, 128, 158, 0.28),
    0 16px 34px -14px rgba(15, 23, 42, 0.2),
    0 2px 6px rgba(15, 23, 42, 0.05);
  --glass-shadow-sm:
    inset 0 1px 1px rgba(255, 255, 255, 0.92),
    0 6px 16px -6px rgba(15, 23, 42, 0.14),
    0 1px 3px rgba(15, 23, 42, 0.05);

  --well-bg: rgba(255, 255, 255, 0.4);
  --well-shadow:
    inset 0 2px 4px rgba(15, 23, 42, 0.08),
    inset 0 -1.5px 2px rgba(255, 255, 255, 0.9),
    0 4px 10px rgba(15, 23, 42, 0.05);

  --seg-active-bg: linear-gradient(180deg, rgba(176, 204, 240, 0.9) 0%, rgba(145, 180, 226, 0.92) 100%);
  --seg-active-shadow:
    inset 0 1.5px 2px rgba(255, 255, 255, 0.9),
    inset 0 -2px 4px rgba(68, 108, 162, 0.25),
    0 4px 12px rgba(95, 140, 198, 0.25);
  --seg-active-text: #0d131a;
  --divider: rgba(105, 150, 211, 0.45);

  --primary-bg: linear-gradient(180deg, rgba(156, 190, 233, 0.95) 0%, rgba(121, 162, 216, 0.95) 100%);
  --primary-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.85),
    inset 0 -3px 6px rgba(52, 90, 142, 0.35),
    0 8px 20px -6px rgba(90, 136, 195, 0.45);
  --primary-text: #0d131a;

  --chip-bg: rgba(255, 255, 255, 0.55);
  --chip-bg-hover: rgba(255, 255, 255, 0.88);
  --badge-bg: rgba(255, 255, 255, 0.62);
  --badge-border: rgba(255, 255, 255, 0.9);
  --badge-text: #263040;
  --badge-hi-bg: rgba(164, 200, 244, 0.55);
  --badge-hi-text: #163a66;

  --link: #255799;
  --icon-accent: #4d7ab8;
  --hairline: rgba(255, 255, 255, 0.7);
  --inner-item-bg: rgba(255, 255, 255, 0.5);

  --ext-bg: rgba(255, 255, 255, 0.72);
  --ext-text: #3b6db3;
  --ext-hover-bg: #6895d2;
  --ext-hover-text: #ffffff;

  --danger-bg: rgba(244, 182, 182, 0.55);
  --danger-text: #7c1d1d;
  --success-bg: rgba(176, 224, 192, 0.6);
  --success-text: #13532c;
  --tag-ok-bg: rgba(169, 219, 184, 0.55);
  --tag-ok-text: #155229;
  --tag-warn-bg: rgba(243, 206, 162, 0.6);
  --tag-warn-text: #6e3f09;
  --tag-muted-bg: rgba(255, 255, 255, 0.6);
  --tag-muted-text: #4f5866;

  --drop-border: rgba(105, 140, 190, 0.42);
  --drop-border-active: #6895d2;
  --drop-active-bg: rgba(180, 208, 245, 0.35);

  --toast-bg: rgba(255, 255, 255, 0.9);
  --popover-bg: rgba(248, 250, 252, 0.94);
  --popover-shadow: 0 24px 48px -14px rgba(15, 23, 42, 0.35), 0 2px 8px rgba(15, 23, 42, 0.08);

  --track-bg: rgba(255, 255, 255, 0.42);
  --track-on: rgba(205, 222, 245, 0.6);
  --knob-bg: #f6f8fa;
  --knob-on: linear-gradient(180deg, #86aee3 0%, #6895d2 100%);
  --knob-on-shadow: 0 3px 8px rgba(72, 118, 182, 0.45), inset 0 1px 2px rgba(255, 255, 255, 0.75);
  --check-on-text: #ffffff;

  /* Графики (палитра проверена на CVD: зелёный/коралловый/синий) */
  --c-dist: #5a87cc;
  --c-good: #1c7f4f;
  --c-bad: #f08c5a;
  --c-warn: #d99a2b;
  --c-muted: #a3aab8;
  --bar-track: rgba(255, 255, 255, 0.5);
  --chart-axis: rgba(86, 94, 108, 0.22);
}

/* ---------- Тёмная тема ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;

  --scene-base: #26272e;
  --scene:
    radial-gradient(55% 45% at 80% 2%, rgba(178, 180, 194, 0.6) 0%, rgba(178, 180, 194, 0) 70%),
    linear-gradient(97deg,
      rgba(0, 0, 0, 0) 12%, rgba(12, 12, 18, 0.42) 19%, rgba(0, 0, 0, 0) 27%,
      rgba(0, 0, 0, 0) 51%, rgba(12, 12, 18, 0.36) 58%, rgba(0, 0, 0, 0) 66%),
    linear-gradient(180deg,
      rgba(0, 0, 0, 0) 26%, rgba(12, 12, 18, 0.3) 34%, rgba(0, 0, 0, 0) 43%),
    radial-gradient(42% 32% at 28% 46%, rgba(108, 112, 134, 0.38) 0%, rgba(108, 112, 134, 0) 70%),
    linear-gradient(180deg, #5b5d69 0%, #3d3e48 42%, #25262d 100%);

  --text-primary: #f3f4f7;
  --text-secondary: #a9acb8;
  --text-muted: #8a8d9a;

  --glass-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.085) 0%, rgba(255, 255, 255, 0.025) 100%) rgba(22, 23, 29, 0.26);
  --glass-bg-hover: linear-gradient(180deg, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0.045) 100%) rgba(22, 23, 29, 0.26);
  --glass-blur: blur(24px) saturate(140%);
  --rim: linear-gradient(160deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.14) 22%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.12) 80%,
    rgba(255, 255, 255, 0.42) 100%);
  --glass-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -12px 24px -16px rgba(255, 255, 255, 0.12),
    0 22px 44px -18px rgba(0, 0, 0, 0.6),
    0 2px 6px rgba(0, 0, 0, 0.22);
  --glass-shadow-sm:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 24px -12px rgba(0, 0, 0, 0.55),
    0 1px 3px rgba(0, 0, 0, 0.2);

  --well-bg: rgba(10, 11, 15, 0.3);
  --well-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.38),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06);

  --seg-active-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.17) 0%, rgba(255, 255, 255, 0.07) 100%);
  --seg-active-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    0 6px 16px -6px rgba(0, 0, 0, 0.55);
  --seg-active-text: #ffffff;
  --divider: rgba(255, 255, 255, 0.14);

  --primary-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0.1) 100%);
  --primary-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    inset 0 -2px 6px rgba(0, 0, 0, 0.18),
    0 10px 24px -10px rgba(0, 0, 0, 0.6);
  --primary-text: #ffffff;

  --chip-bg: rgba(255, 255, 255, 0.06);
  --chip-bg-hover: rgba(255, 255, 255, 0.13);
  --badge-bg: rgba(255, 255, 255, 0.07);
  --badge-border: rgba(255, 255, 255, 0.1);
  --badge-text: #dfe1e8;
  --badge-hi-bg: rgba(160, 185, 255, 0.17);
  --badge-hi-text: #d0dbff;

  --link: #bccbf5;
  --icon-accent: #e8e9ee;
  --hairline: rgba(255, 255, 255, 0.08);
  --inner-item-bg: rgba(255, 255, 255, 0.04);

  --ext-bg: rgba(255, 255, 255, 0.08);
  --ext-text: #e3e5ec;
  --ext-hover-bg: rgba(255, 255, 255, 0.9);
  --ext-hover-text: #1b1c22;

  --danger-bg: rgba(255, 110, 110, 0.16);
  --danger-text: #ffb4b4;
  --success-bg: rgba(110, 220, 155, 0.14);
  --success-text: #a3eac2;
  --tag-ok-bg: rgba(110, 220, 155, 0.14);
  --tag-ok-text: #a3eac2;
  --tag-warn-bg: rgba(245, 180, 105, 0.15);
  --tag-warn-text: #f5c78f;
  --tag-muted-bg: rgba(255, 255, 255, 0.07);
  --tag-muted-text: #b9bcc7;

  --drop-border: rgba(255, 255, 255, 0.18);
  --drop-border-active: rgba(255, 255, 255, 0.6);
  --drop-active-bg: rgba(255, 255, 255, 0.06);

  --toast-bg: rgba(38, 39, 47, 0.92);
  --popover-bg: rgba(44, 45, 54, 0.96);
  --popover-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08);

  --track-bg: rgba(255, 255, 255, 0.07);
  --track-on: rgba(255, 255, 255, 0.22);
  --knob-bg: #d8dae1;
  --knob-on: linear-gradient(180deg, #ffffff 0%, #d4d6de 100%);
  --knob-on-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), inset 0 1px 1px rgba(255, 255, 255, 1);
  --check-on-text: #1b1c22;

  --c-dist: #6f93dc;
  --c-good: #2f9064;
  --c-bad: #d6627a;
  --c-warn: #d9a441;
  --c-muted: #6c707c;
  --bar-track: rgba(255, 255, 255, 0.06);
  --chart-axis: rgba(255, 255, 255, 0.12);
}

/* ================================================================
   2. БАЗА
   ================================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--scene-base);
}

body {
  min-height: 100vh;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  color: var(--text-primary);
  padding: 32px 20px 80px;
  background: transparent;
  line-height: 1.4;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--scene);
  pointer-events: none;
}

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

svg {
  display: block;
  flex-shrink: 0;
}

a {
  color: var(--link);
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 2000;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--toast-bg);
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app-container {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--page-gap);
}

.app-main {
  display: flex;
  flex-direction: column;
  gap: var(--page-gap);
  min-width: 0;
}

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

/* ================================================================
   3. LIQUID GLASS: поверхность + светящийся кант
   ================================================================ */
.glass-panel,
.btn-pill,
.tabs-pill-bar,
.search-pill,
.domain-card,
.theme-switch,
.toast-item,
.select-pill {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 0;
}

.glass-panel::before,
.btn-pill::before,
.tabs-pill-bar::before,
.search-pill::before,
.domain-card::before,
.theme-switch::before,
.toast-item::before,
.select-pill::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--rim);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

.glass-panel {
  border-radius: var(--r-panel);
  box-shadow: var(--glass-shadow);
  padding: 20px 24px;
}

/* ================================================================
   4. КНОПКИ, ПОЛЯ, ПЕРЕКЛЮЧАТЕЛИ
   ================================================================ */
.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: var(--glass-shadow-sm);
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease, color 0.18s ease;
  user-select: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-pill:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-1px);
}

.btn-pill:active {
  transform: translateY(0.5px);
}

.btn-pill:focus-visible,
.tab-btn:focus-visible,
.theme-opt:focus-visible,
.json-chip:focus-visible,
.ext-link-icon:focus-visible,
.filter-chip:focus-visible,
.seg-btn:focus-visible,
.tag-option:focus-visible,
.input-action:focus-visible,
.color-pick:focus-visible,
.swatch-btn:focus-visible,
[data-tip]:focus-visible {
  outline: 2px solid var(--icon-accent);
  outline-offset: 2px;
}

.btn-pill.btn-primary {
  background: var(--primary-bg);
  box-shadow: var(--primary-shadow);
  color: var(--primary-text);
}

.btn-pill.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-pill.btn-sm {
  height: 36px;
  padding: 0 15px;
  font-size: 13.5px;
}

.btn-pill.btn-icon {
  width: 40px;
  height: 36px;
  padding: 0;
}

.btn-pill.btn-block {
  width: 100%;
  height: 48px;
  font-size: 15.5px;
}

.btn-pill.btn-danger:hover {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.btn-pill.btn-success:hover {
  background: var(--success-bg);
  color: var(--success-text);
}

.btn-pill[aria-expanded="true"] {
  background: var(--seg-active-bg);
  box-shadow: var(--seg-active-shadow);
  color: var(--seg-active-text);
}

.btn-pill[disabled],
.btn-pill[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.btn-pill.is-busy {
  pointer-events: none;
  opacity: 0.7;
}

/* Поля ввода (вдавленная «лунка» стекла) */
.glass-input {
  width: 100%;
  height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  background: var(--well-bg);
  box-shadow: var(--well-shadow);
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

.glass-input::placeholder {
  color: var(--text-muted);
}

.glass-input:focus {
  box-shadow: var(--well-shadow), 0 0 0 3px color-mix(in srgb, var(--icon-accent) 28%, transparent);
}

.field {
  display: grid;
  gap: 7px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-with-action {
  position: relative;
  display: block;
}

.input-with-action .glass-input {
  padding-right: 50px;
}

.input-action {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.input-action:hover,
.input-action[aria-pressed="true"] {
  color: var(--text-primary);
  background: var(--chip-bg);
}

/* Чекбокс-капля */
.check-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
  user-select: none;
}

.check-wrap input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-box {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--well-bg);
  box-shadow: var(--well-shadow);
  display: grid;
  place-items: center;
  color: transparent;
  transition: background 0.2s ease, color 0.2s ease;
}

.check-box svg {
  stroke-width: 3;
}

.check-wrap input:checked + .check-box {
  background: var(--knob-on);
  box-shadow: var(--knob-on-shadow);
  color: var(--check-on-text);
}

.check-wrap input:focus-visible + .check-box {
  outline: 2px solid var(--icon-accent);
  outline-offset: 2px;
}

.text-link {
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.form-alert {
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--chip-bg);
  border: 1px solid var(--badge-border);
}

.form-alert.is-error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: transparent;
}

/* Переключатель темы */
.theme-switch {
  display: inline-grid;
  grid-template-columns: 40px 40px;
  height: 44px;
  padding: 4px;
  border-radius: 9999px;
  box-shadow: var(--glass-shadow);
  flex-shrink: 0;
}

.theme-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 40px;
  height: 36px;
  border-radius: 9999px;
  background: var(--seg-active-bg);
  box-shadow: var(--seg-active-shadow);
  transition: transform 0.4s var(--ease-spring);
  view-transition-name: theme-thumb;
}

:root[data-theme="dark"] .theme-thumb {
  transform: translateX(40px);
}

.theme-opt {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  height: 36px;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s ease;
}

.theme-opt:hover {
  color: var(--text-primary);
}

.theme-opt[aria-pressed="true"] {
  color: var(--seg-active-text);
}

/* Сегменты-табы */
.tabs-pill-bar {
  display: inline-flex;
  align-items: center;
  height: 52px;
  padding: 5px;
  border-radius: 9999px;
  box-shadow: var(--glass-shadow);
}

.tab-btn {
  position: relative;
  height: 42px;
  padding: 0 20px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.tab-btn:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 28%;
  height: 44%;
  width: 1px;
  background: var(--divider);
  border-radius: 2px;
}

.tab-btn.active::after,
.tab-btn:has(+ .tab-btn.active)::after {
  display: none;
}

.tab-btn.active {
  background: var(--seg-active-bg);
  box-shadow: var(--seg-active-shadow);
  color: var(--seg-active-text);
}

.tab-count {
  min-width: 30px;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  text-align: center;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-variant-numeric: tabular-nums;
}

/* Мини-сегменты внутри панелей */
.seg-control {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--well-bg);
  box-shadow: var(--well-shadow);
  flex-shrink: 0;
}

.seg-btn {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-secondary);
  cursor: pointer;
}

.seg-btn.active {
  background: var(--seg-active-bg);
  box-shadow: var(--seg-active-shadow);
  color: var(--seg-active-text);
}

.soon-badge {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--badge-hi-bg);
  color: var(--badge-hi-text);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Цветные метки для легенд и списков */
.key-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--c-muted);
}

.key-dot.is-dist { background: var(--c-dist); }
.key-dot.is-good { background: var(--c-good); }
.key-dot.is-bad { background: var(--c-bad); }
.key-dot.is-warn { background: var(--c-warn); }
.key-dot.is-muted { background: var(--c-muted); }

/* ================================================================
   5. ЛЕНДИНГ И ВХОД
   ================================================================ */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--primary-bg);
  box-shadow: var(--primary-shadow);
  color: var(--primary-text);
  flex-shrink: 0;
}

.brand-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.landing-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 12px 12px 16px;
}

.landing-menu ul {
  list-style: none;
  display: flex;
  gap: 18px;
}

.landing-menu a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.landing-menu a:hover {
  color: var(--text-primary);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.landing-grid {
  display: grid;
  gap: 28px;
}

.landing-grid.has-aside {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  align-items: start;
}

.landing-hero {
  padding: 28px 4px 8px;
  min-width: 0;
}

.placeholder-badge {
  display: inline-block;
  margin-bottom: 14px;
  padding: 4px 11px;
  border: 1.5px dashed var(--drop-border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--badge-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.hero-eyebrow svg {
  color: var(--icon-accent);
}

.hero-title {
  margin: 18px 0 14px;
  font-size: clamp(30px, 4.4vw, 50px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 760;
  max-width: 17ch;
  text-wrap: balance;
}

.hero-lead {
  max-width: 54ch;
  font-size: 17px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.hero-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.feature-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 20px;
  background: var(--chip-bg);
  border: 1px solid var(--badge-border);
}

.feature-item strong {
  display: block;
  font-size: 14px;
  line-height: 1.3;
}

.feature-item span:not(.feature-icon) {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.feature-icon {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--badge-bg);
  box-shadow: var(--glass-shadow-sm);
  color: var(--icon-accent);
}

.hero-preview {
  margin-top: 24px;
  display: grid;
  gap: 10px;
  max-width: 560px;
}

.demo-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 20px;
}

.demo-card .badge-label {
  display: inline;
}

.demo-actions {
  display: inline-flex;
  gap: 6px;
}

.demo-dot {
  width: 54px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--badge-border);
}

.demo-dot.is-good { background: var(--success-bg); }
.demo-dot.is-bad { background: var(--danger-bg); }

.landing-aside {
  position: sticky;
  top: 24px;
  min-width: 0;
}

.login-card {
  display: grid;
  gap: 18px;
  padding: 26px;
}

.login-card-head {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.login-card-head h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.login-card-head p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

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

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  font-size: 13.5px;
}

.login-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.page-login {
  display: grid;
  justify-items: center;
  padding-top: 24px;
}

.page-login .entry-content {
  width: min(440px, 100%);
}

.page-article {
  padding: 28px 30px;
}

.page-title {
  font-size: 26px;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.page-title a {
  color: inherit;
  text-decoration: none;
}

.entry-content {
  font-size: 15.5px;
  line-height: 1.6;
}

.entry-content > * + * {
  margin-top: 1em;
}

.entry-content ul,
.entry-content ol {
  padding-left: 1.4em;
}

.site-footer {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}

.empty-state-lg {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 56px 24px;
}

.empty-code {
  font-size: 56px;
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1;
}

/* ================================================================
   6. КАБИНЕТ: ШАПКА И НАВИГАЦИЯ
   ================================================================ */
.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "brand nav tools";
  align-items: center;
  gap: 14px 18px;
  padding: 12px 12px 12px 16px;
}

.app-header .brand {
  grid-area: brand;
}

.app-nav {
  grid-area: nav;
  height: 48px;
  padding: 4px;
}

.app-nav .tab-btn {
  height: 40px;
  padding: 0 16px;
  font-size: 14.5px;
}

.app-nav .tab-btn svg {
  color: var(--text-secondary);
}

.app-nav .tab-btn.active svg {
  color: currentColor;
}

.app-header .header-tools {
  grid-area: tools;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  max-width: 190px;
  padding: 0 14px 0 5px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--badge-border);
  font-size: 13.5px;
  font-weight: 600;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--seg-active-bg);
  box-shadow: var(--seg-active-shadow);
  color: var(--seg-active-text);
  font-size: 13px;
  font-weight: 700;
}

.user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout.btn-icon {
  width: 40px;
  height: 40px;
}

.btn-logout:hover {
  color: var(--danger-text);
}

/* ================================================================
   7. ПРОВЕРКА: ЗАГРУЗКА, СПИСОК, ТЕГИ
   ================================================================ */
.upload-panel {
  display: grid;
  gap: 16px;
  padding: 14px;
}

.drop-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1.5px dashed var(--drop-border);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.upload-panel.dragover .drop-area {
  background: var(--drop-active-bg);
  border-color: var(--drop-border-active);
}

.upload-info {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.upload-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: var(--chip-bg);
  box-shadow: var(--glass-shadow-sm);
  display: grid;
  place-items: center;
  color: var(--icon-accent);
}

.upload-text h2 {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.3;
}

.upload-text p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.45;
}

.json-status-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 0 8px 4px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.json-status-bar strong {
  color: var(--text-primary);
  font-weight: 600;
}

.json-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.json-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--badge-border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s ease;
  font-variant-numeric: tabular-nums;
}

.json-chip:hover {
  background: var(--chip-bg-hover);
}

.json-chip svg {
  color: var(--text-secondary);
}

/* Подтверждение после разбора / импорта */
.confirm-banner {
  display: none;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  animation: fadeIn 0.25s ease;
}

.confirm-banner.active {
  display: grid;
}

.confirm-details {
  min-width: 0;
}

.confirm-details h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.confirm-details p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.confirm-details strong {
  color: var(--text-primary);
}

.confirm-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.breakdown:empty {
  display: none;
}

.breakdown-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--badge-border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.breakdown-item b {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 8px;
  margin-top: 14px;
  border-radius: 999px;
  background: var(--well-bg);
  box-shadow: var(--well-shadow);
  overflow: hidden;
}

.progress-track.is-large {
  height: 12px;
}

.progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--knob-on);
  transition: width 0.35s ease;
}

.import-files {
  display: grid;
  gap: 8px;
  margin: 12px 0 14px;
}

.import-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 6px 14px;
  border-radius: 16px;
  background: var(--inner-item-bg);
  border: 1px solid var(--hairline);
  font-size: 13.5px;
}

.import-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.import-file-count {
  color: var(--text-secondary);
  font-size: 12.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.import-file-row.is-error {
  color: var(--danger-text);
}

.radio-group {
  border: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.radio-group legend {
  float: left;
  width: 100%;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.radio-pill {
  position: relative;
  cursor: pointer;
}

.radio-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-pill span {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--badge-border);
  font-size: 13px;
  font-weight: 600;
}

.radio-pill input:checked + span {
  background: var(--seg-active-bg);
  box-shadow: var(--seg-active-shadow);
  border-color: transparent;
  color: var(--seg-active-text);
}

.radio-pill input:focus-visible + span {
  outline: 2px solid var(--icon-accent);
  outline-offset: 2px;
}

/* Выпадающий список в стеклянной капсуле */
.select-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 4px 0 16px;
  border-radius: 999px;
  box-shadow: var(--glass-shadow-sm);
  flex-shrink: 0;
}

.select-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.select-pill select,
.glass-select {
  appearance: none;
  -webkit-appearance: none;
  height: 32px;
  padding: 0 30px 0 10px;
  border: 0;
  border-radius: 999px;
  background-color: transparent;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
}

.select-pill select:focus-visible,
.glass-select:focus-visible {
  box-shadow: 0 0 0 2px var(--icon-accent);
}

.glass-select {
  background-color: var(--chip-bg);
  border: 1px solid var(--badge-border);
}

.select-pill select option,
.glass-select option {
  color: initial;
}

/* Табы + поиск */
.toolbar-row {
  display: grid;
  grid-template-columns: auto minmax(240px, 360px);
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.search-pill {
  width: 100%;
  height: 52px;
  border-radius: 9999px;
  box-shadow: var(--glass-shadow);
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  color: var(--text-secondary);
}

.search-pill input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  color: var(--text-primary);
}

.search-pill input::-webkit-search-cancel-button {
  cursor: pointer;
}

.search-pill input::placeholder {
  color: var(--text-muted);
}

.search-pill:focus-within {
  box-shadow: var(--glass-shadow), 0 0 0 3px color-mix(in srgb, var(--icon-accent) 22%, transparent);
}

/* Фильтр по тегам + сортировка */
.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -6px;
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--badge-border);
  background: var(--chip-bg);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.filter-chip:hover {
  background: var(--chip-bg-hover);
}

.filter-chip.active {
  background: var(--seg-active-bg);
  box-shadow: var(--seg-active-shadow);
  border-color: transparent;
  color: var(--seg-active-text);
}

.filter-hint {
  font-size: 13px;
  color: var(--text-muted);
}

/* Панель вкладки */
.tab-action-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  padding-left: var(--card-pad-x);
}

.tab-summary {
  font-size: 13.5px;
  color: var(--text-secondary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tab-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* Прогресс проверки ссылок */
.progress-panel {
  padding: 18px 22px 20px;
  animation: fadeIn 0.25s ease;
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.progress-head h3 {
  font-size: 16px;
  font-weight: 700;
}

.progress-head p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* Сетка списка доменов (общие колонки у заголовка и карточек) */
.list-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  --row-cols: minmax(0, 1fr) var(--col-dr) var(--col-lang) var(--col-urls) var(--col-actions, var(--col-actions-dist));
}

.list-area[data-tab="whitelist"] {
  --row-cols: minmax(0, 1fr) var(--col-dr) var(--col-lang) var(--col-urls) var(--col-actions, var(--col-actions-wl));
}

.list-area[data-tab="blacklist"] {
  --row-cols: minmax(0, 1fr) var(--col-actions, var(--col-actions-bl));
}

.list-head {
  display: grid;
  grid-template-columns: var(--row-cols);
  column-gap: var(--cell-gap);
  align-items: center;
  padding: 0 var(--card-pad-x);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.domains-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.domain-card {
  border-radius: var(--r-card);
  box-shadow: var(--glass-shadow-sm);
  padding: 14px var(--card-pad-x);
  transition: background 0.15s ease, opacity 0.25s ease, transform 0.25s ease;
}

.domain-card:hover {
  background: var(--glass-bg-hover);
}

.domain-card.is-leaving {
  opacity: 0;
  transform: translateX(16px);
}

.domain-row-main {
  display: grid;
  grid-template-columns: var(--row-cols);
  column-gap: var(--cell-gap);
  row-gap: 10px;
  align-items: center;
  min-height: 36px;
}

.cell {
  min-width: 0;
}

.cell-dr,
.cell-lang,
.cell-urls {
  justify-self: center;
}

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

.cell-actions > * {
  flex-shrink: 0;
}

.list-head .cell-actions {
  display: block;
  text-align: right;
}

.cell-domain {
  display: flex;
  align-items: center;
  gap: 8px;
}

.domain-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.ext-link-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ext-bg);
  border: 1px solid var(--badge-border);
  color: var(--ext-text);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.ext-link-icon:hover {
  background: var(--ext-hover-bg);
  color: var(--ext-hover-text);
  transform: scale(1.06);
}

.domain-tags {
  display: flex;
  gap: 5px;
  min-width: 0;
  flex: 0 100 auto;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent);
}

.domain-tags:empty {
  display: none;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px 0 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tag) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--tag) 34%, transparent);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  flex-shrink: 0;
}

.tag-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tag);
  flex-shrink: 0;
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 46px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  color: var(--badge-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.metric-badge.dr-high {
  background: var(--badge-hi-bg);
  color: var(--badge-hi-text);
}

.metric-badge.lang-badge {
  text-transform: uppercase;
}

.badge-label {
  display: none;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
}

.check-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-muted);
}

.check-dot.is-alive { background: var(--c-good); }
.check-dot.is-checking,
.check-dot.is-queued { background: var(--c-accent, #5b8def); }
.check-dot.is-dead { background: var(--c-bad); }
.check-dot.is-partial,
.check-dot.is-error { background: var(--c-warn); }

/* Кнопка тегов в карточке */
.btn-tags .tags-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--knob-on);
  color: var(--check-on-text);
  font-size: 10.5px;
  font-weight: 750;
  line-height: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Спойлер с URL */
.details-spoiler {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  animation: fadeIn 0.2s ease;
}

.spoiler-header {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.url-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.url-item {
  background: var(--inner-item-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--r-inner);
  padding: 10px 14px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.url-item-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.url-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.url-link {
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
  word-break: break-all;
}

.url-link:hover {
  text-decoration: underline;
}

.url-title {
  font-size: 12px;
  color: var(--text-secondary);
}

.url-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.url-meta strong,
.url-context b {
  color: var(--text-primary);
}

.url-context {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.rel-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--tag-ok-bg);
  color: var(--tag-ok-text);
  white-space: nowrap;
}

.rel-tag.nofollow,
.rel-tag.state-error,
.rel-tag.state-partial {
  background: var(--tag-warn-bg);
  color: var(--tag-warn-text);
}

.rel-tag.state-dead {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.rel-tag.state-unchecked,
.rel-tag.state-checking,
.rel-tag.state-queued {
  background: var(--tag-muted-bg);
  color: var(--tag-muted-text);
}

.empty-state {
  text-align: center;
  padding: 46px 20px;
  color: var(--text-secondary);
  font-size: 15px;
}

.empty-state .btn-pill {
  margin-top: 14px;
}

.lazy-sentinel {
  text-align: center;
  padding: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.skeleton-card {
  height: 64px;
  border-radius: var(--r-card);
  background: var(--glass-bg);
  box-shadow: var(--glass-shadow-sm);
  animation: pulse 1.4s ease-in-out infinite;
}

/* ================================================================
   8. ДАШБОРД
   ================================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border-radius: 24px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.kpi-link {
  transition: background 0.15s ease, transform 0.18s ease;
}

.kpi-link:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-1px);
}

.kpi-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

.dash-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 24px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-head h2 {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-head p {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-number {
  font-size: 40px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-number small {
  margin-left: 2px;
  font-size: 20px;
  color: var(--text-secondary);
}

.stack-bar {
  display: flex;
  gap: 2px;
  height: 22px;
}

.stack-bar.is-thin {
  height: 14px;
}

.stack-seg {
  min-width: 4px;
  border-radius: 4px;
  flex-basis: 0;
  background: var(--c-muted);
  transition: filter 0.15s ease;
}

.stack-seg:hover {
  filter: brightness(1.08) saturate(1.1);
}

.stack-seg.is-dist { background: var(--c-dist); }
.stack-seg.is-good { background: var(--c-good); }
.stack-seg.is-bad { background: var(--c-bad); }
.stack-seg.is-muted { background: var(--c-muted); }

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 13px;
  color: var(--text-secondary);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend b {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--page-gap);
}

/* Колонки */
.col-chart {
  --label-h: 24px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  height: 210px;
  background: linear-gradient(var(--chart-axis), var(--chart-axis)) left bottom var(--label-h) / 100% 1px no-repeat;
}

.col {
  display: grid;
  grid-template-rows: minmax(0, 1fr) var(--label-h);
  min-width: 0;
  border-radius: 8px;
  outline-offset: 0;
}

.col-plot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 0;
  padding-top: 18px;
}

.col-value {
  min-height: 15px;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 650;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  line-height: 15px;
}

.col-bar,
.col-stack {
  width: 100%;
  max-width: 24px;
  flex-shrink: 0;
}

.col-bar {
  border-radius: 4px 4px 0 0;
  background: var(--c-dist);
  transition: filter 0.15s ease;
}

.col-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.col-seg {
  flex-basis: 0;
  min-height: 2px;
  border-radius: 1px;
}

.col-seg:first-child {
  border-radius: 4px 4px 1px 1px;
}

.col-seg.is-good { background: var(--c-good); }
.col-seg.is-bad { background: var(--c-bad); }

.col:hover .col-bar,
.col:hover .col-stack,
.col:focus-visible .col-bar {
  filter: brightness(1.1) saturate(1.1);
}

.col-label {
  padding-top: 7px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Горизонтальные полосы */
.hbar-list {
  display: grid;
  gap: 10px;
}

.hbar-row {
  display: grid;
  grid-template-columns: minmax(64px, 132px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.hbar-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hbar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--bar-track);
  overflow: hidden;
}

.hbar-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--c-dist);
}

.hbar-row:hover .hbar-fill {
  filter: brightness(1.1);
}

.hbar-value {
  min-width: 32px;
  text-align: right;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.subpanel {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}

.subpanel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.subpanel-head svg {
  color: var(--icon-accent);
}

.state-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.state-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--inner-item-bg);
  border: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--text-secondary);
}

.state-list b {
  margin-left: auto;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.state-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--c-muted);
}

.state-icon svg {
  stroke-width: 2.6;
}

.is-good > .state-icon { background: var(--c-good); }
.is-bad > .state-icon { background: var(--c-bad); }
.is-warn > .state-icon { background: var(--c-warn); }

.import-log {
  list-style: none;
  display: grid;
  gap: 8px;
}

.import-log li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--inner-item-bg);
  border: 1px solid var(--hairline);
}

.log-icon {
  width: 32px;
  height: 32px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--badge-bg);
  color: var(--icon-accent);
}

.log-main {
  min-width: 0;
}

.log-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 650;
}

.log-meta {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.log-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.log-stats b {
  font-size: 14px;
}

.panel-empty {
  padding: 8px 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

.dash-empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 56px 24px;
  text-align: center;
}

.dash-empty h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.dash-empty p {
  max-width: 52ch;
  color: var(--text-secondary);
  line-height: 1.5;
}

.chart-tooltip {
  position: fixed;
  z-index: 1500;
  pointer-events: none;
  padding: 7px 11px;
  border-radius: 10px;
  background: var(--popover-bg);
  border: 1px solid var(--badge-border);
  box-shadow: var(--popover-shadow);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ================================================================
   9. НАСТРОЙКИ
   ================================================================ */
.settings-panel {
  display: grid;
  gap: 18px;
  padding: 22px 24px;
}

.tag-create {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.color-pick {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  background: var(--well-bg);
  box-shadow: var(--well-shadow);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.color-pick.is-small {
  width: 40px;
  height: 40px;
  border-radius: 13px;
}

.color-pick .swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--tag);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.tag-list {
  list-style: none;
  display: grid;
  gap: 8px;
}

.tag-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 6px;
  border-radius: 18px;
  background: var(--inner-item-bg);
  border: 1px solid var(--hairline);
}

.tag-row .glass-input {
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  font-weight: 650;
}

.tag-row .glass-input:hover {
  background: var(--chip-bg);
}

.tag-row .glass-input:focus {
  background: var(--well-bg);
  box-shadow: var(--well-shadow), 0 0 0 3px color-mix(in srgb, var(--icon-accent) 28%, transparent);
}

.tag-usage {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.swatch-pop {
  display: grid;
  grid-template-columns: repeat(4, 32px);
  gap: 10px;
  padding: 12px;
}

.swatch-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--tag);
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
  transition: transform 0.15s ease;
}

.swatch-btn:hover {
  transform: scale(1.08);
}

.swatch-btn[aria-pressed="true"] {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.list-manage {
  list-style: none;
  display: grid;
  gap: 8px;
}

.list-manage li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  padding: 8px 8px 8px 16px;
  border-radius: 18px;
  background: var(--inner-item-bg);
  border: 1px solid var(--hairline);
}

.list-manage-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
}

.list-manage-actions {
  display: flex;
  gap: 8px;
}

/* ================================================================
   10. ПОПОВЕРЫ, ТОСТЫ, АНИМАЦИИ, АДАПТИВ
   ================================================================ */
.popover {
  position: fixed;
  z-index: 1200;
  min-width: 240px;
  max-width: min(320px, calc(100vw - 24px));
  max-height: min(380px, calc(100vh - 24px));
  overflow: auto;
  padding: 6px;
  border-radius: 20px;
  background: var(--popover-bg);
  border: 1px solid var(--badge-border);
  box-shadow: var(--popover-shadow);
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  animation: popIn 0.16s ease;
}

.popover-head {
  padding: 8px 10px 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tag-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 560;
  text-align: left;
  cursor: pointer;
}

.tag-option:hover {
  background: var(--chip-bg-hover);
}

.tag-option-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-option .check {
  margin-left: auto;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--well-bg);
  box-shadow: var(--well-shadow);
  color: transparent;
}

.tag-option .check svg {
  stroke-width: 3;
}

.tag-option[aria-checked="true"] .check {
  background: var(--knob-on);
  box-shadow: var(--knob-on-shadow);
  color: var(--check-on-text);
}

.popover-foot {
  margin-top: 4px;
  padding: 9px 10px 6px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
}

.popover-empty {
  padding: 8px 10px 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.toast-box {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  max-width: min(460px, calc(100vw - 24px));
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--toast-bg);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  pointer-events: auto;
  animation: fadeIn 0.2s ease;
}

.toast-item.is-error {
  color: var(--danger-text);
}

.toast-action {
  border: 0;
  background: transparent;
  color: var(--link);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.toast-action:hover {
  text-decoration: underline;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.97) translateY(-4px); }
  to { opacity: 1; transform: none; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
}

/* Админ-бар WordPress не должен ломать фон */
body.admin-bar {
  padding-top: 32px;
}

@media (max-width: 1080px) {
  .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand tools"
      "nav nav";
  }

  .app-nav {
    justify-self: start;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .app-nav::-webkit-scrollbar {
    display: none;
  }

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

@media (max-width: 960px) {
  .json-status-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .json-badges {
    justify-content: flex-start;
  }

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

  .landing-aside {
    position: static;
    max-width: 480px;
  }

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

  /* Карточка в две строки: домен сверху, метрики + кнопки снизу */
  .list-head {
    display: none;
  }

  .list-area,
  .list-area[data-tab="whitelist"] {
    --row-cols: auto auto auto minmax(0, 1fr);
  }

  .list-area:not([data-tab="blacklist"]) .domain-row-main {
    grid-template-areas:
      "domain domain domain domain"
      "dr lang urls actions";
  }

  .cell-domain { grid-area: domain; }
  .cell-dr { grid-area: dr; }
  .cell-lang { grid-area: lang; }
  .cell-urls { grid-area: urls; }
  .list-area:not([data-tab="blacklist"]) .cell-actions { grid-area: actions; }

  .cell-dr,
  .cell-lang,
  .cell-urls {
    justify-self: start;
  }

  .list-area[data-tab="blacklist"] {
    --row-cols: minmax(0, 1fr) auto;
  }

  .badge-label {
    display: inline;
  }
}

@media (max-width: 860px) {
  .toolbar-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .tabs-pill-bar {
    justify-self: start;
    max-width: 100%;
  }

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

  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .select-pill {
    align-self: flex-start;
  }
}

@media (max-width: 720px) {
  body {
    padding: 14px 12px 72px;
  }

  body.admin-bar {
    padding-top: 60px;
  }

  .glass-panel {
    padding: 18px;
  }

  .app-header,
  .landing-bar {
    padding: 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .brand-name {
    font-size: 16.5px;
  }

  .brand-sub,
  .user-chip {
    display: none;
  }

  .app-nav {
    width: 100%;
  }

  .app-nav .tab-btn {
    flex: 1 1 0;
    justify-content: center;
    padding: 0 10px;
  }

  .tabs-pill-bar {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tabs-pill-bar::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    padding: 0 14px;
    font-size: 14px;
  }

  .drop-area,
  .confirm-banner.active {
    grid-template-columns: minmax(0, 1fr);
  }

  .confirm-actions {
    flex-wrap: wrap;
  }

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

  .import-file-row .glass-select {
    grid-column: 1 / -1;
  }

  .tab-action-bar {
    grid-template-columns: minmax(0, 1fr);
    padding-left: 4px;
  }

  .tab-actions {
    justify-content: flex-start;
  }

  .list-area:not([data-tab="blacklist"]) .domain-row-main {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas:
      "domain domain domain"
      "dr lang urls"
      "actions actions actions";
  }

  /* Кнопки на всю ширину карточки одной строкой */
  .list-area[data-tab="distribution"] .cell-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px 40px;
  }

  .list-area[data-tab="whitelist"] .cell-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px 40px;
  }

  .list-area:not([data-tab="blacklist"]) .cell-actions .btn-sm {
    min-width: 0;
    padding: 0 10px;
  }

  .list-area[data-tab="blacklist"] .domain-row-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .list-area[data-tab="blacklist"] .cell-actions {
    justify-content: flex-start;
  }

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

  .kpi-grid .kpi:first-child {
    grid-column: 1 / -1;
  }

  .kpi-value {
    font-size: 26px;
  }

  .dash-panel,
  .settings-panel {
    padding: 18px;
  }

  .panel-head {
    flex-wrap: wrap;
  }

  .col-chart {
    height: 180px;
    gap: 2px;
  }

  .col-value {
    font-size: 10px;
  }

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

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

  .tag-create .btn-pill {
    grid-column: 1 / -1;
  }

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

  .tag-row .tag-usage {
    display: none;
  }

  .toast-box {
    left: 12px;
    right: 12px;
    align-items: center;
  }

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

  .demo-actions {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ================================================================
   ДОРАБОТКИ ПОСЛЕ ВИЗУАЛЬНОЙ ПРОВЕРКИ
   ================================================================ */
/* Затухание тегов в карточке — только если они не помещаются */
.domain-tags {
  -webkit-mask-image: none;
  mask-image: none;
}

.domain-tags.is-overflow {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent);
}

.col-label.is-hidden {
  visibility: hidden;
}

.landing-login-link {
  display: none;
}

@media (max-width: 960px) {
  .landing-login-link {
    display: inline-flex;
  }
}

@media (max-width: 720px) {
  .col-label.is-minor {
    visibility: hidden;
  }

  .hero-preview {
    display: none;
  }

  .landing-hero {
    padding-top: 12px;
  }

  .hero-lead {
    font-size: 16px;
  }

  .upload-info {
    align-items: start;
  }
}

/* Домен в карточке не сжимается из-за тегов: теги занимают остаток строки */
.cell-domain .domain-name {
  flex: 0 0 auto;
  max-width: calc(100% - 34px);
}

.cell-domain .domain-tags {
  flex: 1 1 0;
}

.lbl-short {
  display: none;
}

@media (max-width: 560px) {
  .lbl-full {
    display: none;
  }

  .lbl-short {
    display: inline;
  }
}
