/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base:     #0a0d13;
  --bg-card:     #111622;
  --bg-card2:    #161d2e;
  --bg-row:      #111622;
  --bg-row-alt:  #0e1420;
  --border:      #1e2a40;
  --border-glow: #2a3f6f;

  --accent:      #00d4ff;
  --accent-dim:  #0099bb;
  --green:       #00e676;
  --green-dim:   #00c853;
  --red:         #ff5252;
  --yellow:      #ffd740;
  --purple:      #b388ff;

  --text-primary:   #e8edf5;
  --text-secondary: #8899bb;
  --text-muted:     #4a5a7a;

  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.15);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── HEADER ──────────────────────────────────────────────── */
.header {
  background: linear-gradient(135deg, #0d1220 0%, #111d35 50%, #0a1528 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--purple), var(--accent), transparent);
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-icon {
  font-size: 2rem;
  filter: drop-shadow(0 0 8px var(--accent));
  animation: pulse-icon 2s ease-in-out infinite;
}

@keyframes pulse-icon {
  0%, 100% { filter: drop-shadow(0 0 6px var(--accent)); }
  50%       { filter: drop-shadow(0 0 16px var(--accent)); }
}

.brand-title {
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.brand-sub { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

/* Stats row */
.stats-row { display: flex; gap: 12px; flex: 1; justify-content: center; }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  text-align: center;
  min-width: 100px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.stat-card.highlight {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
}

.stat-label { font-size: 0.7rem; color: var(--text-secondary); margin-top: 2px; }

/* Connection badges */
.conn-indicators { display: flex; gap: 10px; align-items: center; }

.conn-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  transition: all 0.3s;
}

.conn-badge.online {
  border-color: var(--green);
  color: var(--green);
}

.conn-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}

.conn-badge.online .conn-dot {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: blink-dot 1.5s ease-in-out infinite;
}

@keyframes blink-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── CONTROLS ─────────────────────────────────────────────── */
.controls-bar {
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  position: sticky;
  top: 81px;
  z-index: 90;
}

.controls-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.control-group { display: flex; align-items: center; gap: 8px; }
.ctrl-label { font-size: 0.72rem; color: var(--text-secondary); white-space: nowrap; }

.ctrl-select, .ctrl-input {
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s;
}

.ctrl-select:focus, .ctrl-input:focus {
  border-color: var(--accent);
}

.ctrl-input { width: 130px; }

.range-wrap { display: flex; align-items: center; gap: 8px; }

input[type="range"] {
  -webkit-appearance: none;
  width: 100px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  cursor: pointer;
}

.range-display {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  min-width: 36px;
}

.last-update {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── SECTIONS ─────────────────────────────────────────────── */
.section-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── TOP CARDS ────────────────────────────────────────────── */
.top-section { padding: 24px 0 12px; }

.top-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  padding-bottom: 4px;
}

.top-card-placeholder {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 20px;
}

.top-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.top-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green), var(--accent));
}

.top-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.top-card-rank {
  font-size: 0.62rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.top-card-coin {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 3px 0;
}

.top-card-spread {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--green);
  text-shadow: 0 0 10px rgba(0, 230, 118, 0.4);
}

.top-card-dir {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-top: 4px;
  white-space: normal;
}

.top-card-status { display: flex; gap: 6px; margin-top: 6px; }
.status-pill {
  font-size: 0.62rem;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 500;
}

