/* ====== ZGinfo — публичная витрина (двойная тема: Aurora + Светлый премиум) ====== */

/* === Тема Aurora (тёмная, по умолчанию) === */
:root {
  color-scheme: dark;
  --bg-primary:     #060d1a;
  --bg-secondary:   #0a1220;
  --bg-card:        rgba(255,255,255,0.03);
  --bg-card-hover:  rgba(255,255,255,0.06);
  --bg-input:       #0a1220;
  --border:         rgba(255,255,255,0.07);
  --border-light:   rgba(255,255,255,0.12);
  --text-primary:   #e8f0f8;
  --text-secondary: #6a8a9a;
  --text-muted:     #3a5a6a;
  --accent:         #818cf8;
  --accent-hover:   #a78bfa;
  --accent-glow:    rgba(129,140,248,0.25);
  --green:          #34d399;
  --red:            #fb7185;
  --blue:           #60a5fa;
  --orange:         #fbbf24;
  --gold:           #fbbf24;
  --cyan:           #06b6d4;

  /* Градиент шапки */
  --topbar-bg: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(6,182,212,0.08), transparent);

  /* Бейджи */
  --badge-bg:       rgba(52,211,153,0.15);
  --badge-border:   rgba(52,211,153,0.35);

  /* Модалки */
  --backdrop-bg:    rgba(0,0,0,0.65);
  --modal-shadow:   0 20px 60px rgba(0,0,0,0.6);
  --tooltip-shadow: 0 18px 40px rgba(0,0,0,0.6);
  --btn-overlay:    rgba(255,255,255,0.05);

  /* Dropped */
  --dropped-bg:      rgba(251,113,133,0.06);
  --dropped-border:  rgba(251,113,133,0.3);
  --dropped-heading: #fca5a5;
  --dropped-name:    #fca5a5;

  /* Ссылки-карточки */
  --link-underline:       rgba(232,240,248,0.45);
  --link-underline-hover: rgba(232,240,248,0.75);

  /* Chart.js (читаются через JS) */
  --chart-line:      #818cf8;
  --chart-line-fill: rgba(129,140,248,0.13);
  --chart-tooltip-bg:   rgba(6,13,26,0.95);
  --chart-tooltip-title: #e8f0f8;
  --chart-tooltip-body:  #6a8a9a;
  --chart-tick:      #6a8a9a;
  --chart-grid:      rgba(255,255,255,0.06);
  --chart-bar-from:  rgb(129,140,248);
  --chart-bar-to:    rgb(60,60,120);

  /* Акцент на низкой непрозрачности (кнопки, бейджи, хуки) */
  --accent-subtle:        rgba(129,140,248,0.15);
  --accent-subtle-hover:  rgba(129,140,248,0.28);
  --accent-subtle-border: rgba(129,140,248,0.4);
  --accent-subtle-strong: rgba(129,140,248,0.55);
  --accent-subtle-tip:    rgba(129,140,248,0.35);
}

