:root {
  --bg: #0f1115;
  --card: #181b22;
  --border: #262a33;
  --text: #e8eaed;
  --muted: #9aa1ad;
  --accent: #4f8cff;
  --accent-ink: #ffffff;
  --danger: #ff6b6b;
  --success: #3ddc97;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

/**
 * The `hidden` attribute is how this app gates every signed-in view, but the
 * browser implements it as a low-priority `display: none` that ANY author
 * `display` rule silently beats. A single `display: grid` further down this file
 * is enough to render a "hidden" panel to a signed-out visitor.
 *
 * Make hidden actually mean hidden, so gating a view is never one stylesheet
 * edit away from being undone.
 */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 20px 64px;
  display: grid;
  gap: 16px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

h1 {
  font-size: 20px;
  margin: 0;
}

h2 {
  font-size: 15px;
  margin: 0 0 14px;
}

.badge {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.balance-card {
  text-align: center;
  padding: 28px 20px;
}

.label {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 8px;
}

.balance {
  font-size: 34px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.5px;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.preset {
  flex: 1 1 auto;
  min-width: 72px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}

.preset:hover {
  border-color: var(--accent);
}

.preset[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.12);
}

.amount-input {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #12151b;
}

.amount-input:focus-within {
  border-color: var(--accent);
}

.currency {
  color: var(--muted);
  font-size: 20px;
}

#amount {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
  width: 100%;
}

#amount::-webkit-outer-spin-button,
#amount::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 0;
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin: 8px 0 0;
}

.primary {
  width: 100%;
  margin-top: 18px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.secondary {
  width: 100%;
  margin-top: 10px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
  font-size: 15px;
  cursor: pointer;
}

.txns {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.txns li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.txns .when {
  color: var(--muted);
  font-size: 12px;
}

.credit {
  color: var(--success);
  font-variant-numeric: tabular-nums;
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

.notice {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 18px;
}

.banner {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
}

.banner.success {
  border-color: rgba(61, 220, 151, 0.4);
  background: rgba(61, 220, 151, 0.1);
  color: var(--success);
}

.banner.failure {
  border-color: rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.1);
  color: var(--danger);
}

.banner.pending {
  color: var(--muted);
}

/* An underpayment is neither a success nor a failure — do not dress it as either. */
.banner.partial {
  border-color: rgba(255, 176, 32, 0.4);
  background: rgba(255, 176, 32, 0.1);
  color: #ffb020;
}

#vpa,
#email,
#password {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  width: 100%;
}

#wallet-view {
  display: grid;
  gap: 16px;
}

/* --- merchant console ---------------------------------------------------- */

.page.wide {
  max-width: 880px;
}

#console-view {
  display: grid;
  gap: 16px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-value {
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

/* Wide tables scroll inside their own box rather than the page. */
.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 12px 12px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Only the final column hugs the edge. Zeroing this on every .num cell made a
   right-aligned amount collide with whatever followed it. */
.table th:last-child,
.table td:last-child {
  padding-right: 0;
}

.table .when {
  color: var(--muted);
  font-size: 12px;
}

.status {
  text-transform: capitalize;
  font-size: 12px;
}

.status.paid {
  color: var(--success);
}

.status.failed {
  color: var(--danger);
}

.status.created {
  color: var(--muted);
}

.status.expired {
  color: var(--muted);
}

.status.partial {
  color: #ffb020;
}

/* --- gateway keys -------------------------------------------------------- */

.gw-status {
  font-size: 13px;
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.gw-status.missing {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.08);
}

.gw-status.test {
  color: var(--muted);
}

/* Live keys move real money — make that impossible to miss. */
.gw-status.live {
  color: var(--success);
  border-color: rgba(61, 220, 151, 0.4);
  background: rgba(61, 220, 151, 0.08);
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.copy-row:last-of-type {
  border-bottom: 0;
}

.copy-label {
  color: var(--muted);
  font-size: 12px;
  flex: 0 0 96px;
}

.copy-value {
  font-size: 12px;
  overflow-x: auto;
  white-space: nowrap;
  color: var(--text);
}

#api-key,
#api-secret {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  width: 100%;
}
