/* ===========================================
   RB MIDDLEMAN - Neobrutalism with Dark Mode
   =========================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ===== LIGHT THEME ===== */
:root {
  --bg:        #fef6e4;
  --paper:     #ffffff;
  --paper-alt: #f8f5ec;
  --ink:       #0f172a;
  --ink-soft:  #475569;
  --primary:   #5b8def;
  --primary-on: #ffffff;
  --accent:    #ffd803;
  --accent-on: #0f172a;
  --success:   #22c55e;
  --success-on: #0f172a;
  --danger:    #ef4444;
  --danger-on: #ffffff;
  --warning:   #fbbf24;
  --warning-on: #0f172a;
  --info:      #06b6d4;
  --info-on:   #0f172a;
  --muted:     #94a3b8;
  --border-color: #0f172a;
  --shadow-color: #0f172a;
  --shadow:    8px 8px 0 0 var(--shadow-color);
  --shadow-sm: 4px 4px 0 0 var(--shadow-color);
  --shadow-lg: 12px 12px 0 0 var(--shadow-color);
  --border:    3px solid var(--border-color);
  --border-thick: 4px solid var(--border-color);
  --dot-color: rgba(15,23,42,0.08);
  --header-bg: var(--border-color);
  --header-fg: var(--accent);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, var(--dot-color) 1px, transparent 0);
  background-size: 24px 24px;
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Sticky footer — keep footer glued to bottom when content is short */
body {
  display: flex;
  flex-direction: column;
}
body > main { flex: 1 0 auto; }
body > .footer, body > footer.footer { flex-shrink: 0; }

.pixel { font-family: 'Press Start 2P', monospace; letter-spacing: 0.5px; }

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 16px 0; }
h1 { font-size: 48px; line-height: 1.1; }
h2 { font-size: 32px; line-height: 1.2; }
h3 { font-size: 22px; line-height: 1.3; }

a { color: var(--ink); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; text-decoration-thickness: 3px; }

p { margin: 0 0 16px 0; }

/* ===== NAVBAR ===== */
.nav {
  background: var(--paper);
  border-bottom: var(--border-thick);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}
.nav-brand {
  display: inline-flex; align-items: center;
  flex-shrink: 0;
  line-height: 0;
}
.nav-brand img { display: block; height: 44px; width: auto; }
.nav-brand-mark { display: none; }
.nav-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.nav-search {
  flex: 1; max-width: 420px;
  position: relative;
}
.nav-search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-family: inherit; font-size: 14px;
  background: var(--bg); color: var(--ink);
  border: 2px solid var(--border-color);
  box-shadow: 3px 3px 0 var(--border-color);
  outline: none;
}
.nav-search input:focus { box-shadow: 5px 5px 0 var(--border-color); transform: translate(-2px,-2px); }
.nav-search::before {
  content: '⌕'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-weight: 700; font-size: 16px; color: var(--muted);
}
.nav-search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: monospace; font-size: 11px;
  padding: 2px 6px; background: var(--paper-alt); border: 1px solid var(--border-color);
}
.nav-toggle {
  display: none;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--border-color);
  width: 40px; height: 40px; padding: 0;
  cursor: pointer; font-size: 20px; font-weight: 700;
  align-items: center; justify-content: center;
}

