/* Social Partners Trends — aligned with the canonical Offerwall dark workspace. */

:root {
  --bg: #07090d;
  --bg-elev: #0f1420;
  --bg-soft: #131928;
  --bg-input: #0b0e16;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(201, 168, 76, 0.3);
  --text: #e8eaf0;
  --muted: #8b95a8;
  --gold: #c9a84c;
  --gold-dim: #f0c040;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --gold-soft: rgba(235, 192, 63, 0.12);
  --danger: #f87171;
  --ok: #4ade80;
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-w: 264px;
  --shadow-panel: none;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: clip;
  color: var(--text);
  font-family: var(--font);
  font-feature-settings: "ss01" on, "cv11" on;
  background: var(--bg);
}

body::before {
  content: none;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: #93c5fd; text-decoration: none; }

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

.auth-sync {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

.auth-sync-mark {
  display: block;
}

.auth-sync-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: auth-sync-spin 0.8s linear infinite;
}

.auth-sync p {
  margin: 0;
  color: var(--muted);
}

.auth-sync-error {
  max-width: 32rem;
}

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

@media (prefers-reduced-motion: reduce) {
  .auth-sync-spinner { animation: none; }
}

/* ——— Shell ——— */
.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
}

.nav {
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  padding: 1.15rem 0.85rem 1rem;
  border-right: 1px solid var(--line);
  background: #0b0e16;
  scrollbar-gutter: stable;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.15rem 0.35rem 1.35rem;
  padding: 0.35rem;
  text-decoration: none;
  min-width: 0;
  border-radius: var(--radius-sm);
  transition: background 0.2s var(--ease);
}
.brand:hover { text-decoration: none; background: var(--bg-card, var(--bg-elev)); }
.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  filter: none;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.brand-name {
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-name .gold,
.gold { color: var(--gold); }
.brand-sub {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

.nav-links {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.nav a.nav-item {
  display: flex;
  align-items: safe center;
  min-height: 44px;
  color: var(--muted);
  padding: 0.58rem 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.nav a.nav-item:hover {
  background: var(--bg-elev);
  color: var(--text);
  text-decoration: none;
  transform: none;
}
.nav a.nav-item.active {
  background: var(--accent-soft);
  color: #dbeafe;
  box-shadow: none;
  text-decoration: none;
}
.nav-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
}
.nav-foot .nav-item { margin-bottom: 0.15rem; }
.nav-admin {
  margin-top: 0.4rem !important;
  border: 1px dashed rgba(212, 184, 90, 0.35) !important;
  color: var(--gold-dim) !important;
}
.nav-admin.active {
  border-color: var(--gold) !important;
  color: var(--gold) !important;
  background: var(--gold-soft) !important;
  box-shadow: none !important;
}

.main {
  padding: 1.5rem 1.75rem 2.75rem;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}
.main-inner {
  inline-size: 100%;
  max-inline-size: none;
  margin-inline: auto;
  animation: rise 0.45s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ——— Type ——— */
.main > .main-inner > h1,
.main-inner > h1 {
  font-family: var(--font);
  font-size: clamp(1.45rem, 2.2vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 0.35rem;
  overflow-wrap: anywhere;
  min-width: 0;
  line-height: 1.2;
}
.main-inner > h1 + .muted {
  margin: 0 0 1.15rem;
  max-width: 42rem;
  line-height: 1.45;
}
h2 {
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 0.75rem;
  overflow-wrap: anywhere;
}
label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0.75rem 0 0.35rem;
  letter-spacing: 0.01em;
}

/* ——— Forms ——— */
input, select, textarea {
  width: 100%;
  max-width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.68rem 0.8rem;
  font: inherit;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}
input:hover, select:hover {
  border-color: var(--line-strong);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.65);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
  background: #0c1018;
}
input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.62rem 1.05rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease);
}
button:hover, .btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
  color: #fff;
  filter: none;
}
button:active, .btn:active { transform: translateY(1px); }
button:focus-visible, .btn:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.7);
  outline-offset: 2px;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn-ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line-strong);
  filter: none;
}

.error { color: var(--danger); margin-top: 0.75rem; font-weight: 600; }
.ok { color: var(--ok); margin-top: 0.75rem; font-weight: 600; }
td.ok, .table-wrap .ok { margin-top: 0; }
.warn { color: var(--gold); margin-top: 0.75rem; font-weight: 600; }
.muted { color: var(--muted); }