/* === Тема Светлый премиум === */
:root[data-theme="light"] {
  color-scheme: light;
  --bg-primary:     #f0eff8;
  --bg-secondary:   #ffffff;
  --bg-card:        #ffffff;
  --bg-card-hover:  #f5f4fc;
  --bg-input:       #ffffff;
  --border:         #e0dff0;
  --border-light:   #d0cfdf;
  --text-primary:   #1a1035;
  --text-secondary: #7a7a9a;
  --text-muted:     #a0a0b8;
  --accent:         #7c3aed;
  --accent-hover:   #6d28d9;
  --accent-glow:    rgba(124,58,237,0.18);
  --green:          #059669;
  --red:            #dc2626;
  --blue:           #2563eb;
  --orange:         #d97706;
  --gold:           #d97706;
  --cyan:           #0891b2;

  --topbar-bg: linear-gradient(135deg, rgba(124,58,237,0.08), rgba(6,182,212,0.05), transparent);

  --badge-bg:       rgba(5,150,105,0.12);
  --badge-border:   rgba(5,150,105,0.35);

  --backdrop-bg:    rgba(0,0,0,0.35);
  --modal-shadow:   0 20px 60px rgba(0,0,0,0.15);
  --tooltip-shadow: 0 18px 40px rgba(0,0,0,0.15);
  --btn-overlay:    rgba(0,0,0,0.04);

  --dropped-bg:      rgba(220,38,38,0.06);
  --dropped-border:  rgba(220,38,38,0.3);
  --dropped-heading: #dc2626;
  --dropped-name:    #b91c1c;

  --link-underline:       rgba(26,16,53,0.3);
  --link-underline-hover: rgba(26,16,53,0.6);

  --chart-line:      #7c3aed;
  --chart-line-fill: rgba(124,58,237,0.10);
  --chart-tooltip-bg:   rgba(255,255,255,0.97);
  --chart-tooltip-title: #1a1035;
  --chart-tooltip-body:  #7a7a9a;
  --chart-tick:      #7a7a9a;
  --chart-grid:      rgba(0,0,0,0.07);
  --chart-bar-from:  rgb(124,58,237);
  --chart-bar-to:    rgb(180,160,220);

  --accent-subtle:        rgba(124,58,237,0.10);
  --accent-subtle-hover:  rgba(124,58,237,0.18);
  --accent-subtle-border: rgba(124,58,237,0.35);
  --accent-subtle-strong: rgba(124,58,237,0.40);
  --accent-subtle-tip:    rgba(124,58,237,0.25);
}

/* === Плавные переходы между темами === */
*, *::before, *::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body {
  font-family: Arial, sans-serif;
  max-width: 900px;
  margin: 24px auto;
  padding: 0 16px;
  background: var(--bg-primary);
  color: var(--text-primary);
}
body.modal-open { overflow: hidden; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--topbar-bg);
  border-radius: 14px;
  padding: 14px 18px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }

label { font-size: 12px; color: var(--text-secondary); display: block; margin-bottom: 6px; }

select, button {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px;
}
button { cursor: pointer; }
button.primary {
  background: var(--accent-subtle);
  border-color: var(--accent-subtle-border);
}
button.primary:hover {
  background: var(--accent-subtle-hover);
}

table { width: 100%; border-collapse: collapse; margin-top: 14px; }
th, td { border-bottom: 1px solid var(--border); padding: 10px; vertical-align: middle; }
th { text-align: left; font-size: 12px; color: var(--text-secondary); font-weight: 600; user-select: none; }
td { font-size: 14px; }

.pos { width: 120px; font-weight: 800; }
.muted { color: var(--text-secondary); }
.small { font-size: 12px; color: var(--text-secondary); }

/* Позиция + дельта */
.pos-cell { width: 70px; text-align: center; vertical-align: middle; padding: 8px 6px; }
.pos-num  { font-size: 20px; font-weight: 900; line-height: 1; }
.delta    { display: block; font-size: 12px; font-weight: 700; margin-top: 3px; letter-spacing: .3px; }
.delta.up   { color: var(--green); }
.delta.down { color: var(--red); }
.delta.eq   { color: var(--text-muted); }

/* Песня + недели */
.song-title-row { font-size: 15px; font-weight: 600; }
.song-weeks     { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Строки чарта — полупрозрачные карточки с тонкой рамкой */
.chart-table tbody tr {
  background: var(--bg-card);
  border-radius: 8px;
}
.chart-table tbody tr:hover {
  background: var(--bg-card-hover);
}

@media print {
  body { background: #fff; color: #000; }
  .card { border: none; }
  button, select { display: none; }
  th, td { border-bottom: 1px solid #ccc; }
}

.badge-new {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  background: var(--badge-bg);
  color: var(--green);
  border: 1px solid var(--badge-border);
  vertical-align: middle;
}

.dropped-wrap {
  margin-top: 18px;
  padding: 16px 20px;
  border: 1px solid var(--dropped-border);
  border-left: 4px solid var(--red);
  border-radius: 12px;
  background: var(--dropped-bg);
  width: fit-content;
  min-width: 340px;
}
.dropped-wrap h3 {
  margin: 0 0 10px 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--dropped-heading);
  letter-spacing: .2px;
}
.dropped-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}
.dropped-list li {
  margin: 6px 0;
  line-height: 1.4;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.dropped-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  min-width: 18px;
}
.dropped-name {
  font-weight: 700;
  color: var(--dropped-name);
  font-size: 14px;
}
.dropped-pos {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.muted2 { color: var(--text-muted); }

/* Обложки треков */
.art-cell { display: flex; align-items: center; gap: 10px; }
.art-thumb {
  width: 48px; height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-input);
}
.art-placeholder {
  width: 48px; height: 48px;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-muted);
}
.art-modal {
  width: 200px; height: 200px;
  border-radius: 14px;
  object-fit: cover;
  display: block;
  margin: 0 auto 14px;
}
.mob-art {
  width: 48px; height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-input);
}
.mob-art-placeholder {
  width: 48px; height: 48px;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-muted);
}

