/* Panel de payments: mismo sistema de diseño que la consola de LoginFlow
   (tokens de color, Instrument Sans para texto, JetBrains Mono para
   identificadores). Sin estilos en línea: la CSP sólo permite este archivo. */

@font-face { font-family: IS; src: url(fonts/instrument-sans-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: IS; src: url(fonts/instrument-sans-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: IS; src: url(fonts/instrument-sans-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: IS; src: url(fonts/instrument-sans-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: JB; src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: JB; src: url(fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --ink: #15202B; --ink2: #4A5560; --ink3: #7A848C;
  --paper: #F4F5F3; --surface: #FFFFFF; --rail: #E9ECEA; --line: #DCE1DE; --line2: #EBEEEC;
  --flow: #0E6E6A; --flow-d: #0A5552; --flow-t: #E2F0EE;
  --danger: #B93A27; --danger-t: #FBE9E5;
  --warn: #9A6312; --warn-t: #FBF0DC;
  --ok: #2C7A4B; --ok-t: #E3F2E8;
  --info: #3A5BA0; --info-t: #E6ECF7;
  --mute-t: #EEF0EF;
  --prod: #B93A27; --dev: #3A5BA0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body { font-family: IS, system-ui, sans-serif; font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a, .link { color: var(--flow); font-weight: 600; text-decoration: none; cursor: pointer; background: none; border: 0; }
.mono { font-family: JB, ui-monospace, monospace; font-size: 12.5px; letter-spacing: -.01em; }
.muted { color: var(--ink3); }
.ink2 { color: var(--ink2); }
.small { font-size: 12.5px; }
b, strong { font-weight: 600; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- banda de entorno ---------- */
.band { position: fixed; left: 0; right: 0; top: 0; height: 4px; z-index: 50; }
.band.prod { background: repeating-linear-gradient(135deg, var(--prod) 0 14px, #8E2A1B 14px 28px); }
.band.dev { background: var(--dev); }

/* ---------- marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.mark { width: 28px; height: 28px; border-radius: 8px; background: var(--flow); display: grid; place-items: center; flex: none; }
.mark svg { width: 16px; height: 16px; stroke: #fff; fill: none; stroke-width: 2.4; }
.brand .name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand .what { color: var(--ink3); font-size: 13px; margin-left: 4px; }

/* ---------- login y alta ---------- */
.auth { display: grid; grid-template-columns: minmax(360px, 560px) 1fr; min-height: 100vh; }
.auth .left { background: var(--surface); padding: 56px 72px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.auth .right { background: var(--rail); padding: 56px 64px; display: flex; flex-direction: column; justify-content: center; }
.auth h1 { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin: 44px 0 8px; }
.auth .lead { color: var(--ink2); margin-bottom: 26px; }
.auth form { max-width: 420px; }
.qr { width: 196px; height: 196px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 8px; }
.connected { max-width: 520px; }
.connected .cap { font-size: 13px; color: var(--ink3); margin-bottom: 10px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.rail { background: var(--rail); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 22px 12px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.rail .brand { padding: 2px 8px 14px; }
.navgroup { margin-top: 10px; }
.navgroup .gl { font-size: 11.5px; color: var(--ink3); padding: 6px 10px 4px; font-weight: 500; }
.nav { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 7px; color: var(--ink2); font-weight: 500; font-size: 13.5px; background: none; border: 0; cursor: pointer; text-align: left; }
.nav:hover { background: rgba(255, 255, 255, .55); }
.nav svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; flex: none; }
.nav.on { background: var(--surface); color: var(--ink); box-shadow: inset 3px 0 0 var(--flow); }
.nav .cnt { margin-left: auto; font-size: 11.5px; color: var(--ink3); font-weight: 500; }
.nav .cnt.alert { color: var(--danger); font-weight: 600; }
.rail .spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); margin-top: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #C9D6D3; color: var(--flow-d); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; text-transform: uppercase; }
.me .who { line-height: 1.2; min-width: 0; flex: 1; }
.me .who div:first-child { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { min-height: 58px; display: flex; align-items: center; gap: 12px; padding: 8px 28px 0; border-bottom: 1px solid var(--line); background: var(--paper); flex-wrap: wrap; }
.btn.menu-btn { display: none; }
#content:focus { outline: none; }
.envpill { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; font-weight: 500; font-size: 13px; }
.envdot { width: 9px; height: 9px; border-radius: 2px; background: var(--dev); }
.envdot.prod { background: var(--prod); }
.envpill .host { color: var(--ink3); font-family: JB, monospace; font-size: 11.5px; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--ink3); font-size: 12.5px; }
.live { display: flex; align-items: center; gap: 6px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; }
.live.down i { background: var(--danger); }
.content { flex: 1; padding: 22px 28px 40px; min-width: 0; }
.crumbs { font-size: 12.5px; color: var(--ink3); margin-bottom: 6px; }
.ph { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.ph h1 { font-size: 24px; font-weight: 600; letter-spacing: -.015em; line-height: 1.15; }
.ph .sub { color: var(--ink2); margin-top: 4px; max-width: 680px; }
.ph .acts { margin-left: auto; display: flex; gap: 8px; }

/* ---------- controles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 7px; font-weight: 600; font-size: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); white-space: nowrap; cursor: pointer; }
.btn:hover { border-color: #C4CBC8; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.btn.pri { background: var(--flow); border-color: var(--flow); color: #fff; }
.btn.pri:hover { background: var(--flow-d); }
.btn.dng { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.dng-o { color: var(--danger); border-color: #E7C3BB; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.block { width: 100%; height: 42px; }
.btn:disabled { opacity: .5; cursor: default; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.t-ok { background: var(--ok-t); color: var(--ok); }
.t-warn { background: var(--warn-t); color: var(--warn); }
.t-dng { background: var(--danger-t); color: var(--danger); }
.t-info { background: var(--info-t); color: var(--info); }
.t-mute { background: var(--mute-t); color: var(--ink2); }
.t-flow { background: var(--flow-t); color: var(--flow-d); }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; background: var(--mute-t); color: var(--ink2); font-family: JB, monospace; }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.field-inline { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: 13px; }
.field-inline .k { color: var(--ink3); }
.field-inline select, .field-inline input { border: 0; outline: 0; background: transparent; font-size: 13px; }

/* ---------- superficies ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.panel + .panel { margin-top: 16px; }
.grid2 > .panel + .panel { margin-top: 0; }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line2); flex-wrap: wrap; }
.panel-h h3 { font-size: 14px; font-weight: 600; }
.panel-h .r { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel-b { padding: 16px; }
.metrics { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.metric { flex: 1; min-width: 140px; padding: 14px 18px; border-right: 1px solid var(--line2); }
.metric:last-child { border-right: 0; }
.metric .v { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.metric .l { color: var(--ink2); font-size: 12.5px; margin-top: 3px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { font-size: 12px; font-weight: 500; color: var(--ink3); text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); background: #FAFBFA; white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line2); vertical-align: middle; font-size: 13.5px; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: #F7F9F8; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; }
.two { line-height: 1.25; }
.two .n { font-weight: 600; }
.two .e { font-size: 12.5px; color: var(--ink3); }
.tfoot { display: flex; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line2); font-size: 12.5px; color: var(--ink3); gap: 12px; }
.tfoot .pg { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.empty { padding: 36px 16px; text-align: center; color: var(--ink3); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kv { display: grid; grid-template-columns: 170px 1fr; row-gap: 9px; column-gap: 12px; font-size: 13.5px; }
.kv .k { color: var(--ink3); }
.kv .v { min-width: 0; overflow-wrap: anywhere; }
.note { display: flex; gap: 10px; padding: 11px 13px; border-radius: 8px; font-size: 13px; line-height: 1.45; margin-bottom: 14px; }
.note.info { background: var(--info-t); color: #2C477F; }
.note.warn { background: var(--warn-t); color: #6E470D; }
.note.dng { background: var(--danger-t); color: #8B2B1C; }
.note.ok { background: var(--ok-t); color: #20603A; }
.code { font-family: JB, monospace; font-size: 12px; background: #F6F7F6; border: 1px solid var(--line2); border-radius: 7px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
details { border: 1px solid var(--line2); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
details summary { cursor: pointer; font-weight: 500; font-size: 13px; }
details .code { margin-top: 8px; }
.secret { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 8px; background: #F3F5F4; border: 1px dashed #BFC8C4; font-family: JB, monospace; font-size: 13px; word-break: break-all; }
.secret .btn { margin-left: auto; flex: none; }
.section-t { font-size: 13px; font-weight: 600; margin: 18px 0 8px; }

/* ---------- formularios ---------- */
.f { margin-bottom: 14px; }
.f label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; }
.f label .opt { color: var(--ink3); font-weight: 400; }
.fi { width: 100%; min-height: 38px; padding: 0 11px; border: 1px solid #CDD4D1; border-radius: 7px; background: #fff; font-size: 14px; outline: 0; }
select.fi { padding-right: 6px; }
textarea.fi { padding: 9px 11px; min-height: 76px; resize: vertical; }
.fi:focus { border-color: var(--flow); box-shadow: 0 0 0 3px #CFE6E3; }
.fi.err { border-color: var(--danger); box-shadow: 0 0 0 3px #F6D6CF; }
.fi.code-input { font-family: JB, monospace; font-size: 22px; letter-spacing: .3em; text-align: center; height: 52px; }
.f .hint { font-size: 12px; color: var(--ink3); margin-top: 5px; }
.form-error { font-size: 13px; color: var(--danger); min-height: 18px; margin-top: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 10px; }
.check input { width: 16px; height: 16px; accent-color: var(--flow); }

/* ---------- capas ---------- */
.scrim { position: fixed; inset: 0; background: rgba(21, 32, 43, .38); z-index: 60; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--surface); z-index: 61; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(21, 32, 43, .16); }
.dh { padding: 20px 24px 16px; border-bottom: 1px solid var(--line2); display: flex; gap: 12px; align-items: flex-start; }
.dh h2 { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.dh .sub { color: var(--ink2); font-size: 13px; margin-top: 3px; }
.dh .x { margin-left: auto; }
.db { padding: 20px 24px; flex: 1; overflow-y: auto; }
.df { padding: 14px 24px; border-top: 1px solid var(--line2); display: flex; gap: 8px; align-items: center; background: #FAFBFA; }
.df .r { margin-left: auto; display: flex; gap: 8px; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 32px)); background: var(--surface); border-radius: 12px; z-index: 71; box-shadow: 0 24px 60px rgba(21, 32, 43, .25); }
.modal-scrim { z-index: 70; }
.mh { padding: 20px 22px 6px; display: flex; gap: 12px; align-items: flex-start; }
.mh .ic { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--flow-t); color: var(--flow-d); }
.mh .ic.dng { background: var(--danger-t); color: var(--danger); }
.mh .ic svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
.mh h2 { font-size: 17px; font-weight: 600; }
.mh .sub { color: var(--ink2); font-size: 13.5px; margin-top: 3px; }
.mb { padding: 12px 22px 18px; }
.mf { padding: 12px 22px; border-top: 1px solid var(--line2); display: flex; justify-content: flex-end; gap: 8px; background: #FAFBFA; border-radius: 0 0 12px 12px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 9px; font-size: 13.5px; z-index: 80; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); max-width: calc(100vw - 32px); }
.toast.err { background: var(--danger); }

/* ---------- documentación ---------- */
.ep { border-top: 1px solid var(--line2); padding: 12px 16px; }
.ep:first-child { border-top: 0; }
.ep-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ep-m { font-family: JB, monospace; font-size: 11.5px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: var(--mute-t); }
.ep-p { font-family: JB, monospace; font-size: 13px; }
.ep-d { color: var(--ink2); font-size: 13px; margin-top: 6px; }

/* ---------- pantallas angostas ---------- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth .left { padding: 36px 20px; border-right: 0; }
  .auth .right { padding: 28px 20px; }
  .auth h1 { margin-top: 28px; }
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; z-index: 65; transform: translateX(-100%); transition: transform .18s ease; }
  .rail.open { transform: none; box-shadow: 12px 0 40px rgba(21, 32, 43, .2); }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 8px 16px; }
  .topbar .right .updated { display: none; }
  .content { padding: 18px 16px 32px; }
  .grid2, .row2 { grid-template-columns: 1fr; }
  .table-wrap table { min-width: 680px; }
  .kv { grid-template-columns: 1fr; row-gap: 2px; }
  .kv .v { margin-bottom: 8px; }
  .ph .acts { margin-left: 0; }
}

/* Boot screen (configuration loading or failing) and the sign-in buttons. */
.boot { max-width: 520px; margin: 18vh auto; padding: 0 16px; }
#login-email-step .btn.block + .btn.block { margin-top: 10px; }
#login-email-step .btn svg { width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; }
#login-code-step .row2 { margin-top: 10px; }
#login-phone-step { max-width: 420px; }
#login-phone-step .btn.block + .btn.block { margin-top: 10px; }
.phone-number { font-family: JB, monospace; font-size: 64px; font-weight: 600; letter-spacing: .08em; line-height: 1; text-align: center; color: var(--flow-d); background: var(--flow-t); border-radius: 12px; padding: 22px 0; margin-bottom: 10px; }
.phone-countdown { text-align: center; font-size: 13px; color: var(--ink3); min-height: 18px; margin-bottom: 16px; }
