:root {
  --bg: #000000;
  /* Match right filter drawers (Deep / RM / FB / General): #060d16 */
  --sidebar-bg: #060d16;
  --panel: #0b1c28;
  --text: #ffffff;
  --text-dim: #d1d5db;
  /* Sidebar / menu links — soft gray, not pure white on dark drawer */
  --nav-muted: #94a3b8;
  --nav-hover: #cbd5e1;
  --nav-active: #e2e8f0;
  --pill-gray: #6b7280;
  --pill-gray-dark: #4b5563;
  --pill-blue: #1d6fd8;
  --pill-blue-dark: #1558b0;
  --pill-green: #1a9e47;
  --pill-red: #b30000;
  --input-bg: #050505;
  --input-border: #1db954;
  --table-head: #1f2937;
  --cyan-ring: #22d3ee;
  /* Shared header / toolbar icon chrome (matches sidebar-burger + sync) */
  --icon-btn-size: 40px;
  --icon-btn-radius: 10px;
  --icon-btn-bg: rgba(255, 255, 255, 0.06);
  --icon-btn-bg-hover: rgba(255, 255, 255, 0.1);
  --icon-btn-fg: #e2e8f0;
  --icon-btn-spin: #38bdf8;
  --icon-btn-active-fg: #38bdf8;
  --icon-btn-active-bg: rgba(56, 189, 248, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

.hidden { display: none !important; }

/* Sync status subheader — sits below topbar, pushes content down */
.sync-status-strip {
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  background: rgba(8, 16, 24, 0.96);
  border-bottom: 1px solid rgba(56, 189, 248, 0.18);
}

@media (min-width: 769px) {
  .general-head,
  .deep-head,
  .fb-head,
  .rm-head {
    position: relative;
    align-items: flex-start;
  }

  .sync-status-strip {
    box-sizing: border-box;
    align-self: flex-start;
    flex-shrink: 0;
    width: calc(100% + 1.75rem + 2rem - var(--sync-strip-inset-left, 0px) - var(--sync-strip-inset-right, 0px));
    margin-left: calc(-1.75rem + var(--sync-strip-inset-left, 0px));
    margin-right: 0;
    transition: width 0.22s ease, margin-left 0.22s ease;
  }

  /* Legacy element kept in DOM — unused after in-drawer dock. */
  .desktop-sync-dock {
    display: none !important;
  }

  /* Save + sync ride inside the open drawer, under the hide button. */
  .drawer-action-dock {
    display: none;
  }

  .drawer-action-dock.is-active {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin: 0.35rem 0 0.55rem;
    flex-shrink: 0;
  }

  .drawer-action-dock .filter-defaults-btn,
  .drawer-action-dock .refresh-btn,
  .drawer-action-dock .icon-link-btn,
  .general-head-actions .filter-defaults-btn,
  .general-head-actions .refresh-btn,
  .general-head-actions .deep-rail-toggle,
  .deep-head-actions .filter-defaults-btn,
  .deep-head-actions .refresh-btn,
  .deep-head-actions .deep-rail-toggle,
  .fb-head-actions .filter-defaults-btn,
  .fb-head-actions .refresh-btn,
  .fb-head-actions .deep-rail-toggle,
  .rm-head-actions .filter-defaults-btn,
  .rm-head-actions .refresh-btn,
  .rm-head-actions .deep-rail-toggle,
  .plists-head-actions .filter-defaults-btn,
  .plists-head-actions .refresh-btn,
  .plists-head-actions .deep-rail-toggle {
    display: inline-flex;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    min-height: var(--icon-btn-size);
    margin: 0;
    border: none;
    border-radius: var(--icon-btn-radius);
    background: var(--icon-btn-bg);
    color: var(--icon-btn-fg);
  }

  .drawer-action-dock .refresh-btn.spinning,
  .general-head-actions .refresh-btn.spinning,
  .deep-head-actions .refresh-btn.spinning,
  .fb-head-actions .refresh-btn.spinning,
  .rm-head-actions .refresh-btn.spinning,
  .plists-head-actions .refresh-btn.spinning {
    color: var(--icon-btn-spin);
    opacity: 0.95;
  }

  /* Drawer open on desktop — only the in-drawer collapse bar closes it.
     Head rail toggle is for reopening after collapse (and mobile topbar). */
  .general-panel.filters-open:not(.filters-collapsed) .general-head .general-filters-toggle,
  .deep-panel.filters-open:not(.filters-collapsed) .deep-head .deep-rail-toggle,
  .fb-panel.filters-open:not(.filters-collapsed) .fb-head .fb-head-actions .deep-rail-toggle,
  .rm-panel.filters-open:not(.filters-collapsed) .rm-head .deep-rail-toggle {
    display: none !important;
  }

  /* Drawer collapsed — show filter toggle next to sync/save */
  .general-panel.filters-open.filters-collapsed .general-head .general-filters-toggle,
  .deep-panel.filters-open.filters-collapsed .deep-head .deep-rail-toggle,
  .fb-panel.filters-open.filters-collapsed .fb-head .fb-head-actions .deep-rail-toggle,
  .rm-panel.filters-open.filters-collapsed .rm-head .deep-rail-toggle {
    display: inline-flex !important;
  }
}

.sync-status-strip.visible {
  display: flex;
}

.sync-status-progress {
  height: 4px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.sync-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #38bdf8, #1db954);
  transition: width 0.35s ease;
}

.sync-progress-fill.indeterminate {
  width: 35%;
  animation: sync-progress-slide 1.1s ease-in-out infinite;
}

@keyframes sync-progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(420%); }
}

.sync-status-text {
  margin: 0;
  padding: 0.5rem 1rem 0.55rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.52);
  letter-spacing: 0.01em;
}

.refresh-btn.spinning,
.icon-link-btn.spinning {
  color: var(--icon-btn-spin);
}

.refresh-btn.spinning svg,
.icon-link-btn.spinning svg {
  animation: sync-btn-spin 0.9s linear infinite;
  color: inherit;
}

@keyframes sync-btn-spin {
  to { transform: rotate(360deg); }
}

/* Canonical soft icon button — one look for sync / floppy / rail / PR / planner / SL */
.icon-link-btn,
.filter-defaults-btn,
.refresh-btn,
.deep-rail-toggle,
.pr-icon-btn,
.pl-icon-btn,
.pl-stage-filter-btn,
.sl-status-filter-btn,
.ai-sparkle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  min-width: var(--icon-btn-size);
  min-height: var(--icon-btn-size);
  padding: 0;
  border: none;
  border-radius: var(--icon-btn-radius);
  background: var(--icon-btn-bg);
  color: var(--icon-btn-fg);
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.icon-link-btn:hover,
.filter-defaults-btn:hover,
.refresh-btn:hover,
.deep-rail-toggle:hover,
.pr-icon-btn:hover,
.pl-icon-btn:hover,
.pl-stage-filter-btn:hover,
.sl-status-filter-btn:hover,
.ai-sparkle-btn:hover {
  background: var(--icon-btn-bg-hover);
  color: #fff;
  border-color: transparent;
}

.icon-link-btn svg,
.filter-defaults-btn svg,
.refresh-btn svg,
.deep-rail-toggle svg,
.pr-icon-btn svg,
.pl-icon-btn svg,
.pl-stage-filter-btn svg,
.sl-status-filter-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.pr-icon-btn.active,
.sl-status-filter-btn.is-open,
.sl-status-filter-btn.has-filter:not(.is-open) {
  color: var(--icon-btn-active-fg);
  background: var(--icon-btn-active-bg);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0 1rem;
  transition: width 0.2s ease, min-width 0.2s ease;
  position: relative;
}

.app-shell.sidebar-collapsed .sidebar {
  width: 72px;
  min-width: 72px;
}

/* Legacy traffic-light — health now lives on sidebar-toggle / burger */
.sidebar-health {
  display: none !important;
}

@keyframes healthPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.35); }
}

.sidebar-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: var(--nav-hover);
  margin-bottom: 2.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font: inherit;
  border-radius: 12px;
  transition: opacity 0.15s, color 0.15s;
  width: 100%;
}

.sidebar-profile:hover { opacity: 0.9; color: var(--nav-active); }

.sidebar-avatar {
  width: 96px;
  height: 96px;
  border-radius: 22%;
  background: #e5e7eb;
  background-size: cover;
  background-position: center;
  display: block;
  flex-shrink: 0;
  transition: width 0.2s ease, height 0.2s ease;
}

.app-shell.sidebar-collapsed .sidebar-avatar {
  width: 44px;
  height: 44px;
}

.sidebar-name {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--nav-hover);
  transition: opacity 0.15s, max-height 0.2s, color 0.15s;
  overflow: hidden;
}

/* Only hide the name in the desktop rail — never when profile sits inside the mobile drawer */
.app-shell.sidebar-collapsed .sidebar > .sidebar-profile .sidebar-name {
  opacity: 0;
  max-height: 0;
  margin: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
  padding: 0 0.65rem;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: none;
  border: none;
  color: var(--nav-muted);
  font-size: 0.98rem;
  font-weight: 400;
  cursor: pointer;
  padding: 0.55rem 0.65rem;
  letter-spacing: 0.01em;
  border-radius: 10px;
  text-align: left;
  width: 100%;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  box-sizing: border-box;
}

a.sidebar-profile {
  text-decoration: none;
  color: inherit;
}