.status-pill.open {
  background: rgba(0, 230, 118, 0.12);
  color: var(--green);
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.status-pill.closed {
  background: rgba(255, 82, 82, 0.1);
  color: var(--red);
  border: 1px solid rgba(255, 82, 82, 0.25);
}

/* ── TABLE ────────────────────────────────────────────────── */
.table-section { padding: 12px 0 40px; }

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 1300px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

thead tr {
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

th:hover { color: var(--accent); }
th.sorted-asc::after  { content: ' ↑'; color: var(--accent); }
th.sorted-desc::after { content: ' ↓'; color: var(--accent); }

tbody tr {
  background: var(--bg-row);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s, box-shadow 0.15s;
}

tbody tr:nth-child(even) { background: var(--bg-row-alt); }

tbody tr:hover {
  background: var(--bg-card2);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Highlight rows by spread level */
tbody tr.spread-hot    { box-shadow: inset 3px 0 0 var(--red); }
tbody tr.spread-warm   { box-shadow: inset 3px 0 0 var(--yellow); }
tbody tr.spread-cool   { box-shadow: inset 3px 0 0 var(--green); }

td {
  padding: 11px 16px;
  white-space: nowrap;
  vertical-align: middle;
}

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-size: 0.9rem;
}

/* Coin cell */
.coin-cell { display: flex; align-items: center; gap: 8px; }
.coin-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
}

.coin-name { font-weight: 600; color: var(--text-primary); }
.coin-pair { font-size: 0.68rem; color: var(--text-muted); }

/* Spread cell */
.spread-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 3px 10px;
  border-radius: 6px;
}

.spread-badge.hot  { background: rgba(255,82,82,0.15);  color: var(--red);    border: 1px solid rgba(255,82,82,0.3); }
.spread-badge.warm { background: rgba(255,215,64,0.12); color: var(--yellow); border: 1px solid rgba(255,215,64,0.3); }
.spread-badge.good { background: rgba(0,230,118,0.12);  color: var(--green);  border: 1px solid rgba(0,230,118,0.3); }
.spread-badge.low  { background: rgba(136,153,187,0.1); color: var(--text-secondary); border: 1px solid var(--border); }

/* Direction cell */
.direction-cell { display: flex; flex-direction: column; gap: 3px; }
.dir-buy  { color: var(--green);  font-size: 0.75rem; font-weight: 500; }
.dir-sell { color: var(--red);    font-size: 0.75rem; font-weight: 500; }

/* Price cell */
.price-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-primary);
}

/* Profit cell */
.profit-pos { color: var(--green); font-family: var(--font-mono); font-size: 0.82rem; }
.profit-neg { color: var(--red);   font-family: var(--font-mono); font-size: 0.82rem; }

/* Network cell */
.network-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.net-tag {
  font-size: 0.62rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(179, 136, 255, 0.1);
  color: var(--purple);
  border: 1px solid rgba(179, 136, 255, 0.25);
  font-weight: 500;
}
.net-tag.fee-high {
  background: rgba(255, 82, 82, 0.15);
  color: var(--red);
  border: 1px solid rgba(255, 82, 82, 0.35);
}

/* Deposit/Withdraw cell */
.dw-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 105px;
}

.dw-item {
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  text-align: center;
  border: 1px solid transparent;
}

.dw-item.open {
  background: rgba(0, 230, 118, 0.12);
  color: var(--green);
  border-color: rgba(0, 230, 118, 0.3);
}

.dw-item.closed {
  background: rgba(255, 82, 82, 0.1);
  color: var(--red);
  border-color: rgba(255, 82, 82, 0.25);
}

/* Table footer */
.table-footer {
  padding: 10px 16px;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg-card2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── TOAST ────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 280px;
  max-width: 360px;
  box-shadow: 0 0 20px rgba(0, 230, 118, 0.2);
  animation: toast-in 0.3s ease, toast-out 0.3s ease 4.7s forwards;
  pointer-events: all;
}

.toast-title { font-weight: 600; color: var(--green); font-size: 0.85rem; }
.toast-body  { color: var(--text-secondary); font-size: 0.8rem; margin-top: 4px; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-row { gap: 8px; }
  .stat-card { min-width: 80px; padding: 8px 12px; }
  .stat-val  { font-size: 1.2rem; }
  .conn-indicators { gap: 6px; }
}

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .stats-row    { width: 100%; }
  th, td        { padding: 8px 10px; }
}