/* Плеер хуков */
.hook-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-subtle-border);
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1;
  padding: 0;
  transition: background 0.15s;
}
.hook-btn:hover { background: var(--accent-subtle-hover); }
.hook-btn.playing { background: var(--accent); color: #fff; border-color: var(--accent); }

.mini-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
  height: 32px;
  box-sizing: border-box;
}
.mini-player-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.mini-player-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}
.mini-player-time {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 70px;
  text-align: right;
}

/* Плеер в модалке карточки */
.modal-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 14px;
}
.modal-player-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.modal-player-btn:hover { background: var(--accent-hover); }
.modal-player-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.modal-player-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s linear;
}
.modal-player-time {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}

.song-meta {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  vertical-align: middle;
  white-space: nowrap;
}
.song-meta .br {
  color: var(--text-muted);
  font-weight: 700;
}
.song-meta .sep {
  color: var(--text-muted);
  padding: 0 6px;
  font-weight: 700;
}


/* ====== Модалки (карточки артиста/песни, статистика, графики) ====== */
.zg-card-link { cursor: pointer; text-decoration: underline dotted var(--link-underline); text-underline-offset: 3px; }
.zg-card-link:hover { text-decoration-color: var(--link-underline-hover); }

.modalBackdrop {
  position: fixed; inset: 0; background: var(--backdrop-bg);
  display: none; align-items: center; justify-content: center; padding: 18px;
  z-index: 9999;
  overscroll-behavior: contain;
}
.modal {
  width: min(980px, 100%);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--modal-shadow);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modalHead {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
}
.modalTitle { margin: 0; font-size: 20px; font-weight: 800; }
.modalSub { margin-top: 4px; font-size: 13px; color: var(--text-secondary); }
.modalActions { display: flex; gap: 10px; }
.modalBtn {
  border: 1px solid var(--border-light);
  background: var(--btn-overlay);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}
.modalBtn.primary {
  border-color: var(--accent-subtle-strong);
  box-shadow: 0 0 0 2px var(--accent-glow) inset;
}
.modalClose { cursor: pointer; border: none; background: transparent; color: var(--text-primary); font-size: 18px; padding: 6px 10px; border-radius: 10px; }
.modalBody { padding: 14px; overflow: auto; -webkit-overflow-scrolling: touch; flex: 1 1 auto; }
.kpiGrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpiCard {
  border: 1px solid var(--border);
  background: var(--bg-input);
  border-radius: 14px;
  padding: 10px 12px;
  min-height: 64px;
}
.kpiVal { font-size: 20px; font-weight: 900; line-height: 1.05; }
.kpiLabel { margin-top: 6px; font-size: 13px; color: var(--text-secondary); display: flex; gap: 8px; align-items: center; }
.kpiHint {
  width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-light);
  background: var(--btn-overlay);
  color: var(--text-primary);
  font-size: 12px; font-weight: 900;
  cursor: help;
}

