/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:         #080808;
  --bg2:        #111111;
  --bg3:        #1a1a1a;
  --bg4:        #222222;
  --gold:       #F5C518;
  --gold2:      #c8960c;
  --gold3:      #ffd700;
  --text:       #e8e8e8;
  --text2:      #aaa;
  --text3:      #666;
  --ok:         #4caf50;
  --err:        #f44336;
  --warn:       #ff9800;
  --info:       #2196f3;
  --purple:     #9c27b0;
  --border:     rgba(245,197,24,0.15);
  --glass:      rgba(255,255,255,0.04);
  --glass2:     rgba(255,255,255,0.07);
  --shadow:     0 8px 32px rgba(0,0,0,0.4);
  --radius:     12px;
  --radius-sm:  8px;
  --transition: 0.2s ease;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--gold2); border-radius: 3px; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; min-height: 100vh; }

header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8,8,8,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  height: 52px;
}
.logo { font-size: 20px; font-weight: 700; color: var(--gold); letter-spacing: -0.5px; white-space: nowrap; }
.logo span { color: var(--text2); font-weight: 400; font-size: 12px; margin-left: 6px; }

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 2px;
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 3px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 7px 14px; border: none; border-radius: 9px;
  background: transparent; color: var(--text2);
  cursor: pointer; font-size: 13px; font-weight: 500;
  white-space: nowrap; transition: var(--transition);
  min-height: 44px; display: flex; align-items: center; gap: 5px;
}
.tab-btn:hover { color: var(--text); background: var(--glass2); }
.tab-btn.active { background: var(--gold); color: #000; font-weight: 700; }
.tab-btn .badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--err); display: inline-block;
}

/* ── Main content ──────────────────────────────────────────────────────────── */
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px; width: 100%; flex: 1; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(8px);
  margin-bottom: 16px;
}
.card-title {
  font-size: 13px; font-weight: 700; color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 14px; display: flex; align-items: center; gap: 7px;
}
.card-title .ct-badge {
  background: var(--gold); color: #000;
  padding: 1px 7px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}

/* ── Token row ─────────────────────────────────────────────────────────────── */
.token-row { display: flex; gap: 8px; align-items: center; }
.token-row input { flex: 1; }