/* ——— Auth ——— */
.auth-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}
.auth-wrap {
  width: min(420px, 100%);
  margin: 0 auto;
  background: var(--bg-elev);
  border: 1px solid rgba(42, 49, 64, 0.95);
  border-radius: 18px;
  padding: 2rem 1.85rem 1.75rem;
  box-shadow: var(--shadow-panel);
  animation: rise 0.5s var(--ease) both;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.4rem;
  min-width: 0;
}
.auth-brand img {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  filter: none;
}
.auth-kicker, .auth-lead {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.15rem 0 0;
}
.auth-wrap h1 {
  font-family: var(--font);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 0.35rem;
}
.auth-wrap label { margin-top: 0.85rem; }
.auth-wrap label input { margin-top: 0.35rem; }
.auth-wrap button { width: 100%; margin-top: 1.25rem; }
.auth-foot { margin-top: 1.15rem; font-size: 0.9rem; }

/* ——— Tables ——— */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow-panel);
  scrollbar-gutter: stable;
}
.table-wrap table {
  margin-top: 0;
  min-width: 760px;
}
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td {
  text-align: left;
  padding: 0.72rem 0.7rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--bg-soft);
  position: sticky;
  top: 0;
  z-index: 1;
}
tbody tr {
  transition: background 0.15s var(--ease);
}
tbody tr:hover { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: 0; }
td {
  max-width: 14rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}
td.td-tight {
  max-width: none;
  white-space: nowrap;
  overflow-wrap: normal;
  font-variant-numeric: tabular-nums;
}
td .btn { margin-top: 0; padding: 0.32rem 0.7rem; font-size: 0.82rem; white-space: nowrap; }

.empty {
  margin-top: 1.5rem;
  padding: 1.5rem 1.35rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(18, 22, 31, 0.45);
  text-align: center;
}

/* ——— Filters ——— */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
  margin: 0.35rem 0 1.15rem;
  padding: 1.05rem 1.1rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 100%;
  max-width: 100%;
  box-shadow: var(--shadow-panel);
}
.filters label {
  margin: 0;
  min-width: min(100%, 140px);
  flex: 1 1 150px;
  max-width: 100%;
}
.filters select,
.filters input {
  margin-top: 0.35rem;
  width: 100%;
}
.filters-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  flex: 1 1 180px;
  padding-bottom: 0.1rem;
}
.filters button, .filters .btn { margin-top: 0; }
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  max-width: 100%;
}
.inline-form select { width: auto; min-width: 110px; max-width: 100%; }
.inline-form .btn { margin-top: 0; padding: 0.35rem 0.7rem; }

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0;
  max-width: 100%;
}
.pager-meta { min-width: 0; overflow-wrap: anywhere; font-size: 0.88rem; }
.pager-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  max-width: 100%;
}
.pager-links .btn {
  margin-top: 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  min-width: 2.2rem;
  text-align: center;
}
.pager-current {
  background: var(--accent-soft);
  color: #93c5fd;
  pointer-events: none;
  box-shadow: none;
}
.pager-links .disabled {
  opacity: 0.4;
  pointer-events: none;
}
.pager-gap { padding: 0 0.25rem; }

/* ——— Stats / panels ——— */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 0.85rem;
  margin-top: 1.15rem;
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.05rem 1.15rem 1.1rem;
  position: relative;
  overflow: hidden;
  min-width: 0;
  box-shadow: var(--shadow-panel);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.stat:hover {
  transform: none;
  border-color: var(--line-strong);
}
.stat::before, .stat::after { content: none; }
.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.stat-value {
  font-family: var(--font);
  font-size: clamp(1.5rem, 2.4vw, 1.85rem);
  font-weight: 700;
  margin: 0.4rem 0 0.2rem;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-value.gold { color: var(--gold); }

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
}
.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.15rem 1.2rem;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-shadow: var(--shadow-panel);
}
.panel .table-wrap {
  margin-top: 0.5rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.panel .table-wrap table { min-width: 420px; }
.panel .dash-grid { margin-top: 0.5rem; }
.panel .dash-grid > div { min-width: 0; }
.panel h2 {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0 0 0.9rem;
  overflow-wrap: anywhere;
}
.chart-wrap {
  position: relative;
  height: 260px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.ideas {
  margin-top: 1.25rem;
  display: grid;
  gap: 0.65rem;
}
.idea {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(18, 22, 31, 0.65);
  overflow-wrap: anywhere;
}
.idea strong { color: var(--gold); }
.create-box {
  margin: 1rem 0 1.5rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
  max-width: 100%;
  box-shadow: var(--shadow-panel);
}
.create-box h2 { margin-top: 0; }
.create-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
}
.create-grid label { margin: 0; min-width: 0; }
.create-grid button { margin-top: 0; }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  max-width: 100%;
}
.chip {
  display: inline-block;
  max-width: 11rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(42, 49, 64, 0.95);
  color: var(--muted);
  background: rgba(0, 0, 0, 0.28);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}