.scale-badge {
  display: inline-block;
  background: rgba(179, 136, 255, 0.15);
  color: var(--purple);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid rgba(179, 136, 255, 0.3);
  margin-left: 6px;
  vertical-align: middle;
}

.btn-check-scan {
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  outline: none;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  color: #030712;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-check-scan:hover {
  transform: translateY(-1.5px) scale(1.02);
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.6), 0 0 10px rgba(179, 136, 255, 0.4);
  filter: brightness(1.1);
}

.btn-check-scan:active {
  transform: translateY(0.5px) scale(0.97);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
  filter: brightness(0.9);
}

.btn-check-scan span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* ── Expandable Rows & Liquidity Badges ───────────────────────── */
.expand-btn {
  display: inline-block;
  width: 20px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease, color 0.2s;
  color: var(--accent);
  font-weight: bold;
  font-size: 0.85rem;
  margin-right: 4px;
}

tr.main-row.expanded .expand-btn {
  transform: rotate(90deg);
}

tr.child-row {
  background: var(--bg-row-alt) !important;
  opacity: 0.95;
  font-size: 0.78rem;
  border-left: 2px solid var(--accent-dim);
}

tr.child-row td {
  padding-top: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

tr.child-row:hover {
  background: var(--bg-card) !important;
}

.badge-low-liquidity {
  background: rgba(255, 215, 64, 0.12);
  color: var(--yellow);
  border: 1px solid rgba(255, 215, 64, 0.35);
  font-size: 0.65rem;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
  white-space: normal;
  max-width: 100px;
  line-height: 1.2;
}

.badge-volume {
  font-size: 0.65rem;
  color: var(--text-secondary);
  background: rgba(30, 42, 64, 0.5);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 6px;
  font-family: var(--font-mono);
  vertical-align: middle;
}

/* Ẩn các dòng cơ hội phụ cho đến khi mở rộng */
.hidden {
  display: none !important;
}

/* ── Advanced Filters Panel ── */
.ctrl-btn-adv {
  background: rgba(30, 42, 64, 0.4);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.ctrl-btn-adv:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.15);
}

.ctrl-btn-adv.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, 0.08);
}

.adv-chevron {
  font-size: 0.6rem;
  transition: transform 0.25s ease;
  display: inline-block;
}

.ctrl-btn-adv.active .adv-chevron {
  transform: rotate(180deg);
}

.adv-filters-panel {
  width: 100%;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin-top 0.35s ease, padding-top 0.35s ease;
  border-top: 1px solid transparent;
  margin-top: 0;
  padding-top: 0;
  pointer-events: none;
}

.adv-filters-panel.open {
  max-height: 500px;
  opacity: 1;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  pointer-events: all;
}

.adv-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.adv-group {
  display: flex;
  flex-direction: column;
  background: rgba(22, 29, 46, 0.4);
  border: 1px solid rgba(30, 42, 64, 0.5);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.2);
}

.adv-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(30, 42, 64, 0.4);
  padding-bottom: 6px;
}

/* Custom Checkboxes */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
  position: relative;
}

.check-item:hover {
  color: var(--accent);
}