.sidebar-link:hover {
  color: var(--nav-hover);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-link.active {
  color: var(--nav-active);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.08);
}

/* Meta account issue — glow on the act row in the right filter drawer (not left nav) */
.meta-act-filter-row.meta-act-filter-alert .meta-act-filter-name {
  color: #ff6b6b;
  font-weight: 600;
}
.meta-act-filter-row.meta-act-filter-alert {
  border-radius: 8px;
  background: rgba(255, 77, 79, 0.1);
  outline: 1px solid rgba(255, 77, 79, 0.35);
  padding: 0.15rem 0.35rem;
  animation: fbAccountAlertPulse 1.6s ease-in-out infinite;
}
@keyframes fbAccountAlertPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.0); }
  50% { box-shadow: 0 0 10px 0 rgba(255, 77, 79, 0.45); }
}

.sidebar-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.sidebar-link.active .sidebar-icon {
  opacity: 1;
}

.sidebar-icon svg {
  width: 22px;
  height: 22px;
}

.sidebar-label {
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s, max-width 0.2s;
  max-width: 140px;
}

.sidebar-meta-check-wrap {
  margin-top: auto;
  padding: 0.75rem 0 0.15rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}
.sidebar-meta-check {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  background: none;
  border: none;
  color: var(--nav-muted);
  font-size: 0.92rem;
  font-weight: 400;
  cursor: pointer;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  text-align: left;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.sidebar-meta-check:hover {
  color: var(--nav-hover);
  background: rgba(255, 255, 255, 0.05);
}
.sidebar-meta-check.is-loading {
  opacity: 0.55;
  pointer-events: none;
}
.sidebar-meta-check-dot {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}
.sidebar-meta-check-dot.ok { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }
.sidebar-meta-check-dot.bad { background: #ff6b6b; box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.22); }
.sidebar-meta-check-dot.unknown { background: #64748b; }
.app-shell.sidebar-collapsed .sidebar-meta-check .sidebar-label {
  opacity: 0;
  max-width: 0;
}
.app-shell.sidebar-collapsed .sidebar-meta-check {
  justify-content: center;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}
.app-shell.sidebar-collapsed .sidebar-meta-check-dot {
  right: 0.35rem;
  top: 0.35rem;
  transform: none;
}

.sidebar-meta-accounts {
  margin-top: auto;
  padding: 0.85rem 0.55rem 0.35rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  position: relative;
}
.sidebar-meta-caption {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin: 0 0.2rem 0.35rem;
}
.sidebar-meta-current {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
  cursor: pointer;
  position: relative;
}
.sidebar-meta-current:hover {
  border-color: rgba(56, 189, 248, 0.35);
}
.sidebar-meta-current.is-loading {
  opacity: 0.6;
}
.sidebar-meta-folio {
  font-size: 0.68rem;
  color: #7dd3fc;
}
.sidebar-meta-name {
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-meta-chevron {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 0.7rem;
}
.sidebar-meta-menu {
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: calc(100% - 0.2rem);
  z-index: 40;
  max-height: 280px;
  overflow: auto;
  padding: 0.4rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: #0b1522;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
.sidebar-meta-group {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  padding: 0.35rem 0.4rem 0.15rem;
}
.sidebar-meta-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  text-align: left;
  padding: 0.4rem 0.45rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
  font-size: 0.82rem;
}
.sidebar-meta-item:hover {
  background: rgba(56, 189, 248, 0.1);
}
.sidebar-meta-item.is-primary {
  background: rgba(56, 189, 248, 0.12);
}
.sidebar-meta-pill {
  font-size: 0.62rem;
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  padding: 0.05rem 0.35rem;
}
.app-shell.sidebar-collapsed .sidebar-meta-accounts {
  padding: 0.5rem 0.25rem;
}
.app-shell.sidebar-collapsed .sidebar-meta-caption,
.app-shell.sidebar-collapsed .sidebar-meta-folio,
.app-shell.sidebar-collapsed .sidebar-meta-chevron {
  display: none;
}
.app-shell.sidebar-collapsed .sidebar-meta-current {
  align-items: center;
  padding: 0.35rem 0.2rem;
}
.app-shell.sidebar-collapsed .sidebar-meta-name {
  font-size: 0.62rem;
  text-align: center;
  white-space: normal;
  line-height: 1.15;
}

.meta-act-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.meta-act-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 10px;
  background: rgba(6, 14, 22, 0.4);
}
.meta-act-filter-group-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7dd3fc;
  margin-bottom: 0.1rem;
}

.app-shell.sidebar-collapsed .sidebar-nav {
  padding: 0 0.45rem;
  align-items: center;
}

.app-shell.sidebar-collapsed .sidebar-link {
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: 0.55rem 0;
  width: 100%;
}

/* Label must not take layout space — otherwise icons sit off-center */
.app-shell.sidebar-collapsed .sidebar-label {
  display: none;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  pointer-events: none;
}

.sidebar-toggle {
  margin: 0 0.65rem 1.6rem;
  width: calc(100% - 1.3rem);
  padding: 0.35rem;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--nav-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.sidebar-toggle:hover {
  color: var(--nav-hover);
  background: rgba(255, 255, 255, 0.1);
}

/* Server OK — quiet dark-green outline only (same as mobile burger), no glow */
.sidebar-toggle.ok {
  color: var(--nav-muted);
  background: rgba(255, 255, 255, 0.06);
  border-color: #166534;
  box-shadow: none;
}

.sidebar-toggle.ok:hover {
  color: var(--nav-hover);
  background: rgba(255, 255, 255, 0.1);
  border-color: #166534;
  box-shadow: none;
}

/* Server BAD — loud red, hard to miss */
.sidebar-toggle.bad {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
  border-color: #ef4444;
  box-shadow:
    0 0 0 2px rgba(239, 68, 68, 0.45),
    0 0 14px rgba(239, 68, 68, 0.55);
  animation: toggleHealthPulse 0.9s ease-in-out infinite;
}

.sidebar-toggle.bad:hover {
  color: #fff;
  background: rgba(239, 68, 68, 0.24);
}

@keyframes toggleHealthPulse {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(239, 68, 68, 0.4),
      0 0 10px rgba(239, 68, 68, 0.45);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(248, 113, 113, 0.7),
      0 0 20px rgba(239, 68, 68, 0.75);
  }
}

.sidebar-toggle-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

/* Mobile hamburger + off-canvas nav (hidden on desktop) */
.sidebar-burger {
  display: none;
  border: none;
  background: var(--icon-btn-bg);
  color: var(--icon-btn-fg);
  border-radius: var(--icon-btn-radius);
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-burger svg {
  width: 22px;
  height: 22px;
}

/* Заголовок раздела и кнопки действий в верхней полосе — только мобилка */
.topbar-title,
.topbar-actions {
  display: none;
}

.mobile-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 55;
}

.sidebar-close {
  display: none;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-close svg {
  width: 22px;
  height: 22px;
}

.app-shell.sidebar-collapsed .sidebar-toggle-icon {
  transform: rotate(180deg);
}

/* ── Main ── */
.main {
  flex: 1;
  padding: 1.75rem 2.1rem 2.75rem 2rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  --sync-strip-inset-right: 0px;
  --sync-strip-inset-left: 0px;
}

.nav-panel { display: none; }
.nav-panel.active { display: block; }

/* ── Topbar (profile panel) ── */
.topbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.topbar-row .artist-select-wrap {
  flex: 1;
  min-width: 140px;
}

.topbar-row .pill-gray {
  flex-shrink: 0;
}

.topbar-add {
  width: 100%;
  max-width: 100%;
}

@media (min-width: 769px) {
  .topbar {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 0.85rem;
    align-items: center;
  }

  .topbar-row {
    display: contents;
  }

  .topbar-add {
    width: auto;
  }
}

.artist-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--pill-gray-dark);
  border-radius: 999px;
  padding: 0.45rem 2rem 0.45rem 0.55rem;
  min-width: 150px;
}

.artist-select-wrap::after {
  content: '';
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-30%);
  border: 5px solid transparent;
  border-top-color: #fff;
  pointer-events: none;
}

.artist-select-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e5e7eb;
  background-size: cover;
  flex-shrink: 0;
}

.artist-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  color: var(--text);
  outline: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  min-width: 60px;
  padding: 0;
}

.pill {
  border: none;
  border-radius: 999px;
  padding: 0.62rem 1.35rem;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pill.small { padding: 0.4rem 0.9rem; font-size: 0.85rem; }

.pill-gray { background: var(--pill-gray-dark); }
.pill-gray-light { background: var(--pill-gray); }
.pill-blue { background: var(--pill-blue); }
.pill-blue-dark { background: var(--pill-blue-dark); }
.pill-green { background: var(--pill-green); }
.pill-sky {
  background: #38bdf8;
  color: #04131f;
}
.pill-sky:hover {
  background: #7dd3fc;
}
.pill-red { background: var(--pill-red); }

.pill.tab-active {
  background: var(--pill-blue);
  box-shadow: 0 0 0 2px var(--cyan-ring);
}

.input-link {
  width: 100%;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: 999px;
  color: var(--text);
  padding: 0.62rem 1.25rem;
  outline: none;
  font-size: 0.95rem;
}

.input-link::placeholder { color: #6b7280; }

.input-spotify-link {
  border: 2px solid transparent;
  background:
    linear-gradient(rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.42)) padding-box,
    linear-gradient(90deg, #c084fc, #4ade80, #22d3ee) border-box;
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.12);
}

.input-spotify-link:focus {
  outline: none;
  background:
    linear-gradient(rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.42)) padding-box,
    linear-gradient(90deg, #d8b4fe, #86efac, #67e8f9) border-box;
  box-shadow: 0 0 16px rgba(74, 222, 128, 0.18);
}

.section-title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.empty-state {
  color: var(--text-dim);
  padding: 3rem 1rem;
  text-align: center;
}

/* ── Artist panel (navy card) ── */
.artist-panel {
  background: var(--panel);
  border: none;
  border-radius: 28px;
  padding: 1.35rem 1.5rem 1.75rem;
}

.artist-panel-head {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
  min-width: 0;
}

.artist-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.artist-tabs-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  max-width: 100%;
  min-width: 0;
  scrollbar-width: none;
  padding: 0.15rem 0;
}

