:root {
  --bg: #0f1117; --surface: #1a1d27; --surface2: #242836; --border: #2e3345;
  --text: #e8eaf0; --muted: #8b92a8; --accent: #4f8cff; --accent2: #3b6fd9;
  --ok: #4ade80; --warn: #fbbf24; --err: #f87171;
  --radius: 10px; font-family: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); min-height: 100vh; }
.hidden { display: none !important; }
.screen { min-height: 100vh; }
.login-card {
  max-width: 380px; margin: 12vh auto; padding: 2rem;
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
}
.login-card h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.subtitle { color: var(--muted); margin-bottom: 1.5rem; font-size: 0.9rem; }
.login-card label { display: block; font-size: 0.8rem; color: var(--muted); margin: 0.75rem 0 0.25rem; }
.login-card input {
  width: 100%; padding: 0.65rem 0.75rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--text);
}
.login-card button {
  width: 100%; margin-top: 1.25rem; padding: 0.75rem;
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  font-weight: 600; cursor: pointer;
}
.error { color: var(--err); font-size: 0.85rem; margin-top: 0.75rem; }
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.topbar .brand em { color: var(--accent); font-style: normal; }
.tabs { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; }
.tabs button {
  background: transparent; border: 0; color: var(--muted); padding: 0.45rem 0.85rem;
  border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.9rem;
}
.tabs button.active, .tabs button:hover { background: var(--surface2); color: var(--text); }
button.ghost {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 0.4rem 0.75rem; border-radius: 8px; cursor: pointer;
}
.content { padding: 1.25rem; max-width: 1200px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1rem;
}
.toolbar h2 { margin-right: 0.5rem; font-size: 1.25rem; }
.toolbar input, .toolbar select {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 0.45rem 0.65rem; font-size: 0.9rem;
}
.toolbar button {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 0.45rem 0.85rem; font-weight: 600; cursor: pointer;
}
.stats-row { display: flex; gap: 1rem; margin: 1rem 0; flex-wrap: wrap; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem; min-width: 140px;
}
.stat-card .val { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.stat-card .lbl { color: var(--muted); font-size: 0.8rem; }
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; }
.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--muted);
}
.badge.ok { color: var(--ok); }
.badge.pending { color: var(--warn); }
.badge.fail { color: var(--err); }
.badge-muted { opacity: 0.75; font-size: 0.72rem; }
.live-badge { color: var(--muted); font-size: 0.8rem; margin-left: auto; }
.live-badge.live { color: var(--ok); }
.tx-sub { font-size: 0.75rem; color: var(--muted); margin-top: 0.15rem; }
.amt-pos { color: var(--ok); font-weight: 600; }
.amt-neg { color: var(--err); font-weight: 600; }
.tx-totals { margin-top: 0.85rem; }
.tx-total-card {
  display: inline-block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.85rem 1.1rem;
}
.tx-total-card .lbl { color: var(--muted); font-size: 0.78rem; }
.tx-total-card .val { font-size: 1.35rem; font-weight: 700; }
.tx-total-card .val span { font-size: 0.85rem; color: var(--muted); }
.tx-margin-total-row td { background: var(--surface2); font-weight: 600; }
.cards-table tbody tr.card-row { cursor: pointer; }
.cards-table tbody tr.card-row:hover { background: var(--surface2); }
.pan-cell { font-family: ui-monospace, monospace; font-size: 0.82rem; letter-spacing: 0.5px; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 1.25rem 1.35rem; position: relative; max-width: 520px; width: 100%;
}
.modal-box.card-modal { max-width: 960px; width: 95%; max-height: 92vh; overflow: auto; }
.modal-close {
  position: absolute; top: 0.6rem; right: 0.75rem; background: transparent;
  border: 0; color: var(--muted); font-size: 1.5rem; cursor: pointer; line-height: 1;
}
.card-detail-layout {
  display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 1.25rem;
}
@media (max-width: 800px) {
  .card-detail-layout { grid-template-columns: 1fr; }
}
.card-visual-wrap { display: flex; flex-direction: column; gap: 0.75rem; }
.card-stats-mini {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem;
}
.card-stats-mini div {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.5rem 0.65rem; font-size: 0.8rem;
}
.card-stats-mini span { display: block; color: var(--muted); font-size: 0.72rem; }
.card-tx-scroll { max-height: 340px; overflow: auto; }
.card-scene { perspective: 1200px; }
.admin-ccard {
  position: relative; width: 100%; aspect-ratio: 1.586/1;
  transform-style: preserve-3d; transition: transform 0.55s cubic-bezier(.4,0,.2,1);
  cursor: pointer;
}
.admin-ccard.flipped { transform: rotateY(180deg); }
.admin-face {
  position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden;
  color: #fff; padding: 18px; overflow: hidden;
  background: linear-gradient(135deg, #1a1f71, #1e5799);
  box-shadow: 0 16px 36px -14px rgba(0,0,0,.55);
}
.admin-back { transform: rotateY(180deg); }
.admin-brand { display: flex; justify-content: flex-end; min-height: 1.2rem; }
.admin-brand-name {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em;
  color: rgba(255,255,255,.85); text-transform: uppercase;
}
.net-txt { font-weight: 800; letter-spacing: 1px; font-size: 1rem; }
.net-txt.visa { font-style: italic; }
.admin-card-net {
  position: absolute; right: 16px; bottom: 14px;
  display: flex; align-items: flex-end; z-index: 2;
}
.admin-card-net .net-logo { height: 28px; width: auto; display: block; object-fit: contain; filter: brightness(0) invert(1); }
.admin-card-net .net-logo.mc { height: 26px; filter: none; }
.admin-ccard[data-network="VISA"] .admin-card-net { bottom: 18px; }
.admin-flip-hint {
  position: absolute; right: 14px; top: 52px; font-size: 10px;
  color: rgba(255,255,255,.45);
}
.net-badge { font-size: 0.72rem; }
.admin-chip {
  width: 42px; height: 30px; margin-top: 14px; border-radius: 6px;
  background: linear-gradient(135deg, #d4af37, #f5e6a8 40%, #c9a227);
}
.admin-bal { position: absolute; left: 18px; bottom: 42px; }
.admin-bal-lbl { font-size: 10px; color: rgba(255,255,255,.65); text-transform: uppercase; }
.admin-bal-val { font-size: 1.6rem; font-weight: 800; }
.admin-l4 {
  position: absolute; left: 18px; bottom: 16px; font-size: 0.95rem;
  letter-spacing: 2px; font-variant-numeric: tabular-nums;
}
.admin-strip {
  position: absolute; left: 0; right: 0; top: 22px; height: 38px; background: #0b0c14;
}
.admin-pan-row {
  position: absolute; left: 18px; right: 18px; top: 74px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  font-family: ui-monospace, monospace; font-size: 0.9rem; letter-spacing: 1.5px;
}
.admin-rev-btn {
  background: rgba(255,255,255,.15); border: 0; color: #fff; border-radius: 6px;
  padding: 4px 10px; font-size: 11px; font-weight: 700; cursor: pointer; flex-shrink: 0;
}
.admin-rev-btn:disabled { opacity: 0.6; }
.admin-meta {
  position: absolute; left: 18px; right: 18px; bottom: 16px;
  display: flex; gap: 24px;
}
.admin-meta-k { font-size: 9px; color: rgba(255,255,255,.55); text-transform: uppercase; }
.admin-meta-v { font-size: 0.95rem; font-family: ui-monospace, monospace; }