.check-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.check-custom {
  width: 15px;
  height: 15px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.check-item:hover .check-custom {
  border-color: var(--border-glow);
}

.check-item input[type="checkbox"]:checked ~ .check-custom {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.check-custom::after {
  content: "";
  position: absolute;
  display: none;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 7px;
  border: solid #000;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check-item input[type="checkbox"]:checked ~ .check-custom::after {
  display: block;
}

.adv-row-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.adv-input-sub {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.adv-label {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.adv-checkbox-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* ── Disclaimer Modal Overlay ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6, 9, 15, 0.95);
  backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.modal-box {
  max-width: 520px;
  width: 100%;
  background: linear-gradient(135deg, #0f1424 0%, #151d33 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 212, 255, 0.05);
  animation: modal-enter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.modal-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--purple), var(--accent));
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-header-icon {
  font-size: 1.6rem;
  animation: pulse-icon 1.5s ease-in-out infinite;
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.modal-body p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-guide-link {
  display: block;
  text-align: center;
  background: rgba(0, 212, 255, 0.08);
  border: 1px dashed var(--accent);
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  padding: 12px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  margin-bottom: 20px;
  transition: all 0.25s;
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.05);
}

.modal-guide-link:hover {
  background: rgba(0, 212, 255, 0.15);
  box-shadow: 0 0 25px rgba(0, 212, 255, 0.25);
  transform: translateY(-1px);
}

.modal-notice {
  background: rgba(255, 82, 82, 0.04);
  border: 1px solid rgba(255, 82, 82, 0.15);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 24px;
}

.modal-notice strong {
  color: var(--red);
}

.modal-check-item {
  margin-bottom: 24px;
  justify-content: center;
  font-weight: 500;
  font-size: 0.85rem !important;
}

.btn-enter-sys {
  width: 100%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  color: #000;
  font-weight: 700;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.25s;
}

.btn-enter-sys:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
  transform: translateY(-1px);
}

.btn-enter-sys:active:not(:disabled) {
  transform: translateY(0);
}

.btn-enter-sys:disabled {
  background: var(--text-muted);
  color: var(--bg-base);
  opacity: 0.5;
  cursor: not-allowed;
}

/* Header Guide Link */
.header-guide-link {
  color: var(--accent);
  text-decoration: none;
  margin-left: 12px;
  font-weight: 600;
  font-size: 0.72rem;
  border: 1px solid rgba(0, 212, 255, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 212, 255, 0.05);
  transition: all 0.2s;
  display: inline-block;
  vertical-align: middle;
}

.header-guide-link:hover {
  background: rgba(0, 212, 255, 0.15);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

/* ── HEADER MEMBER LINK ───────────────────────────────────── */
.header-member-link {
  color: var(--purple);
  text-decoration: none;
  margin-left: 12px;
  font-weight: 600;
  font-size: 0.72rem;
  border: 1px solid rgba(179, 136, 255, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(179, 136, 255, 0.05);
  transition: all 0.2s;
  display: inline-block;
  vertical-align: middle;
}

.header-member-link:hover {
  background: rgba(179, 136, 255, 0.15);
  box-shadow: 0 0 10px rgba(179, 136, 255, 0.2);
}

.btn-back-scanner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  color: #000;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.25s;
  box-shadow: 0 2px 10px rgba(0, 212, 255, 0.2);
}

.btn-back-scanner:hover {
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
  transform: translateY(-1px);
}

/* ── AD TICKER BAR ────────────────────────────────────────── */
.ad-ticker-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: 40px;
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
  font-size: 0.82rem;
  z-index: 95;
}

.ad-ticker-title {
  background: var(--bg-card2);
  color: var(--accent);
  font-weight: 700;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border);
  z-index: 2;
  white-space: nowrap;
  box-shadow: 5px 0 15px rgba(0, 0, 0, 0.3);
}

.ad-ticker-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

.ad-ticker-content {
  display: inline-block;
  white-space: nowrap;
  position: absolute;
  padding-left: 100%;
  will-change: transform;
  animation: ticker-marquee 45s linear infinite;
  color: var(--text-primary);
  font-weight: 500;
}

.ad-ticker-content:hover {
  animation-play-state: paused;
  cursor: pointer;
}

.ad-ticker-item {
  display: inline-block;
  padding-right: 50px;
}

.ad-ticker-item::after {
  content: "  |  ";
  color: var(--purple);
  margin-left: 25px;
  font-weight: bold;
}

@keyframes ticker-marquee {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-100%, 0, 0);
  }
}

/* ── MEMBER PAGE GENERAL ──────────────────────────────────── */
.member-body {
  background: #06090e;
}

.member-main {
  padding: 40px 24px;
  min-height: calc(100vh - 82px);
  display: flex;
  justify-content: center;
}

.member-container {
  max-width: 1400px;
  width: 100%;
}