.artist-tabs-scroll::-webkit-scrollbar {
  display: none;
}

.artist-tabs-scroll .tab-segment {
  overflow: visible;
}

.artist-tabs {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: max-content;
}

@media (min-width: 900px) {
  .artist-panel-head {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .artist-head-top {
    flex-shrink: 0;
  }

  .artist-tabs-scroll {
    flex: 1;
    margin: 0;
  }

  .artist-tabs {
    flex-wrap: nowrap;
    width: max-content;
  }
}

.artist-identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

.artist-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #e5e7eb;
  background-size: cover;
  flex-shrink: 0;
}

.artist-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.artist-tabs {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.artist-panel-head .btn-trash {
  flex-shrink: 0;
  margin-left: 0;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Releases tab ── */
.releases-add-shell {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.18);
  background: rgba(6, 13, 22, 0.72);
}

.releases-toolbar {
  width: 100%;
  max-width: 100%;
  margin-bottom: 1.25rem;
}

.releases-main-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.releases-submit-btn {
  width: 100%;
  padding: 0.7rem 1rem;
}

.releases-toolbar-row {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  width: 100%;
}

.pre-release-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  margin: 0;
  padding: 0.15rem 0 0.65rem;
  font-size: 0.92rem;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

label.pre-release-toggle {
  flex-direction: row;
}

.pre-release-toggle input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  accent-color: #38bdf8;
  background: transparent;
  border: none;
  border-radius: 4px;
}

.releases-add-shell:has(#add-pre-release-cb:checked) {
  border-color: rgba(251, 191, 36, 0.35);
}

.releases-add-shell:has(#add-pre-release-cb:checked) .pre-release-toggle {
  color: #fde68a;
  border-bottom-color: rgba(251, 191, 36, 0.2);
}

.add-pre-release-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}

.pre-release-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.pre-release-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
}

.pre-cover-label {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pre-cover-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pre-cover-box {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.pre-cover-box:hover {
  border-color: rgba(56, 189, 248, 0.5);
}

.pre-cover-ph {
  color: #64748b;
  font-size: 1.5rem;
}

.pre-cover-pencil {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(8, 20, 32, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #bae6fd;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
}

.pre-cover-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  border-radius: 0;
  background: #374151;
}

.pre-cover-preview:not(.hidden) {
  display: block;
}

.release-pre-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fde68a;
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.35);
  flex-shrink: 0;
}

.releases-toolbar-row .input-link {
  flex: 1;
  min-width: 0;
}

/* Pending pre-release row (Spotify URI not resolved yet) */
.row-pending-pre td {
  vertical-align: middle;
}

.pre-wait-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fbbf24;
  margin-right: 5px;
  flex-shrink: 0;
  animation: healthPulse 1.6s ease-in-out infinite;
}

.btn-set-uri {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.1);
  color: #fde68a;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-set-uri:hover {
  background: rgba(251, 191, 36, 0.22);
}

.release-budget-uri {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
}
.release-budget-uri .input-max-budget {
  width: 5.5rem;
  flex-shrink: 0;
}
.release-budget-uri .btn-set-uri {
  padding: 0.3rem 0.7rem;
  font-size: 0.72rem;
}

/* Graduation celebration */
.grad-celeb-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 10, 18, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.grad-celeb-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.grad-celeb-card {
  position: relative;
  max-width: 28rem;
  width: calc(100% - 2rem);
  padding: 1.75rem 1.5rem 1.4rem;
  border-radius: 1.25rem;
  background: linear-gradient(160deg, #122033 0%, #0c1624 100%);
  border: 1px solid rgba(251, 191, 36, 0.35);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), 0 0 40px rgba(251, 191, 36, 0.12);
  text-align: center;
  transform: translateY(16px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.grad-celeb-overlay.visible .grad-celeb-card {
  transform: translateY(0) scale(1);
}
.grad-celeb-emoji {
  font-size: 2.6rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}
.grad-celeb-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fde68a;
}
.grad-celeb-card p {
  margin: 0 0 0.75rem;
  color: #c8d4e4;
  font-size: 0.95rem;
  line-height: 1.45;
}
.grad-celeb-link {
  display: inline-block;
  margin: 0.25rem 0 1rem;
  color: #7dd3fc;
  font-weight: 600;
  word-break: break-all;
}
.grad-celeb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8rem;
  padding: 0.65rem 1.4rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1205;
  font-weight: 700;
  cursor: pointer;
}
.grad-celeb-btn:hover { filter: brightness(1.05); }
#grad-celeb-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.releases-add-shell .pill-green {
  flex-shrink: 0;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (min-width: 769px) {
  .releases-toolbar-row {
    flex-direction: row;
  }
}

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead tr {
  background: var(--table-head);
}

.data-table th {
  text-align: left;
  color: var(--text);
  font-weight: 500;
  font-size: 0.88rem;
  padding: 0.7rem 0.85rem;
  white-space: nowrap;
}

.data-table th:first-child {
  width: 220px;
}

.data-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  font-size: 0.92rem;
  color: var(--text);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.releases-table .col-track {
  min-width: 200px;
}

.release-name-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 500;
  font-size: 0.95rem;
}

.release-track-title {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.release-thumb {
  width: 52px;
  height: 52px;
  border-radius: 4px;
  object-fit: cover;
  background: #374151;
  flex-shrink: 0;
}

.release-thumb.placeholder {
  display: inline-block;
}

.col-center { text-align: center; }

/* Custom checkbox (Deep Stats) */
.chk-deep {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid #475569;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  vertical-align: middle;
  position: relative;
  transition: background 0.12s, border-color 0.12s;
}

.chk-deep:hover {
  border-color: rgba(56, 189, 248, 0.7);
}

.chk-deep:checked {
  background: #38bdf8;
  border-color: #38bdf8;
}

.chk-deep:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #06202f;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.btn-trash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  margin-left: auto;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.btn-trash:hover {
  background: rgba(239, 68, 68, 0.26);
  color: #ef4444;
}

.btn-trash svg {
  width: 18px;
  height: 18px;
}

/* ── Musicstax / forms ── */
.data-table input[type="text"] {
  width: 100%;
  background: #060e14;
  border: 1px solid #1a3344;
  border-radius: 6px;
  color: var(--text);
  padding: 0.45rem 0.55rem;
  font-size: 0.88rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-grid.two { grid-template-columns: 1fr 1fr; }

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

label input:not([type="checkbox"]):not([type="radio"]), label select {
  background: #060e14;
  border: 1px solid #1a3344;
  border-radius: 8px;
  color: var(--text);
  padding: 0.5rem 0.65rem;
}

.check-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  margin: 0.65rem 0;
}

/* Designer sky checkboxes (shared) */
.check-row input[type="checkbox"],
.pre-release-toggle input[type="checkbox"],
.settings-page-body .check-row input[type="checkbox"],
.ai-chat-feedback .ai-feedback-check-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin: 0;
  flex: 0 0 auto;
  border: 1.5px solid #475569;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: background 0.12s, border-color 0.12s;
  accent-color: transparent;
}

.check-row input[type="checkbox"]:hover,
.pre-release-toggle input[type="checkbox"]:hover,
.settings-page-body .check-row input[type="checkbox"]:hover,
.ai-chat-feedback .ai-feedback-check-row input[type="checkbox"]:hover {
  border-color: rgba(56, 189, 248, 0.7);
}

.check-row input[type="checkbox"]:checked,
.pre-release-toggle input[type="checkbox"]:checked,
.settings-page-body .check-row input[type="checkbox"]:checked,
.ai-chat-feedback .ai-feedback-check-row input[type="checkbox"]:checked {
  background: #38bdf8;
  border-color: #38bdf8;
}

