/* ============================================================================
   wallet.softbet.io — shared UI components.
   Class values byte-match the recurring inline clusters in the DC designs so
   ported markup renders identically. Unique one-off styling stays inline in
   the pages (fidelity over purity).
   ========================================================================== */

/* ---- base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
}
::selection { background: var(--acid); color: var(--acid-ink); }
a { -webkit-tap-highlight-color: transparent; }
input, select, textarea, button { font-family: var(--font-ui); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acid-line-2) !important; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-3); }

/* ---- keyframes ------------------------------------------------------------ */
@keyframes sbFloatSm { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes sbBlink   { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes sbPulse   { 0%,100% { opacity: 0.55; transform: scale(1); } 50% { opacity: 0.3; transform: scale(1.08); } }
@keyframes sbSpin    { to { transform: rotate(360deg); } }
@keyframes sbRowIn   { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes sbToastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes skelShimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }

/* ---- inputs --------------------------------------------------------------- */
.sb-in {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 12px 14px;
  color: var(--ink);
  font-size: 14px;
  transition: border-color 0.2s;
}
.sb-in:hover { border-color: var(--line-4) !important; }
.sb-in.mono { font-size: 13px; font-family: var(--font-mono); }
.sb-label { display: block; font-size: 11.5px; color: var(--ink-4); margin-bottom: 6px; }
.sb-check { accent-color: var(--acid); }

/* ---- buttons -------------------------------------------------------------- */
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--acid-grad);
  color: var(--acid-ink);
  font-weight: 700; font-size: 15px;
  padding: 14px;
  border: none; border-radius: var(--r-btn);
  box-shadow: var(--acid-glow);
  cursor: pointer;
  font-family: var(--font-ui);
  text-decoration: none;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.btn-primary:hover { box-shadow: var(--acid-glow-hi); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.55; cursor: default; box-shadow: none; transform: none; }
.btn-primary.sm { font-size: 13px; padding: 10px 16px; border-radius: var(--r-md); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: var(--r-btn);
  padding: 13px 20px;
  color: var(--ink-3);
  font-size: 14px;
  cursor: pointer;
  font-family: var(--font-ui);
  text-decoration: none;
  transition: border-color 0.2s;
}
.btn-ghost:hover { border-color: var(--line-4); }
.btn-ghost:disabled { opacity: 0.55; cursor: default; }
.btn-ghost.sm { font-size: 12px; padding: 7px 12px; border-radius: var(--r-sm); }

.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--red-dim);
  border: 1px solid var(--red-line);
  border-radius: var(--r-md);
  padding: 10px 16px;
  color: var(--red);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-ui);
}
.btn-danger:disabled { opacity: 0.55; cursor: default; }

.btn-chip {
  background: var(--acid-dim);
  border: 1px solid var(--acid-line);
  border-radius: var(--r-sm);
  padding: 7px 11px;
  color: var(--acid);
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font-ui);
  flex-shrink: 0;
}
.btn-link {
  background: none; border: none;
  color: var(--acid);
  font-size: 13px; cursor: pointer;
  font-family: var(--font-ui);
  padding: 0;
}

/* ---- cards / badges -------------------------------------------------------- */
.sb-card {
  background: linear-gradient(165deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
}
.sb-card-flat {
  background: var(--bg-4);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
}
.sb-card-acid { border-color: var(--acid-line); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: 0.4px;
  border-radius: 6px; padding: 3px 8px;
  color: var(--ink-3);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-3);
  white-space: nowrap;
}
.badge-green { color: var(--green); background: var(--green-dim); border-color: var(--green-line); }
.badge-amber { color: var(--amber); background: var(--amber-dim); border-color: var(--amber-line); }
.badge-red   { color: var(--red); background: var(--red-dim); border-color: var(--red-line); }
.badge-acid  { color: var(--acid); background: var(--acid-dim); border-color: var(--acid-line); }

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