.glass-panel {
  background: rgba(17, 22, 34, 0.65);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  transition: border-color 0.3s;
}

.glass-panel:hover {
  border-color: var(--border-glow);
}

/* Auth Card */
.auth-card {
  max-width: 480px;
  margin: 40px auto;
  padding: 32px;
}

.tab-header {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 600;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  bottom: -2px;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  background: rgba(10, 13, 19, 0.8);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.9rem;
  transition: all 0.3s;
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.15);
}

.text-area-input {
  resize: vertical;
  font-family: var(--font-sans);
}

.font-mono-input {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.input-tip {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Buttons */
.btn-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  color: #000;
  font-weight: 700;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.25s;
  margin-top: 10px;
}

.btn-submit:hover {
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
  transform: translateY(-1px);
}

.btn-submit-ad {
  width: 100%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--green) 100%);
  color: #000;
  font-weight: 700;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.25s;
}

.btn-submit-ad:hover {
  box-shadow: 0 4px 20px rgba(0, 230, 118, 0.3);
  transform: translateY(-1px);
}

.btn-submit-pw {
  width: 100%;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 600;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s;
}

.btn-submit-pw:hover {
  background: var(--border);
  border-color: var(--accent);
}

/* Dashboard Panel */
.user-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  margin-bottom: 32px;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-avatar {
  font-size: 2.2rem;
}

.user-name-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.user-role-badge {
  margin-top: 4px;
}

.badge-admin {
  background: rgba(179, 136, 255, 0.15);
  color: var(--purple);
  border: 1px solid rgba(179, 136, 255, 0.3);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

.badge-user {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.3);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

.btn-logout {
  background: rgba(255, 82, 82, 0.1);
  border: 1px solid rgba(255, 82, 82, 0.3);
  color: var(--red);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--red);
  color: #000;
  box-shadow: 0 0 15px rgba(255, 82, 82, 0.2);
}

