:root {
  --red: #E8192C;
  --red-dark: #b81020;
  --bg: #1a1a1a;
  --bg-2: #232323;
  --bg-3: #2d2d2d;
  --text: #f0f0f0;
  --muted: #9a9a9a;
  --border: #333;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(0,0,0,.4);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--red); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { background: #111; border-bottom: 2px solid var(--red); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { font-weight: 900; font-size: 22px; letter-spacing: -.5px; }
.logo span { color: var(--red); }
.main-nav { display: flex; gap: 18px; flex: 1; }
.main-nav a { font-weight: 600; color: var(--muted); }
.main-nav a:hover { color: var(--text); }
.user-nav { display: flex; gap: 14px; align-items: center; }
.balance { background: var(--bg-3); padding: 6px 12px; border-radius: 999px; font-weight: 700; color: var(--red); }
.badge { background: var(--red); color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 12px; }

/* Buttons */
.btn { display: inline-block; background: var(--red); color: #fff !important; padding: 10px 18px; border-radius: 8px; font-weight: 700; border: none; cursor: pointer; transition: .15s; }
.btn:hover { background: var(--red-dark); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text) !important; }
.btn-ghost:hover { border-color: var(--red); }

/* Flash */
.flash { padding: 12px 20px; text-align: center; font-weight: 600; }
.flash-success { background: #1f5b2e; }
.flash-error { background: var(--red-dark); }
.flash-info { background: var(--bg-3); }

/* Hero */
.hero { padding: 80px 0; background: linear-gradient(135deg, #2a0509 0%, var(--bg) 70%); border-radius: var(--radius); text-align: center; margin: 24px 0; }
.hero h1 { font-size: 56px; margin: 0 0 12px; line-height: 1.05; }
.hero h1 span { color: var(--red); }
.hero p { font-size: 18px; color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; }

/* Section */
.section { margin: 40px 0; }
.section h2 { font-size: 28px; margin: 0 0 20px; }

/* Grid */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* Card */
.card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: .15s; display: flex; flex-direction: column; }
.card:hover { border-color: var(--red); transform: translateY(-2px); box-shadow: var(--shadow); }
.card .thumb { aspect-ratio: 16/10; background: var(--bg-3) center/cover; }
.card .body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.card .title { font-weight: 700; font-size: 15px; line-height: 1.3; }
.card .meta { color: var(--muted); font-size: 12px; }
.card .price { color: var(--red); font-weight: 800; font-size: 18px; margin-top: auto; }
.card .cat { display: inline-block; background: var(--red); color: #fff; font-size: 10px; padding: 3px 8px; border-radius: 4px; text-transform: uppercase; font-weight: 700; }
.card.featured { border-color: var(--red); }

/* Forms */
.form { max-width: 440px; margin: 40px auto; background: var(--bg-2); padding: 32px; border-radius: var(--radius); border: 1px solid var(--border); }
.form h1 { margin: 0 0 20px; }
.form label { display: block; margin: 12px 0 6px; font-weight: 600; font-size: 14px; }
.form input, .form select, .form textarea {
  width: 100%; padding: 10px 12px; background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font: inherit;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--red); }
.form .btn { width: 100%; margin-top: 18px; padding: 12px; }
.form .alt { text-align: center; margin-top: 14px; color: var(--muted); font-size: 14px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--bg-2); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: var(--bg-3); font-size: 13px; text-transform: uppercase; color: var(--muted); }

/* Listing detail */
.listing-detail { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; margin: 24px 0; }
.listing-detail .gallery { background: var(--bg-2); border-radius: var(--radius); padding: 16px; }
.listing-detail .gallery img { width: 100%; border-radius: 8px; }
.listing-detail .info { background: var(--bg-2); border-radius: var(--radius); padding: 24px; }
.listing-detail .info h1 { margin-top: 0; }
.listing-detail .info .price { color: var(--red); font-size: 32px; font-weight: 800; margin: 12px 0; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.specs div { background: var(--bg-3); padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.specs div b { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; }

/* Dashboard */
.dash { display: grid; grid-template-columns: 220px 1fr; gap: 20px; margin: 24px 0; }
.dash .side { background: var(--bg-2); border-radius: var(--radius); padding: 16px; }
.dash .side a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--muted); }
.dash .side a:hover, .dash .side a.active { background: var(--bg-3); color: var(--text); }
.dash .pane { background: var(--bg-2); border-radius: var(--radius); padding: 24px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--bg-3); padding: 16px; border-radius: 10px; }
.stat b { color: var(--muted); font-size: 12px; text-transform: uppercase; display: block; margin-bottom: 6px; }
.stat span { font-size: 24px; font-weight: 800; color: var(--red); }

/* Footer */
.site-footer { background: #0d0d0d; padding: 40px 0 20px; margin-top: 60px; border-top: 1px solid var(--border); }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.site-footer h4 { color: var(--red); margin: 0 0 10px; }
.site-footer a { display: block; color: var(--muted); padding: 4px 0; font-size: 14px; }
.site-footer .copy { text-align: center; color: var(--muted); font-size: 13px; padding-top: 20px; border-top: 1px solid var(--border); }

@media (max-width: 768px) {
  .hero h1 { font-size: 36px; }
  .main-nav { display: none; }
  .listing-detail, .dash { grid-template-columns: 1fr; }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
}

/* Toasts */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--bg-3); border-left: 4px solid var(--red); padding: 12px 18px; border-radius: 8px; box-shadow: var(--shadow); animation: slide .3s ease; }
@keyframes slide { from { transform: translateX(100%); opacity: 0; } }