.check-row input[type="checkbox"]:checked::after,
.pre-release-toggle input[type="checkbox"]:checked::after,
.settings-page-body .check-row input[type="checkbox"]:checked::after,
.ai-chat-feedback .ai-feedback-check-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #06202f;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.table-toolbar h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.actions-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.status {
  margin-top: 0.75rem;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.status.ok { color: #4ade80; }
.status.err { color: #f87171; }

.hint-block, .muted-block {
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.5;
}

.schedule-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0.5rem;
}

.schedule-timeline-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.schedule-item {
  padding: 0.85rem 1rem;
  border: 1px solid #1f2937;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
}

.schedule-item-fixed {
  border-color: #166534;
  background: rgba(22, 101, 52, 0.12);
}

.schedule-item-muted {
  opacity: 0.85;
}

.schedule-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.schedule-badge {
  font-size: 0.78rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #14532d;
  color: #bbf7d0;
  white-space: nowrap;
}

.schedule-badge-config {
  background: #1e3a5f;
  color: #bfdbfe;
}

.schedule-item-desc {
  margin: 0 0 0.65rem;
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.45;
}

.schedule-item .general-filter-label {
  margin-top: 0.25rem;
}

.schedule-item .general-schedule-select {
  margin: 0.35rem 0 0.65rem;
  max-width: 280px;
}

.log-box {
  margin-top: 1rem;
  background: #030303;
  border: 1px solid #1f2937;
  border-radius: 10px;
  max-height: 280px;
  overflow: auto;
}

.log-box pre {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.mock-panel { padding: 2rem 0; }
.mock-panel h2 { margin: 0 0 0.5rem; }

.mono { font-family: ui-monospace, monospace; font-size: 0.85rem; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  border: 1px solid #1f3a4d;
  border-radius: 20px;
  padding: 1.35rem 1.5rem 1.5rem;
}

.modal-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-hint {
  margin: 0 0 1rem;
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.45;
}

.modal-label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.modal-input {
  border-radius: 12px;
}

.modal-preview {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--input-border);
  word-break: break-all;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.modal-actions .pill {
  width: 100%;
  padding: 0.7rem 1rem;
}

.popularity-badge {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-left: 0.25rem;
}

.popularity-badge.on { color: var(--input-border); }
.popularity-badge.off { color: #f87171; }

.row-no-pop { opacity: 0.55; }

@media (min-width: 480px) {
  .modal-actions {
    flex-direction: row;
  }
  .modal-actions .pill { width: auto; flex: 1; }
}

.releases-scroll {
  -webkit-overflow-scrolling: touch;
}

.releases-table {
  min-width: 640px;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  body {
    font-size: 14px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .app-shell {
    flex-direction: column;
    min-height: 100dvh;
  }

  /* Верхняя полоса сливается с фоном — остаётся только кнопка меню */
  .sidebar {
    width: 100%;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    background: var(--bg);
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .sidebar-toggle {
    display: none;
  }

  .sidebar-burger {
    display: flex;
  }

  /* Профиль только внутри выезжающего меню */
  .sidebar > .sidebar-profile {
    display: none;
  }

  .topbar-title {
    display: block;
    flex: 1;
    min-width: 0;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
  }

  /* По умолчанию кнопки разделов в topbar скрыты — показываем только активный раздел */
  .topbar-actions .refresh-btn,
  .topbar-actions .deep-rail-toggle,
  .topbar-actions .pr-icon-btn {
    display: none;
  }

  body[data-nav="general"] .topbar-actions #general-refresh-btn,
  body[data-nav="general"] .topbar-actions #general-toggle-filters,
  body[data-nav="deep"] .topbar-actions #deep-sync-btn,
  body[data-nav="deep"] .topbar-actions #deep-toggle-filters,
  body[data-nav="release-map"] .topbar-actions #rm-refresh-btn,
  body[data-nav="release-map"] .topbar-actions #rm-toggle-filters,
  body[data-nav="release-map"] .topbar-actions #ai-advisor-launch,
  body[data-nav="facebook"] .topbar-actions #fb-sync-btn,
  body[data-nav="facebook"] .topbar-actions #fb-toggle-filters,
  body[data-nav="playlists"] .topbar-actions #plists-sync-btn,
  body[data-nav="playlists"] .topbar-actions #plists-filters-toggle,
  body[data-nav="pre-release"] .topbar-actions .pr-icon-btn {
    display: inline-flex;
  }

  /* Health lives on the burger outline — hide the separate traffic-light */
  .sidebar > .sidebar-health {
    display: none !important;
  }

  .sidebar-burger {
    border: 1.5px solid rgba(100, 116, 139, 0.55);
    box-sizing: border-box;
  }

  /* OK: quiet dark green outline only — no glow */
  .sidebar-burger.ok {
    border-color: #166534;
    box-shadow: none;
  }

  /* BAD: loud — hard to miss */
  .sidebar-burger.bad {
    border-color: #ef4444;
    box-shadow:
      0 0 0 2px rgba(239, 68, 68, 0.55),
      0 0 14px rgba(239, 68, 68, 0.7),
      0 0 28px rgba(239, 68, 68, 0.45);
    animation: burgerHealthPulse 0.9s ease-in-out infinite;
  }

  @keyframes burgerHealthPulse {
    0%, 100% {
      border-color: #ef4444;
      box-shadow:
        0 0 0 2px rgba(239, 68, 68, 0.45),
        0 0 10px rgba(239, 68, 68, 0.55),
        0 0 20px rgba(239, 68, 68, 0.3);
    }
    50% {
      border-color: #f87171;
      box-shadow:
        0 0 0 3px rgba(248, 113, 113, 0.75),
        0 0 22px rgba(239, 68, 68, 0.9),
        0 0 40px rgba(239, 68, 68, 0.55);
    }
  }

  #topbar-save-defaults {
    display: none;
  }

  body:not([data-nav="profile"]) #topbar-save-defaults:not(.hidden) {
    display: inline-flex;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    min-height: var(--icon-btn-size);
    max-height: var(--icon-btn-size);
    padding: 0;
    border: none;
    border-radius: var(--icon-btn-radius);
    background: var(--icon-btn-bg);
    color: var(--icon-btn-fg);
  }

  #general-save-defaults,
  #deep-save-defaults,
  #rm-save-defaults,
  #fb-save-defaults {
    display: none !important;
  }

  body[data-nav="facebook"] .topbar-actions .fb-head-actions {
    display: none !important;
  }

  .topbar-actions .refresh-btn.spinning {
    color: var(--icon-btn-spin);
  }

  /* Когда drawer открыт — в topbar только sync, закрытие через панель или backdrop */
  body.general-filters-open .topbar-actions #general-toggle-filters,
  body.deep-filters-open .topbar-actions #deep-toggle-filters,
  body.rm-filters-open .topbar-actions #rm-toggle-filters,
  body.fb-filters-open .topbar-actions #fb-toggle-filters {
    display: none !important;
  }

  .topbar-actions .refresh-btn:disabled {
    opacity: 0.55;
    pointer-events: none;
  }

  .topbar-actions .refresh-btn:disabled.spinning {
    opacity: 0.85;
  }

  /* Кнопки в топбаре видны только для активного раздела (legacy fallback) */
  body:not([data-nav="general"]) .topbar-actions #general-refresh-btn,
  body:not([data-nav="general"]) .topbar-actions #general-toggle-filters,
  body:not([data-nav="deep"]) .topbar-actions #deep-sync-btn,
  body:not([data-nav="deep"]) .topbar-actions #deep-toggle-filters,
  body:not([data-nav="release-map"]) .topbar-actions #rm-refresh-btn,
  body:not([data-nav="release-map"]) .topbar-actions #rm-toggle-filters,
  body:not([data-nav="release-map"]) .topbar-actions #ai-advisor-launch,
  body:not([data-nav="facebook"]) .topbar-actions #fb-sync-btn,
  body:not([data-nav="facebook"]) .topbar-actions #fb-toggle-filters,
  body:not([data-nav="playlists"]) .topbar-actions #plists-sync-btn,
  body:not([data-nav="playlists"]) .topbar-actions #plists-filters-toggle {
    display: none !important;
  }

  body.plists-filters-open .topbar-actions #plists-filters-toggle {
    display: none !important;
  }

  .app-shell.sidebar-collapsed .sidebar {
    width: 100%;
    min-width: 0;
  }

  .app-shell.sidebar-collapsed .sidebar-label {
    opacity: 1;
    max-width: none;
    max-height: none;
  }

  .sidebar-profile {
    flex-direction: row;
    margin-bottom: 0;
    align-self: stretch;
    gap: 0.65rem;
    width: 100%;
  }

  .sidebar-avatar,
  .app-shell.sidebar-collapsed .sidebar-avatar {
    width: 38px;
    height: 38px;
  }

  .sidebar-name,
  .sidebar-nav .sidebar-name,
  .app-shell.sidebar-collapsed .sidebar-nav .sidebar-name,
  .app-shell.sidebar-collapsed .sidebar > .sidebar-profile .sidebar-name {
    display: block !important;
    opacity: 1 !important;
    max-height: none !important;
    max-width: none !important;
    margin: 0 !important;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--nav-hover);
  }

  /* Off-canvas nav panel, opens from the left over half the screen */
  .sidebar-nav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: min(64vw, 300px);
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.6rem 0.85rem 1rem;
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    overflow-y: auto;
  }

  .sidebar-close {
    display: flex;
    margin-bottom: 0.5rem;
  }

  /* Профиль (аватар + имя), перенесённый в меню скриптом */
  .sidebar-nav .sidebar-profile {
    display: flex !important;
    width: 100%;
    padding: 0.45rem 0.5rem 0.9rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    align-items: center;
  }

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

  /* .sidebar (z-index 20) создаёт stacking context — поднимаем его над бэкдропом,
     чтобы выехавшая панель была кликабельна. */
  body.mobile-nav-open .sidebar {
    z-index: 60;
  }

  body.mobile-nav-open .mobile-nav-backdrop {
    display: block;
  }

  .sidebar-link,
  .app-shell.sidebar-collapsed .sidebar-link {
    font-size: 1rem;
    white-space: nowrap;
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    width: 100%;
    justify-content: flex-start;
    gap: 0.65rem;
  }

  /* Mobile drawer shows labels even if desktop-collapsed class is present */
  .app-shell.sidebar-collapsed .sidebar-label {
    display: inline;
    opacity: 1;
    max-width: 160px;
    pointer-events: auto;
  }

  .sidebar-icon {
    width: 20px;
    height: 20px;
  }

  .sidebar-icon svg {
    width: 20px;
    height: 20px;
  }

  .sidebar-link {
    color: var(--nav-muted);
  }

  .sidebar-link.active {
    background: rgba(255, 255, 255, 0.07);
    color: var(--nav-active);
  }

  .main {
    padding: 1.15rem 1.1rem 2.25rem;
    flex: 1;
  }

  .sync-status-strip {
    margin: -1rem -1rem 0.65rem;
    width: calc(100% + 2rem);
  }

  body.sync-active .main {
    padding-top: 0;
  }

  body.sync-active .sync-status-strip {
    margin-top: 0;
  }

  .artist-panel {
    border-radius: 20px;
    padding: 1rem 1rem 1.25rem;
  }

  .artist-avatar {
    width: 56px;
    height: 56px;
  }

  .artist-title {
    font-size: 1.35rem;
  }

  .releases-add-shell {
    padding: 0.85rem 0.9rem;
  }

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

  .releases-add-shell .pill-green {
    width: 100%;
    padding: 0.7rem 1rem;
  }

  .pre-release-grid {
    grid-template-columns: 1fr;
  }

  .pill {
    padding: 0.58rem 1.1rem;
    font-size: 0.9rem;
  }

  .actions-row {
    flex-direction: column;
  }

  .actions-row .pill {
    width: 100%;
  }

  .table-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* Musicstax: card rows on mobile */
  .mx-table thead { display: none; }

  .mx-table tr {
    display: block;
    background: #060e14;
    border: 1px solid #1a3344;
    border-radius: 12px;
    padding: 0.65rem;
    margin-bottom: 0.65rem;
  }

  .mx-table td {
    display: block;
    border: none;
    padding: 0.35rem 0;
  }

  .mx-table td:last-child {
    text-align: right;
    padding-top: 0.5rem;
  }

  .mx-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 0.2rem;
  }

  .form-grid,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .online-panel {
    padding: 1.5rem 0;
  }
}