.dashboard-grid {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.dash-col-left {
  flex: 1;
  min-width: 320px;
}

.dash-col-right {
  flex: 1.5;
  min-width: 480px;
}

.card-action {
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  border-left: 3px solid var(--accent);
  padding-left: 12px;
}

/* Donate Info */
.donate-info-box {
  background: rgba(10, 13, 19, 0.5);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  font-size: 0.82rem;
}

.donate-info-box p {
  color: var(--text-primary);
  margin-bottom: 8px;
}

.donate-info-box ul {
  margin-left: 20px;
  margin-bottom: 16px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wallet-copy-box {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
}

.wallet-address-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.wallet-addr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wallet-addr-row code {
  font-family: var(--font-mono);
  color: var(--yellow);
  font-size: 0.8rem;
  word-break: break-all;
}

.btn-copy {
  background: var(--border);
  border: 1px solid var(--border-glow);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-copy:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* Member Table Styles */
.table-container {
  overflow-x: auto;
}

.max-h-400 {
  max-height: 400px;
  overflow-y: auto;
}

.member-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.member-table th {
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 12px;
}

.member-table td {
  border-bottom: 1px solid rgba(30, 42, 64, 0.5);
  padding: 12px;
  vertical-align: middle;
}

.member-table tr:hover {
  background: rgba(30, 42, 64, 0.15);
}

.table-empty {
  text-align: center;
  padding: 40px !important;
  color: var(--text-muted);
  font-style: italic;
}

.ad-content-cell {
  max-width: 250px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
}

.time-cell {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.user-cell-name {
  font-weight: 600;
  color: var(--accent);
}

.bsc-link {
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  transition: opacity 0.2s;
}

.bsc-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.text-mono {
  font-family: var(--font-mono);
}

.text-green {
  color: var(--green) !important;
}

/* Ad Status Badges */
.ad-status {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  text-transform: uppercase;
}

.badge-pending {
  background: rgba(255, 215, 64, 0.1);
  color: var(--yellow);
  border: 1px solid rgba(255, 215, 64, 0.3);
}

.badge-approved {
  background: rgba(0, 230, 118, 0.15);
  color: var(--green);
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.badge-rejected {
  background: rgba(255, 82, 82, 0.15);
  color: var(--red);
  border: 1px solid rgba(255, 82, 82, 0.3);
}

.badge-expired {
  background: rgba(74, 90, 122, 0.15);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Admin Panel */
.admin-section-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--purple);
}

.pending-ads-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pending-ad-card {
  background: rgba(10, 13, 19, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  transition: all 0.3s;
}

.pending-ad-card:hover {
  border-color: var(--border-glow);
}

.ad-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(30, 42, 64, 0.3);
  padding-bottom: 8px;
}

.ad-card-user {
  color: var(--text-primary);
}

.ad-card-time {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.ad-card-body {
  margin-bottom: 16px;
}

.ad-card-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.4;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 12px;
  border-radius: 6px;
}

.ad-card-tx-row {
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ad-card-tx-row span {
  color: var(--text-secondary);
}

.ad-card-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-action-approve {
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid var(--green);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action-approve:hover {
  background: var(--green);
  color: #000;
  box-shadow: 0 0 15px rgba(0, 230, 118, 0.2);
}

.btn-action-reject {
  background: rgba(255, 82, 82, 0.15);
  border: 1px solid var(--red);
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action-reject:hover {
  background: var(--red);
  color: #000;
  box-shadow: 0 0 15px rgba(255, 82, 82, 0.2);
}

/* ── TOAST NOTIFICATIONS ──────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border-left: 4px solid var(--accent);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.success {
  border-left-color: var(--green);
}

.toast.error {
  border-left-color: var(--red);
}

.toast.info {
  border-left-color: var(--purple);
}

.error-text {
  color: var(--red) !important;
}

.h-100 {
  height: 100%;
}

@media (max-width: 768px) {
  .dashboard-grid {
    flex-direction: column;
  }
  .dash-col-left, .dash-col-right {
    width: 100%;
  }
}

/* ── VOTE BUTTONS ────────────────────────────────────────── */
.vote-cell {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-vote {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.25s;
  user-select: none;
}

.btn-vote:hover {
  border-color: var(--border-glow);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-vote-win.active {
  background: rgba(0, 230, 118, 0.15);
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.2);
}

.btn-vote-lose.active {
  background: rgba(255, 82, 82, 0.15);
  border-color: var(--red);
  color: var(--red);
  box-shadow: 0 0 10px rgba(255, 82, 82, 0.2);
}

.vote-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

/* Định kích thước cột tránh bị bóp méo */
th:nth-child(4), td:nth-child(4) {
  min-width: 140px;
  width: 140px;
}
th:nth-child(10), td:nth-child(10) {
  min-width: 130px;
  width: 130px;
  text-align: center;
}
td:nth-child(10) {
  overflow: visible;
}

.coin-liq-row {
  display: block;
  margin-top: 4px;
  white-space: normal;
}
.coin-liq-row .badge-low-liquidity {
  margin-left: 0;
}
.stale-badge-row {
  display: block;
  margin-top: 4px;
}
.top-card.stale-card {
  border-color: rgba(255, 82, 82, 0.45);
  box-shadow: 0 0 12px rgba(255, 82, 82, 0.08);
}
.top-card.stale-card::before {
  background: linear-gradient(90deg, var(--red), var(--yellow));
}
.top-card-warning-icon {
  display: inline-block;
  margin-left: 4px;
  cursor: help;
  animation: pulse-warning 1.5s infinite;
}
@keyframes pulse-warning {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.8; }
}


/* ── COMMUNITY CHAT WIDGET ───────────────────────────────── */
.chat-widget-minimized {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}

.chat-bubble-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-bubble-btn:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 6px 24px rgba(0, 212, 255, 0.6);
}

.chat-bubble-btn:active {
  transform: scale(0.95);
}

.chat-icon {
  font-size: 24px;
}

.chat-unread-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--red);
  color: #fff;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  border: 1.5px solid var(--bg-base);
  box-shadow: 0 0 5px rgba(255, 82, 82, 0.6);
}

.chat-window-box {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  height: 480px;
  background: rgba(17, 22, 34, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 212, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  animation: chat-open-anim 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: width 0.3s ease, height 0.3s ease;
}

/* Expanded state dimensions */
.chat-window-box.chat-expanded {
  width: 600px;
  height: 550px;
}

@keyframes chat-open-anim {
  from { opacity: 0; transform: translateY(30px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.chat-header {
  padding: 14px 18px;
  background: rgba(26, 36, 54, 0.7);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chat-header-icon {
  font-size: 16px;
}

.chat-header-actions {
  display: flex;
  gap: 6px;
}

.chat-btn-action {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-btn-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* Messages area */
.chat-messages-list {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Message items */
.chat-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  align-self: flex-start;
}

.chat-msg-row.self {
  align-self: flex-end;
}

.chat-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  font-size: 0.7rem;
}

.chat-msg-username {
  font-weight: 600;
  color: var(--accent);
}

.chat-msg-row.self .chat-msg-username {
  color: var(--purple);
}

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

.chat-msg-bubble {
  background: rgba(26, 36, 54, 0.9);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 4px 12px 12px 12px;
  font-size: 0.85rem;
  word-break: break-word;
  position: relative;
  transition: border-color 0.2s;
}

.chat-msg-row.self .chat-msg-bubble {
  background: rgba(179, 136, 255, 0.08);
  border-color: rgba(179, 136, 255, 0.2);
  border-radius: 12px 4px 12px 12px;
}

.chat-msg-bubble:hover {
  border-color: var(--border-glow);
}

/* System messages */
.chat-msg-row.system {
  align-self: center;
  max-width: 95%;
  text-align: center;
}

.chat-msg-row.system .chat-msg-bubble {
  background: rgba(0, 212, 255, 0.04);
  border-color: rgba(0, 212, 255, 0.15);
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.8rem;
  border-radius: 8px;
}

.chat-msg-row.system .chat-msg-username {
  color: var(--accent);
  font-weight: bold;
}

/* Footer / Input area */
.chat-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: rgba(13, 18, 30, 0.9);
}

#chat-form {
  display: flex;
  gap: 10px;
}

#chat-input {
  flex: 1;
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s;
}

#chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.15);
}

.chat-send-btn {
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  color: #000;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-send-btn:hover {
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.4);
  transform: translateY(-1px);
}

.chat-guest-notice {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 4px 0;
}

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

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

/* ── ADMIN MODERATION ELEMENTS ───────────────────────────── */
.chat-admin-actions {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.2s;
}

.chat-msg-row:hover .chat-admin-actions {
  opacity: 1;
}

.chat-admin-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.chat-admin-btn-delete:hover {
  background: rgba(255, 82, 82, 0.15);
}

.chat-admin-btn-ban:hover {
  background: rgba(255, 215, 64, 0.15);
}

.chat-msg-deleted {
  font-style: italic;
  color: var(--text-muted) !important;
  border-color: var(--border) !important;
  background: transparent !important;
}

/* ── LBank warning style overrides ── */
.dw-item.warning-lbank {
  background: rgba(255, 215, 64, 0.08) !important;
  color: var(--yellow) !important;
  border-color: rgba(255, 215, 64, 0.4) !important;
}
.status-pill.warning-lbank {
  background: rgba(255, 215, 64, 0.08) !important;
  color: var(--yellow) !important;
  border-color: rgba(255, 215, 64, 0.4) !important;
}

/* ── Margin badge styling ── */
.badge-margin {
  display: inline-block;
  background: rgba(0, 212, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.35);
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
  line-height: 1.2;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.1);
}

/* ── Top Grid Analysis Row & Columns ── */
.top-analysis-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  width: 100%;
}

.top-analysis-col {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
}

.top-cards-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