/* ---- tables ---------------------------------------------------------------- */
.sb-thead {
  display: grid; align-items: center; gap: 12px;
  padding: 10px 16px;
  font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--ink-4);
  border-bottom: 1px solid var(--line);
}
.sb-row {
  display: grid; align-items: center; gap: 12px;
  padding: 13px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  animation: sbRowIn 0.25s ease both;
}
.sb-row:hover { background: rgba(255,255,255,0.02); }
.sb-row:last-child { border-bottom: none; }
.sb-row.click { cursor: pointer; }

/* ---- skeleton / empty / error ---------------------------------------------- */
.skel {
  display: inline-block;
  border-radius: 6px;
  background: linear-gradient(90deg, #15171A 25%, #1C1F24 37%, #15171A 63%);
  background-size: 400px 100%;
  animation: skelShimmer 1.4s ease infinite;
  color: transparent !important;
  user-select: none;
  min-height: 12px;
}
.skel-num  { width: 110px; height: 30px; }
.skel-line { width: 100%; height: 14px; }
.skel-sm   { width: 70px; height: 12px; }

.sb-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 42px 20px; text-align: center;
}
.sb-empty .t { font-size: 14.5px; font-weight: 600; color: var(--ink-2); }
.sb-empty .h { font-size: 12.5px; color: var(--ink-4); max-width: 380px; line-height: 1.5; }

.sb-error {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 36px 20px; text-align: center;
}
.sb-error .t { font-size: 13.5px; color: var(--red); }

.sb-spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line-3); border-top-color: var(--acid);
  animation: sbSpin 0.8s linear infinite;
  display: inline-block; vertical-align: middle;
}

/* ---- modal ------------------------------------------------------------------ */
.sb-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(5,6,8,0.72);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.sb-modal {
  width: 100%; max-width: 440px;
  background: linear-gradient(165deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  padding: 22px;
  box-shadow: 0 40px 90px rgba(0,0,0,0.6);
  font-family: var(--font-ui);
  color: var(--ink);
  max-height: 90vh; overflow: auto;
}
.sb-modal .m-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.sb-modal .m-sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }
.sb-modal .m-err { color: var(--red); font-size: 12.5px; margin-top: 10px; display: none; }
.sb-modal .m-field { display: block; font-size: 11.5px; color: var(--ink-4); margin-top: 12px; }
.sb-modal .m-in {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 11px 13px;
  color: var(--ink);
  font-size: 14px;
  margin-top: 5px;
}
.sb-modal .m-in.mono { font-size: 13px; font-family: var(--font-mono); }

