/* Consola de JustoAPI. Un libro de cuentas: números tabulares, mucho aire,
   un solo acento. Claro y oscuro siguen al sistema. */

:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --ink: #17191c;
  --muted: #5d636b;
  --line: #dedbd2;
  --accent: #0d5f4a;
  --accent-ink: #ffffff;
  --good: #0d6b3f;
  --bad: #a3271f;
  --warn: #8a5a00;
  --tag: #ecebe5;
  --radius: 10px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111314;
    --surface: #191c1e;
    --ink: #eceae4;
    --muted: #a0a6ad;
    --line: #2c3033;
    --accent: #6fd3b3;
    --accent-ink: #0b1512;
    --good: #6fd3a0;
    --bad: #ff8f85;
    --warn: #e6b450;
    --tag: #25292c;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 1.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 0.95rem; margin: 1.5rem 0 0.5rem; }
p { margin: 0 0 1rem; }

.mono, code, pre { font-family: var(--mono); font-size: 0.875em; }
.fine { color: var(--muted); font-size: 0.875rem; }
.lead { color: var(--muted); max-width: 60ch; }
.noscript { padding: 2rem; }

/* --- Cabecera ----------------------------------------------------------- */

.top {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
}

.brand { font-weight: 700; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand span { margin-left: 0.5rem; font-weight: 400; color: var(--muted); }

.top nav { display: flex; gap: 0.25rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.top nav a {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.95rem;
}
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current="page"] { background: var(--tag); color: var(--ink); font-weight: 600; }

.page { max-width: 68rem; margin: 0 auto; padding: 2.5rem clamp(1rem, 4vw, 2.5rem) 5rem; }

/* --- Entrada ------------------------------------------------------------ */

.signin { max-width: 26rem; margin: 0 auto; padding: 14vh 1.25rem 4rem; }
.signin .brand { display: block; margin-bottom: 2.5rem; }
.signin h1 { font-size: 2.25rem; margin-bottom: 0.75rem; }
.signin-form { display: grid; gap: 0.6rem; margin: 2rem 0 1.5rem; }

/* --- Formularios y botones ---------------------------------------------- */

label { font-size: 0.875rem; font-weight: 600; }

input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
input::placeholder { color: var(--muted); opacity: 0.8; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.925rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--ink); border-color: var(--line); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); }

.inline-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; }
.inline-form .field { display: grid; gap: 0.35rem; flex: 1 1 14rem; }
.inline-form > div:last-child { flex-basis: 100%; }

/* --- Avisos -------------------------------------------------------------- */

.notice { padding: 0.75rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); font-size: 0.925rem; }
.notice-error { border-color: var(--bad); color: var(--bad); }
.notice-info { color: var(--muted); }
.loading, .empty { color: var(--muted); padding: 1.5rem 0; }

.reveal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
}
.reveal p { flex-basis: 100%; margin: 0; }
.secret { flex: 1 1 18rem; padding: 0.6rem 0.75rem; background: var(--tag); border-radius: 6px; overflow-wrap: anywhere; user-select: all; }

/* --- Cifras -------------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat p { margin: 0; }
.stat-label { color: var(--muted); font-size: 0.875rem; }
.stat-value { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat-main .stat-value { color: var(--accent); }
.stat-note { color: var(--muted); font-size: 0.8125rem; }

.bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 9rem;
  margin: 0;
  padding: 1rem;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow-x: auto;
}
.bars li { flex: 1 1 0; min-width: 14px; max-width: 48px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar { width: 100%; height: var(--h, 2%); background: var(--accent); border-radius: 3px 3px 0 0; }
.bar-label { font-size: 0.6875rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 2rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* --- Tablas -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
th, td { padding: 0.7rem 1rem; text-align: left; white-space: nowrap; }
th { font-size: 0.8125rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
td { border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.credit { color: var(--good); }
.debit { color: var(--ink); }

.tag { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--tag); font-size: 0.8125rem; margin-left: 0.4rem; }
td > .tag:first-child, dd > .tag { margin-left: 0; }
.tag-completed, .tag-active, .tag-topup, .tag-refund, .tag-promo { color: var(--good); }
.tag-failed, .tag-revoked, .tag-chargeback { color: var(--bad); }
.tag-queued, .tag-running { color: var(--warn); }

.panel { padding: 1.25rem; margin-bottom: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; }

.sample pre { margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }

@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 0.5rem 1rem; }
  .top nav { order: 3; flex-basis: 100%; }
  .brand { flex: 1; }
  h1 { font-size: 1.5rem; }
  .facts { grid-template-columns: 1fr; gap: 0.1rem; }
  .facts dd { margin-bottom: 0.6rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .top nav a, input { transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease; }
}

.after-samples { margin-top: 1.5rem; }
