/* ── Meridian Web UI — mobile first ─────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; }
body {
  background: #0a0b0f; color: #e4e6eb; font-size: 14px; line-height: 1.5;
  padding-bottom: 64px; /* space for bottom nav */
  overflow-x: hidden;
}
a { color: #4da3ff; }

/* ── Top bar ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,11,15,0.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid #22242a; padding: 10px 14px; display: flex;
  justify-content: space-between; align-items: center; height: 48px;
}
.logo { font-weight: 700; font-size: 17px; color: #4da3ff; }
.top-meta { display: flex; align-items: center; gap: 8px; }
.badge {
  background: #2a2d35; border: 1px solid #444; border-radius: 10px;
  padding: 3px 10px; font-size: 12px; font-weight: 600;
}
.badge.demo { color: #ffd43b; border-color: #6b4f00; }
.badge.live { color: #ff6b6b; border-color: #6b0015; }
#live-dot { width: 8px; height: 8px; border-radius: 50%; }
#live-dot.on  { background: #40ff91; box-shadow: 0 0 6px #40ff91; }
#live-dot.off { background: #555; }
.small { font-size: 11px; color: #9aa0a6; }

/* ── Cards ── */
.cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 14px; }
.card {
  background: #16181e; border: 1px solid #22242a; border-radius: 12px; padding: 12px 8px;
  text-align: center; min-height: 72px; display: flex; flex-direction: column; justify-content: center;
}
.card small { color: #9aa0a6; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.stat { font-size: 20px; font-weight: 700; margin-top: 4px; color: #fff; }
.stat.positive { color: #40ff91; }
.stat.negative { color: #ff6b6b; }

/* ── Layout ── */
.page { display: none; padding: 14px; }
.page.active { display: block; }
.page h2 { margin: 18px 0 10px; font-size: 16px; color: #e4e6eb; }
.page h3 { margin: 16px 0 8px; font-size: 14px; color: #b7babf; border-bottom: 1px solid #222; padding-bottom: 4px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid #22242a; background: #16181e; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 600px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid #0f1014; white-space: nowrap; }
th { background: #1d1f24; color: #9aa0a6; font-weight: 600; position: sticky; top: 0; font-size: 11px; }
tbody tr:hover { background: rgba(77,163,255,.06); }
body.dark tbody tr:hover { background: rgba(77,163,255,.06); }
.muted { color: #9aa0a6; }
.actions { text-align: center; }
.btn-sm { padding: 4px 8px; font-size: 11px; border-radius: 6px; cursor: pointer; }

/* ── Buttons ── */
.btn-primary, .btn-outline, .btn-sm {
  border: 1px solid #444; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all .15s ease;
}
.btn-primary { background: #4da3ff; color: #0b0c0e; border-color: #4da3ff; }
.btn-primary:hover { background: #5db5ff; transform: translateY(-1px); }
.btn-outline { background: transparent; color: #e4e6eb; }
.btn-outline:hover { background: rgba(255,255,255,.06); }
.btn-outline.danger { color: #ff6b6b; border-color: #6b0015; }
.btn-outline.danger:hover { background: rgba(255,107,107,.1); }

/* ── Form ── */
form { margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12px; color: #9aa0a6; }
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-row label { font-size: 12px; color: #9aa0a6; }
input[type="number"], input[type="text"], input[type="password"] {
  background: #0f1014; border: 1px solid #2a2d34; border-radius: 8px; padding: 8px 10px;
  color: #fff; font-size: 13px; outline: none;
}
input:focus { border-color: #4da3ff; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.row-center { display: flex; align-items: center; gap: 8px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0; background: #3a3f49; border-radius: 24px;
  transition: .2s;
}
.slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #e4e6eb; border-radius: 50%; transition: .2s;
}
input:checked + .slider { background: #4da3ff; }
input:checked + .slider::before { transform: translateX(18px); }

/* ── Code / log blocks ── */
.code-block {
  background: #0a0b0d; border: 1px solid #1f2025; border-radius: 8px; padding: 10px;
  font-family: "SF Mono",Menlo,Monaco,monospace; font-size: 11px; white-space: pre-wrap;
  word-break: break-word; overflow-x: auto; color: #c7cad0; max-height: 280px; overflow-y: auto;
}
.log-block { min-height: 140px; color: #40ff91; }

/* ── Modal (token gate) ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 200;
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal { background: #16181e; border: 1px solid #2a2d34; border-radius: 14px;
  padding: 24px; width: min(90%, 340px); text-align: center;
}
.modal h2 { color: #4da3ff; margin-bottom: 12px; font-size: 20px; }
.modal p { color: #9aa0a6; font-size: 13px; margin-bottom: 14px; }
.modal input { width: 100%; margin-bottom: 14px; }
#toast-container {
  position: fixed; bottom: 70px; left: 0; right: 0; display: flex;
  flex-direction: column; gap: 8px; padding: 0 12px; z-index: 150;
}
.toast {
  background: #1d2a3a; border: 1px solid #2a5a7a; border-radius: 10px; padding: 10px 12px;
  color: #cfe3f0; font-size: 12px; animation: slideUp .2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.toast.oor { background: #2a1d1d; border-color: #7a2a2a; color: #f0c4c4; }
.toast.positive { background: #1d2a1d; border-color: #2a7a2a; color: #c4f0c4; }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── Bottom nav (mobile) ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: 60px;
  background: rgba(10,11,15,.95); backdrop-filter: blur(8px);
  border-top: 1px solid #22242a; display: grid;
  grid-template-columns: repeat(5, 1fr); z-index: 100;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; border: none; background: transparent; color: #6b7078;
  font-size: 10px; padding: 6px 4px; cursor: pointer; border-radius: 0;
}
.nav-item.active, .nav-item:hover { color: #4da3ff; }
.nav-item.active { border-top: 2px solid #4da3ff; }
.nav-item span { font-size: 18px; }

/* ── OOR list ── */
.oob-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.oob-chip {
  background: rgba(255,107,107,.12); border: 1px solid #7a2a2a; color: #ff8a8a;
  border-radius: 14px; padding: 4px 10px; font-size: 11px;
}

/* ── Market tab ── */
.tf-btn { padding: 4px 10px; font-size: 12px; opacity: 0.5; }
.tf-btn.active { opacity: 1; background: #4da3ff; color: #0b0c0e; border-color: #4da3ff; }
#market-chart { margin-bottom: 16px; }
.note { color: #9aa0a6; font-size: 12px; }

/* ── Responsive ── */
@media (min-width: 600px) {
  .cards { grid-template-columns: repeat(4,1fr); }
  .bottom-nav { max-width: 600px; margin: 0 auto; }
  .page { max-width: 900px; margin: 0 auto; }
  table { min-width: 0; font-size: 13px; }
}