/* ---- toast ------------------------------------------------------------------ */
.sb-toasts {
  position: fixed; right: 22px; bottom: 22px; z-index: 99999;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none;
}
.sb-toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg-3);
  border: 1px solid var(--acid-line);
  border-radius: var(--r-btn);
  padding: 12px 16px;
  color: var(--ink);
  font-size: 13px; font-family: var(--font-ui);
  box-shadow: var(--shadow-toast);
  max-width: 380px;
  animation: sbToastIn 0.25s ease both;
  pointer-events: auto;
}
.sb-toast.bad { border-color: var(--red-line); }
.sb-toast .ic {
  width: 18px; height: 18px; border-radius: 6px; flex-shrink: 0;
  background: var(--acid-grad-sm); color: var(--acid-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
}
.sb-toast.bad .ic { background: var(--red); color: #fff; }

/* ---- test-environment banner -------------------------------------------------- */
.env-banner {
  display: none;
  align-items: center; justify-content: center; gap: 10px;
  background: var(--amber-dim);
  border-bottom: 1px solid var(--amber-line);
  color: var(--amber);
  font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase;
  padding: 7px 14px;
}
body[data-env="test"] .env-banner { display: flex; }

/* ---- misc --------------------------------------------------------------------- */
.copyable { cursor: pointer; }
.copyable:hover { color: var(--acid); }
.sb-divider { display: flex; align-items: center; gap: 12px; }
.sb-divider::before, .sb-divider::after { content: ""; flex: 1; height: 1px; background: var(--line-div); }
.sb-divider span { font-size: 11px; color: var(--ink-5); }

/* ════════════════════════════════════════════════════════════════════════
   DASHBOARD EXTENSIONS — appended to the wallet Gen-2 kit.
   1) Shell (sidebar/topbar) in the wallet app.html language, applied to the
      existing .db-* class names so dashboard.js wiring is untouched.
   2) New components: KPI cards, filter chips, drawer, global search, hosting
      sticky header, responsive collapse.
   3) LEGACY BRIDGE: re-skins the classes emitted by dashboard.js template
      strings (.db-panel, .am-input, .btn-bracket, .badge-status…) to Gen-2
      visuals WITHOUT touching the templates. Loads last → wins load-order.
   ════════════════════════════════════════════════════════════════════════ */

:root { --dsh-side-w: 256px; --dsh-top-h: 64px; }

/* ── page base ─────────────────────────────────────────────────────────── */
body.dashboard-body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
}
body.dashboard-body ::selection { background: var(--acid); color: var(--acid-ink); }

/* ── Topbar ────────────────────────────────────────────────────────────── */
body.dashboard-body .db-topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--dsh-top-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px;
  background: rgba(10, 11, 13, 0.72);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
body.dashboard-body .db-page-title {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}
body.dashboard-body .db-topbar-link { color: var(--ink-4); font-size: 12.5px; text-decoration: none; white-space: nowrap; }
body.dashboard-body .db-topbar-link:hover { color: var(--acid); }
body.dashboard-body .db-topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

/* global search */
.gs-wrap { position: relative; flex: 0 1 300px; min-width: 140px; }
.gs-input {
  width: 100%; box-sizing: border-box;
  font: 500 13px var(--font-ui);
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 8px 30px 8px 32px;
  outline: none;
  transition: border-color 160ms;
}
.gs-input:focus { border-color: var(--acid-line-2); }
.gs-input::placeholder { color: var(--ink-5); }
.gs-wrap .gs-mag { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-5); pointer-events: none; }
.gs-wrap .gs-key {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font: 600 10px var(--font-mono); color: var(--ink-5);
  border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px;
  pointer-events: none;
}
.gs-panel {
  display: none;
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  background: linear-gradient(165deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-float);
  overflow: hidden;
  padding: 6px;
}
.gs-panel.open { display: block; }
.gs-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); font: 500 13px var(--font-ui);
}
.gs-item:hover, .gs-item.sel { background: var(--acid-dim); color: var(--acid); }
.gs-item .gs-hint { font-size: 11px; color: var(--ink-4); }
.gs-empty { padding: 12px; font-size: 12px; color: var(--ink-4); text-align: center; }