/* KPI тултипы */
.kpiK[data-tip] { position: relative; cursor: help; display: inline-block; }
.kpiK[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  min-width: 260px;
  max-width: 420px;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--accent-subtle-tip);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  box-shadow: var(--tooltip-shadow);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  z-index: 9999;
}
.kpiK[data-tip]::before {
  content: '';
  position: absolute;
  left: 18px;
  bottom: calc(100% + 4px);
  border: 7px solid transparent;
  border-top-color: var(--accent-subtle-tip);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  z-index: 10000;
}
.kpiK[data-tip]:hover::after,
.kpiK[data-tip]:hover::before {
  opacity: 1;
  transform: translateY(0);
}

.modalTableWrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.modalTable { width: 100%; border-collapse: collapse; }
.modalTable th {
  text-align: left; font-size: 12px; color: var(--text-secondary);
  padding: 10px 12px; background: var(--bg-input);
  border-bottom: 1px solid var(--border);
}
.modalTable td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.modalMuted { color: var(--text-secondary); font-size: 12px; }

/* Help-модалка */
.helpBackdrop {
  position: fixed; inset: 0; background: var(--backdrop-bg);
  display: none; align-items: center; justify-content: center; padding: 18px;
  z-index: 10000;
  overscroll-behavior: contain;
}
.helpModal {
  width: min(900px, 100%);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--modal-shadow);
  max-height: 86vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.helpHead {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 14px 12px;
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.helpTitle { margin: 0; font-size: 18px; font-weight: 900; }
.helpBody { padding: 14px; white-space: pre-wrap; line-height: 1.5; font-size: 14px; flex: 1 1 auto; }

/* Поле даты (date picker) */
input[type="date"] {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
:root[data-theme="light"] input[type="date"] {
  background: #ffffff;
  color: #1a1035;
  border-color: #e0dff0;
}

/* Переключатель темы */
.theme-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 50%;
  width: 38px; height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}
.theme-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

@media (max-width: 600px) {
  body { margin: 14px; }
  .modalBackdrop, .helpBackdrop { align-items: flex-start; padding: 10px; }
  .modal { max-height: calc(100vh - 20px); }
  .helpModal { max-height: calc(100vh - 20px); }
  .modalHead { position: sticky; top: 0; background: var(--bg-secondary); z-index: 1; }
}
@media (max-width: 980px) {
  .kpiGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ====== Мобильная адаптивность (до 768px) ====== */
@media (max-width: 768px) {
  body { margin: 10px !important; }
  .topbar { margin-bottom: 10px !important; padding: 10px 12px !important; }
  .topbar > div:first-child > div:first-child { font-size: 16px; }
  .card { padding: 10px !important; border-radius: 10px !important; }

  /* Селект выпуска — полная ширина */
  .row { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
  #issue_select { min-width: 0 !important; width: 100% !important; font-size: 14px; }
  #issue_hint { font-size: 11px; }

  /* Кнопки — сетка 2x2 */
  .btn-row-mobile {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .btn-row-mobile button {
    width: 100% !important;
    padding: 10px 8px !important;
    font-size: 13px;
  }

  /* Скрываем таблицу на мобиле, показываем карточки */
  table.chart-table { display: none !important; }
  .mobile-cards { display: block !important; }

  /* Карточки позиций — Aurora-стиль с backdrop-filter */
  .mob-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    margin-bottom: 4px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  :root[data-theme="light"] .mob-card {
    background: #ffffff;
    border-color: var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .mob-card:last-child { margin-bottom: 0; }
  .mob-pos {
    min-width: 42px;
    text-align: center;
    flex-shrink: 0;
  }
  .mob-pos-num {
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
  }
  .mob-delta {
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-top: 2px;
  }
  .mob-info { flex: 1; min-width: 0; }
  .mob-artist {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mob-song {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
  }
  .mob-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    background: var(--badge-bg);
    color: var(--green);
    border: 1px solid var(--badge-border);
    vertical-align: middle;
  }
  .mob-weeks {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
  }

  /* Кнопки на мобиле — светлая тема: белый фон + фиолетовая рамка */
  :root[data-theme="light"] .btn-row-mobile button.primary {
    background: #ffffff;
    border-color: var(--accent);
    color: var(--accent);
  }
  :root[data-theme="light"] .btn-row-mobile button.primary:hover {
    background: var(--accent-subtle);
  }

  /* Дропдаун на мобиле — светлая тема */
  :root[data-theme="light"] #issue_select {
    background: var(--bg-secondary);
    border-color: var(--border);
  }

  /* Блок «Покинули чарт» */
  .dropped-wrap {
    box-sizing: border-box;
    min-width: 0 !important;
    width: 100% !important;
  }

  /* Модалки — полноэкранные */
  .modalBackdrop, .helpBackdrop {
    padding: 0 !important;
    align-items: stretch !important;
  }
  .modal, .helpModal {
    width: 100% !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    height: 100vh;
  }
  .modalHead { padding: 10px 12px 8px; }
  .modalTitle { font-size: 16px !important; }
  .modalSub { font-size: 12px; }
  .modalActions { gap: 6px; }
  .modalBtn { padding: 8px 10px; font-size: 13px; border-radius: 10px; }
  .modalBody { padding: 10px 12px; }
  .kpiGrid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; }
  .kpiVal { font-size: 16px; }
  .kpiLabel { font-size: 12px; }
  .kpiCard { padding: 8px 10px; min-height: 54px; }

  /* Таблицы в модалках — компактнее */
  .modalTable th, .modalTable td { padding: 8px 8px; font-size: 12px; }

  /* Тултипы KPI — адаптация */
  .kpiK[data-tip]::after { min-width: 200px; max-width: calc(100vw - 40px); }

  /* Переключатель темы — компактнее */
  .theme-toggle { width: 34px; height: 34px; font-size: 16px; }
}
/* ====== /Мобильная адаптивность ====== */


/* ============================================================
   ДИЗАЙН: Spotify — тёмная (по умолчанию для data-design="spotify")
   ============================================================ */
:root[data-design="spotify"] {
  color-scheme: dark;
  --bg-primary:     #121212;
  --bg-secondary:   #181818;
  --bg-card:        rgba(255,255,255,0.04);
  --bg-card-hover:  rgba(255,255,255,0.08);
  --bg-input:       #1f1f1f;
  --border:         rgba(255,255,255,0.08);
  --border-light:   rgba(255,255,255,0.15);
  --text-primary:   #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted:     #6a6a6a;
  --accent:         #1ed760;
  --accent-hover:   #1fdf64;
  --accent-glow:    rgba(30,215,96,0.25);
  --green:          #1ed760;
  --red:            #f3727f;
  --blue:           #539df5;
  --orange:         #ffa42b;
  --gold:           #ffa42b;
  --cyan:           #4cb3d4;

  --topbar-bg: linear-gradient(180deg, rgba(30,215,96,0.1), transparent);

  --badge-bg:       rgba(30,215,96,0.15);
  --badge-border:   rgba(30,215,96,0.35);

  --backdrop-bg:    rgba(0,0,0,0.7);
  --modal-shadow:   0 20px 60px rgba(0,0,0,0.7);
  --tooltip-shadow: 0 18px 40px rgba(0,0,0,0.7);
  --btn-overlay:    rgba(255,255,255,0.05);

  --dropped-bg:      rgba(243,114,127,0.06);
  --dropped-border:  rgba(243,114,127,0.3);
  --dropped-heading: #f3727f;
  --dropped-name:    #f3727f;

  --link-underline:       rgba(255,255,255,0.35);
  --link-underline-hover: rgba(255,255,255,0.65);

  --chart-line:      #1ed760;
  --chart-line-fill: rgba(30,215,96,0.13);
  --chart-tooltip-bg:   rgba(18,18,18,0.95);
  --chart-tooltip-title: #ffffff;
  --chart-tooltip-body:  #b3b3b3;
  --chart-tick:      #6a6a6a;
  --chart-grid:      rgba(255,255,255,0.06);
  --chart-bar-from:  rgb(30,215,96);
  --chart-bar-to:    rgb(15,100,45);

  --accent-subtle:        rgba(30,215,96,0.15);
  --accent-subtle-hover:  rgba(30,215,96,0.28);
  --accent-subtle-border: rgba(30,215,96,0.4);
  --accent-subtle-strong: rgba(30,215,96,0.55);
  --accent-subtle-tip:    rgba(30,215,96,0.35);
}

/* Spotify — светлая */
:root[data-design="spotify"][data-theme="light"] {
  color-scheme: light;
  --bg-primary:     #f5f5f5;
  --bg-secondary:   #ffffff;
  --bg-card:        #ffffff;
  --bg-card-hover:  #f0f0f0;
  --bg-input:       #ffffff;
  --border:         #e0e0e0;
  --border-light:   #c8c8c8;
  --text-primary:   #121212;
  --text-secondary: #535353;
  --text-muted:     #8a8a8a;
  --accent:         #1db954;
  --accent-hover:   #1aa34a;
  --accent-glow:    rgba(29,185,84,0.2);
  --green:          #1db954;
  --red:            #e0334a;
  --blue:           #2e77d0;
  --orange:         #e08c00;
  --gold:           #e08c00;
  --cyan:           #0891b2;

  --topbar-bg: linear-gradient(180deg, rgba(29,185,84,0.06), transparent);

  --badge-bg:       rgba(29,185,84,0.12);
  --badge-border:   rgba(29,185,84,0.35);

  --backdrop-bg:    rgba(0,0,0,0.35);
  --modal-shadow:   0 20px 60px rgba(0,0,0,0.15);
  --tooltip-shadow: 0 18px 40px rgba(0,0,0,0.15);
  --btn-overlay:    rgba(0,0,0,0.04);

  --dropped-bg:      rgba(224,51,74,0.06);
  --dropped-border:  rgba(224,51,74,0.3);
  --dropped-heading: #e0334a;
  --dropped-name:    #c0293e;

  --link-underline:       rgba(18,18,18,0.3);
  --link-underline-hover: rgba(18,18,18,0.6);

  --chart-line:      #1db954;
  --chart-line-fill: rgba(29,185,84,0.10);
  --chart-tooltip-bg:   rgba(255,255,255,0.97);
  --chart-tooltip-title: #121212;
  --chart-tooltip-body:  #535353;
  --chart-tick:      #8a8a8a;
  --chart-grid:      rgba(0,0,0,0.07);
  --chart-bar-from:  rgb(29,185,84);
  --chart-bar-to:    rgb(150,220,170);

  --accent-subtle:        rgba(29,185,84,0.10);
  --accent-subtle-hover:  rgba(29,185,84,0.18);
  --accent-subtle-border: rgba(29,185,84,0.35);
  --accent-subtle-strong: rgba(29,185,84,0.40);
  --accent-subtle-tip:    rgba(29,185,84,0.25);
}


/* ============================================================
   ДИЗАЙН: VoltAgent — тёмная (по умолчанию для data-design="voltagent")
   ============================================================ */
:root[data-design="voltagent"] {
  color-scheme: dark;
  --bg-primary:     #050507;
  --bg-secondary:   #101010;
  --bg-card:        rgba(255,255,255,0.03);
  --bg-card-hover:  rgba(255,255,255,0.06);
  --bg-input:       #101010;
  --border:         #3d3a39;
  --border-light:   rgba(61,58,57,0.8);
  --text-primary:   #f2f2f2;
  --text-secondary: #b8b3b0;
  --text-muted:     #8b949e;
  --accent:         #00d992;
  --accent-hover:   #00e6a0;
  --accent-glow:    rgba(0,217,146,0.3);
  --green:          #00d992;
  --red:            #fb565b;
  --blue:           #60a5fa;
  --orange:         #ffba00;
  --gold:           #f59e0b;
  --cyan:           #4cb3d4;

  --topbar-bg: linear-gradient(135deg, rgba(0,217,146,0.1), rgba(129,140,248,0.04), transparent);

  --badge-bg:       rgba(0,217,146,0.15);
  --badge-border:   rgba(0,217,146,0.35);

  --backdrop-bg:    rgba(0,0,0,0.7);
  --modal-shadow:   0 20px 60px rgba(0,0,0,0.7);
  --tooltip-shadow: 0 18px 40px rgba(0,0,0,0.7);
  --btn-overlay:    rgba(255,255,255,0.05);

  --dropped-bg:      rgba(251,86,91,0.06);
  --dropped-border:  rgba(251,86,91,0.3);
  --dropped-heading: #fd9c9f;
  --dropped-name:    #fd9c9f;

  --link-underline:       rgba(242,242,242,0.35);
  --link-underline-hover: rgba(242,242,242,0.65);

  --chart-line:      #00d992;
  --chart-line-fill: rgba(0,217,146,0.13);
  --chart-tooltip-bg:   rgba(5,5,7,0.95);
  --chart-tooltip-title: #f2f2f2;
  --chart-tooltip-body:  #8b949e;
  --chart-tick:      #8b949e;
  --chart-grid:      rgba(255,255,255,0.06);
  --chart-bar-from:  rgb(0,217,146);
  --chart-bar-to:    rgb(0,80,55);

  --accent-subtle:        rgba(0,217,146,0.15);
  --accent-subtle-hover:  rgba(0,217,146,0.28);
  --accent-subtle-border: rgba(0,217,146,0.4);
  --accent-subtle-strong: rgba(0,217,146,0.55);
  --accent-subtle-tip:    rgba(0,217,146,0.35);
}

/* VoltAgent — светлая */
:root[data-design="voltagent"][data-theme="light"] {
  color-scheme: light;
  --bg-primary:     #fafaf9;
  --bg-secondary:   #ffffff;
  --bg-card:        #ffffff;
  --bg-card-hover:  #f5f5f4;
  --bg-input:       #ffffff;
  --border:         #e7e5e4;
  --border-light:   #d6d3d1;
  --text-primary:   #1c1917;
  --text-secondary: #78716c;
  --text-muted:     #a8a29e;
  --accent:         #00b377;
  --accent-hover:   #009966;
  --accent-glow:    rgba(0,179,119,0.2);
  --green:          #00b377;
  --red:            #dc2626;
  --blue:           #2563eb;
  --orange:         #d97706;
  --gold:           #d97706;
  --cyan:           #0891b2;

  --topbar-bg: linear-gradient(135deg, rgba(0,179,119,0.06), rgba(129,140,248,0.03), transparent);

  --badge-bg:       rgba(0,179,119,0.12);
  --badge-border:   rgba(0,179,119,0.35);

  --backdrop-bg:    rgba(0,0,0,0.35);
  --modal-shadow:   0 20px 60px rgba(0,0,0,0.15);
  --tooltip-shadow: 0 18px 40px rgba(0,0,0,0.15);
  --btn-overlay:    rgba(0,0,0,0.04);

  --dropped-bg:      rgba(220,38,38,0.06);
  --dropped-border:  rgba(220,38,38,0.3);
  --dropped-heading: #dc2626;
  --dropped-name:    #b91c1c;

  --link-underline:       rgba(28,25,23,0.3);
  --link-underline-hover: rgba(28,25,23,0.6);

  --chart-line:      #00b377;
  --chart-line-fill: rgba(0,179,119,0.10);
  --chart-tooltip-bg:   rgba(255,255,255,0.97);
  --chart-tooltip-title: #1c1917;
  --chart-tooltip-body:  #78716c;
  --chart-tick:      #78716c;
  --chart-grid:      rgba(0,0,0,0.07);
  --chart-bar-from:  rgb(0,179,119);
  --chart-bar-to:    rgb(150,220,190);

  --accent-subtle:        rgba(0,179,119,0.10);
  --accent-subtle-hover:  rgba(0,179,119,0.18);
  --accent-subtle-border: rgba(0,179,119,0.35);
  --accent-subtle-strong: rgba(0,179,119,0.40);
  --accent-subtle-tip:    rgba(0,179,119,0.25);
}


/* ====== Панель выбора дизайна ====== */
.design-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.design-pin-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.design-pin-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.design-pin-btn.pinned {
  background: var(--accent-subtle);
  border-color: var(--accent-subtle-border);
  color: var(--accent);
}
.design-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0.7;
}