/* ===== CONTAINER ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 40px 32px; }
.container-wide { max-width: 1440px; margin: 0 auto; padding: 32px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 20px;
  font-family: 'Space Grotesk', sans-serif; font-size: 15px; font-weight: 700;
  background: var(--paper); color: var(--ink);
  border: var(--border); box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s;
  text-decoration: none !important;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 0 var(--border-color); }
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 0 var(--border-color); }
.btn-primary  { background: var(--primary); color: white; }
.btn-success  { background: var(--success); color: var(--border-color); }
.btn-danger   { background: var(--danger); color: white; }
.btn-warning  { background: var(--warning); color: var(--border-color); }
.btn-accent   { background: var(--accent); color: var(--border-color); }
.btn-dark     { background: var(--border-color); color: var(--bg); }
.btn-ghost    { background: transparent; box-shadow: none; border: 2px solid var(--border-color); }
.btn-icon     { padding: 8px 10px; min-width: 38px; justify-content: center; }
.btn-lg { padding: 16px 28px; font-size: 17px; }
.btn-sm { padding: 7px 13px; font-size: 13px; box-shadow: 3px 3px 0 var(--border-color); }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ===== CARDS ===== */
.card {
  background: var(--paper);
  border: var(--border); box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 24px;
}
.card-header {
  margin: -24px -24px 20px -24px; padding: 14px 24px;
  background: var(--header-bg); color: var(--header-fg);
  border-bottom: var(--border);
  font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.card-compact { padding: 16px; }
.card-compact .card-header { margin: -16px -16px 12px -16px; padding: 10px 16px; font-size: 14px; }

/* ===== HERO ===== */
.hero {
  background: var(--accent); color: #0f172a;
  border: var(--border-thick); box-shadow: var(--shadow-lg);
  padding: 56px 40px; margin-bottom: 32px; position: relative; overflow: hidden;
}
.hero::before, .hero::after {
  content: ''; position: absolute; pointer-events: none;
  border: var(--border-thick); background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.hero::before {
  top: -28px; right: 10%;
  width: 60px; height: 60px;
  transform: rotate(12deg);
  background: var(--primary);
}
.hero::after {
  bottom: 40px; left: -32px;
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--success);
}
.hero > * { position: relative; z-index: 1; }

.hero h1 {
  font-size: 64px; margin: 18px 0 16px 0;
  letter-spacing: -0.035em; color: #0f172a; line-height: 0.98;
}
.hero h1 .accent-underline {
  display: inline-block; position: relative;
  background: #0f172a; color: var(--accent);
  padding: 0 10px; transform: rotate(-1deg);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.15);
}
.hero p { font-size: 18px; max-width: 560px; margin-bottom: 28px; color: #0f172a; line-height: 1.55; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; }

/* Hero trust row — small chips under CTA */
.hero-trust {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-top: 28px; padding-top: 22px;
  border-top: 2px dashed rgba(15,23,42,0.3);
}
.hero-trust-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: #0f172a;
}
.hero-trust-item svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ===== HERO DISCORD MOCK (terminal-style) ===== */
.hero-mock {
  background: #0b1220; color: #e2e8f0;
  border: 3px solid #0f172a; box-shadow: 10px 10px 0 #0f172a;
  min-width: 280px; position: relative;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  animation: heroMockPop 0.8s cubic-bezier(.16,1,.3,1) both;
}
@keyframes heroMockPop {
  from { opacity: 0; transform: translateY(20px) rotate(-2deg); }
  to   { opacity: 1; transform: translateY(0) rotate(0); }
}
.hero-mock-chrome {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: #1e293b; color: #94a3b8;
  border-bottom: 2px solid #0f172a;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.hero-mock-dots { display: flex; gap: 6px; }
.hero-mock-dot { width: 12px; height: 12px; border-radius: 50%; }
.hero-mock-dot.r { background: #ef4444; }
.hero-mock-dot.y { background: #fbbf24; }
.hero-mock-dot.g { background: #22c55e; }
.hero-mock-chrome-title { font-weight: 700; }

.hero-mock-body { padding: 18px 22px; font-size: 13px; line-height: 1.9; }
.hero-mock-line {
  display: flex; align-items: center; gap: 8px;
  opacity: 0; transform: translateX(-10px);
  animation: heroLineIn 0.4s ease forwards;
}
.hero-mock-line.muted { color: #64748b; }
.hero-mock-line.hi { color: var(--accent); font-weight: 600; }
.hero-mock-line.rule { height: 2px; background: linear-gradient(to right, transparent, #334155, transparent); padding: 0; margin: 6px 0; animation: heroRuleIn 0.6s ease forwards; }
.hero-mock-line .t { color: #64748b; font-size: 11px; min-width: 48px; }
.hero-mock-line .u { color: #5b8def; font-weight: 700; }
.hero-mock-line .c { color: #22c55e; font-weight: 800; }
.hero-mock-line .cursor {
  display: inline-block; width: 8px; height: 14px;
  background: var(--accent); animation: heroCursor 1s step-end infinite;
  vertical-align: middle; margin-left: 4px;
}
.hero-mock-line:nth-child(1) { animation-delay: 0.2s; }
.hero-mock-line:nth-child(2) { animation-delay: 0.4s; }
.hero-mock-line:nth-child(3) { animation-delay: 0.7s; }
.hero-mock-line:nth-child(4) { animation-delay: 1.0s; }
.hero-mock-line:nth-child(5) { animation-delay: 1.3s; }
.hero-mock-line:nth-child(6) { animation-delay: 1.6s; }
.hero-mock-line:nth-child(7) { animation-delay: 1.9s; }
.hero-mock-line:nth-child(8) { animation-delay: 2.2s; }
.hero-mock-line:nth-child(9) { animation-delay: 2.5s; }
.hero-mock-buttons { display: flex; gap: 8px; margin-top: 10px; animation-delay: 2.8s; }
.hero-mock-btn {
  display: inline-block;
  padding: 6px 14px;
  background: #334155; color: #e2e8f0;
  border: 1px solid #475569; font-size: 12px; font-weight: 700;
  transition: background 0.15s;
}
.hero-mock-btn.primary { background: #5b8def; color: #fff; border-color: #3b6fd9; }
.hero-mock-btn.danger { background: transparent; color: #ef4444; border-color: #ef4444; }

@keyframes heroLineIn {
  to { opacity: 1; transform: translateX(0); }
}
@keyframes heroRuleIn { to { opacity: 0.6; } }
@keyframes heroCursor { 50% { opacity: 0; } }

/* Live pulsing dot inside trusted badge */
.hero-live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: #ef4444;
  border: 1.5px solid #0f172a;
  margin-right: 6px;
  vertical-align: middle;
  animation: heroLivePulse 1.6s ease-in-out infinite;
}
@keyframes heroLivePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* ===== STATUS DOT (online/offline) ===== */
.status-dot {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 4px 10px;
  background: var(--paper-alt); color: var(--ink);
  border: 2px solid var(--border-color);
}
.status-dot::before {
  content: ''; width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted); border: 2px solid var(--border-color);
}
.status-dot.online::before { background: var(--success); animation: pulse-dot 2s ease-in-out infinite; border-color: var(--success); }
.status-dot.offline::before { background: var(--danger); }
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* ===== BADGES ===== */
.badge {
  display: inline-block; padding: 5px 10px;
  font-size: 11px; font-weight: 700;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--border-color); box-shadow: 2px 2px 0 var(--border-color);
  letter-spacing: 0.03em; text-transform: uppercase;
}
.badge.success { background: var(--success); color: #0f172a; }
.badge.danger  { background: var(--danger); color: white; }
.badge.warning { background: var(--warning); color: #0f172a; }
.badge.info    { background: var(--info); color: #0f172a; }
.badge.dark    { background: var(--border-color); color: var(--bg); }
.badge.accent  { background: var(--accent); color: #0f172a; }
.badge-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; font-size: 11px; font-weight: 700;
  background: var(--danger); color: white;
  border: 2px solid var(--border-color);
  border-radius: 3px;
}
.badge-pixel {
  font-family: 'Press Start 2P', monospace; font-size: 9px;
  padding: 6px 10px; display: inline-block;
  background: var(--accent); color: #0f172a;
  border: 2px solid var(--border-color); box-shadow: 2px 2px 0 var(--border-color);
  text-transform: uppercase;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--paper); border: var(--border); box-shadow: var(--shadow);
  padding: 20px; position: relative;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.stat-card:hover { transform: translate(-2px, -2px); box-shadow: 10px 10px 0 var(--border-color); }
.stat-card.s1 { background: var(--info); color: #0f172a; }
.stat-card.s2 { background: var(--accent); color: #0f172a; }
.stat-card.s3 { background: var(--success); color: #0f172a; }
.stat-card.s4 { background: var(--primary); color: white; }
.stat-card.s4 .stat-label { color: rgba(255,255,255,0.85); }
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.75; }
.stat-value {
  font-weight: 700; font-size: 32px; margin-top: 4px;
  letter-spacing: -0.02em; word-break: break-word;
  font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 12px; opacity: 0.7; margin-top: 4px; }
.stat-trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ===== TABLES ===== */
.table-wrap { background: var(--paper); border: var(--border); box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--ink); }
th, td { padding: 14px 16px; text-align: left; border-bottom: 2px solid var(--border-color); color: var(--ink); }
thead { background: var(--header-bg); color: var(--header-fg); }
thead th { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--header-fg); }
tbody tr:hover { background: var(--paper-alt); }
tbody tr:last-child td { border-bottom: none; }
.table-checkbox { width: 40px; }
table code { background: var(--paper-alt); padding: 2px 6px; border: 1px solid var(--border-color); font-size: 12px; }

/* Status badges */
.s-PENDING_AGREEMENT, .s-PENDING_FEE_CHOICE, .s-PENDING_FEE_AGREEMENT,
.s-AWAITING_PAYMENT { background: var(--warning); color: #0f172a; }
.s-PAID, .s-RELEASED, .s-HOLD, .s-PENDING_HOLD { background: var(--info); color: #0f172a; }
.s-WITHDRAWN, .s-COMPLETED, .s-SENT, .s-READY { background: var(--success); color: #0f172a; }
.s-EXPIRED, .s-CANCELLED, .s-REFUNDED { background: var(--muted); color: white; }
.s-REFUND_REQUESTED, .s-REFUND_PENDING_TRANSFER, .s-DISPUTED { background: var(--danger); color: white; }

/* ===== FORM INPUTS ===== */
.input, .select, .textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: inherit; font-size: 14px;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--border-color);
  box-shadow: 3px 3px 0 var(--border-color);
  outline: none;
  transition: transform 0.1s, box-shadow 0.1s;
}
.input:focus, .select:focus, .textarea:focus {
  transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--border-color);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='square'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row > * { flex: 1; min-width: 160px; }

/* ===== ALERTS ===== */
.alert {
  padding: 14px 18px;
  border: var(--border); box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--paper);
  position: relative;
}
.alert::before {
  font-family: 'Press Start 2P', monospace; font-size: 12px;
  flex-shrink: 0; width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--border-color); color: var(--accent);
  border: 2px solid var(--border-color);
}
.alert-info    { background: #e0f7fb; }
.alert-success { background: #dcfce7; }
.alert-warning { background: #fef3c7; }
.alert-danger  { background: #fee2e2; }
.alert-info::before    { content: 'i'; }
.alert-success::before { content: '✓'; background: var(--success); color: #0f172a; }
.alert-warning::before { content: '!'; background: var(--warning); color: #0f172a; }
.alert-danger::before  { content: '×'; background: var(--danger); color: white; }
.alert-close {
  margin-left: auto; cursor: pointer; background: transparent; border: none;
  font-size: 20px; font-weight: 700; line-height: 1; padding: 0 4px; color: inherit;
}
.alert-title { font-weight: 700; margin-bottom: 4px; }
.alert-body { font-size: 14px; }

/* ===== TOAST ===== */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  max-width: 400px;
}
.toast {
  background: var(--paper);
  border: var(--border); box-shadow: var(--shadow-sm);
  padding: 14px 18px;
  animation: toast-in 0.25s ease-out;
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600;
  color: var(--ink);
}
.toast.success { background: var(--success); color: #0f172a; }
.toast.danger  { background: var(--danger); color: white; }
.toast.warning { background: var(--warning); color: #0f172a; }
.toast.info    { background: var(--info); color: #0f172a; }
.toast.dismiss { animation: toast-out 0.2s ease-in forwards; }
@keyframes toast-in  { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { to { transform: translateX(120%); opacity: 0; } }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  z-index: 1000; display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--paper); color: var(--ink);
  border: var(--border-thick); box-shadow: var(--shadow-lg);
  padding: 0; width: 100%; max-width: 520px;
  max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column;
  animation: modal-in 0.2s ease-out;
}
@keyframes modal-in { from { transform: translateY(-24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  padding: 14px 20px; background: var(--header-bg); color: var(--header-fg);
  border-bottom: var(--border); display: flex; justify-content: space-between; align-items: center;
  font-weight: 700;
}
.modal-body { padding: 20px; overflow-y: auto; color: var(--ink); }
.modal-footer {
  padding: 14px 20px; border-top: var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  background: var(--paper-alt);
}
.modal-close { background: transparent; border: none; color: inherit; font-size: 22px; cursor: pointer; font-weight: 700; padding: 0; }

/* ===== DROPDOWN ===== */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--paper);
  border: var(--border); box-shadow: var(--shadow-sm);
  min-width: 200px; padding: 6px 0;
  display: none; z-index: 50;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: var(--ink);
  cursor: pointer; font-weight: 600; font-size: 14px;
  background: transparent; border: none; width: 100%; text-align: left;
}
.dropdown-item:hover { background: var(--paper-alt); text-decoration: none; }
.dropdown-divider { height: 2px; background: var(--border-color); opacity: 0.15; margin: 6px 0; }

/* ===== NUMBER UPDOWN ===== */
.updown {
  display: inline-flex; align-items: center;
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--border-color);
  background: var(--paper);
}
.updown input {
  width: 60px; text-align: center; font-family: inherit; font-weight: 700;
  border: none; background: transparent; color: var(--ink);
  padding: 8px 0; outline: none;
  font-variant-numeric: tabular-nums;
  appearance: textfield; -moz-appearance: textfield;
}
.updown input::-webkit-outer-spin-button, .updown input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.updown button {
  width: 32px; height: 36px;
  background: var(--border-color); color: var(--accent);
  border: none; cursor: pointer; font-weight: 700;
}
.updown button:hover { background: var(--primary); color: white; }

/* ===== TOGGLE SWITCH ===== */
.switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; cursor: pointer; inset: 0;
  background-color: var(--muted);
  border: 2px solid var(--border-color);
  box-shadow: 2px 2px 0 var(--border-color);
  transition: background 0.2s;
}
.switch-slider::before {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 16px; height: 16px; background: var(--paper);
  border: 2px solid var(--border-color);
  transition: transform 0.2s;
}
.switch input:checked + .switch-slider { background-color: var(--success); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }

/* ===== CHECKBOX ===== */
.check {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
}
.check input[type="checkbox"] {
  appearance: none; width: 20px; height: 20px;
  background: var(--paper); border: 2px solid var(--border-color);
  box-shadow: 2px 2px 0 var(--border-color);
  cursor: pointer; position: relative;
}
.check input[type="checkbox"]:checked { background: var(--success); }
.check input[type="checkbox"]:checked::after {
  content: '✓'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #0f172a;
}

/* ===== DASHBOARD LAYOUT ===== */
.dash-layout { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start; }

/* -- Sidebar shell -- */
.dash-sidebar {
  position: sticky; top: 88px; align-self: start;
  background: var(--paper);
  border: var(--border); box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  max-height: calc(100vh - 108px);
  display: flex; flex-direction: column;
}

/* -- Sidebar brand header -- */
.dash-sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--border-color); color: var(--bg);
  border-bottom: 3px solid var(--border-color);
  flex-shrink: 0;
}
.dash-sidebar-brand-mark {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #0f172a;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px; letter-spacing: 0;
  border: 2px solid var(--bg); box-shadow: 2px 2px 0 var(--bg);
  flex-shrink: 0;
}
.dash-sidebar-brand-meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.dash-sidebar-brand-name { font-weight: 700; font-size: 14px; color: var(--bg); letter-spacing: -0.01em; }
.dash-sidebar-brand-role {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-top: 2px;
}

/* -- Nav scrollable region -- */
.dash-sidebar-nav {
  padding: 6px 0 12px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.dash-sidebar-nav::-webkit-scrollbar { width: 6px; }
.dash-sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* -- Sidebar group (collapsible) -- */
.dash-sidebar-group { padding: 0; }
.dash-sidebar-group + .dash-sidebar-group { border-top: 1px dashed var(--border-color); margin-top: 4px; padding-top: 4px; }

.dash-sidebar-heading {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  padding: 14px 20px 8px; color: var(--muted); letter-spacing: 0.14em;
  background: transparent; border: 0; cursor: pointer;
  font-family: inherit; text-align: left;
}
.dash-sidebar-heading:hover { color: var(--ink); }
.dash-sidebar-heading .chev { transition: transform 0.18s ease; }
.dash-sidebar-group.collapsed .chev { transform: rotate(-90deg); }

.dash-sidebar-group-items {
  display: flex; flex-direction: column;
  max-height: 600px; overflow: hidden;
  transition: max-height 0.2s ease;
}
.dash-sidebar-group.collapsed .dash-sidebar-group-items { max-height: 0; }

/* -- Nav item -- */
.dash-nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px 10px 18px;
  color: var(--ink-soft);
  font-size: 14px; font-weight: 600;
  border-left: 3px solid transparent;
  text-decoration: none !important;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.12s;
}
.dash-nav-item:hover {
  background: var(--paper-alt);
  color: var(--ink);
  border-left-color: var(--muted);
  transform: translateX(2px);
}
.dash-nav-item.active {
  background: var(--paper-alt);
  color: var(--ink);
  border-left-color: var(--primary);
  font-weight: 700;
}
.dash-nav-item.active::after {
  content: ''; position: absolute; right: 0; top: 8px; bottom: 8px;
  width: 3px; background: var(--primary);
}
.dash-nav-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: currentColor;
}
.dash-nav-icon svg { width: 18px; height: 18px; display: block; }
.dash-nav-item.active .dash-nav-icon { color: var(--primary); }
.dash-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-nav-item .badge-count { margin-left: auto; }

/* -- Close button (mobile only) -- */
.dash-sidebar-close {
  display: none;
  background: var(--bg); color: var(--border-color);
  border: 2px solid var(--bg);
  width: 34px; height: 34px;
  align-items: center; justify-content: center;
  cursor: pointer; margin-left: auto;
  flex-shrink: 0;
}
.dash-sidebar-close:hover { background: var(--accent); }

/* -- Mobile trigger (hamburger floating button) -- */
.dash-sidebar-trigger {
  display: none;
  align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--border-color); color: var(--accent);
  border: 3px solid var(--border-color); box-shadow: 4px 4px 0 var(--accent);
  font-family: inherit; font-weight: 700; font-size: 13px; letter-spacing: 0.08em;
  text-transform: uppercase; cursor: pointer;
  margin-bottom: 16px;
}
.dash-sidebar-trigger:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--accent); }
.dash-sidebar-trigger:active { transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--accent); }

/* -- Backdrop -- */
.dash-sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 195;
  opacity: 0; transition: opacity 0.2s ease;
}
.dash-sidebar-backdrop.is-show { opacity: 1; }

body.dash-nav-locked { overflow: hidden; }

.dash-main { min-width: 0; }


/* ===== QUICK ACTION CARDS ===== */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 24px; }
.quick-action {
  background: var(--paper); color: var(--ink);
  border: var(--border); box-shadow: var(--shadow-sm);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: transform 0.1s, box-shadow 0.1s;
  text-decoration: none;
}
.quick-action:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--shadow-color); text-decoration: none; }
.quick-action-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #0f172a;
  border: 2px solid #0f172a; font-weight: 700; font-size: 18px;
}
.quick-action-label { font-size: 12px; text-transform: uppercase; font-weight: 700; color: var(--muted); letter-spacing: 0.05em; }
.quick-action-value { font-size: 22px; font-weight: 700; color: var(--ink); }
.quick-action.danger .quick-action-icon { background: var(--danger); color: white; }
.quick-action.warning .quick-action-icon { background: var(--warning); color: #0f172a; }
.quick-action.success .quick-action-icon { background: var(--success); color: #0f172a; }
.quick-action.info .quick-action-icon { background: var(--info); color: #0f172a; }

/* ===== FEE LIST ===== */
.fee-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 12px; }
.fee-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--paper-alt); color: var(--ink);
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--shadow-color);
}
.fee-row .fee-amt { font-weight: 700; }

/* ===== STEPS LIST ===== */
.steps { display: grid; gap: 12px; list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px 16px; background: var(--paper-alt); color: var(--ink);
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--shadow-color);
}
.steps li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: 'Press Start 2P', monospace; font-size: 11px;
  background: var(--header-bg); color: var(--header-fg);
  padding: 8px 10px; flex-shrink: 0;
}

/* ===== TICKER ===== */
.ticker-wrap {
  display: flex;
  background: #0f172a; color: #ffd803;
  border: var(--border); box-shadow: var(--shadow);
  padding: 0; margin-bottom: 28px; overflow: hidden; position: relative;
}
.ticker-label {
  background: #ffd803; color: #0f172a;
  font-weight: 800; padding: 12px 18px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: 0.14em;
  font-family: 'Press Start 2P', monospace;
  flex-shrink: 0; z-index: 2;
  position: relative;
  border-right: 3px solid #0f172a;
}
.ticker-label::after {
  content: ''; position: absolute; right: -12px; top: 0; bottom: 0;
  width: 12px;
  background:
    linear-gradient(to top right, #ffd803 50%, transparent 50%) top left / 100% 50% no-repeat,
    linear-gradient(to bottom right, #ffd803 50%, transparent 50%) bottom left / 100% 50% no-repeat;
}
.ticker-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444; border: 1.5px solid #0f172a;
  animation: tickerPulse 1.4s ease-in-out infinite;
}
@keyframes tickerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  50%      { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
}

.ticker-track {
  display: inline-flex; gap: 36px; padding: 14px 16px 14px 28px;
  white-space: nowrap;
  animation: ticker 50s linear infinite;
  will-change: transform;
  flex-grow: 1; min-width: 0;
}
.ticker-wrap:hover .ticker-track { animation-play-state: paused; }
.ticker-item {
  display: inline-flex; gap: 8px; align-items: center;
  font-weight: 600; font-size: 13px; color: #ffd803;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}
.ticker-item .ticker-ico { color: #22c55e; flex-shrink: 0; }
.ticker-item .ticker-sep { color: #475569; padding: 0 2px; }
.ticker-item .ticker-amt { color: #f1f5f9; font-variant-numeric: tabular-nums; }
.ticker-item .ticker-time { color: #94a3b8; }
.ticker-item strong { color: #fff; letter-spacing: 0.02em; }
.ticker-empty { color: #94a3b8; font-style: italic; }
.ticker-empty svg { color: #fbbf24; }

.ticker-flash {
  animation: tickerFlashAnim 2.6s ease-out;
  padding: 2px 10px; background: rgba(255,216,3,0.15);
  border: 1px solid #ffd803;
}
@keyframes tickerFlashAnim {
  0%   { transform: scale(1.08); box-shadow: 0 0 0 0 rgba(255,216,3,0.6); }
  60%  { box-shadow: 0 0 0 10px rgba(255,216,3,0); }
  100% { transform: scale(1); }
}

@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ===== PROFILE (legacy — retained for backward compat) ===== */
.profile-header {
  background: var(--paper); border: var(--border); box-shadow: var(--shadow);
  padding: 28px; margin-bottom: 24px; display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
  color: var(--ink);
}
.profile-avatar { width: 96px; height: 96px; border: var(--border); box-shadow: 4px 4px 0 var(--shadow-color); background: var(--paper-alt); }
.profile-tier {
  display: inline-block; padding: 6px 14px; font-weight: 700;
  background: var(--accent); color: #0f172a;
  border: 2px solid #0f172a; box-shadow: 4px 4px 0 #0f172a; font-size: 16px; margin-top: 6px;
}

/* ===== PROFILE PAGE — NEW DESIGN ===== */
.profile-page { display: block; }

/* Hero */
.profile-hero {
  position: relative;
  background: var(--border-color);
  border: var(--border-thick); box-shadow: var(--shadow-lg);
  padding: 0;
  margin-bottom: 28px;
  overflow: hidden;
  color: #f1f5f9;
}
.profile-hero-bg {
  position: absolute; inset: 0;
  background: var(--tier-grad);
  opacity: 0.45;
  pointer-events: none;
}
.profile-hero-bg::before,
.profile-hero-bg::after {
  content: ''; position: absolute; border-radius: 50%;
  background: #fff; opacity: 0.12; pointer-events: none;
}
.profile-hero-bg::before {
  width: 280px; height: 280px;
  top: -120px; right: -80px;
  animation: profileOrbit 18s ease-in-out infinite;
}
.profile-hero-bg::after {
  width: 160px; height: 160px;
  bottom: -60px; left: 12%;
  opacity: 0.08;
  animation: profileOrbit 14s ease-in-out infinite reverse;
}
@keyframes profileOrbit {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-16px, 14px) scale(1.06); }
}
.profile-hero-deco {
  position: absolute; top: 22px; left: 30px;
  width: 44px; height: 44px; color: #fff; opacity: 0.25;
  animation: profileSpin 22s linear infinite;
  pointer-events: none;
}
@keyframes profileSpin { to { transform: rotate(360deg); } }

.profile-hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 28px; align-items: center;
  padding: 36px 32px;
}

/* Avatar */
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar {
  width: 128px; height: 128px;
  border: 4px solid var(--bg);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.4);
  background: var(--paper-alt);
  object-fit: cover;
  display: block;
  animation: profileAvatarIn 0.6s cubic-bezier(.16,1,.3,1) both;
}
.profile-avatar-initial {
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 48px; color: var(--ink);
}
@keyframes profileAvatarIn {
  from { opacity: 0; transform: scale(0.85) rotate(-4deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}
.profile-avatar-badge {
  position: absolute; bottom: -6px; right: -6px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #0f172a;
  border: 3px solid var(--border-color);
  box-shadow: 3px 3px 0 var(--border-color);
  animation: profileBadgeBob 3s ease-in-out infinite;
}
@keyframes profileBadgeBob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-3px) rotate(4deg); }
}

.profile-hero-meta { min-width: 0; }
.profile-name {
  font-size: 40px; line-height: 1.05; letter-spacing: -0.03em;
  margin: 0 0 6px; color: #fff;
  word-break: break-word;
}
.profile-handle {
  display: inline-flex; align-items: center; gap: 6px;
  color: rgba(255,255,255,0.75); font-size: 14px; font-weight: 600;
  margin-bottom: 14px;
}

.profile-chips {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.profile-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.25);
  color: #fff;
  text-transform: uppercase;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
}
.profile-chip.chip-banned { background: var(--danger); color: #fff; border-color: #0f172a; }
.profile-chip.chip-rating { background: var(--accent); color: #0f172a; border-color: #0f172a; }
.profile-chip.chip-member { background: rgba(0,0,0,0.3); border-color: rgba(255,255,255,0.15); }
.profile-chip.chip-tier { border-color: #0f172a; box-shadow: 2px 2px 0 rgba(0,0,0,0.4); }

/* Rating ring */
.profile-ring {
  position: relative;
  width: 120px; height: 120px;
  flex-shrink: 0;
}
.profile-ring svg { display: block; }
.profile-ring-fg {
  transition: stroke-dashoffset 1s cubic-bezier(.16,1,.3,1);
  filter: drop-shadow(0 0 4px rgba(255,216,3,0.5));
}
.profile-ring-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
}
.profile-ring-num {
  font-family: 'Space Grotesk', sans-serif; font-weight: 800;
  font-size: 32px; line-height: 1; color: #fff;
  font-variant-numeric: tabular-nums;
}
.profile-ring-sub {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255,255,255,0.7); margin-top: 4px; font-weight: 700;
}

/* Reviews grid */
.review-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.review-card-new {
  background: var(--paper-alt);
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--shadow-color);
  padding: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  opacity: 0; transform: translateY(12px);
  animation: reviewCardIn 0.5s cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes reviewCardIn { to { opacity: 1; transform: translateY(0); } }
.review-card-new:hover { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--shadow-color); }

.review-card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.review-stars-svg { display: inline-flex; gap: 2px; }
.review-stars-svg svg { filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.08)); }
.review-time { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; }

.review-body {
  font-size: 14px; color: var(--ink); line-height: 1.55; margin: 0 0 14px;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.review-body-empty { color: var(--muted); font-style: italic; }

.review-card-foot {
  display: flex; align-items: center; gap: 8px;
  padding-top: 10px; border-top: 1px dashed var(--border-color);
}
.review-avatar {
  width: 24px; height: 24px; border: 2px solid var(--border-color);
  object-fit: cover; flex-shrink: 0;
}
.review-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #0f172a;
  font-weight: 800; font-size: 12px;
}
.review-rater {
  font-size: 13px; font-weight: 700; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Action bar at bottom */
.profile-actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 16px 20px;
  background: var(--paper); border: var(--border); box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
}

/* Responsive */
@media (max-width: 820px) {
  .profile-hero-inner { grid-template-columns: auto 1fr; gap: 20px; padding: 24px 20px; }
  .profile-ring { grid-column: 1 / -1; justify-self: center; margin-top: 8px; }
  .profile-avatar { width: 96px; height: 96px; }
  .profile-name { font-size: 28px; }
}
@media (max-width: 560px) {
  .profile-hero-inner { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 16px; padding: 24px 16px; }
  .profile-avatar { width: 88px; height: 88px; }
  .profile-avatar-badge { width: 32px; height: 32px; bottom: -4px; right: -4px; }
  .profile-chips { justify-content: center; }
  .profile-name { font-size: 24px; }
  .profile-hero-deco { top: 12px; left: 12px; width: 32px; height: 32px; }
  .profile-ring { width: 100px; height: 100px; }
  .profile-ring svg { width: 100px; height: 100px; }
  .profile-ring-num { font-size: 24px; }
  .review-grid { grid-template-columns: 1fr; }
}

/* ===== LEGACY .review-card (kept for other uses) ===== */
.review-card {
  background: var(--paper-alt); color: var(--ink);
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--shadow-color);
  padding: 14px; margin-bottom: 10px;
}
.review-stars { color: var(--warning); font-size: 16px; letter-spacing: 2px; }

/* ===== LEADERBOARD ===== */
.leaderboard-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; background: var(--paper-alt); color: var(--ink);
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--shadow-color);
  margin-bottom: 8px;
}
.leaderboard-rank {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--header-bg); color: var(--header-fg);
  font-family: 'Press Start 2P', monospace; font-size: 11px;
}
.leaderboard-row:nth-child(1) .leaderboard-rank { background: #ffd803; color: #0f172a; }
.leaderboard-row:nth-child(2) .leaderboard-rank { background: #cbd5e1; color: #0f172a; }
.leaderboard-row:nth-child(3) .leaderboard-rank { background: #d97706; color: white; }

/* ===== COUNTER (big numbers) ===== */
.counter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.counter-big {
  position: relative;
  text-align: center; padding: 24px 14px 20px;
  background: var(--paper); border: var(--border); box-shadow: var(--shadow-sm);
  color: var(--ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}
.counter-big::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px;
}
.counter-big:nth-child(1)::before { background: var(--primary); }
.counter-big:nth-child(2)::before { background: var(--success); }
.counter-big:nth-child(3)::before { background: var(--info); }
.counter-big:nth-child(4)::before { background: var(--accent); }
.counter-big:hover { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--shadow-color); }
.counter-ico {
  width: 44px; height: 44px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper-alt); color: var(--ink);
  border: 2px solid var(--border-color);
  box-shadow: 3px 3px 0 var(--border-color);
}
.counter-big:nth-child(1) .counter-ico { background: var(--primary); color: #fff; }
.counter-big:nth-child(2) .counter-ico { background: var(--success); color: #0f172a; }
.counter-big:nth-child(3) .counter-ico { background: var(--info); color: #0f172a; }
.counter-big:nth-child(4) .counter-ico { background: var(--accent); color: #0f172a; }
.counter-ico svg { width: 22px; height: 22px; }
.counter-big .num {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: 40px; letter-spacing: -0.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.counter-big .lbl {
  font-size: 11px; text-transform: uppercase; font-weight: 700;
  letter-spacing: 0.1em; color: var(--muted); margin-top: 8px;
}

/* ===== FAQ ===== */
.faq-item {
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--shadow-color);
  margin-bottom: 10px;
}
.faq-q {
  padding: 14px 18px; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; user-select: none; color: var(--ink);
}
.faq-q::after { content: '+'; font-size: 22px; font-weight: 700; transition: transform 0.2s; }
.faq-item.open .faq-q::after { transform: rotate(45deg); }
.faq-a { padding: 0 18px; max-height: 0; overflow: hidden; transition: max-height 0.25s, padding 0.2s; color: var(--ink-soft); }
.faq-item.open .faq-a { padding: 0 18px 16px; max-height: 500px; }

/* ===== KBD SHORTCUTS HINT ===== */
kbd {
  display: inline-block; padding: 2px 6px; font-family: monospace; font-size: 11px;
  background: var(--paper-alt); border: 1px solid var(--border-color);
  border-bottom-width: 2px;
}

/* ===== ERROR PAGE ===== */
.error-page { text-align: center; padding: 80px 24px; }
.error-code { font-size: 120px; font-weight: 700; text-shadow: 8px 8px 0 var(--accent); margin: 0 0 16px 0; letter-spacing: -0.05em; }

/* ===== FOOTER ===== */
.footer {
  text-align: center; padding: 28px 24px; margin-top: 60px;
  border-top: var(--border-thick); background: var(--paper);
  font-size: 14px; font-weight: 600; color: var(--muted);
  display: flex; flex-direction: column; gap: 14px; align-items: center;
}
.footer-main { display: flex; align-items: center; justify-content: center; gap: 6px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; font-size: 13px; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; color: var(--ink); }
.footer-sep { color: var(--muted); opacity: 0.5; }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.page-header h1 { font-size: 32px; margin: 0; }

/* ===== METRIC BAR ===== */
.metric-bar { display: inline-block; height: 14px; background: var(--primary); border: 2px solid var(--border-color); }

/* ===== FLEX/GRID UTILITIES ===== */
.flex { display: flex; }
.flex-gap-8 { gap: 8px; }
.flex-gap-12 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-end { display: flex; justify-content: flex-end; align-items: center; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }

/* ===== RESPONSIVE ===== */

/* Tablet / iPad */
@media (max-width: 1024px) {
  .container, .container-wide { padding: 32px 24px; }
  .dash-layout { grid-template-columns: 230px 1fr; gap: 18px; }
  .dash-sidebar { max-height: calc(100vh - 100px); }
  .dash-nav-item { padding-left: 14px; padding-right: 14px; gap: 10px; font-size: 13px; }
  .dash-sidebar-brand { padding: 12px 14px; gap: 10px; }
  .dash-sidebar-brand-mark { width: 36px; height: 36px; font-size: 9px; }
  .dash-sidebar-brand-name { font-size: 13px; }
  .dash-sidebar-heading { padding-left: 14px; padding-right: 14px; }
  .gap-2col { grid-template-columns: 1fr; }
  .hero { padding: 48px 32px; }
  .hero h1 { font-size: 48px; }
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .hero-mock { min-width: 0; }
  .stats-grid, .counter-grid, .quick-actions {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .nav-search { max-width: 320px; }
}

/* Small tablet / large phone */
@media (max-width: 820px) {
  .nav {
    padding: 12px 16px;
    flex-wrap: wrap;
    row-gap: 12px;
  }
  .nav-brand img { height: 38px; }
  .nav-toggle { display: inline-flex; }
  .nav-search {
    order: 3;
    max-width: 100%;
    width: 100%;
    flex-basis: 100%;
  }
  .nav-actions {
    display: none;
    order: 4;
    flex-basis: 100%;
    width: 100%;
    justify-content: flex-start;
    padding-top: 8px;
    border-top: 2px solid var(--border-color);
  }
  .nav.open .nav-actions { display: flex; }
  .nav-actions .btn, .nav-actions .dropdown { width: 100%; }
  .nav-actions .btn { justify-content: center; }
  .nav-actions .dropdown { display: block; }
  .nav-actions .dropdown > .btn { width: 100%; }
  .nav-actions .dropdown-menu { position: static; width: 100%; box-shadow: none; margin-top: 6px; }

  /* -- DASHBOARD: sidebar becomes slide-in drawer -- */
  .dash-layout { grid-template-columns: 1fr; gap: 0; }
  .dash-sidebar-trigger { display: inline-flex; }
  .dash-sidebar-close { display: inline-flex; }
  .dash-sidebar-backdrop { display: block; pointer-events: none; }
  .dash-sidebar-backdrop.is-show { pointer-events: auto; }

  .dash-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 200;
    width: min(320px, 88vw);
    max-height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(.16,1,.3,1);
    box-shadow: 8px 0 0 var(--border-color), 10px 10px 0 rgba(0,0,0,0.2);
    border-right: var(--border-thick);
    border-top: 0; border-bottom: 0; border-left: 0;
  }
  .dash-sidebar.is-open { transform: translateX(0); }

  .page-header { gap: 12px; }
  .page-header h1 { font-size: 26px; }

  .card { padding: 18px; }
  .card-header { margin: -18px -18px 14px -18px; padding: 12px 18px; font-size: 14px; }

  h1 { font-size: 30px; }
  h2 { font-size: 22px; }

  /* Tables scroll horizontally — keep full table, just scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { font-size: 13px; min-width: 560px; }
  .table-wrap th, .table-wrap td { padding: 10px 12px; white-space: nowrap; }

  /* Stack forms */
  .form-row { flex-direction: column; }
  .form-row > * { min-width: 0; width: 100%; }

  /* Stack all 2-col grids */
  .gap-2col { grid-template-columns: 1fr; }

  /* Charts keep height sane */
  .chart-box { min-height: 240px; }
}

/* Phone */
@media (max-width: 560px) {
  .container, .container-wide { padding: 20px 14px; }
  .hero { padding: 32px 20px; }
  .hero h1 { font-size: 34px; }
  .hero p { font-size: 15px; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  h1 { font-size: 26px; }
  h2 { font-size: 20px; }

  .nav { padding: 10px 12px; }
  .nav-brand img { height: 34px; }

  .stat-value { font-size: 24px; }
  .counter-big .num { font-size: 30px; }
  .counter-big { padding: 16px 10px; }

  .btn-lg { padding: 12px 18px; font-size: 15px; }

  .quick-action { padding: 12px 14px; gap: 10px; }
  .quick-action-icon { width: 36px; height: 36px; font-size: 15px; }
  .quick-action-value { font-size: 18px; }
  .quick-action-label { font-size: 12px; }

  .card { padding: 14px; }
  .card-header { margin: -14px -14px 12px -14px; padding: 10px 14px; font-size: 13px; }

  /* Stats / charts stacked */
  .stats-grid, .counter-grid, .quick-actions {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* Page header: stack title & actions on phones */
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header h1 { font-size: 22px; }
  .page-header > * { width: 100%; }
  .page-header .btn, .page-header .xselect { width: 100%; }

  /* Dashboard: make table scroll affordance more visible */
  .table-wrap {
    border-width: 2px;
    box-shadow: 4px 4px 0 var(--shadow-color);
    margin-left: -14px; margin-right: -14px;
    border-left: 0; border-right: 0;
  }
  .table-wrap table { font-size: 12px; min-width: 520px; }
  .table-wrap th, .table-wrap td { padding: 8px 10px; }

  /* Dashboard stat-card tighter */
  .stat-card { padding: 14px; }
  .stat-card .stat-label { font-size: 10px; }
  .stat-card .stat-value { font-size: 22px; }

  /* Sidebar slides as narrower drawer */
  .dash-sidebar { width: min(300px, 92vw); }
  .dash-sidebar-brand { padding: 12px 14px; gap: 10px; }
  .dash-sidebar-brand-mark { width: 36px; height: 36px; font-size: 9px; }

  /* Trigger button full width at top */
  .dash-sidebar-trigger { width: 100%; justify-content: center; }

  /* Modal fits small screens */
  .modal { max-width: 100%; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }

  /* Charts shorter */
  .chart-box { min-height: 200px; }
  .chart-wrap h3 { font-size: 14px; }

  /* Toast */
  .toast-stack { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .toast { width: 100%; }

  /* Pagination wraps */
  .pagination { font-size: 12px; flex-wrap: wrap; }
  .pagination .btn-sm { padding: 5px 8px; font-size: 12px; }

  /* Footer */
  .footer { padding: 20px 14px; font-size: 12px; }

  .dashboard-actions .btn { width: 100%; justify-content: center; }

  /* Forms in cards stretch full width */
  .form-group label { font-size: 12px; }
  .input, .select, .textarea { font-size: 14px; }
}

/* Very small phone */
@media (max-width: 380px) {
  .container, .container-wide { padding: 16px 10px; }
  .stats-grid, .counter-grid, .quick-actions { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 20px; }
  .card { padding: 12px; }
  .card-header { margin: -12px -12px 10px -12px; padding: 10px 12px; font-size: 12px; }
  .nav-brand img { height: 30px; }
  .counter-big .num { font-size: 26px; }
  .counter-big .lbl { font-size: 11px; }
}

/* ===== CUSTOM SELECT (wraps native <select>) ===== */
.xselect { position: relative; display: inline-block; width: 100%; }
.xselect-btn {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; padding: 10px 14px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--border-color);
  box-shadow: 3px 3px 0 var(--border-color);
  cursor: pointer; text-align: left;
  transition: transform 0.1s, box-shadow 0.1s;
}
.xselect-btn::after {
  content: ''; width: 10px; height: 10px;
  border-right: 3px solid currentColor; border-bottom: 3px solid currentColor;
  transform: rotate(45deg) translate(-4px, -2px);
  margin-left: 8px; transition: transform 0.2s;
}
.xselect.open .xselect-btn::after { transform: rotate(-135deg) translate(-2px, -4px); }
.xselect-btn:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--border-color); }
.xselect-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: var(--paper);
  border: 2px solid var(--border-color); box-shadow: var(--shadow-sm);
  max-height: 320px; overflow-y: auto;
  display: none;
}
.xselect.open .xselect-list { display: block; }
.xselect-option {
  padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 14px;
  border-bottom: 1px solid var(--border-color);
}
.xselect-option:last-child { border-bottom: none; }
.xselect-option:hover { background: var(--paper-alt); }
.xselect-option.selected { background: var(--primary); color: white; }
.xselect-native { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }

/* ===== CUSTOM CHECKBOX (wraps native) ===== */
/* Already defined above as .check */

/* ===== SHORTCUT HELP MODAL ===== */
.shortcuts-list { display: grid; gap: 10px; }
.shortcut-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--paper-alt); border: 1px solid var(--border-color); }

/* ===== SPINNER ===== */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 3px solid var(--border-color); border-right-color: transparent;
  border-radius: 50%; animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ACTIVITY FEED ===== */
.activity-feed { max-height: 420px; overflow-y: auto; padding-right: 6px; }
.activity-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border-color); color: var(--ink); }
.activity-row:last-child { border-bottom: none; }
.activity-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.activity-body { font-size: 13px; flex: 1; color: var(--ink); }
.activity-dot { width: 8px; height: 8px; flex-shrink: 0; margin-top: 6px; background: var(--primary); border: 1px solid var(--border-color); }
.activity-dot.success { background: var(--success); }
.activity-dot.danger { background: var(--danger); }
.activity-dot.warning { background: var(--warning); }
.activity-dot.info { background: var(--info); }