/* notifications — restyle existing dropdown */
body.dashboard-body .db-notif-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-md);
  color: var(--ink-3); cursor: pointer; position: relative;
}
body.dashboard-body .db-notif-btn:hover { border-color: var(--acid-line); color: var(--acid); }
body.dashboard-body .db-notif-count {
  position: absolute; top: -5px; right: -5px;
  background: var(--acid); color: var(--acid-ink);
  font: 700 10px var(--font-ui);
  min-width: 16px; height: 16px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 10px rgba(201,243,29,0.5);
}
body.dashboard-body .db-notif-dropdown {
  background: linear-gradient(165deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
body.dashboard-body .db-shell { display: flex; min-height: calc(100vh - var(--dsh-top-h)); }
body.dashboard-body .db-sidebar {
  width: var(--dsh-side-w); flex: 0 0 var(--dsh-side-w);
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  padding: 18px 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: var(--dsh-top-h);
  height: calc(100vh - var(--dsh-top-h));
  overflow-y: auto;
}
body.dashboard-body .db-nav-group { padding: 8px 0 2px; }
body.dashboard-body .db-nav-group-label {
  font: 600 10px var(--font-ui);
  letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--ink-5);
  padding: 0 12px 6px;
}
body.dashboard-body .db-nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--ink-3);
  font: 500 13.5px var(--font-ui);
  text-decoration: none;
  transition: background 140ms, color 140ms;
}
body.dashboard-body .db-nav-item:hover { background: rgba(255,255,255,0.04); color: var(--ink); }
body.dashboard-body .db-nav-item.active {
  background: var(--acid-dim);
  color: var(--acid);
}
body.dashboard-body .db-nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px;
  border-radius: 2px;
  background: var(--acid);
  box-shadow: 0 0 10px rgba(201,243,29,0.55);
}
body.dashboard-body .db-nav-glyph { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 18px; }
body.dashboard-body .db-nav-glyph svg { width: 18px; height: 18px; }
body.dashboard-body .db-nav-badge {
  margin-left: auto;
  background: var(--acid); color: var(--acid-ink);
  font: 700 10.5px var(--font-ui);
  border-radius: 999px; padding: 1px 7px;
}
body.dashboard-body .db-sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 2px 12px 14px; border-bottom: 1px solid var(--line-div); margin-bottom: 8px; }
body.dashboard-body .db-sidebar-brand img { height: 24px; display: block; }
body.dashboard-body .db-sidebar-brand .brand-tag {
  font: 600 9px var(--font-ui); letter-spacing: 2px; text-transform: uppercase;
  color: var(--acid);
  border: 1px solid var(--acid-line); border-radius: 999px; padding: 2px 8px;
}
body.dashboard-body .db-sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--line-div);
  padding: 12px 12px 4px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
body.dashboard-body .db-sidebar-stat-label { font: 600 9.5px var(--font-ui); letter-spacing: 1.6px; text-transform: uppercase; color: var(--ink-5); display: block; }
body.dashboard-body .db-sidebar-stat-value { font-family: var(--font-display); font-size: 19px; color: var(--ink); letter-spacing: 0.03em; }

/* ── Main column ───────────────────────────────────────────────────────── */
body.dashboard-body .db-main { flex: 1; min-width: 0; padding: 26px; }
body.dashboard-body .db-section { display: none; }
body.dashboard-body .db-section.active { display: block; }
body.dashboard-body .db-section-head { margin-bottom: 22px; }
body.dashboard-body .db-eyebrow,
body.dashboard-body .db-panel-eyebrow,
body.dashboard-body .db-fieldset-legend {
  font: 600 10.5px var(--font-ui);
  letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--acid);
}
body.dashboard-body .db-h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 6px 0 4px;
}
body.dashboard-body .db-sub { color: var(--ink-4); font-size: 13.5px; }

/* ── KPI stat cards ────────────────────────────────────────────────────── */
body.dashboard-body .db-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
body.dashboard-body .db-stat-card {
  background: linear-gradient(160deg, #16181C, #101317);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 16px 18px;
  transition: border-color 160ms, transform 160ms;
}
body.dashboard-body .db-stat-card:hover { border-color: var(--acid-line); }
body.dashboard-body .db-stat-label { font: 600 10.5px var(--font-ui); letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-4); }
body.dashboard-body .db-stat-value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(22px, 2.4vw, 30px);
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 6px 0 2px;
}
body.dashboard-body .db-stat-meta { font-size: 11.5px; color: var(--ink-4); }
body.dashboard-body .db-stat-meta a, body.dashboard-body .db-link { color: var(--acid); text-decoration: none; }
body.dashboard-body .db-link:hover { color: var(--acid-hi); text-decoration: underline; }