a.chip:hover {
  color: var(--text);
  border-color: rgba(59, 130, 246, 0.55);
  background: var(--accent-soft);
  text-decoration: none;
}

/* ——— Heatmap ——— */
.heat-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.5rem;
  max-width: 100%;
}
.heat-table {
  border-collapse: separate;
  border-spacing: 3px;
  margin: 0;
  width: 100%;
  table-layout: fixed;
}
.heat-table th, .heat-table td {
  border: 0;
  padding: 0.45rem 0.35rem;
  font-size: 0.78rem;
  text-align: center;
  vertical-align: middle;
  background: transparent;
  position: static;
  text-transform: none;
  letter-spacing: normal;
}
.heat-table thead th {
  color: var(--muted);
  font-weight: 600;
  white-space: normal;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  max-width: none;
  min-width: 0;
  padding-bottom: 0.55rem;
  background: transparent;
}
.heat-table thead th:first-child,
.heat-table tbody th {
  width: 3.2rem;
  min-width: 3.2rem;
  max-width: 3.2rem;
}
.heat-cat { display: block; text-align: center; }
.heat-table tbody th {
  text-align: left;
  color: var(--text);
  font-weight: 800;
  padding-right: 0.5rem;
  position: sticky;
  left: 0;
  background: var(--bg-elev);
  z-index: 1;
  white-space: nowrap;
}
.heat-table td {
  background: color-mix(in srgb, var(--accent) calc(var(--heat, 0) * 1%), #12161f);
  color: #f4f5f7;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

/* ——— Profile ——— */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
  gap: 0.35rem 0.75rem;
}
.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  min-width: 0;
  overflow-wrap: anywhere;
}
.check input { width: auto; margin: 0; flex: 0 0 auto; }
.profile-form { max-width: 1100px; width: 100%; }
.profile-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.profile-account label { margin-top: 0.65rem; }
.profile-account label:first-of-type { margin-top: 0; }
.profile-account input { margin-top: 0.3rem; }
.prefs-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.75rem;
}
.prefs-head h2 { margin: 0; text-transform: none; letter-spacing: -0.02em; font-size: 1.05rem; color: var(--text); }
.prefs-cols {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: 0.85rem;
  min-width: 0;
}
.prefs-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.prefs-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.prefs-count { font-size: 0.8rem; }
.prefs-filter {
  margin: 0;
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
}
.check-grid-regions,
.check-grid-cats {
  max-height: min(52vh, 420px);
  overflow: auto;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  gap: 0.3rem;
  align-content: start;
}
.check-grid-regions {
  grid-template-columns: repeat(auto-fill, minmax(3.4rem, 1fr));
}
.check-grid-cats {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
}
.check-chip {
  padding: 0.28rem 0.4rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.82rem;
  line-height: 1.25;
  gap: 0.35rem;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.check-chip:hover { background: var(--bg-soft); }
.check-chip:has(input:checked) {
  border-color: rgba(59, 130, 246, 0.45);
  background: var(--accent-soft);
}
.check-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.check-grid-cats .check-chip span { white-space: normal; }
.profile-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
  padding: 0.85rem 0 0.25rem;
  background: var(--bg);
  z-index: 2;
}
.profile-actions button { margin-top: 0; }
.account-value {
  display: grid;
  gap: 0.2rem;
  margin: 0;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  overflow-wrap: anywhere;
}
.account-value span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.profile-account .btn { margin-top: 1rem; }