/* ===== CHARTS ===== */
.chart-wrap {
  background: var(--paper); border: var(--border); box-shadow: var(--shadow);
  padding: 20px; position: relative;
  display: flex; flex-direction: column;
  height: 100%; /* so grid rows can align heights */
}
.chart-wrap h3 {
  font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em;
  margin: 0 0 16px 0; color: var(--ink);
  padding-bottom: 10px; border-bottom: 2px solid var(--border-color);
}
.chart-box {
  position: relative;
  flex: 1;
  min-height: 260px;
}

/* Dashboard two-col grid — stretch both cards same height */
.gap-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.gap-2col > * { min-height: 100%; }

/* Custom chart tooltip (neobrutalism style, injected by Chart.js) */
.rb-tooltip {
  position: absolute; pointer-events: none;
  background: var(--border-color); color: var(--bg);
  border: 3px solid var(--border-color);
  box-shadow: 4px 4px 0 var(--shadow-color);
  padding: 10px 14px; font-size: 13px; font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  opacity: 0; transition: opacity 0.15s, transform 0.15s;
  transform: translate(-50%, -110%);
  white-space: nowrap;
  z-index: 10;
  min-width: 140px;
}
.rb-tooltip.show { opacity: 1; transform: translate(-50%, -120%); }
.rb-tooltip::after {
  content: ''; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 8px solid transparent; border-right: 8px solid transparent;
  border-top: 8px solid var(--border-color);
}
.rb-tt-title { font-family: 'Press Start 2P', monospace; font-size: 9px; letter-spacing: 0.08em; margin-bottom: 6px; opacity: 0.7; }
.rb-tt-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.rb-tt-dot { width: 10px; height: 10px; border: 2px solid currentColor; flex-shrink: 0; }
.rb-tt-value { font-weight: 700; margin-left: auto; }