/* ── LEGACY BRIDGE: panels / forms / buttons / badges / chips ──────────── */
body.dashboard-body .db-panel,
body.dashboard-body .db-fieldset,
body.dashboard-body .db-chart-card {
  background: linear-gradient(165deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: none;
}
body.dashboard-body .db-panel-h, body.dashboard-body .db-panel-head { border-bottom: 1px solid var(--line-div); }

body.dashboard-body .am-label { font: 600 11px var(--font-ui); letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-4); }
body.dashboard-body .am-label::before, body.dashboard-body .am-label::after { content: none; }
body.dashboard-body .am-input, body.dashboard-body .am-select,
body.dashboard-body input.am-input, body.dashboard-body select.am-select {
  font: 500 13.5px var(--font-ui);
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
}
body.dashboard-body .am-input:hover { border-color: var(--line-3); }
body.dashboard-body .am-input:focus, body.dashboard-body .am-select:focus {
  border-color: var(--acid-line-2);
  background: var(--bg-2);
  box-shadow: 0 0 0 3px rgba(201,243,29,0.12);
}
body.dashboard-body .db-form-hint { color: var(--ink-4); }
body.dashboard-body .am-form-error, body.dashboard-body .db-form-error {
  background: var(--red-dim); border: 1px solid var(--red-line); color: var(--red);
  border-radius: var(--r-md);
}
body.dashboard-body .db-form-success { background: var(--green-dim); border: 1px solid var(--green-line); color: var(--green); border-radius: var(--r-md); }

/* buttons — override components.css to the acid system */
body.dashboard-body .btn {
  font-family: var(--font-ui);
  font-weight: 600;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
}
body.dashboard-body .btn-primary {
  background: var(--acid-grad);
  color: var(--acid-ink);
  font-weight: 700;
  box-shadow: var(--acid-glow), inset 0 1px 0 rgba(255,255,255,0.55);
}
body.dashboard-body .btn-primary:hover {
  background: var(--acid-grad);
  filter: brightness(1.06);
  box-shadow: var(--acid-glow-hi), inset 0 1px 0 rgba(255,255,255,0.55);
  transform: translateY(-1px);
}
body.dashboard-body .btn-bracket, body.dashboard-body .btn-ghost {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--ink-3);
}
body.dashboard-body .btn-bracket:hover, body.dashboard-body .btn-ghost:hover {
  border-color: var(--acid-line); color: var(--acid); background: rgba(201,243,29,0.04);
}
body.dashboard-body .btn-bracket .sweep { display: none; }
body.dashboard-body .btn-danger { background: var(--red-dim); border: 1px solid var(--red-line); color: var(--red); }

/* status badges emitted as .badge-status[data-status] */
body.dashboard-body .badge-status {
  display: inline-flex; align-items: center; gap: 5px;
  font: 600 10.5px var(--font-ui);
  letter-spacing: 0.8px; text-transform: uppercase;
  border-radius: 999px; padding: 2px 9px;
  background: var(--bg-chip); border: 1px solid var(--line-3); color: var(--ink-3);
}
body.dashboard-body .badge-status[data-status="running"],
body.dashboard-body .badge-status[data-status="active"],
body.dashboard-body .badge-status[data-status="committed"],
body.dashboard-body .badge-status[data-status="finished"],
body.dashboard-body .badge-status[data-status="ok"] { background: var(--green-dim); border-color: var(--green-line); color: var(--green); }
body.dashboard-body .badge-status[data-status="pending"],
body.dashboard-body .badge-status[data-status="creating"],
body.dashboard-body .badge-status[data-status="provisioning"],
body.dashboard-body .badge-status[data-status="waiting"],
body.dashboard-body .badge-status[data-status="installing"],
body.dashboard-body .badge-status[data-status="resizing"],
body.dashboard-body .badge-status[data-status="syncing"] { background: var(--amber-dim); border-color: var(--amber-line); color: var(--amber); }
body.dashboard-body .badge-status[data-status="failed"],
body.dashboard-body .badge-status[data-status="stopped"],
body.dashboard-body .badge-status[data-status="suspended"],
body.dashboard-body .badge-status[data-status="expired"],
body.dashboard-body .badge-status[data-status="error"] { background: var(--red-dim); border-color: var(--red-line); color: var(--red); }