/* ——— Feature chrome ——— */
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 0.25rem 0 1.1rem;
  padding: 0.95rem 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  box-shadow: var(--shadow-panel);
  animation: rise 0.4s var(--ease) both;
}
.banner-ok {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
}
.banner-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.banner-actions .btn { margin-top: 0; }
.collect-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 0.85rem;
  margin: 0.25rem 0 0.85rem;
}
.cdn-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.cdn-alive { color: var(--ok); border-color: rgba(74, 222, 128, 0.45); background: rgba(74, 222, 128, 0.08); }
.cdn-expired { color: var(--danger); border-color: rgba(248, 113, 113, 0.45); background: rgba(248, 113, 113, 0.08); }
.cdn-none, .cdn-unknown { color: var(--muted); }
.presets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0 0 0.75rem;
}
.presets-save {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 1rem;
}
.presets-save input[type="text"] {
  width: auto;
  min-width: 160px;
  flex: 1 1 180px;
  margin: 0;
  padding: 0.45rem 0.65rem;
}
.presets-save .btn { margin-top: 0; }
.compare-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 900px) {
  .compare-grid { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .profile-layout { grid-template-columns: 1fr; }
  .prefs-cols { grid-template-columns: 1fr; }
  .check-grid-regions,
  .check-grid-cats { max-height: 280px; }
}
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .nav {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    backdrop-filter: none;
  }
  .nav-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
    gap: 0.25rem;
  }
  .nav a.nav-item:hover { transform: none; }
  .nav-foot { margin-top: 0.85rem; }
  .main { padding: 1rem 1rem 2rem; }
  .filters label { flex: 1 1 100%; max-width: 100%; }
  .table-wrap table { min-width: 640px; }
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .auth-wrap { padding: 1.4rem 1.2rem; }
  .nav-links { grid-template-columns: 1fr 1fr; }
}

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

/* Download overlay */
body.dl-open { overflow: hidden; }
.dl-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(7, 9, 13, 0.72);
}
.dl-overlay[hidden] { display: none !important; }
.dl-card {
  width: min(380px, 100%);
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  box-shadow: var(--shadow-panel);
  text-align: center;
}
.dl-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  display: block;
  animation: dl-spin 1.1s linear infinite;
  filter: none;
}
.dl-logo-static { animation: none; }
.dl-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0 0 0.4rem;
  letter-spacing: -0.02em;
}
.dl-sub { margin: 0; font-size: 0.88rem; }
.dl-msg {
  margin: 0 0 1.15rem;
  font-size: 0.92rem;
  line-height: 1.45;
}
.dl-close { margin-top: 0; width: 100%; }
@keyframes dl-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .dl-logo { animation: none; }
}

/* Buyer desk */
.thumb {
  width: 48px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: block;
}
.cell-main { font-weight: 600; }
.cell-sub { font-size: 0.8rem; max-width: 220px; line-height: 1.3; margin-top: 0.15rem; }
.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  min-width: 9rem;
}
.batch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}
.batch-check { font-size: 0.88rem; color: var(--muted); display: flex; align-items: center; gap: 0.4rem; }
.vel-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid var(--line);
}
.vel-new { color: #7dd3a0; border-color: rgba(125,211,160,0.35); background: rgba(125,211,160,0.08); }
.vel-rising { color: #6eb5ff; border-color: rgba(110,181,255,0.35); background: rgba(110,181,255,0.08); }
.vel-falling { color: #f0a0a0; border-color: rgba(240,160,160,0.35); background: rgba(240,160,160,0.08); }
.vel-stable { color: var(--muted); }
.vel-long { color: #e0b84e; border-color: rgba(224,184,78,0.4); background: rgba(224,184,78,0.1); }
.fav-card { text-align: left; width: min(420px, 100%); }
.fav-form { display: grid; gap: 0.65rem; margin-top: 0.75rem; }
.fav-form label { display: grid; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); text-align: left; }
.fav-form input, .fav-form select, .fav-form textarea {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: inherit;
  font: inherit;
}
.fav-form-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.35rem; }
.fav-inline select {
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: inherit;
  font-size: 0.82rem;
}
.videos-table { min-width: 980px; }