/* ===== NOTIFICATION BELL ===== */
.notif-dropdown { position: relative; }
.notif-bell { position: relative; }
.notif-bell .notif-count {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 4px;
  font-size: 10px; line-height: 14px;
}
.notif-menu {
  width: 380px; max-width: 90vw;
  max-height: 520px; overflow: hidden;
  display: none;
  flex-direction: column;
}
.notif-dropdown.open .notif-menu { display: flex; }
.notif-header {
  padding: 12px 14px;
  background: var(--paper-alt);
  border-bottom: 2px solid var(--border-color);
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
.notif-list { overflow-y: auto; flex: 1; min-height: 100px; }
.notif-item {
  display: flex; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px dashed var(--border-color);
  cursor: pointer;
  color: var(--ink);
  transition: background 0.1s;
}
.notif-item:hover { background: var(--paper-alt); text-decoration: none; }
.notif-item:last-child { border-bottom: none; }
.notif-icon-wrap {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #0f172a;
  border: 2px solid var(--border-color);
  font-weight: 700;
}
.notif-item.danger .notif-icon-wrap { background: var(--danger); color: white; }
.notif-item.warning .notif-icon-wrap { background: var(--warning); color: #0f172a; }
.notif-item.success .notif-icon-wrap { background: var(--success); color: #0f172a; }
.notif-item.info .notif-icon-wrap { background: var(--info); color: #0f172a; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-weight: 700; font-size: 13px; }
.notif-item-subtitle { font-size: 12px; color: var(--muted); }
.notif-item-time { font-size: 11px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

@media (max-width: 820px) {
  .notif-menu { width: calc(100vw - 32px); right: 0; }
}


/* ===== AI CHAT WIDGET — redesigned ===== */

.aichat-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 900;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px 12px 14px;
  background: var(--border-color); color: var(--accent);
  border: 3px solid var(--border-color);
  box-shadow: 6px 6px 0 var(--shadow-color);
  cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 14px;
  letter-spacing: 0.02em;
  transition: transform 0.12s, box-shadow 0.12s;
}
.aichat-fab:hover { transform: translate(-2px,-2px); box-shadow: 8px 8px 0 var(--shadow-color); }
.aichat-fab:active { transform: translate(3px,3px); box-shadow: 3px 3px 0 var(--shadow-color); }
.aichat-fab .fab-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: var(--accent); color: var(--border-color);
  font-family: 'Press Start 2P', monospace; font-size: 10px;
}
.aichat-fab .fab-dot {
  width: 8px; height: 8px; background: var(--success);
  border: 2px solid var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

.aichat-panel {
  position: fixed; bottom: 24px; right: 24px; z-index: 901;
  width: 400px; max-width: calc(100vw - 32px);
  height: 620px; max-height: calc(100vh - 64px);
  background: var(--paper);
  border: 3px solid var(--border-color);
  box-shadow: 10px 10px 0 var(--shadow-color);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: aichat-in 0.25s ease-out;
}
.aichat-panel.open { display: flex; }
@keyframes aichat-in { from { transform: translateY(20px) scale(0.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

.aichat-header {
  padding: 14px 16px;
  background: var(--border-color); color: var(--accent);
  border-bottom: 3px solid var(--border-color);
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
.aichat-header .aichat-title {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 14px; letter-spacing: 0.03em;
}
.aichat-avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  background: var(--accent); color: var(--border-color);
  border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Press Start 2P', monospace; font-size: 10px;
}
.aichat-title-text { display: flex; flex-direction: column; line-height: 1.2; }
.aichat-title-text strong { font-size: 14px; }
.aichat-title-text small {
  font-size: 10px; opacity: 0.75; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.08em; display: flex; align-items: center; gap: 5px;
}
.aichat-title-text small::before {
  content: ''; width: 6px; height: 6px; background: var(--success); border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}
.aichat-header-actions { display: flex; align-items: center; gap: 4px; }
.aichat-header-actions button {
  background: transparent; border: none; color: var(--accent);
  font-size: 18px; cursor: pointer; font-weight: 700;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
}
.aichat-header-actions button:hover { background: rgba(255, 216, 3, 0.15); }

.aichat-body {
  flex: 1; overflow-y: auto;
  padding: 16px; background: var(--bg);
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}

.aichat-msg-row {
  display: flex; gap: 8px;
  animation: aichat-msg-in 0.2s ease-out;
}
@keyframes aichat-msg-in { from { transform: translateY(6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.aichat-msg-row.user { justify-content: flex-end; }
.aichat-msg-row.user .aichat-msg-avatar { display: none; }

.aichat-msg-avatar {
  width: 28px; height: 28px; flex-shrink: 0;
  background: var(--accent); color: var(--border-color);
  border: 2px solid var(--border-color);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Press Start 2P', monospace; font-size: 9px;
}

.aichat-msg {
  max-width: 80%;
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  border: 2px solid var(--border-color);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.aichat-msg.user {
  background: var(--primary); color: white;
  box-shadow: 3px 3px 0 var(--shadow-color);
}
.aichat-msg.bot {
  background: var(--paper); color: var(--ink);
  box-shadow: 3px 3px 0 var(--shadow-color);
}
.aichat-msg.typing {
  background: var(--paper); color: var(--muted);
  font-style: italic;
  padding: 12px 16px;
  display: inline-flex; gap: 4px; align-items: center;
}
.aichat-msg.typing .dot {
  width: 6px; height: 6px; background: var(--muted);
  border-radius: 50%;
  animation: aichat-bounce 1.4s infinite ease-in-out both;
}
.aichat-msg.typing .dot:nth-child(1) { animation-delay: -0.32s; }
.aichat-msg.typing .dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes aichat-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40%            { transform: scale(1);   opacity: 1; }
}

.aichat-msg-time {
  font-size: 10px; color: var(--muted);
  margin-top: 4px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.aichat-msg-row.bot .aichat-msg-time { text-align: left; padding-left: 4px; }

.aichat-suggestions {
  padding: 12px 16px;
  background: var(--paper-alt);
  border-top: 2px solid var(--border-color);
  flex-shrink: 0;
  max-height: 180px; overflow-y: auto;
}
.aichat-suggestions-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); margin-bottom: 8px;
}
.aichat-suggestions-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.aichat-chip {
  padding: 7px 12px;
  font-family: inherit; font-size: 12px; font-weight: 600;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--border-color);
  box-shadow: 2px 2px 0 var(--shadow-color);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
  text-align: left; line-height: 1.3;
}
.aichat-chip:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--shadow-color);
  background: var(--accent);
}
.aichat-chip:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--shadow-color); }

.aichat-footer {
  padding: 12px; background: var(--paper);
  border-top: 3px solid var(--border-color);
  display: flex; gap: 8px;
  flex-shrink: 0;
  align-items: center;
}
.aichat-footer input {
  flex: 1;
  padding: 11px 14px;
  font-family: inherit; font-size: 13px;
  background: var(--bg); color: var(--ink);
  border: 2px solid var(--border-color);
  outline: none;
  transition: background 0.15s;
}
.aichat-footer input:focus { background: var(--paper); }
.aichat-footer input::placeholder { color: var(--muted); }
.aichat-footer button {
  padding: 11px 16px;
  background: var(--border-color); color: var(--accent);
  border: 2px solid var(--border-color);
  font-family: inherit; font-weight: 700; font-size: 13px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--shadow-color);
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex; align-items: center; gap: 6px;
}
.aichat-footer button:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--shadow-color); }
.aichat-footer button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--shadow-color); }