/* range tabs / integration tabs / hosting subnav → chips */
body.dashboard-body .db-range-tab, body.dashboard-body .db-int-tab,
body.dashboard-body .hz-nav button, body.dashboard-body .db-tx-chip {
  font: 600 12px var(--font-ui);
  color: var(--ink-3);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 140ms;
}
body.dashboard-body .db-range-tab:hover, body.dashboard-body .db-int-tab:hover,
body.dashboard-body .db-tx-chip:hover { border-color: var(--acid-line); color: var(--acid); }
body.dashboard-body .db-range-tab.active, body.dashboard-body .db-range-tab.is-active,
body.dashboard-body .db-int-tab.active, body.dashboard-body .db-int-tab.is-active,
body.dashboard-body .db-tx-chip.active, body.dashboard-body .db-tx-chip.is-active {
  background: var(--acid); border-color: var(--acid); color: var(--acid-ink);
  box-shadow: 0 0 14px rgba(201,243,29,0.35);
}

/* empty state */
body.dashboard-body .db-empty {
  border: 1px dashed var(--line-3);
  border-radius: var(--r-lg);
  color: var(--ink-4);
  background: transparent;
}

/* user pill (topbar) */
body.dashboard-body .user-pill { background: var(--bg-2); border: 1px solid var(--line-2); color: var(--ink-2); }
body.dashboard-body .user-pill:hover { border-color: var(--acid-line); box-shadow: none; }

/* banners */
body.dashboard-body .db-banner {
  border-radius: var(--r-lg);
  border: 1px solid var(--amber-line);
  background: var(--amber-dim);
}

/* ── Drawer (detail panel, right side) ─────────────────────────────────── */
.dsh-drawer-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(5, 6, 8, 0.6);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity 200ms;
}
.dsh-drawer-overlay.open { opacity: 1; pointer-events: auto; }
.dsh-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 91;
  width: min(520px, 94vw);
  background: linear-gradient(165deg, var(--bg-3), var(--bg-2));
  border-left: 1px solid var(--line-2);
  box-shadow: var(--shadow-card);
  transform: translateX(102%);
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
  display: flex; flex-direction: column;
}
.dsh-drawer.open { transform: translateX(0); }
.dsh-drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--line-div);
}
.dsh-drawer-title { font-family: var(--font-display); font-size: 16px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink); }
.dsh-drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.dsh-drawer-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--line-2); color: var(--ink-3);
  cursor: pointer; font-size: 15px;
}
.dsh-drawer-close:hover { border-color: var(--acid-line); color: var(--acid); }
.dsh-kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 13px; padding: 6px 0; }
.dsh-kv dt { color: var(--ink-4); }
.dsh-kv dd { margin: 0; color: var(--ink-2); word-break: break-all; }

/* ── Hosting sticky server header (P6) ─────────────────────────────────── */
.hs-head {
  position: sticky; top: var(--dsh-top-h); z-index: 30;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: rgba(12, 13, 16, 0.9);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.hs-head .hs-name { font-family: var(--font-display); font-size: 18px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink); }