/* ── Inputs ────────────────────────────────────────────────────────────────── */
input, textarea, select {
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
  transition: border-color var(--transition);
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(245,197,24,0.15);
}
textarea { resize: vertical; min-height: 100px; }
input[type="datetime-local"] { color-scheme: dark; }
label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 5px; font-weight: 500; }
.field { margin-bottom: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media(max-width:600px) { .row2, .row3 { grid-template-columns: 1fr; } }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 18px; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: var(--transition); min-height: 44px; white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-gold   { background: var(--gold); color: #000; }
.btn-gold:hover:not(:disabled) { background: var(--gold3); }
.btn-dark   { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-dark:hover:not(:disabled) { background: var(--bg4); }
.btn-ok     { background: var(--ok); color: #fff; }
.btn-err    { background: var(--err); color: #fff; }
.btn-warn   { background: var(--warn); color: #000; }
.btn-sm     { padding: 6px 12px; min-height: 32px; font-size: 12px; }
.btn-full   { width: 100%; justify-content: center; }
.btn-group  { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Filter grid ───────────────────────────────────────────────────────────── */
.filter-search { margin-bottom: 12px; position: relative; }
.filter-search input { padding-left: 34px; }
.filter-search::before { content: '🔍'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 14px; }

.filter-groups { display: flex; flex-direction: column; gap: 6px; }
.filter-group { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.filter-group-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; cursor: pointer; user-select: none;
  background: var(--bg3); font-weight: 600; font-size: 13px;
  transition: background var(--transition);
}
.filter-group-header:hover { background: var(--bg4); }
.filter-group-header .fg-arrow { transition: transform var(--transition); font-size: 10px; color: var(--text3); }
.filter-group-header .fg-count { font-size: 11px; background: var(--gold); color: #000; padding: 1px 7px; border-radius: 20px; font-weight: 700; }
.filter-group.open .fg-arrow { transform: rotate(180deg); }
.filter-group-body { display: none; padding: 8px; background: var(--bg2); }
.filter-group.open .filter-group-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }

.filter-chip {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  background: var(--bg3); transition: var(--transition);
  text-align: left;
}
.filter-chip:hover { border-color: var(--gold2); background: var(--bg4); }
.filter-chip.selected { border-color: var(--gold); background: rgba(245,197,24,0.08); }
.filter-chip input[type="radio"],
.filter-chip input[type="checkbox"] { display: none; }
.filter-chip-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.filter-chip-body { flex: 1; min-width: 0; }
.filter-chip-label { font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.3; }
.filter-chip-desc  { font-size: 11px; color: var(--text3); margin-top: 2px; }
.filter-chip-count { font-size: 11px; font-weight: 700; color: var(--gold); margin-top: 3px; }

/* ── Tag chips ─────────────────────────────────────────────────────────────── */
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag-chip {
  background: rgba(156,39,176,0.2); border: 1px solid rgba(156,39,176,0.5);
  color: #ce93d8; padding: 4px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: var(--transition); user-select: none;
}
.tag-chip:hover { background: rgba(156,39,176,0.4); color: #fff; }
.math-chips { display: flex; gap: 5px; margin-bottom: 10px; }
.math-chip {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); padding: 4px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: var(--transition);
}
.math-chip:hover { border-color: var(--gold); color: var(--gold); }

/* ── Live preview ──────────────────────────────────────────────────────────── */
.live-preview {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  margin-top: 10px; font-size: 13px; white-space: pre-wrap;
  min-height: 50px; color: var(--text); line-height: 1.6;
}
.live-preview-label { font-size: 11px; color: var(--text3); margin-bottom: 4px; }

/* ── Filter preview panel ──────────────────────────────────────────────────── */
.preview-panel { margin-top: 12px; }
.preview-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.preview-total { font-size: 13px; color: var(--text2); }
.preview-total b { color: var(--gold); font-size: 18px; }
.preview-grid { display: flex; flex-direction: column; gap: 6px; }
.preview-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg3); border-radius: var(--radius-sm);
  padding: 8px 12px; border: 1px solid transparent;
  transition: var(--transition);
}
.preview-row:hover { border-color: var(--border); }
.preview-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; background: var(--bg4);
  flex-shrink: 0; border: 1px solid var(--border);
}
.preview-info { flex: 1; min-width: 0; }
.preview-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-meta { font-size: 11px; color: var(--text2); }
.preview-sort { font-size: 11px; color: var(--gold); font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.active  { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.status-dot.idle    { background: var(--warn); }
.status-dot.offline { background: var(--text3); }

/* ── Progress bar ──────────────────────────────────────────────────────────── */
.progress-wrap { background: var(--bg3); border-radius: 999px; height: 10px; overflow: hidden; margin: 10px 0; }
.progress-bar  { height: 100%; background: linear-gradient(90deg, var(--gold2), var(--gold3)); border-radius: 999px; transition: width 0.4s ease; }
.progress-stats { display: flex; gap: 16px; font-size: 13px; margin-bottom: 8px; flex-wrap: wrap; }
.c-ok   { color: var(--ok); font-weight: 600; }
.c-err  { color: var(--err); font-weight: 600; }
.c-gold { color: var(--gold); font-weight: 600; }
.c-warn { color: var(--warn); font-weight: 600; }
.c-info { color: var(--info); font-weight: 600; }

/* ── Log ───────────────────────────────────────────────────────────────────── */
.log-scroll {
  max-height: 240px; overflow-y: auto;
  background: #050505; border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 10px; font-size: 12px; font-family: monospace;
}
.log-scroll div { padding: 2px 0; line-height: 1.5; }
.lok  { color: #81c784; }
.lerr { color: #ef9a9a; }
.ldone { color: var(--gold); font-weight: 700; }
.lwarn { color: #ffcc80; }

/* ── Ongoing banner ────────────────────────────────────────────────────────── */
#ongoingBanner {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(245,197,24,0.95); color: #000;
  padding: 10px 20px; border-radius: 999px;
  font-size: 13px; font-weight: 600; z-index: 999;
  box-shadow: var(--shadow); white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
  max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}
#ongoingBanner.show { opacity: 1; pointer-events: auto; }

/* ── A/B Toggle ────────────────────────────────────────────────────────────── */
.ab-section { border: 1px solid rgba(156,39,176,0.3); border-radius: var(--radius-sm); padding: 14px; margin-top: 10px; display: none; }
.ab-section.show { display: block; }
.ab-label { font-size: 12px; font-weight: 700; color: #ce93d8; margin-bottom: 6px; }

/* ── Toggle switch ─────────────────────────────────────────────────────────── */
.toggle-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.toggle-row label { margin: 0; cursor: pointer; font-size: 13px; color: var(--text2); }
.toggle {
  position: relative; width: 40px; height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg4); border-radius: 999px; cursor: pointer;
  transition: var(--transition); border: 1px solid var(--border);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text2); top: 2px; left: 2px;
  transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--gold); border-color: var(--gold); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: #000; }

/* ── Analytics ─────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card {
  background: var(--glass2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  text-align: center; transition: var(--transition);
}
.stat-card:hover { border-color: var(--gold2); }
.stat-icon { font-size: 22px; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--gold); line-height: 1; }
.stat-label { font-size: 11px; color: var(--text2); margin-top: 4px; }

.matrix-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.matrix-item {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
  text-align: center;
}
.matrix-item .m-val  { font-size: 24px; font-weight: 800; }
.matrix-item .m-label{ font-size: 11px; color: var(--text2); margin-top: 3px; }
.whale     { color: #e040fb; }
.champion  { color: var(--gold); }
.regular   { color: var(--ok); }
.dormant   { color: var(--warn); }
.ghost     { color: var(--text3); }
.new-p     { color: var(--info); }

.analytics-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.atab {
  padding: 7px 14px; border-radius: var(--radius-sm);
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); cursor: pointer; font-size: 13px;
  transition: var(--transition); min-height: 36px;
}
.atab:hover { color: var(--text); border-color: var(--gold2); }
.atab.active { background: var(--gold); color: #000; border-color: var(--gold); font-weight: 700; }

.leaderboard-table { width: 100%; border-collapse: collapse; }
.leaderboard-table th { text-align: left; padding: 8px 10px; font-size: 11px; color: var(--text3); text-transform: uppercase; border-bottom: 1px solid var(--border); }
.leaderboard-table td { padding: 9px 10px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.leaderboard-table tr:hover td { background: var(--glass); }
.rank-1 { color: #ffd700; font-weight: 800; }
.rank-2 { color: #c0c0c0; font-weight: 700; }
.rank-3 { color: #cd7f32; font-weight: 700; }

.funnel-bar { display: flex; flex-direction: column; gap: 8px; }
.funnel-stage { display: flex; align-items: center; gap: 10px; }
.funnel-label { width: 140px; font-size: 12px; color: var(--text2); flex-shrink: 0; }
.funnel-track { flex: 1; background: var(--bg3); border-radius: 999px; height: 22px; overflow: hidden; }
.funnel-fill { height: 100%; background: linear-gradient(90deg, var(--gold2), var(--gold3)); border-radius: 999px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-size: 11px; font-weight: 700; color: #000; transition: width 0.8s ease; }
.funnel-count { width: 50px; text-align: right; font-size: 12px; color: var(--gold); font-weight: 700; }

.alert-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  margin-bottom: 6px; font-size: 13px;
}
.alert-item.success { background: rgba(76,175,80,0.1); border: 1px solid rgba(76,175,80,0.3); }
.alert-item.warn    { background: rgba(255,152,0,0.1); border: 1px solid rgba(255,152,0,0.3); }
.alert-item.danger  { background: rgba(244,67,54,0.1); border: 1px solid rgba(244,67,54,0.3); }
.alert-item.info    { background: rgba(33,150,243,0.1); border: 1px solid rgba(33,150,243,0.3); }

.churn-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.churn-score { font-size: 18px; font-weight: 800; width: 50px; text-align: right; flex-shrink: 0; }
.churn-score.high { color: var(--err); }
.churn-score.med  { color: var(--warn); }
.churn-score.low  { color: var(--ok); }

/* ── History ───────────────────────────────────────────────────────────────── */
.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-item {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
  transition: var(--transition);
}
.hist-item:hover { border-color: var(--gold2); }
.hist-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.hist-label { font-size: 14px; font-weight: 600; }
.hist-time  { font-size: 11px; color: var(--text3); margin-top: 2px; }
.hist-stats { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; margin-bottom: 6px; }
.hist-caption { font-size: 12px; color: var(--text2); }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; margin-left: 6px; }
.badge-done { background: rgba(76,175,80,0.2); color: var(--ok); }
.badge-run  { background: rgba(255,152,0,0.2); color: var(--warn); }
.badge-poll { background: rgba(33,150,243,0.2); color: var(--info); }
.badge-ab   { background: rgba(156,39,176,0.2); color: #ce93d8; }

/* ── Schedule ──────────────────────────────────────────────────────────────── */
.holiday-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; background: var(--bg3); border-radius: var(--radius-sm);
  border: 1px solid var(--border); margin-bottom: 6px;
  cursor: pointer; transition: var(--transition);
}
.holiday-item:hover { border-color: var(--gold2); background: var(--bg4); }
.holiday-days { font-size: 11px; background: var(--gold); color: #000; padding: 2px 8px; border-radius: 20px; font-weight: 700; white-space: nowrap; margin-left: auto; }

.task-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--bg3);
  border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 6px;
}
.task-time { font-size: 12px; color: var(--gold); font-weight: 600; }
.task-meta { flex: 1; font-size: 12px; color: var(--text2); }

/* ── Admin / Withdrawal ────────────────────────────────────────────────────── */
.wd-item {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  margin-bottom: 8px; display: flex; gap: 12px; align-items: flex-start;
}
.wd-info { flex: 1; }
.wd-name   { font-size: 14px; font-weight: 600; }
.wd-meta   { font-size: 12px; color: var(--text2); margin-top: 2px; }
.wd-amount { font-size: 18px; font-weight: 800; color: var(--gold); }
.wd-status { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.status-pending  { background: rgba(255,152,0,0.2); color: var(--warn); }
.status-approved { background: rgba(76,175,80,0.2);  color: var(--ok);   }
.status-rejected { background: rgba(244,67,54,0.2);  color: var(--err);  }

.admin-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px;
}
.role-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.role-super_admin     { background: rgba(245,197,24,0.2); color: var(--gold); }
.role-stakeholder     { background: rgba(156,39,176,0.2); color: #ce93d8; }
.role-finance_manager { background: rgba(33,150,243,0.2); color: var(--info); }
.role-support_agent   { background: rgba(76,175,80,0.2);  color: var(--ok); }
.role-view_only       { background: rgba(255,255,255,0.1); color: var(--text2); }

/* ── Poll ──────────────────────────────────────────────────────────────────── */
.option-list { display: flex; flex-direction: column; gap: 6px; }
.option-row { display: flex; gap: 6px; align-items: center; }
.option-row input { flex: 1; }
.option-row .btn-err { flex-shrink: 0; }

/* ── Popup manager ─────────────────────────────────────────────────────────── */
.popup-item { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px; }
.popup-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.popup-title-text { font-weight: 600; font-size: 14px; flex: 1; }
.popup-stats { display: flex; gap: 14px; font-size: 12px; color: var(--text2); }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state { text-align: center; color: var(--text3); padding: 32px; font-size: 14px; }
.empty-state span { display: block; font-size: 32px; margin-bottom: 8px; }

/* ── Skeleton loader ───────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm); height: 16px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Mobile bottom sheet ────────────────────────────────────────────────────── */
.bottom-sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 200; display: none; align-items: flex-end;
}
.bottom-sheet-overlay.show { display: flex; }
.bottom-sheet {
  width: 100%; background: var(--bg2); border-radius: 20px 20px 0 0;
  padding: 20px; max-height: 80vh; overflow-y: auto;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }

/* ── Sort select ─────────────────────────────────────────────────────────────*/
.sort-select { max-width: 240px; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  z-index: 300; display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal { background: var(--bg2); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 500px; border: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 700; color: var(--gold); margin-bottom: 16px; }
.modal-close { float: right; cursor: pointer; color: var(--text3); font-size: 20px; line-height: 1; margin-top: -4px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media(max-width: 768px) {
  .header-inner { gap: 8px; }
  .logo span    { display: none; }
  .tabs { max-width: calc(100vw - 120px); }
  .tab-btn { padding: 7px 10px; font-size: 12px; }
  main { padding: 12px 10px; }
  .card { padding: 14px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media(max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .matrix-grid { grid-template-columns: repeat(3, 1fr); }
  .filter-group.open .filter-group-body { grid-template-columns: 1fr; }
}

.btns-preview{margin-top:8px}
.btns-row{display:flex;gap:6px;margin-bottom:6px}
.btns-chip{flex:1;text-align:center;padding:8px 10px;border-radius:8px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.15);font-size:13px;font-weight:600}

.img-preview{margin-top:6px;font-size:13px;color:#aaa}