/* ==========  Listing cards (browse page)  ========== */
.browse-hero { padding: 32px 0 12px; }
.browse-hero h1 { margin: 0; font-size: 36px; }
.browse-hero .muted { color: var(--muted); margin: 6px 0 0; }

.cat-pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 14px; }
.cat-pills a {
  background: var(--bg-2); border: 1px solid var(--border); padding: 8px 16px;
  border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted);
}
.cat-pills a:hover { color: var(--text); border-color: var(--red); }
.cat-pills a.active { background: var(--red); color: #fff; border-color: var(--red); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 22px; padding: 14px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); }
.filters input, .filters select {
  padding: 9px 12px; background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font: inherit;
}
.filters input { flex: 1; min-width: 140px; }

.listing-card { color: var(--text); }
.listing-card .card-img {
  position: relative; aspect-ratio: 4/3;
  background: var(--bg-3) center/cover no-repeat;
  border-bottom: 1px solid var(--border);
}
.listing-card .tag {
  position: absolute; top: 10px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  padding: 4px 8px; border-radius: 4px;
}
.listing-card .tag-cat  { left: 10px; background: rgba(0,0,0,.7); color: #fff; }
.listing-card .tag-feat { right: 10px; background: var(--red); color: #fff; }
.listing-card .card-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.listing-card .card-title { font-size: 15px; font-weight: 700; line-height: 1.35;
  margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing-card .card-meta { font-size: 12px; color: var(--muted); }
.listing-card .card-footer { display: flex; justify-content: space-between; align-items: center;
  margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); }
.listing-card .price { color: var(--red); font-weight: 800; font-size: 18px; }
.listing-card .seller { font-size: 12px; color: var(--muted); }
.listing-card .verified { color: #2ecc71; font-weight: 700; margin-left: 2px; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted);
  background: var(--bg-2); border-radius: var(--radius); border: 1px dashed var(--border); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary { background: var(--red); }

/* listing form: rows, hints */
.listing-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.listing-form fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin: 18px 0; background: var(--bg-3); }
.listing-form fieldset legend { padding: 0 8px; color: var(--red); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.hint { display: inline-block; margin-left: 4px; width: 16px; height: 16px; line-height: 16px;
  text-align: center; background: var(--bg-3); color: var(--muted); border-radius: 50%;
  font-size: 11px; cursor: help; border: 1px solid var(--border); }
.hint:hover { color: var(--red); border-color: var(--red); }

/* ==========  Admin panel (redesigned)  ========== */
.admin-shell {
  display: grid; grid-template-columns: 240px 1fr; gap: 0;
  margin: 24px 0; background: var(--bg-2);
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  min-height: 70vh;
}
.admin-side { background: #141414; padding: 20px 0; border-right: 1px solid var(--border); }
.admin-brand { padding: 0 20px 16px; font-size: 13px; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--muted); font-weight: 700;
  border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.admin-side nav { display: flex; flex-direction: column; }
.admin-side nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px; color: var(--muted); font-weight: 600; font-size: 14px;
  border-left: 3px solid transparent;
}
.admin-side nav a .ico { font-size: 16px; width: 20px; text-align: center; }
.admin-side nav a .lbl { flex: 1; }
.admin-side nav a .pill {
  background: var(--red); color: #fff; font-size: 11px;
  padding: 2px 8px; border-radius: 999px; font-weight: 700;
}
.admin-side nav a:hover { background: rgba(232,25,44,.08); color: var(--text); }
.admin-side nav a.active { background: rgba(232,25,44,.12); color: #fff; border-left-color: var(--red); }

.admin-main { display: flex; flex-direction: column; }
.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 28px; border-bottom: 1px solid var(--border); background: #1d1d1d;
}
.admin-header h1 { margin: 0; font-size: 22px; }
.admin-user { color: var(--muted); font-size: 13px; }
.admin-pane { padding: 28px; flex: 1; }

.admin-pane h2 { margin-top: 0; font-size: 18px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 1px; font-weight: 700; }
.admin-pane .table { box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.admin-pane .table th { position: sticky; top: 0; background: #1a1a1a; }
.admin-pane .table tr:hover td { background: rgba(232,25,44,.04); }
.admin-pane .stats .stat { background: linear-gradient(135deg, var(--bg-3), #2a2a2a);
  border: 1px solid var(--border); }
.admin-pane form.inline { display: inline; }
.admin-pane form.inline button {
  background: transparent; color: var(--red); border: 1px solid var(--border);
  padding: 5px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; font-weight: 600;
}
.admin-pane form.inline button:hover { background: var(--red); color: #fff; border-color: var(--red); }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { display: flex; overflow-x: auto; padding: 10px; }
  .admin-side nav { flex-direction: row; }
  .admin-brand { display: none; }
  .listing-form .row { grid-template-columns: 1fr; }
}

/* ==========  Dashboard polish (v2)  ========== */
.dash .side { padding: 0; overflow: hidden; }
.dash .side .dash-user {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 16px; background: linear-gradient(135deg, #2a0509, #1a1a1a);
  border-bottom: 1px solid var(--border);
}
.dash .side .dash-user img {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; background: var(--bg-3); border: 2px solid var(--red);
}
.dash .side .dash-user-name { font-weight: 800; font-size: 15px; }
.dash .side .dash-user-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.dash .side a:not(.dash-user) {
  display: flex; align-items: center; gap: 8px;
  margin: 4px 8px; padding: 9px 12px; border-radius: 8px;
  color: var(--muted); font-weight: 600; font-size: 14px;
  border-left: 3px solid transparent;
}
.dash .side a:not(.dash-user):hover { background: rgba(232,25,44,.08); color: #fff; }
.dash .side a.active {
  background: rgba(232,25,44,.15); color: #fff;
  border-left-color: var(--red);
}

.welcome { margin-bottom: 24px; }
.welcome h1 { margin: 0 0 4px; font-size: 28px; }
.welcome h1 span { color: var(--red); }
.welcome p { margin: 0; color: var(--muted); }

.stat.stat-primary {
  background: linear-gradient(135deg, var(--red), #8a0e1c);
}
.stat.stat-primary b, .stat.stat-primary span { color: #fff !important; }

/* Status pills */
.status-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; background: #444; color: #fff;
}
.status-pill.status-active, .status-pill.status-paid, .status-pill.status-completed,
.status-pill.status-delivered { background: #1f8a3a; }
.status-pill.status-pending { background: #b8841d; }
.status-pill.status-rejected, .status-pill.status-refunded, .status-pill.status-disputed { background: #b81020; }
.status-pill.status-sold { background: #444; }

.empty-row { text-align: center; color: var(--muted); padding: 30px !important; }

/* Settings cards */
.settings-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px;
}
.settings-card {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 12px; padding: 22px;
}
.settings-card h3 { margin: 0 0 16px; font-size: 16px;
  text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.settings-card label { display: block; margin: 12px 0 6px; font-weight: 600; font-size: 13px; }
.settings-card input, .settings-card textarea, .settings-card select {
  width: 100%; padding: 10px 12px; background: #1a1a1a; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font: inherit;
}
.settings-card input:focus, .settings-card textarea:focus { outline: none; border-color: var(--red); }
.settings-card textarea { resize: vertical; }
.profile-row { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.avatar-preview img {
  width: 80px; height: 80px; border-radius: 50%;
  object-fit: cover; background: var(--bg-2);
  border: 2px solid var(--red);
}

/* Buttons polish */
.btn {
  background: linear-gradient(135deg, var(--red), #c41023);
  box-shadow: 0 4px 12px rgba(232,25,44,.25);
}
.btn:hover { background: linear-gradient(135deg, #ff3346, var(--red-dark));
  transform: translateY(-1px); box-shadow: 0 6px 16px rgba(232,25,44,.35); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { background: transparent !important; box-shadow: none; }

@media (max-width: 768px) {
  .settings-grid { grid-template-columns: 1fr; }
}

/* v4 — user badges, dashboard polish, admin settings cards */
.dash .side .dash-user{flex-wrap:wrap;}
.dash-user-badges{display:flex;flex-wrap:wrap;gap:4px;margin-top:6px;}
.ubadge{display:inline-block;padding:2px 8px;border-radius:999px;font-size:10px;font-weight:700;color:#fff;letter-spacing:.3px;}
.settings-card{background:var(--bg-3);border:1px solid var(--border);border-radius:12px;padding:18px;}
.settings-card h3{margin-top:0;}
.admin-pane h2{margin-top:0;}
.admin-side nav a{transition:background .15s,color .15s;}
.empty-row{text-align:center;color:var(--muted);padding:24px;}

/* ============== v5 — admin user cards, tighter shell, polish ============== */
.admin-shell{grid-template-columns:220px 1fr;max-width:100%;}
.admin-pane{padding:24px;min-width:0;overflow:hidden;}
.admin-pane h1,.admin-pane h2{margin-top:0;}

/* Users tab */
.users-toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;gap:12px;flex-wrap:wrap;}
.search-input{padding:8px 12px;background:var(--bg-3);border:1px solid var(--border);color:#fff;border-radius:8px;min-width:240px;}
.user-cards{display:grid;gap:14px;}
.user-card{background:var(--bg-2);border:1px solid var(--border);border-radius:14px;padding:16px;display:grid;gap:14px;}
.user-card-head{display:grid;grid-template-columns:56px 1fr auto auto;gap:14px;align-items:center;}
.user-avatar{width:56px;height:56px;border-radius:50%;background:var(--bg-3);object-fit:cover;border:2px solid var(--border);}
.user-name{font-weight:700;font-size:16px;display:flex;align-items:center;gap:8px;}
.user-name .muted{color:var(--muted);font-weight:400;font-size:12px;}
.user-email{font-size:12px;color:var(--muted);margin-top:2px;}
.user-badges{display:flex;flex-wrap:wrap;gap:4px;margin-top:6px;}
.user-balance{text-align:right;}
.user-balance .muted{color:var(--muted);font-size:11px;text-transform:uppercase;}
.user-balance .bal{color:var(--red);font-weight:800;font-size:18px;}
.user-status .pill{font-size:11px;padding:4px 10px;border-radius:999px;color:#fff;font-weight:700;display:inline-block;}

.user-card-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center;border-top:1px solid var(--border);padding-top:12px;}
.inline-form{display:inline-flex;gap:4px;align-items:center;background:var(--bg-3);padding:4px 6px;border-radius:8px;border:1px solid var(--border);}
.action-buttons{display:inline-flex;gap:4px;margin-left:auto;}
.mini{width:80px;padding:5px 8px;background:var(--bg);border:1px solid var(--border);color:#fff;border-radius:6px;font-size:12px;}
.mini-select{padding:5px 8px;background:var(--bg);border:1px solid var(--border);color:#fff;border-radius:6px;font-size:12px;}
.color-mini{width:34px;height:28px;padding:1px;border:1px solid var(--border);background:var(--bg);border-radius:6px;cursor:pointer;}
.chip{padding:5px 10px;font-size:12px;font-weight:700;border-radius:6px;border:none;cursor:pointer;color:#fff;background:#444;transition:.12s;}
.chip:hover{filter:brightness(1.15);}
.chip-green{background:#1f8a3a;}
.chip-red{background:#b81020;}
.chip-blue{background:#2563eb;}
.chip-purple{background:#8b5cf6;}
.chip-danger{background:transparent;color:#ff5b6e;border:1px solid #5a1f25;}
.chip-danger:hover{background:#5a1f25;color:#fff;}

/* Switch row */
.switch-row{display:flex;gap:10px;align-items:flex-start;margin:6px 0;}
.switch-row input{margin-top:3px;}

/* Seller profile */
.seller-hero{background:var(--bg-2);padding:24px;border-radius:14px;display:flex;gap:20px;align-items:center;flex-wrap:wrap;}
.seller-avatar{width:96px;height:96px;border-radius:50%;background:#333;object-fit:cover;border:3px solid var(--red);}
.seller-meta{flex:1;min-width:240px;}
.seller-badges{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;}

/* Listing form delivery box */
.auto-delivery-box{background:var(--bg-3);border:1px solid var(--border);border-radius:10px;padding:14px;margin-top:8px;}
.auto-delivery-box label{margin-top:8px;}

/* Mobile tighter */
@media(max-width:900px){
  .user-card-head{grid-template-columns:48px 1fr;}
  .user-balance,.user-status{grid-column:span 2;display:flex;gap:14px;align-items:center;text-align:left;}
  .user-balance .bal{font-size:16px;}
  .action-buttons{margin-left:0;}
}

/* ===== v7 additions ===== */
.site-announce{background:linear-gradient(90deg,#7c3aed,#E8192C);color:#fff;text-align:center;padding:8px 16px;font-weight:600;font-size:13px;}

/* Global / mod chat */
.global-chat{background:var(--bg-2);border:1px solid var(--border);border-radius:12px;padding:14px;height:480px;overflow-y:auto;display:flex;flex-direction:column;gap:6px;font-size:14px;}
.gc-msg{display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:6px;background:rgba(255,255,255,.02);}
.gc-msg.gc-admin{background:rgba(232,25,44,.08);border-left:3px solid var(--red);}
.gc-user{font-weight:700;color:#fff;}
.gc-role{font-size:10px;padding:2px 6px;border-radius:6px;color:#fff;font-weight:700;}
.gc-body{flex:1;color:var(--text);word-break:break-word;}
.gc-time{color:var(--muted);font-size:11px;}
.gc-del{background:transparent;border:none;color:var(--muted);cursor:pointer;font-size:18px;padding:0 6px;}
.gc-del:hover{color:var(--red);}
.chat-input-row{display:flex;gap:8px;margin-top:10px;}
.chat-input-row input{flex:1;padding:10px 14px;background:var(--bg-3);border:1px solid var(--border);color:#fff;border-radius:8px;}

/* DMs */
.dm-shell{display:grid;grid-template-columns:280px 1fr;gap:14px;background:var(--bg-2);border:1px solid var(--border);border-radius:12px;height:560px;overflow:hidden;}
.dm-list{border-right:1px solid var(--border);overflow-y:auto;}
.dm-thread-row{display:flex;gap:10px;padding:10px 12px;align-items:center;border-bottom:1px solid var(--border);color:var(--text);}
.dm-thread-row:hover{background:var(--bg-3);color:var(--text);}
.dm-thread-row.active{background:var(--bg-3);border-left:3px solid var(--red);}
.dm-thread-row img{width:36px;height:36px;border-radius:50%;object-fit:cover;}
.dm-thread-row strong{display:block;font-size:14px;}
.dm-thread-row small{color:var(--muted);font-size:11px;}
.dm-pane{display:flex;flex-direction:column;}
.dm-head{display:flex;align-items:center;gap:10px;padding:10px 14px;border-bottom:1px solid var(--border);}
.dm-head img{width:32px;height:32px;border-radius:50%;object-fit:cover;}
.dm-msgs{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:8px;}
.dm-msg{max-width:75%;padding:8px 12px;border-radius:14px;font-size:14px;display:flex;flex-direction:column;}
.dm-mine{background:var(--red);color:#fff;align-self:flex-end;border-bottom-right-radius:4px;}
.dm-theirs{background:var(--bg-3);align-self:flex-start;border-bottom-left-radius:4px;}
.dm-time{font-size:10px;opacity:.7;margin-top:2px;}
.dm-pane .chat-input-row{padding:10px 14px;margin:0;border-top:1px solid var(--border);}

/* Settings sub-tabs */
.settings-tabs{display:flex;gap:4px;flex-wrap:wrap;margin-bottom:18px;border-bottom:1px solid var(--border);padding-bottom:0;}
.settings-tabs a{padding:10px 16px;color:var(--muted);font-weight:600;border-bottom:2px solid transparent;font-size:14px;}
.settings-tabs a:hover{color:#fff;}
.settings-tabs a.active{color:#fff;border-bottom-color:var(--red);}
.settings-card{background:var(--bg-3);border:1px solid var(--border);border-radius:12px;padding:18px;}
.settings-card h3{margin:0 0 10px;}
.switch-row{display:flex;gap:10px;align-items:center;cursor:pointer;}
.search-input{padding:8px 12px;background:var(--bg-3);border:1px solid var(--border);color:#fff;border-radius:8px;min-width:240px;}
.mini{padding:6px 10px;background:var(--bg-3);border:1px solid var(--border);color:#fff;border-radius:6px;font-size:12px;width:90px;}
.mini-select{padding:6px 10px;background:var(--bg-3);border:1px solid var(--border);color:#fff;border-radius:6px;font-size:12px;}
.color-mini{width:34px;height:30px;padding:0;border:1px solid var(--border);border-radius:6px;background:transparent;}
.chip{padding:6px 10px;font-size:12px;font-weight:700;border-radius:6px;border:none;cursor:pointer;background:var(--bg-3);color:#fff;}
.chip-green{background:#1f8a3a;}.chip-red{background:#5a1f25;}.chip-blue{background:#1e3a8a;}
.chip-purple{background:#5b21b6;}.chip-danger{background:#b81020;}
.inline-form{display:flex;gap:4px;align-items:center;}
.user-card{background:var(--bg-2);border:1px solid var(--border);border-radius:12px;padding:14px;margin-bottom:12px;}
.user-card-head{display:flex;gap:14px;align-items:center;}
.user-avatar{width:54px;height:54px;border-radius:50%;object-fit:cover;}
.user-name{font-weight:800;font-size:15px;}
.user-email{color:var(--muted);font-size:12px;}
.user-balance{margin-left:auto;text-align:right;}
.user-balance .bal{font-weight:800;color:var(--red);font-size:18px;}
.user-card-actions{display:flex;flex-direction:column;gap:8px;margin-top:12px;}
.users-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;}
.muted{color:var(--muted);}
.action-buttons{display:flex;gap:6px;flex-wrap:wrap;}
.ubadge{display:inline-block;padding:3px 8px;border-radius:6px;color:#fff;font-size:11px;font-weight:700;margin-right:4px;}

/* ===== v8 additions ===== */
/* Chat scroll fix — make sure content can always scroll */
.global-chat{height:480px;max-height:60vh;overflow-y:auto !important;overscroll-behavior:contain;}
/* DM pane: keep contained so the input is always visible and old messages scroll */
.dm-shell{height:75vh;min-height:520px;max-height:80vh;display:grid;}
.dm-pane{display:flex;flex-direction:column;min-height:0;height:100%;overflow:hidden;}
.dm-msgs{flex:1 1 0;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;}
.dm-pane .chat-input-row{flex-shrink:0;}
.dm-msg{word-wrap:break-word;overflow-wrap:anywhere;}
@media (max-width:720px){.dm-shell{grid-template-columns:1fr;height:80vh;}.dm-list{max-height:140px;}}
.gc-msg{flex-wrap:wrap;}
.gc-user{color:#7cf;text-decoration:none;font-weight:600;}
.gc-user:hover{text-decoration:underline;}
.gc-role{font-size:10px;padding:2px 6px;border-radius:4px;color:#fff;font-weight:600;}

/* Dashboard user ID + balance pill */
.dash-user-id{display:inline-block;background:linear-gradient(135deg,#E8192C,#8a3ad6);color:#fff;font-size:11px;padding:2px 8px;border-radius:10px;margin-left:6px;font-weight:700;letter-spacing:.3px;}
.dash-bal{color:#3cd07a;font-weight:700;}

/* Homepage v8 polish */
.hero-new{background:radial-gradient(1200px 400px at 50% -100px,rgba(232,25,44,.18),transparent),linear-gradient(180deg,#11131a,#0c0d12);padding:80px 20px 60px;text-align:center;border-bottom:1px solid var(--border,#222);}
.hero-new h1{font-size:48px;margin:18px 0 14px;line-height:1.05;}
.hero-new h1 span{background:linear-gradient(90deg,#E8192C,#ff7c44);-webkit-background-clip:text;background-clip:text;color:transparent;}
.hero-new p{max-width:640px;margin:0 auto 24px;color:#aab;font-size:17px;line-height:1.55;}
.hero-pill{display:inline-block;background:rgba(232,25,44,.15);color:#ff7c8a;padding:6px 14px;border-radius:999px;font-size:13px;font-weight:600;border:1px solid rgba(232,25,44,.3);}
.hero-stats{display:flex;justify-content:center;gap:48px;margin-top:42px;flex-wrap:wrap;}
.hero-stats > div{text-align:center;}
.hero-stats strong{display:block;font-size:28px;color:#fff;font-weight:700;}
.hero-stats span{color:#888;font-size:13px;}
.cat-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:14px;margin:30px 0;}
.cat-card{background:var(--bg-2,#1a1c24);border:1px solid var(--border,#2a2c34);padding:24px;border-radius:14px;text-align:center;text-decoration:none;color:#fff;transition:all .15s;}
.cat-card:hover{transform:translateY(-3px);border-color:#E8192C;box-shadow:0 10px 30px -10px rgba(232,25,44,.3);}
.cat-card span{font-size:32px;display:block;margin-bottom:8px;}
.cat-card b{display:block;font-size:16px;margin-bottom:4px;}
.cat-card small{color:#888;font-size:12px;}
.why-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:18px;margin-top:18px;}
.why{background:var(--bg-2,#1a1c24);border:1px solid var(--border,#2a2c34);padding:24px;border-radius:14px;}
.why span{font-size:32px;display:block;margin-bottom:10px;}
.why b{display:block;font-size:18px;margin-bottom:8px;}
.why p{color:#aab;font-size:14px;line-height:1.55;margin:0;}

/* === New 3-category layout + rotating featured listings === */
.cat-row-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.featured-head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:14px; }
.featured-tabs { display:inline-flex; gap:6px; background:var(--surface,#1a1a1a); padding:4px; border-radius:10px; border:1px solid var(--border,#2a2a2a); }
.featured-tab { background:transparent; color:var(--muted,#9aa0a6); border:none; padding:7px 14px; border-radius:7px; cursor:pointer; font-size:13px; font-weight:600; transition:all .2s; }
.featured-tab:hover { color:#fff; }
.featured-tab.active { background:var(--red,#E8192C); color:#fff; }
.featured-rotator { position:relative; }
.featured-pane { display:none; animation:fadeIn .4s ease; }
.featured-pane.active { display:block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(6px);} to{opacity:1;transform:translateY(0);} }
.stock-pill { display:inline-block; background:#1f5b2e; color:#cfeed9; font-size:11px; font-weight:600; padding:2px 8px; border-radius:10px; margin-left:8px; vertical-align:middle; }

/* ===== Notifications bell (top-right header) ===== */
.notif-bell { position:relative; display:inline-flex; align-items:center; }
.notif-bell > button {
  background:transparent; border:1px solid var(--border, #2a2a2e); color:var(--text, #eee);
  width:36px; height:36px; border-radius:50%; cursor:pointer; display:inline-flex;
  align-items:center; justify-content:center; padding:0; position:relative;
  transition:background .15s, border-color .15s;
}
.notif-bell > button:hover { background:rgba(232,25,44,.10); border-color:#E8192C; }
.notif-bell.has-unread > button { color:#E8192C; border-color:#E8192C; }
.notif-bell.has-unread > button { animation:notifPulse 1.6s ease-out 1; }
@keyframes notifPulse {
  0% { box-shadow:0 0 0 0 rgba(232,25,44,.55); }
  100% { box-shadow:0 0 0 14px rgba(232,25,44,0); }
}
.notif-badge {
  position:absolute; top:-3px; right:-3px; min-width:18px; height:18px; padding:0 5px;
  background:#E8192C; color:#fff; border-radius:9px; font-size:11px; font-weight:700;
  display:inline-flex; align-items:center; justify-content:center;
  border:2px solid var(--bg, #0e0e10); line-height:1;
}
.notif-panel {
  position:absolute; top:calc(100% + 8px); right:0; width:340px; max-width:calc(100vw - 24px);
  background:var(--card, #16161a); border:1px solid var(--border, #2a2a2e); border-radius:10px;
  box-shadow:0 12px 40px rgba(0,0,0,.45); z-index:1000; overflow:hidden;
}
.notif-panel-header {
  display:flex; justify-content:space-between; align-items:center;
  padding:10px 14px; border-bottom:1px solid var(--border, #2a2a2e);
  background:rgba(255,255,255,.02);
}
.notif-mark-all {
  background:transparent; border:none; color:#E8192C; cursor:pointer; font-size:12px; padding:2px 6px;
}
.notif-mark-all:hover { text-decoration:underline; }
.notif-list { max-height:380px; overflow-y:auto; }
.notif-item {
  display:block; padding:10px 14px; border-bottom:1px solid rgba(255,255,255,.04);
  color:inherit; text-decoration:none; font-size:13px; line-height:1.4;
  transition:background .12s;
}
.notif-item:hover { background:rgba(232,25,44,.06); }
.notif-item.unread { background:rgba(232,25,44,.07); }
.notif-item .notif-time { display:block; font-size:11px; color:var(--muted, #888); margin-top:3px; }
.notif-item .notif-kind { font-weight:700; margin-right:6px; }
.notif-empty { padding:24px 14px; color:var(--muted, #888); text-align:center; font-size:13px; }

/* ===== In-app slide-in popup (top-right) ===== */
.notif-popup-wrap {
  position:fixed; top:14px; right:14px; z-index:9999;
  display:flex; flex-direction:column; gap:8px; pointer-events:none;
}
.notif-popup {
  pointer-events:auto; min-width:280px; max-width:360px; padding:12px 14px 12px 16px;
  background:var(--card, #16161a); border:1px solid var(--border, #2a2a2e);
  border-left:4px solid #E8192C; border-radius:8px; color:var(--text, #eee);
  box-shadow:0 8px 24px rgba(0,0,0,.4); font-size:13px; cursor:pointer;
  animation:notifSlideIn .25s ease-out;
}
.notif-popup.kind-dm       { border-left-color:#8b5cf6; }
.notif-popup.kind-order    { border-left-color:#3b82f6; }
.notif-popup.kind-order_msg{ border-left-color:#3b82f6; }
.notif-popup.kind-sale     { border-left-color:#22c55e; }
.notif-popup .notif-popup-title { font-weight:700; margin-bottom:2px; font-size:13px; }
.notif-popup .notif-popup-body  { color:var(--muted, #bbb); }
.notif-popup.leaving { animation:notifSlideOut .25s ease-in forwards; }
@keyframes notifSlideIn  { from { transform:translateX(110%); opacity:0; } to { transform:translateX(0); opacity:1; } }
@keyframes notifSlideOut { from { transform:translateX(0); opacity:1; } to { transform:translateX(110%); opacity:0; } }