.hs-head .hs-meta { font-size: 12px; color: var(--ink-4); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hs-pip { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.hs-pip.off { background: var(--red); box-shadow: 0 0 8px var(--red); }
.hs-pip.busy { background: var(--amber); box-shadow: 0 0 8px var(--amber); animation: sbBlink 1.4s ease-in-out infinite; }
@keyframes sbBlink { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ── Responsive: sidebar off-canvas ≤1024px ────────────────────────────── */
.db-side-burger {
  display: none;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-md);
  color: var(--ink-2); cursor: pointer; flex-direction: column; gap: 4px;
}
.db-side-burger span { width: 16px; height: 2px; background: currentColor; border-radius: 2px; display: block; }
@media (max-width: 1024px) {
  .db-side-burger { display: inline-flex; }
  body.dashboard-body .db-sidebar {
    position: fixed; left: 0; top: var(--dsh-top-h); bottom: 0; z-index: 80;
    transform: translateX(-104%);
    transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: var(--shadow-card);
  }
  body.dashboard-body .db-sidebar.open { transform: translateX(0); }
  body.dashboard-body .db-main { padding: 18px 14px; }
  body.dashboard-body .db-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .gs-wrap { flex: 1 1 auto; }
  body.dashboard-body .db-topbar-link { display: none; }
}
@media (max-width: 560px) {
  body.dashboard-body .db-stat-grid { grid-template-columns: 1fr; }
}

/* strip the legacy bracket-button decorations ({ }) in the dashboard */
body.dashboard-body .btn-bracket::before,
body.dashboard-body .btn-bracket::after { content: none !important; }

/* ── Gen-2 data tables (transactions / sessions / keys) ────────────────── */
body.dashboard-body .db-tx-table-wrap {
  background: linear-gradient(165deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  overflow: hidden;
}
body.dashboard-body .db-tx-table { width: 100%; border-collapse: collapse; }
body.dashboard-body .db-tx-table thead th {
  font: 600 10.5px var(--font-ui);
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--ink-4);
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.015);
}
body.dashboard-body .db-tx-table tbody td {
  font: 500 13px var(--font-ui);
  color: var(--ink-2);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-div);
}
body.dashboard-body .db-tx-table tbody tr { cursor: pointer; transition: background 120ms; animation: sbRowIn 200ms ease both; }
body.dashboard-body .db-tx-table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
body.dashboard-body .db-tx-table tbody tr:last-child td { border-bottom: none; }
body.dashboard-body .db-tx-table .tamount,
body.dashboard-body .db-tx-table .tusd,
body.dashboard-body .db-tx-table .tfee { font-family: var(--font-mono); font-size: 12.5px; }
body.dashboard-body .db-tx-table .tarrow { color: var(--ink-5); text-align: right; }
body.dashboard-body .db-tx-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
body.dashboard-body .db-tx-toolbar .db-tx-search { flex: 1 1 240px; }
/* action + status chips inside rows */
body.dashboard-body .db-tx-action, body.dashboard-body .db-tx-status {
  display: inline-flex; align-items: center;
  font: 600 10.5px var(--font-ui);
  letter-spacing: 0.8px; text-transform: uppercase;
  border-radius: 999px; padding: 2px 9px;
  background: var(--bg-chip); border: 1px solid var(--line-3); color: var(--ink-3);
}
body.dashboard-body .db-tx-action-bet     { background: var(--acid-dim); border-color: var(--acid-line); color: var(--acid); }
body.dashboard-body .db-tx-action-win     { background: var(--green-dim); border-color: var(--green-line); color: var(--green); }
body.dashboard-body .db-tx-action-refund,
body.dashboard-body .db-tx-action-rollback{ background: var(--amber-dim); border-color: var(--amber-line); color: var(--amber); }
body.dashboard-body .db-tx-status-committed { background: var(--green-dim); border-color: var(--green-line); color: var(--green); }
body.dashboard-body .db-tx-status-failed    { background: var(--red-dim); border-color: var(--red-line); color: var(--red); }
body.dashboard-body .db-tx-status-rolled_back { background: var(--amber-dim); border-color: var(--amber-line); color: var(--amber); }

/* ── Transaction detail: modal → right-side DRAWER (pure CSS) ──────────── */
body.dashboard-body #tx-modal.module-modal { justify-content: flex-end; align-items: stretch; padding: 0; }
body.dashboard-body #tx-modal .auth-modal-shell,
body.dashboard-body #tx-modal .module-modal-shell {
  width: min(560px, 94vw);
  max-height: 100vh;
  height: 100%;
  border-radius: 0;
  background: linear-gradient(165deg, var(--bg-3), var(--bg-2));
  border-left: 1px solid var(--line-2);
  box-shadow: var(--shadow-card);
  transform: translateX(40px);
}
body.dashboard-body #tx-modal.open .auth-modal-shell,
body.dashboard-body #tx-modal.open .module-modal-shell { transform: translateX(0); }

@media (prefers-reduced-motion: reduce) {
  body.dashboard-body .db-tx-table tbody tr, .sb-row { animation: none !important; }
}