@media (max-width: 1100px) and (min-width: 769px) {
  .artist-panel-head {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ── Filter drawer calendar (shared: General + Deep Insights) ──
   Pattern: right modal → period presets (full width) → calendar → dropdowns.
   See .cursor/rules/filter-drawer-calendar.mdc */
#general-drawer-slot .filter-drawer-periods,
.deep-filters-drawer .filter-drawer-periods,
.fb-filters-drawer .filter-drawer-periods,
.plists-filters-drawer .filter-drawer-periods {
  display: flex;
  width: 100%;
  flex-wrap: nowrap;
  gap: 0.15rem;
  align-items: center;
  justify-content: space-between;
  overflow: visible;
  margin-bottom: 0.15rem;
}

#general-drawer-slot .filter-drawer-periods .period-btn,
.deep-filters-drawer .filter-drawer-periods .period-btn,
.fb-filters-drawer .filter-drawer-periods .period-btn,
.plists-filters-drawer .filter-drawer-periods .period-btn {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  border: none;
  background: transparent;
  padding: 0.35rem 0;
  border-radius: 0;
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

#general-drawer-slot .filter-drawer-periods .period-btn.active,
.deep-filters-drawer .filter-drawer-periods .period-btn.active,
.fb-filters-drawer .filter-drawer-periods .period-btn.active,
.plists-filters-drawer .filter-drawer-periods .period-btn.active {
  color: #fff;
}

/* Filter drawers — top gap before collapse handle (Facebook Ads pattern) */
.general-filters-drawer,
.deep-filters-drawer,
.rm-filters-drawer,
.fb-filters-drawer,
.plists-filters-drawer {
  top: 1rem;
}

.general-drawer-panel .drawer-collapse-btn,
.deep-filters-panel .drawer-collapse-btn,
.rm-filters-panel .drawer-collapse-btn,
.fb-filters-panel .drawer-collapse-btn,
.plists-filters-panel .drawer-collapse-btn {
  margin-bottom: 0.15rem;
}

/* Desktop only — when save/sync sit under collapse, gap before filter content. */
@media (min-width: 769px) {
  .general-drawer-panel > .drawer-action-dock.is-active + *,
  .deep-filters-panel > .drawer-action-dock.is-active + *,
  .rm-filters-panel > .drawer-action-dock.is-active + *,
  .fb-filters-panel > .drawer-action-dock.is-active + *,
  .plists-filters-panel > .drawer-action-dock.is-active + * {
    margin-top: 0.25rem;
  }
}

@media (max-width: 768px) {
  #general-drawer-slot .filter-drawer-periods .period-btn,
  .deep-filters-drawer .filter-drawer-periods .period-btn,
  .fb-filters-drawer .filter-drawer-periods .period-btn {
    font-size: 0.91rem;
  }
  /* Five presets — keep compact so all stay tappable */
  .plists-filters-drawer .filter-drawer-periods .period-btn {
    font-size: 0.78rem;
    padding: 0.4rem 0;
  }
}

/* ── Unified design system (Profile, Settings, placeholders) ── */
.surface-card {
  background: linear-gradient(145deg, rgba(11, 28, 40, 0.95), rgba(6, 14, 22, 0.98));
  border: 1px solid rgba(56, 189, 248, 0.12);
  border-radius: 14px;
  padding: 1rem 1rem 1.1rem;
}

.surface-card + .surface-card {
  margin-top: 1rem;
}

.surface-card h2,
.surface-card h3 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #e2e8f0;
}

.panel-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel-page {
  padding: 0.25rem 0 2rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#topbar-save-defaults {
  display: none;
}

@media (min-width: 769px) {
  .general-head-actions,
  .deep-head-actions,
  .fb-head-actions,
  .rm-head-actions {
    display: inline-flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 0.5rem;
    flex: 0 0 auto;
    flex-shrink: 0;
    flex-wrap: nowrap;
    min-width: max-content;
    align-self: flex-start;
  }

  .general-head-actions > *,
  .deep-head-actions > *,
  .fb-head-actions > *,
  .rm-head-actions > * {
    flex-shrink: 0;
  }
}

.filter-defaults-toast {
  position: fixed;
  right: 1rem;
  bottom: 1.25rem;
  z-index: 12000;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(74, 222, 128, 0.35);
  background: rgba(15, 23, 42, 0.94);
  color: #86efac;
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.filter-defaults-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* filter-defaults keep canonical 40×40 on mobile (same as sync / burger) */

.back-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 0.85rem;
  transition: color 0.15s;
}

.back-link-btn:hover {
  color: #e2e8f0;
}

.standalone-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
}

.settings-body {
  min-height: 100vh;
  background: var(--bg);
}

.tab-segment {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.15rem;
}

.tab-segment::-webkit-scrollbar {
  display: none;
}

.tab-segment-btn {
  flex: 0 0 auto;
  border: 2px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #94a3b8;
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.tab-segment-btn:hover {
  color: #e2e8f0;
}

.tab-segment-btn.active {
  color: #fff;
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.08);
}

.app-field-label {
  display: block;
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

/* Custom in-app select (replaces native Mac/OS popup) */
.app-select-wrap {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  max-width: 100%;
}

.app-select-wrap--block {
  display: block;
  width: 100%;
}

.app-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.app-select-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.5rem 2rem 0.5rem 1rem;
  text-align: left;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  transition: border-color 0.15s, background 0.15s;
}

.app-select-wrap--block .app-select-btn {
  font-size: 0.82rem;
}

/* Mobile track pickers — full width + ~15% taller (important control) */
@media (max-width: 768px) {
  .deep-head-left .app-select-wrap,
  .rm-head-left .app-select-wrap,
  .fb-head-left .app-select-wrap {
    display: block;
    width: 100%;
    max-width: none;
  }

  .deep-head-left .app-select-btn,
  .rm-head-left .app-select-btn,
  .fb-head-left .app-select-btn,
  .plists-head-left .app-select-btn {
    width: 100%;
    min-height: 3rem;
    padding: 0.82rem 2.1rem 0.82rem 1.1rem;
    font-size: 1.05rem;
    font-weight: 600;
  }
}

.app-select-wrap.is-open .app-select-btn,
.app-select-btn:hover {
  border-color: rgba(56, 189, 248, 0.65);
}

.app-select-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 80;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.4rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0b1c28;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.app-select-option {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #e2e8f0;
  text-align: left;
  font: inherit;
  font-size: 0.84rem;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
}

.app-select-option:hover,
.app-select-option.is-active {
  background: rgba(56, 189, 248, 0.14);
  color: #fff;
}

.app-select-option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.app-input,
.app-select,
.modal-input {
  width: 100%;
  box-sizing: border-box;
  appearance: none;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.55rem 1rem;
  outline: none;
  transition: border-color 0.15s;
}

.profile-panel label input:not(.chk-deep):not([type="checkbox"]),
.profile-panel label select,
.standalone-page label input:not(.chk-deep):not([type="checkbox"]),
.standalone-page label select,
.surface-card label input:not(.chk-deep):not([type="checkbox"]),
.surface-card label select {
  width: 100%;
  box-sizing: border-box;
  appearance: none;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.55rem 1rem;
  outline: none;
  transition: border-color 0.15s;
}

.app-select,
.profile-panel label select,
.standalone-page label select,
.surface-card label select {
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
}

.app-input:focus,
.app-select:focus,
.profile-panel label input:not(.chk-deep):not([type="checkbox"]):focus,
.profile-panel label select:focus,
.standalone-page label input:not(.chk-deep):not([type="checkbox"]):focus,
.standalone-page label select:focus,
.surface-card label input:not(.chk-deep):not([type="checkbox"]):focus,
.surface-card label select:focus {
  border-color: rgba(56, 189, 248, 0.65);
}

/* Date/time: kill white native chrome on dark UI */
.app-input[type="date"],
.app-input[type="time"],
.profile-panel label input[type="date"],
.profile-panel label input[type="time"],
.standalone-page label input[type="date"],
.standalone-page label input[type="time"],
.surface-card label input[type="date"],
.surface-card label input[type="time"] {
  color-scheme: dark;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  min-height: 2.55rem;
  padding-right: 2.4rem;
  background-color: rgba(0, 0, 0, 0.35);
  background-repeat: no-repeat;
  background-position: right 0.95rem center;
  background-size: 16px 16px;
}
.app-input[type="date"],
.profile-panel label input[type="date"],
.standalone-page label input[type="date"],
.surface-card label input[type="date"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none'%3E%3Crect x='3' y='5' width='18' height='16' rx='3' stroke='%23a1a1aa' stroke-width='1.8'/%3E%3Cpath d='M8 3v4M16 3v4M3 10h18' stroke='%23a1a1aa' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}
.app-input[type="time"],
.profile-panel label input[type="time"],
.standalone-page label input[type="time"],
.surface-card label input[type="time"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none'%3E%3Ccircle cx='12' cy='12' r='9' stroke='%23a1a1aa' stroke-width='1.8'/%3E%3Cpath d='M12 7v5l3 2' stroke='%23a1a1aa' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.app-input[type="date"]::-webkit-calendar-picker-indicator,
.app-input[type="time"]::-webkit-calendar-picker-indicator,
.profile-panel label input[type="date"]::-webkit-calendar-picker-indicator,
.profile-panel label input[type="time"]::-webkit-calendar-picker-indicator,
.standalone-page label input[type="date"]::-webkit-calendar-picker-indicator,
.standalone-page label input[type="time"]::-webkit-calendar-picker-indicator,
.surface-card label input[type="date"]::-webkit-calendar-picker-indicator,
.surface-card label input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.profile-panel label,
.standalone-page label,
.surface-card label {
  display: flex;
  flex-direction: column;
  gap: 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Checkbox rows must stay horizontal even inside label column layouts */
.profile-panel label.check-row,
.profile-panel label.pre-release-toggle,
.standalone-page label.check-row,
.surface-card label.check-row {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
}

.profile-panel label > .app-field-label,
.profile-panel label:first-child:not(.check-row),
.standalone-page label > .app-field-label,
.standalone-page label:first-child:not(.check-row),
.surface-card label > .app-field-label,
.surface-card label:first-child:not(.check-row) {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.guide-block {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin: 0.85rem 0 1rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #cbd5e1;
}

.guide-block strong {
  display: block;
  margin-bottom: 0.45rem;
  color: #e2e8f0;
}

.guide-block ol {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.guide-block a {
  color: #38bdf8;
}

.key-hints {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.key-hints > div {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
}

.key-hints h3 {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  color: #94a3b8;
  font-weight: 600;
}

.key-hints ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.form-grid {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.form-grid.two {
  grid-template-columns: 1fr 1fr;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.pill-outline {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
}

.pill-outline:hover {
  border-color: rgba(56, 189, 248, 0.45);
}

.btn-danger {
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  background: rgba(179, 0, 0, 0.85);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-danger.small {
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
}

/* Profile panel refresh */
.profile-panel {
  padding: 0.25rem 0 2rem;
  max-width: 100%;
  overflow-x: hidden;
}

.profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.profile-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.profile-toolbar-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.profile-toolbar .artist-select-wrap {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
}

.profile-toolbar .artist-select-wrap::after {
  border-top-color: #94a3b8;
}

.artist-panel {
  background: linear-gradient(145deg, rgba(11, 28, 40, 0.95), rgba(6, 14, 22, 0.98));
  border: 1px solid rgba(56, 189, 248, 0.12);
  border-radius: 14px;
  padding: 1rem 1rem 1.25rem;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.artist-panel .tab-panel {
  margin-top: 0.85rem;
}

.artist-panel .table-wrap {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.artist-panel .data-table thead tr {
  background: rgba(255, 255, 255, 0.04);
}

.artist-panel .data-table th {
  color: #94a3b8;
  font-size: 0.78rem;
}

.empty-state-card {
  text-align: center;
  padding: 2.5rem 1.25rem;
  color: #94a3b8;
}

.placeholder-panel {
  padding: 0.25rem 0 2rem;
}

.placeholder-panel .surface-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.placeholder-panel .surface-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.settings-table .data-table th,
.settings-table .data-table td {
  font-size: 0.82rem;
}

@media (max-width: 768px) {
  body[data-nav="profile"] .main {
    overflow-x: hidden;
  }

  .profile-head {
    display: none;
  }

  .profile-toolbar {
    margin-bottom: 0.85rem;
  }

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

  .profile-toolbar .pill {
    width: 100%;
  }

  .releases-add-shell .pill-green {
    width: 100%;
  }

  .topbar-actions #profile-settings-link {
    display: none;
  }

  body[data-nav="profile"] .topbar-actions #profile-settings-link {
    display: flex;
  }

  .form-grid.two,
  .key-hints {
    grid-template-columns: 1fr;
  }

  .standalone-page {
    padding: 1rem 1rem 2rem;
  }

  .releases-table {
    min-width: 100%;
  }

  .releases-table thead {
    display: none;
  }

  .releases-table tbody tr {
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    margin-bottom: 0.65rem;
    padding: 0.65rem;
    background: rgba(255, 255, 255, 0.02);
  }

  .releases-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    border: none;
    padding: 0.35rem 0;
    font-size: 0.85rem;
  }

  .releases-table tbody td::before {
    content: attr(data-label);
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 500;
    flex-shrink: 0;
  }

  .releases-table tbody td.col-track {
    display: block;
    padding-bottom: 0.5rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .releases-table tbody td.col-track .release-name-cell {
    align-items: flex-start;
  }

  .releases-table tbody td.col-track .release-thumb {
    width: 56px;
    height: 56px;
  }

  .releases-table tbody td.col-track .btn-trash {
    margin-top: 0.15rem;
  }

  .releases-table tbody td.col-track::before {
    display: none;
  }
}

.data-page .data-table-wrap {
  max-height: 60vh;
  margin-top: 0.75rem;
}

.data-page .data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-page .data-table th.sortable:hover {
  color: #e2e8f0;
}

.data-page .data-col-filter {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
  outline: none;
}

.data-page .data-col-filter:focus {
  border-color: rgba(56, 189, 248, 0.45);
}

.data-page .data-table .totals-row td {
  font-weight: 600;
  color: #94a3b8;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.data-page .data-table td,
.data-page .data-table th {
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ── AI Advisor sparkle button ── */
.ai-sparkle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
  transition: background 0.2s, transform 0.2s;
}

.ai-sparkle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ai-sparkle-btn.is-disabled,
.ai-sparkle-btn[aria-disabled='true'] {
  opacity: 0.38;
  cursor: not-allowed;
}

.ai-sparkle-btn.is-disabled:hover,
.ai-sparkle-btn[aria-disabled='true']:hover {
  background: rgba(255, 255, 255, 0.06);
}

.ai-sparkle-icon {
  width: 22px;
  height: 22px;
  transition: transform 0.35s ease;
}

.ai-sparkle-btn.is-magic .ai-sparkle-icon {
  animation: ai-sparkle-spin 1.2s ease-in-out infinite;
}

.ai-sparkle-btn.is-magic::before,
.ai-sparkle-btn.is-magic::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 14px;
  pointer-events: none;
}

.ai-sparkle-btn.is-magic::before {
  background: conic-gradient(from 0deg, #f472b6, #60a5fa, #4ade80, #facc15, #f472b6);
  opacity: 0.45;
  animation: ai-sparkle-glow 1.8s linear infinite;
  filter: blur(6px);
}

.ai-sparkle-btn.is-magic::after {
  inset: 0;
  border: 1px solid rgba(96, 165, 250, 0.35);
  animation: ai-sparkle-pulse 1.4s ease-in-out infinite;
}

@keyframes ai-sparkle-spin {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.12) rotate(18deg); }
}

@keyframes ai-sparkle-glow {
  to { transform: rotate(360deg); }
}

@keyframes ai-sparkle-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.85; }
}

/* ── AI Advisor chat drawer ── */
.ai-chat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 80;
}

.ai-chat-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  z-index: 81;
  display: flex;
  flex-direction: column;
  background: #151b24;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
}

body.ai-chat-open {
  overflow: hidden;
}

.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.ai-chat-title-icon svg {
  width: 20px;
  height: 20px;
}

.ai-chat-header-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.ai-lang-toggle {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-lang-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
}

.ai-lang-btn.is-active {
  background: rgba(56, 189, 248, 0.22);
  color: #e0f7ff;
}

.ai-lang-btn:hover:not(.is-active) {
  color: rgba(255, 255, 255, 0.85);
}

.ai-chat-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}

.ai-chat-close svg {
  width: 18px;
  height: 18px;
}

.ai-kpi-board {
  margin: 0.45rem 0 0.55rem;
  overflow-x: auto;
  max-width: 100%;
}

.ai-kpi-cols {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 1rem;
  width: max-content;
  max-width: 100%;
}

.ai-kpi-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.42rem;
  min-width: 0;
}

.ai-kpi-col-labels {
  flex: 0 0 auto;
  padding-right: 0.25rem;
}

.ai-kpi-h {
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: left;
  line-height: 1.3;
  min-height: 1.3em;
  margin-bottom: 0.12rem;
}

.ai-kpi-h-spacer {
  visibility: hidden;
}

.ai-kpi-rh {
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 500;
  text-align: left;
  line-height: 1.5;
  min-height: 1.5em;
  padding: 0.06rem 0;
}

.ai-kpi-cell {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.28rem;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 0.78rem;
  line-height: 1.5;
  min-height: 1.5em;
  padding: 0.06rem 0;
}

.ai-kpi-mark {
  display: inline-flex;
  width: 1.05em;
  min-width: 1.05em;
  flex: 0 0 1.05em;
  align-items: center;
  justify-content: flex-start;
  line-height: 1;
  font-size: 0.85em;
}

.ai-kpi-mark-empty {
  visibility: hidden;
}

.ai-kpi-mark-est {
  color: #64748b;
  font-size: 0.72em;
}

.ai-kpi-num {
  text-align: left;
}

.ai-kpi-cell-est,
.ai-kpi-cell-est .ai-kpi-num {
  color: #64748b;
}

.ai-kpi-cpl {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.14);
  font-size: 0.8rem;
  color: #e2e8f0;
  line-height: 1.4;
  text-align: left;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  -webkit-overflow-scrolling: touch;
}

.ai-chat-msg {
  display: flex;
}

.ai-chat-msg-user {
  justify-content: flex-end;
}

.ai-chat-bubble {
  max-width: 92%;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}

.ai-chat-bubble.user {
  background: rgba(37, 99, 235, 0.35);
  border: 1px solid rgba(96, 165, 250, 0.25);
  color: #e2e8f0;
}

.ai-chat-bubble.assistant {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.ai-chat-bubble strong {
  color: #f1f5f9;
  font-weight: 600;
}

.ai-chat-bubble.assistant strong {
  display: inline-block;
  margin-top: 0.75rem;
  margin-bottom: 0.2rem;
}

.ai-chat-bubble.assistant strong:first-child {
  margin-top: 0;
}

/* KPI title → board: small breathing room, not flush. */
.ai-chat-bubble.assistant strong + .ai-kpi-board,
.ai-chat-bubble.assistant strong + br + .ai-kpi-board {
  margin-top: 0.35rem;
}

.ai-chat-typing {
  display: none !important;
}

@keyframes ai-chat-dot {
  0%, 80%, 100% { opacity: 0.35; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.15); }
}

.ai-chat-progress {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0.85rem 0.35rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.ai-chat-progress.hidden {
  display: none;
}

.ai-chat-progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #60a5fa;
  flex-shrink: 0;
  animation: ai-chat-dot 1.1s ease-in-out infinite;
}

.ai-chat-progress-label {
  flex: 1;
  min-width: 0;
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-chat-progress-counter {
  color: #64748b;
  font-size: 0.68rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.ai-chat-footer {
  padding: 0.45rem 0.85rem calc(0.55rem + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.ai-chat-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.ai-chat-save {
  margin-left: auto;
  padding: 0.38rem 0.7rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ai-chat-save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ai-chat-cancel {
  padding: 0.38rem 0.7rem;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 8px;
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.ai-chat-reset {
  padding: 0.38rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.ai-chat-reset:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
}

.ai-chat-actions-row,
.ai-chat-context-btn,
.ai-chat-disclaimer {
  display: none !important;
}

.ai-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.35rem 0.35rem 0.35rem 0.45rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-chat-voice {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  order: 2;
}

.ai-chat-send {
  order: 3;
}

.ai-chat-input {
  order: 1;
}

.ai-chat-voice-panel {
  order: 1;
}

.ai-chat-voice svg {
  width: 18px;
  height: 18px;
}

.ai-chat-voice:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

.ai-chat-voice:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ai-chat-voice.is-unsupported {
  opacity: 0.35;
  cursor: not-allowed;
}

.ai-chat-voice-panel {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
  padding: 0.1rem 0;
}

.ai-chat-voice-panel.hidden {
  display: none;
}

.ai-chat-voice-mid {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  justify-content: center;
  min-height: 40px;
}

.ai-chat-voice-wave {
  display: block;
  width: 100%;
  height: 28px;
  border-radius: 8px;
}

.ai-chat-voice-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0.15rem;
}

.ai-chat-voice-status {
  font-size: 0.72rem;
  color: #fca5a5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-chat-voice-timer {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: #94a3b8;
  flex-shrink: 0;
}

.ai-chat-voice-processing {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font-size: 0.8rem;
  z-index: 1;
}

.ai-chat-voice-processing.hidden {
  display: none;
}

.ai-chat-voice-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-top-color: #93c5fd;
  animation: ai-voice-spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes ai-voice-spin {
  to { transform: rotate(360deg); }
}

.ai-chat-voice-confirm,
.ai-chat-voice-discard {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.ai-chat-voice-confirm svg,
.ai-chat-voice-discard svg {
  width: 16px;
  height: 16px;
}

.ai-chat-voice-confirm {
  background: #22c55e;
  color: #052e16;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.ai-chat-voice-confirm:hover:not(:disabled) {
  background: #16a34a;
  transform: scale(1.04);
}

.ai-chat-voice-discard {
  background: rgba(248, 113, 113, 0.16);
  color: #fca5a5;
}

.ai-chat-voice-discard:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.28);
}

.ai-chat-voice-confirm:disabled,
.ai-chat-voice-discard:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.ai-chat-input-row.is-voice-mode .ai-chat-input,
.ai-chat-input-row.is-voice-mode .ai-chat-voice,
.ai-chat-input-row.is-voice-mode .ai-chat-send {
  display: none;
}

.ai-chat-input-row.is-voice-processing .ai-chat-voice-wave,
.ai-chat-input-row.is-voice-processing .ai-chat-voice-meta {
  visibility: hidden;
}

.ai-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  min-width: 0;
  resize: none;
  overflow-y: auto;
  line-height: 1.4;
  min-height: 34px;
  max-height: 160px;
  padding: 0.35rem 0.15rem;
  font-family: inherit;
}

.ai-chat-input::placeholder {
  color: #64748b;
}

.ai-chat-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.ai-chat-send svg {
  width: 18px;
  height: 18px;
}

.ai-chat-feedback {
  margin: 0 0.85rem 0.3rem;
  padding: 0.2rem 0.15rem 0.2rem 0.35rem;
  border-radius: 0;
  background: transparent;
  border: none;
  flex-shrink: 0;
}

.ai-chat-feedback-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: flex-end;
  min-height: 1.6rem;
}

.ai-feedback-toggle,
.ai-feedback-chevron {
  display: none !important;
}

.ai-chat-feedback-body {
  margin-top: 0.35rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: rgba(56, 189, 248, 0.06);
  max-height: min(36vh, 280px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ai-chat-feedback-quick {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.ai-feedback-status {
  margin-right: auto;
  font-size: 0.68rem;
  color: #64748b;
  max-width: 70%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.ai-feedback-status.is-flash,
.ai-feedback-status.is-saved.is-flash {
  opacity: 1;
  transform: translateY(0);
  color: #4ade80;
}

.ai-feedback-status.is-saved {
  color: #4ade80;
}

.ai-feedback-vote {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  color: #94a3b8;
}

.ai-feedback-like.is-active {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.12);
}

.ai-feedback-dislike.is-active {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
}

.ai-feedback-like:hover {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
}

.ai-feedback-dislike:hover {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
}

.ai-feedback-hint {
  margin: 0.4rem 0 0;
  font-size: 0.74rem;
  color: #64748b;
  line-height: 1.35;
}

.ai-feedback-saved {
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-feedback-saved-line {
  font-size: 0.8rem;
  color: #cbd5e1;
  line-height: 1.4;
  margin-bottom: 0.4rem;
}

.ai-feedback-edit {
  border: none;
  background: transparent;
  color: #7dd3fc;
  font-size: 0.76rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.ai-feedback-empty {
  margin: 0;
  font-size: 0.78rem;
  color: #94a3b8;
}

.ai-chat-feedback-form {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-feedback-scope {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.ai-feedback-sections {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.5rem;
}

.ai-feedback-sections-title {
  font-size: 0.76rem;
  color: #94a3b8;
  margin-bottom: 0.25rem;
}

/* Override global label { flex-direction: column } inside feedback panel */
.ai-chat-feedback .ai-feedback-check-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8rem;
  color: #cbd5e1;
  cursor: pointer;
  padding: 0.28rem 0;
  margin: 0;
  min-height: 1.75rem;
}

.ai-chat-feedback .ai-feedback-check-row input[type="checkbox"],
.ai-chat-feedback .ai-feedback-check-row input[type="radio"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: #38bdf8;
  flex-shrink: 0;
}

.ai-feedback-check-label {
  flex: 1;
  line-height: 1.3;
  text-align: left;
}

.ai-feedback-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: flex-end;
  margin-top: 0.15rem;
}

.ai-feedback-cancel {
  border: none;
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-feedback-cancel:hover {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.1);
}

.ai-feedback-note-wrap {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.ai-feedback-note {
  flex: 1;
  width: auto;
  min-height: 2.8rem;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.25);
  color: #e2e8f0;
  font-size: 0.8rem;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0;
  font-family: inherit;
}

.ai-feedback-note-mic {
  flex: 0 0 auto;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.ai-feedback-note-mic:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}

.ai-feedback-submit {
  border: none;
  border-radius: 10px;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
  flex-shrink: 0;
}

.ai-chat-disclaimer {
  margin: 0.55rem 0 0;
  font-size: 0.72rem;
  color: #64748b;
  text-align: center;
}

@media (max-width: 768px) {
  body[data-nav="release-map"] .topbar-actions #ai-advisor-launch {
    display: flex;
  }

  body:not([data-nav="release-map"]) .topbar-actions #ai-advisor-launch {
    display: none !important;
  }
}

/* ── Settings page (aligned with app form tokens) ── */
.settings-page-body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  color-scheme: dark;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.settings-page-body .settings-page {
  max-width: 880px;
}

.settings-page-body .panel-title {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.settings-page-body .settings-tabs {
  margin: 0 0 1rem;
}

.settings-page-body .surface-card {
  background: linear-gradient(145deg, rgba(11, 28, 40, 0.95), rgba(6, 14, 22, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 1rem 1.05rem 1.1rem;
}

.settings-page-body .section-title {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.settings-page-body .settings-subhead {
  margin: 1rem 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.settings-page-body .muted-block,
.settings-page-body .hint-block {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-dim);
}

.settings-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.settings-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.72rem;
  color: #cbd5e1;
}

.settings-chip code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  color: #e2e8f0;
}

.settings-page-body .form-grid {
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.settings-page-body .form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-page-body .settings-form label,
.settings-page-body .settings-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.settings-page-body .app-field-label {
  margin-bottom: 0;
}

/* Same field DNA as Musicstax / app forms — NOT cyan pills */
.settings-page-body .elwo-field,
.settings-page-body .settings-page label input:not([type="checkbox"]):not([type="radio"]),
.settings-page-body .settings-page label select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  box-sizing: border-box;
  background: #060e14 !important;
  background-image: none !important;
  border: 1px solid #1a3344 !important;
  border-radius: 8px !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #ffffff;
  padding: 0.5rem 0.65rem !important;
  font: inherit;
  font-size: 0.88rem !important;
  font-weight: 500;
  outline: none;
  box-shadow: none !important;
  color-scheme: dark;
}

.settings-page-body .elwo-field::placeholder,
.settings-page-body .settings-page label input::placeholder {
  color: #6b7280;
  -webkit-text-fill-color: #6b7280;
  opacity: 1;
}

.settings-page-body .elwo-field:focus,
.settings-page-body .settings-page label input:not([type="checkbox"]):focus,
.settings-page-body .settings-page label select:focus {
  border-color: #2a4d66 !important;
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.12) !important;
}

.settings-page-body select.elwo-field {
  padding-right: 2rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.7rem center !important;
  background-color: #060e14 !important;
}

.settings-page-body input.elwo-field:-webkit-autofill,
.settings-page-body input.elwo-field:-webkit-autofill:hover,
.settings-page-body input.elwo-field:-webkit-autofill:focus,
.settings-page-body input.elwo-field:-webkit-autofill:active,
.settings-page-body .settings-page label input:-webkit-autofill,
.settings-page-body .settings-page label input:-webkit-autofill:hover,
.settings-page-body .settings-page label input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #060e14 inset !important;
  box-shadow: 0 0 0 1000px #060e14 inset !important;
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #ffffff;
  transition: background-color 99999s ease-out;
}

.settings-page-body .check-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin: 0.15rem 0 0;
  color: var(--text);
  font-size: 0.88rem;
}

.settings-page-body .actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.settings-page-body .pill-outline {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
}

.settings-page-body .pill-outline:hover {
  border-color: rgba(56, 189, 248, 0.45);
}

.settings-page-body .settings-full-btn {
  width: 100%;
}

.settings-page-body .settings-backfill-row {
  margin-top: 0.85rem;
}

.settings-page-body .ai-autorun-card {
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: rgba(14, 116, 144, 0.1);
}

.settings-page-body .ai-autorun-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
}

.settings-page-body .muted-inline {
  color: #94a3b8;
  font-size: 0.75rem;
}

.settings-page-body .mono-block,
.settings-page-body .ai-autorun-status,
.settings-page-body .ai-backfill-log {
  margin: 0;
  padding: 0.55rem 0.65rem;
  max-height: 150px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.4;
  border-radius: 8px;
  background: #050505;
  border: 1px solid #1a3344;
  color: #cbd5e1;
  white-space: pre-wrap;
}

.settings-page-body .ai-autorun-hint {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
}

.settings-page-body .settings-table .data-table th,
.settings-page-body .settings-table .data-table td {
  font-size: 0.82rem;
}

.settings-page-body .btn-danger.small {
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
}

@media (max-width: 720px) {
  .settings-page-body .form-grid.three {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .settings-page-body .form-grid.two,
  .settings-page-body .form-grid.three {
    grid-template-columns: 1fr;
  }

  .settings-page-body .actions-row .pill {
    flex: 1 1 auto;
  }
}

/* Settings polish — sky palette, airy spacing (no green CTAs) */
.settings-page-body .pill-sky {
  background: #38bdf8;
  color: #04131f;
  border: none;
  font-weight: 700;
}
.settings-page-body .pill-sky:hover { background: #7dd3fc; }
.settings-page-body .surface-card + .surface-card { margin-top: 0.85rem; }
.settings-page-body .form-grid.two { gap: 0.85rem 1rem; }
.settings-page-body .form-grid.three {
  gap: 0.85rem 0.9rem;
}
@media (max-width: 720px) {
  .settings-page-body .form-grid.three {
    grid-template-columns: 1fr;
  }
  .settings-page-body .form-grid.two {
    grid-template-columns: 1fr;
  }
}
.settings-page-body .actions-row {
  gap: 0.65rem;
  margin-top: 1rem;
}
.settings-page-body .section-title { margin-bottom: 0.55rem; }
.settings-page-body .settings-subhead { margin-top: 1.25rem; }
.settings-page-body .status.ok { color: #7dd3fc; }

.settings-page-body .meta-acc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}
.settings-page-body .meta-pill {
  display: inline-block;
  font-size: 0.68rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
  margin-left: 0.35rem;
  vertical-align: middle;
}
.settings-page-body .meta-pill.warn {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}
.settings-page-body tr.row-muted {
  opacity: 0.55;
}

/* Mobile: hide horizontal scrollbar strip on table wraps (finger scroll kept).
   Playlists keep the visible strip — tables use min-width + overflow scroll. */
@media (max-width: 768px) {
  .table-wrap,
  .fb-table-wrap,
  .rm-playlist-table-wrap,
  .rm-pl-table-wrap,
  .deep-table-card,
  .deep-tables,
  .data-page .data-table-wrap,
  .sl-admin .table-wrap {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .table-wrap::-webkit-scrollbar,
  .fb-table-wrap::-webkit-scrollbar,
  .rm-playlist-table-wrap::-webkit-scrollbar,
  .rm-pl-table-wrap::-webkit-scrollbar,
  .deep-table-card::-webkit-scrollbar,
  .deep-tables::-webkit-scrollbar,
  .data-page .data-table-wrap::-webkit-scrollbar,
  .sl-admin .table-wrap::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }
}

/* Meta accounts hierarchy (Settings) */
.meta-accounts-tree {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.meta-bm-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: rgba(8, 16, 28, 0.55);
  padding: 0.85rem 1rem;
}
.meta-bm-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.65rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.meta-bm-title {
  font-size: 1.05rem;
  font-weight: 650;
  color: #f1f5f9;
}
.meta-bm-sub {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
}
.meta-bm-role {
  min-width: 220px;
  margin: 0;
}
.meta-bm-role .app-field-label {
  display: block;
  margin-bottom: 0.25rem;
}
.meta-bm-acts {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.meta-act-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.65rem 0.45rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  margin-bottom: 0.35rem;
}
.meta-act-row.is-off {
  opacity: 0.55;
}
.meta-act-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  align-items: center;
}
.meta-act-check {
  margin: 0;
  gap: 0.35rem;
  font-size: 0.82rem;
  white-space: nowrap;
}
.meta-act-check.is-disabled {
  opacity: 0.45;
}
.meta-act-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
  align-items: center;
  font-size: 0.88rem;
  flex: 1 1 auto;
}
.meta-act-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-left: auto;
}
.meta-act-tracking {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 1fr auto;
  gap: 0.65rem 0.75rem;
  align-items: end;
  padding: 0.35rem 0 0.15rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.14);
}
.meta-act-tracking label {
  margin: 0;
}
.meta-act-track-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
@media (max-width: 1100px) {
  .meta-act-tracking {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 700px) {
  .meta-act-tracking {
    grid-template-columns: 1fr;
  }
}