.aichat-disclaimer {
  font-size: 10px; color: var(--muted);
  text-align: center;
  padding: 6px 14px 10px;
  background: var(--paper);
  flex-shrink: 0;
}

@media (max-width: 560px) {
  .aichat-panel {
    right: 0; bottom: 0; left: 0; width: 100%;
    max-width: 100%;
    height: 100vh; max-height: 100vh;
    border-width: 0; border-top: 3px solid var(--border-color);
    box-shadow: none;
    animation: aichat-in-mobile 0.25s ease-out;
  }
  @keyframes aichat-in-mobile { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .aichat-fab {
    bottom: 16px; right: 16px;
    padding: 10px 14px 10px 12px;
    font-size: 13px;
  }
  .aichat-fab .fab-icon { width: 26px; height: 26px; font-size: 9px; }
  .aichat-msg { font-size: 13px; max-width: 85%; }
}


/* ===== LEGAL PAGES ===== */
.legal-wrap {
  max-width: 820px; margin: 0 auto;
  background: var(--paper);
  border: var(--border); box-shadow: var(--shadow);
  padding: 40px 48px;
  color: var(--ink);
}
.legal-wrap h1 {
  font-size: 36px; margin: 0 0 8px; letter-spacing: -0.03em;
}
.legal-wrap .legal-meta {
  font-size: 12px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: 700;
  padding-bottom: 24px; margin-bottom: 32px;
  border-bottom: 2px solid var(--border-color);
}
.legal-wrap h2 {
  font-size: 22px; margin: 32px 0 12px;
  padding-top: 16px; border-top: 1px dashed var(--border-color);
  color: var(--ink);
}
.legal-wrap h2:first-of-type { border-top: none; padding-top: 0; }
.legal-wrap h3 { font-size: 16px; margin: 20px 0 10px; color: var(--ink); }
.legal-wrap p { font-size: 15px; line-height: 1.7; margin: 0 0 14px; color: var(--ink); }
.legal-wrap ul, .legal-wrap ol { margin: 0 0 16px; padding-left: 24px; font-size: 15px; line-height: 1.7; }
.legal-wrap li { margin-bottom: 6px; color: var(--ink); }
.legal-wrap strong { font-weight: 700; color: var(--ink); }
.legal-wrap code { background: var(--paper-alt); padding: 2px 6px; border: 1px solid var(--border-color); font-size: 13px; }

.legal-toc {
  background: var(--paper-alt);
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--shadow-color);
  padding: 20px 24px; margin-bottom: 32px;
}
.legal-toc-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); margin-bottom: 10px;
}
.legal-toc ol { padding-left: 20px; margin: 0; font-size: 14px; }
.legal-toc li { margin-bottom: 4px; }
.legal-toc a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; }
.legal-toc a:hover { text-decoration-thickness: 2px; }