/* ── Hosting detail: grouped subnav + power menu + stacked group panels ── */
body.dashboard-body .db-subnav { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 16px; }
body.dashboard-body .db-subnav-item {
  font: 600 12px var(--font-ui);
  color: var(--ink-3);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 7px 15px;
  cursor: pointer;
  transition: all 140ms;
}
body.dashboard-body .db-subnav-item:hover { border-color: var(--acid-line); color: var(--acid); }
body.dashboard-body .db-subnav-item.active {
  background: var(--acid); border-color: var(--acid); color: var(--acid-ink);
  box-shadow: 0 0 14px rgba(201,243,29,0.3);
}
body.dashboard-body .hp-group-panel { margin-bottom: 18px; }
body.dashboard-body .hp-group-panel:last-child { margin-bottom: 0; }

body.dashboard-body .db-detail-head.hs-head { gap: 10px; }
body.dashboard-body .db-detail-head .back {
  background: none; border: none; color: var(--ink-4); cursor: pointer;
  font: 500 12.5px var(--font-ui); padding: 4px 6px;
}
body.dashboard-body .db-detail-head .back:hover { color: var(--acid); }
body.dashboard-body .db-detail-head .hs-name { font-size: 17px; }

.hs-power { position: relative; display: inline-block; }
.hs-power summary { list-style: none; cursor: pointer; display: inline-flex; }
.hs-power summary::-webkit-details-marker { display: none; }
.hs-power .hs-power-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 70;
  min-width: 160px;
  background: linear-gradient(165deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-float);
  padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.hs-power .hs-power-menu button {
  text-align: left; background: none; border: none; cursor: pointer;
  font: 500 13px var(--font-ui); color: var(--ink-2);
  padding: 8px 10px; border-radius: var(--r-sm);
}
.hs-power .hs-power-menu button:hover { background: var(--acid-dim); color: var(--acid); }
.hs-power .hs-power-menu button.danger:hover { background: var(--red-dim); color: var(--red); }

/* ── Wallet cross-product handoff card ─────────────────────────────────── */
body.dashboard-body .db-wallet-promo {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 20px; padding: 18px 20px;
  text-decoration: none;
  background: radial-gradient(120% 160% at 100% 0%, rgba(201,243,29,0.10), transparent 60%),
              linear-gradient(165deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--acid-line);
  border-radius: var(--r-xl);
  transition: border-color 160ms, box-shadow 160ms, transform 160ms;
}
body.dashboard-body .db-wallet-promo:hover {
  border-color: var(--acid-line-2);
  box-shadow: 0 0 30px rgba(201,243,29,0.10);
  transform: translateY(-1px);
}
body.dashboard-body .db-wallet-promo-icon {
  flex: 0 0 46px; width: 46px; height: 46px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--acid-dim); color: var(--acid);
  border: 1px solid var(--acid-line); border-radius: var(--r-md);
}
body.dashboard-body .db-wallet-promo-icon svg { width: 24px; height: 24px; }
body.dashboard-body .db-wallet-promo-body { flex: 1; min-width: 0; }
body.dashboard-body .db-wallet-promo-eyebrow { font: 600 10px var(--font-ui); letter-spacing: 1.6px; text-transform: uppercase; color: var(--acid); }
body.dashboard-body .db-wallet-promo-title { font: 700 15.5px var(--font-ui); color: var(--ink); margin: 3px 0 4px; }
body.dashboard-body .db-wallet-promo-sub { font-size: 12.5px; line-height: 1.5; color: var(--ink-4); max-width: 70ch; }
body.dashboard-body .db-wallet-promo-cta {
  flex: 0 0 auto; align-self: center;
  background: var(--acid-grad); color: var(--acid-ink);
  font: 700 13px var(--font-ui);
  padding: 10px 16px; border-radius: var(--r-btn);
  box-shadow: var(--acid-glow); white-space: nowrap;
}
@media (max-width: 720px) {
  body.dashboard-body .db-wallet-promo { flex-wrap: wrap; }
  body.dashboard-body .db-wallet-promo-cta { width: 100%; text-align: center; }
}