.legal-callout {
  background: #fef3c7; color: #0f172a;
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--shadow-color);
  padding: 14px 18px; margin: 20px 0;
  font-size: 14px;
}
.legal-callout strong { display: block; margin-bottom: 4px; }

.legal-footer-nav {
  display: flex; gap: 16px; flex-wrap: wrap;
  padding-top: 24px; margin-top: 32px;
  border-top: 2px solid var(--border-color);
  font-size: 13px;
}
.legal-footer-nav a { color: var(--ink); text-decoration: underline; }

@media (max-width: 700px) {
  .legal-wrap { padding: 28px 24px; }
  .legal-wrap h1 { font-size: 26px; }
  .legal-wrap h2 { font-size: 19px; }
  .legal-wrap p, .legal-wrap ul, .legal-wrap ol { font-size: 14px; }
}

/* ToS checkbox in verify page */
.tos-box {
  background: var(--paper-alt);
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--shadow-color);
  padding: 16px 18px; margin: 20px 0;
}
.tos-box label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; line-height: 1.5; }
.tos-box input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; }
.tos-box a { color: var(--primary); text-decoration: underline; font-weight: 700; }


/* ===== PRINT STYLES ===== */
@media print {
  /* Hide non-essential UI */
  .nav, .footer, .dash-sidebar, .toast-stack,
  .aichat-fab, .aichat-panel,
  .modal-backdrop, .ticker-wrap,
  .nav-toggle, .nav-search, .nav-actions,
  .btn, .quick-actions, .hero-actions,
  .dashboard-actions, .bulk-bar, #bulkBar,
  .page-header > a, .page-header > button, .page-header > form,
  .card-header > a, .card-header > button,
  form, .form-row, .faq-categories, .status-dot,
  .dropdown, .notif-dropdown {
    display: none !important;
  }

  /* Full page, clean background */
  html, body {
    background: white !important;
    background-image: none !important;
    color: black !important;
    font-size: 11pt;
    line-height: 1.5;
  }

  .container, .container-wide {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .dash-layout {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  /* Cards flat for print */
  .card, .table-wrap, .chart-wrap, .stat-card,
  .profile-header, .hero, .alert,
  .review-card, .leaderboard-row, .fee-row, .steps li {
    border: 1px solid #333 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 12pt;
    background: white !important;
    color: black !important;
  }

  .card-header {
    background: #f0f0f0 !important;
    color: black !important;
    border-bottom: 1px solid #333 !important;
    margin: 0 0 12pt 0 !important;
    padding: 8pt !important;
  }

  /* Tables print clean */
  table, thead, thead th {
    background: white !important;
    color: black !important;
  }
  thead { border-bottom: 2pt solid black !important; }
  thead th { color: black !important; font-weight: 700 !important; }
  td, th {
    border-bottom: 0.5pt solid #666 !important;
    padding: 4pt 8pt !important;
    font-size: 10pt;
  }

  /* Headers readable */
  h1 { font-size: 20pt !important; color: black !important; margin: 0 0 8pt !important; }
  h2 { font-size: 16pt !important; color: black !important; page-break-after: avoid; }
  h3 { font-size: 13pt !important; color: black !important; page-break-after: avoid; }

  /* Links show URL for physical print */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
    font-weight: normal;
  }
  a[href^="#"]::after, a[href^="javascript:"]::after { content: ""; }

  /* Badges flat */
  .badge, [class^="s-"], .badge-pixel {
    background: transparent !important;
    color: black !important;
    border: 1px solid black !important;
    box-shadow: none !important;
    padding: 2pt 6pt !important;
  }

  /* Avoid break inside tables */
  tr { page-break-inside: avoid; }

  /* Stats grid flat */
  .stats-grid, .counter-grid, .gap-2col {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6pt !important;
  }

  /* Chart container hidden */
  .chart-box, canvas { display: none !important; }

  /* Page header */
  .page-header {
    border-bottom: 2pt solid black;
    padding-bottom: 8pt;
    margin-bottom: 12pt;
  }

  /* Ensure white background for fenced sections */
  .legal-wrap, .legal-callout, .blog-content pre {
    background: white !important;
    color: black !important;
    border: 1px solid #333 !important;
    box-shadow: none !important;
  }

  /* Print footer — always show RB branding */
  body::after {
    content: "RB Middleman · Trusted Escrow Service · " attr(data-print-url);
    display: block;
    margin-top: 20pt;
    padding-top: 8pt;
    border-top: 1pt solid #333;
    font-size: 9pt;
    color: #666;
    text-align: center;
  }

  /* Maintenance banner & alerts subtle */
  .maintenanceBanner, .alert {
    border: 1px solid #333 !important;
    background: #f8f8f8 !important;
  }

  /* Dashboard main full width */
  .dash-main { min-width: 100% !important; }

  /* Avoid extra margin */
  .mb-24, .mt-24 { margin: 8pt 0 !important; }
}

/* ===========================================
   LANDING: HOW IT WORKS SECTION
   =========================================== */
.section-header { text-align: center; margin-bottom: 32px; }
.section-kicker {
  display: inline-block;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px; letter-spacing: 0.14em; color: var(--primary);
  padding: 6px 12px; background: var(--paper);
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--border-color);
  margin-bottom: 18px;
}
.section-title {
  font-size: 40px; line-height: 1.05; letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.hiw-underline {
  display: inline-block;
  background: var(--accent); color: var(--ink);
  padding: 0 8px; transform: rotate(-1deg);
  box-shadow: 3px 3px 0 var(--border-color);
}
.section-sub { color: var(--ink-soft); font-size: 16px; max-width: 560px; margin: 0 auto; }

.hiw {
  margin: 40px 0 32px;
  position: relative;
}
.hiw-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
  margin-bottom: 24px;
  position: relative;
}
/* Connector line between cards on desktop */
.hiw-grid::before {
  content: '';
  position: absolute;
  top: 58px; left: 12.5%; right: 12.5%;
  height: 3px;
  background-image: linear-gradient(to right, var(--border-color) 50%, transparent 50%);
  background-size: 16px 3px;
  background-repeat: repeat-x;
  z-index: 0;
  opacity: 0.5;
}
.hiw-card {
  position: relative;
  background: var(--paper);
  border: var(--border); box-shadow: var(--shadow);
  padding: 20px 18px 22px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 1;
}
.hiw-card:hover { transform: translate(-3px, -3px); box-shadow: 10px 10px 0 var(--shadow-color); }
.hiw-n {
  position: absolute; top: -12px; right: 14px;
  font-family: 'Press Start 2P', monospace; font-size: 11px;
  background: var(--border-color); color: var(--accent);
  padding: 6px 10px;
  border: 2px solid var(--border-color);
}
.hiw-ico {
  width: 58px; height: 58px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--border-color);
  margin-bottom: 16px;
  transition: transform 0.25s cubic-bezier(.25,1.4,.5,1);
}
.hiw-card:hover .hiw-ico {
  animation: hiwBounce 0.6s ease;
}
@keyframes hiwBounce {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-6deg) scale(1.05); }
  75% { transform: rotate(6deg) scale(1.05); }
}
.hiw-ico-1 { background: var(--primary); color: #fff; }
.hiw-ico-2 { background: var(--success); color: #0f172a; }
.hiw-ico-3 { background: var(--info); color: #0f172a; }
.hiw-ico-4 { background: var(--accent); color: #0f172a; }
.hiw-ico svg { width: 28px; height: 28px; }
.hiw-card h3 { font-size: 18px; margin: 0 0 6px; letter-spacing: -0.01em; }
.hiw-card p { font-size: 14px; color: var(--ink-soft); margin: 0; line-height: 1.55; }

.hiw-foot {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--paper-alt); color: var(--ink);
  border: 2px solid var(--border-color); box-shadow: 3px 3px 0 var(--border-color);
  font-size: 13px; font-weight: 600;
}
.hiw-foot svg { color: var(--success); flex-shrink: 0; }
.hiw-foot code { background: var(--border-color); color: var(--accent); padding: 2px 6px; font-size: 12px; }

/* ===========================================
   LEADERBOARD RATING BADGE
   =========================================== */
.lb-rating {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px;
  background: var(--accent); color: #0f172a;
  border: 2px solid var(--border-color); box-shadow: 2px 2px 0 var(--border-color);
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}

/* ===========================================
   EMPTY STATE (home, lists)
   =========================================== */
.empty-state {
  text-align: center; padding: 36px 20px; color: var(--muted);
}
.empty-state svg { margin-bottom: 8px; opacity: 0.6; }
.empty-state p { margin: 0; font-size: 14px; }

/* ===========================================
   CTA FINAL BLOCK (home bottom)
   =========================================== */
.cta-final {
  position: relative;
  background: var(--accent); color: #0f172a;
  border: var(--border-thick); box-shadow: var(--shadow-lg);
  padding: 48px 24px; text-align: center;
  overflow: hidden;
  margin-bottom: 24px;
}
.cta-final h2 {
  font-size: 36px; margin: 0 0 10px;
  letter-spacing: -0.02em; color: #0f172a;
}
.cta-final p { color: #0f172a; margin-bottom: 22px; font-size: 16px; }
.cta-final .btn { position: relative; z-index: 2; }
.cta-deco {
  position: absolute; pointer-events: none;
  width: 60px; height: 60px;
  opacity: 0.6;
}
.cta-deco svg { width: 100%; height: 100%; }
.cta-deco-1 { top: 24px; left: 40px; animation: ctaSpin 12s linear infinite; }
.cta-deco-2 { bottom: 36px; right: 60px; animation: ctaSpin 20s linear infinite reverse; width: 48px; height: 48px; }
.cta-deco-3 { top: 36px; right: 14%; animation: ctaFloat 3.5s ease-in-out infinite; width: 36px; height: 36px; }
@keyframes ctaSpin { to { transform: rotate(360deg); } }
@keyframes ctaFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

/* ===========================================
   SCROLL REVEAL
   =========================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.6s cubic-bezier(.16,1,.3,1);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}
/* Stagger children for grid reveals (hiw + counter) */
.reveal.counter-grid .counter-big,
.reveal .hiw-card {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(.16,1,.3,1);
}
.reveal.in.counter-grid .counter-big,
.reveal.in .hiw-card {
  opacity: 1; transform: translateY(0);
}
.reveal.in .hiw-card:nth-child(1), .reveal.in.counter-grid .counter-big:nth-child(1) { transition-delay: 0.05s; }
.reveal.in .hiw-card:nth-child(2), .reveal.in.counter-grid .counter-big:nth-child(2) { transition-delay: 0.15s; }
.reveal.in .hiw-card:nth-child(3), .reveal.in.counter-grid .counter-big:nth-child(3) { transition-delay: 0.25s; }
.reveal.in .hiw-card:nth-child(4), .reveal.in.counter-grid .counter-big:nth-child(4) { transition-delay: 0.35s; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal .hiw-card, .reveal.counter-grid .counter-big,
  .hero-mock, .hero-mock-line, .hiw-card .hiw-ico {
    opacity: 1 !important; transform: none !important; animation: none !important; transition: none !important;
  }
  .ticker-track, .cta-deco, .hero-live-dot, .ticker-pulse { animation: none !important; }
}

/* ===========================================
   LANDING RESPONSIVE
   =========================================== */
@media (max-width: 1024px) {
  .hiw-grid { grid-template-columns: repeat(2, 1fr); }
  .hiw-grid::before { display: none; }
  .section-title { font-size: 32px; }
}
@media (max-width: 560px) {
  .hiw-grid { grid-template-columns: 1fr; gap: 16px; }
  .section-kicker { font-size: 9px; }
  .section-title { font-size: 26px; }
  .section-sub { font-size: 14px; }
  .cta-final { padding: 36px 18px; }
  .cta-final h2 { font-size: 26px; }
  .cta-deco-1, .cta-deco-2 { display: none; }
  .cta-deco-3 { top: 16px; right: 16px; }
  .ticker-label { font-size: 9px; padding: 10px 14px; }
  .ticker-label::after { display: none; }
  .counter-ico { width: 38px; height: 38px; margin-bottom: 8px; }
  .counter-ico svg { width: 18px; height: 18px; }
  .counter-big .num { font-size: 26px; }
}
