/* DoblePago — paleta heredada de DobleCorchea: grafito + degradado magenta → naranja → amarillo */
:root {
  --bg: #1e1e20;
  --bg-2: #252527;
  --panel: #2b2b2e;
  --panel-2: #333337;
  --panel-3: #3c3c41;
  --line: #414147;
  --text: #f5f5f6;
  --muted: #a9a9b1;
  --magenta: #e6197e;
  --orange: #f7941d;
  --yellow: #fcc21b;
  --grad: linear-gradient(90deg, var(--magenta), var(--orange) 62%, var(--yellow));
  --grad-soft: linear-gradient(90deg, rgba(230, 25, 126, .22), rgba(247, 148, 29, .18));
  --ok: #3ecf8e;
  --warn: #fcc21b;
  --danger: #ff4d5e;
  --info: #6aa8ff;
  --radius: 14px;
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.mono, .num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px; gap: 18px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: block; padding: 4px 8px 10px; }
.brand img { display: block; height: auto; max-width: 100%; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 600;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--grad-soft); color: var(--text); box-shadow: inset 3px 0 0 var(--magenta); }
.ni { width: 20px; text-align: center; font-size: 15px; }
.pill { margin-left: auto; background: var(--magenta); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 99px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 16px 28px;
  border-bottom: 1px solid var(--line); background: rgba(30, 30, 32, .9);
  position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px);
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 800; }
.user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-name { display: flex; flex-direction: column; font-weight: 700; font-size: 13px; }
.user-name small { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--grad); color: #19191b; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.badge-demo { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; border: 1px solid var(--orange); color: var(--orange); padding: 2px 7px; border-radius: 99px; }
.icon-btn { display: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; font-size: 18px; }
#view { padding: 26px 28px 60px; outline: none; display: flex; flex-direction: column; gap: 20px; max-width: 1280px; width: 100%; }

/* ---------- componentes ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2 { font-size: 15px; margin: 0 0 14px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.card h2 .spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: 1.6fr 1fr; }
.half { grid-template-columns: 1fr 1fr; }

.kpi { position: relative; overflow: hidden; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .value { font-size: 25px; font-weight: 800; margin: 6px 0 4px; letter-spacing: -.02em; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpi.hero { background: linear-gradient(135deg, rgba(230, 25, 126, .28), rgba(247, 148, 29, .16) 70%), var(--panel); border-color: rgba(247, 148, 29, .45); }
.kpi.hero .value { font-size: 28px; }
.kpi .actions { margin-top: 12px; }
.up { color: var(--ok); font-weight: 700; }
.down { color: var(--danger); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2);
  font-weight: 700; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, filter .15s;
}
.btn:hover:not(:disabled) { background: var(--panel-3); border-color: #57575e; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--grad); border: 0; color: #19191b; }
.btn-primary:hover:not(:disabled) { background: var(--grad); filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(255, 77, 94, .5); color: #ff8b96; background: transparent; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field.compact { font-size: 11.5px; }
.field input, .field select, .field textarea, .filters input, .filters select {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font-weight: 500; font-size: 14px; min-width: 0;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .filters input:focus, .filters select:focus { border-color: var(--orange); outline: none; }
.field .help { font-weight: 500; font-size: 11.5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.checks-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg-2); font-weight: 600; font-size: 12.5px; color: var(--text); cursor: pointer; }
.chip-check:has(input:checked) { border-color: var(--orange); background: rgba(247, 148, 29, .12); }
.chip-check input { accent-color: var(--orange); margin: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters input[type=search] { flex: 1 1 220px; }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 14px; border-top: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; border-top: 0; background: var(--bg-2); }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
td.r, th.r { text-align: right; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
.who { display: flex; flex-direction: column; }
.who small { color: var(--muted); }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-aprobada, .s-pagado, .s-aprobado, .s-activo { color: #7ee2b3; background: rgba(62, 207, 142, .14); }
.s-pendiente, .s-procesando, .s-solicitado { color: #ffd66b; background: rgba(252, 194, 27, .13); }
.s-reembolsada, .s-rechazado { color: #b7b7c0; background: rgba(169, 169, 177, .14); }
.s-en_disputa, .s-cancelada { color: #ff8b96; background: rgba(255, 77, 94, .14); }
.s-pausado { color: #b7b7c0; background: rgba(169, 169, 177, .14); }

.method { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.flag { font-size: 16px; line-height: 1; }

/* ---------- gráficos ---------- */
.chart { width: 100%; height: 220px; display: block; }
.chart .bar { transition: opacity .15s; }
.chart .bar:hover { opacity: .8; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.legend-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: 13px; }
.legend-row .name { flex: 0 0 130px; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.legend-row .track { flex: 1; height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.legend-row .fill { height: 100%; background: var(--grad); border-radius: 99px; }
.legend-row .pct { flex: 0 0 52px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- listas ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; padding-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; }
.list-item .meta { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--panel-3); display: grid; place-items: center; font-size: 18px; flex: none; }

.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--grad-soft); border: 1px solid rgba(247, 148, 29, .35); font-size: 13px; }
.callout b { color: var(--text); }
.link-box { display: flex; gap: 8px; align-items: center; background: var(--bg-2); border: 1px dashed var(--line); padding: 8px 10px; border-radius: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; overflow: hidden; }
.link-box span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13.5px; }
.summary-row.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-weight: 800; font-size: 15px; }

/* ---------- modal & toast ---------- */
dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--text); padding: 0; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 10, 12, .65); backdrop-filter: blur(3px); }
#modalBody { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
#modalBody h3 { margin: 0; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); opacity: 0;
  background: var(--panel-3); border: 1px solid var(--line); padding: 11px 16px; border-radius: 12px;
  font-weight: 600; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: rgba(62, 207, 142, .55); }
.toast.err { border-color: rgba(255, 77, 94, .55); }

/* ---------- responsive (mobile-first para LatAm: la mayoría vende desde el celular) ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two, .half { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 262px; z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: 10px 0 40px rgba(0,0,0,.5); }
  .sidebar.open { transform: none; }
  .icon-btn { display: inline-grid; place-items: center; }
  .topbar { padding: 12px 16px; }
  .user-name, .badge-demo { display: none; }
  #view { padding: 18px 16px 50px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ===================== v2: módulos tipo marketplace, billetera y director ===================== */
.small { font-size: 12px; }
.strong { font-weight: 800; }
.r { text-align: right; }
.clickable { cursor: pointer; }
.hint { font-size: 12.5px; margin: 8px 0 0; color: var(--muted); }
.hint.err { color: var(--danger); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--panel-3); color: var(--text); white-space: nowrap; }
.track { height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.fill { height: 100%; background: var(--grad); border-radius: 99px; }
.toolbar { display: flex; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap; }
.toolbar p { margin: 0; }
.cards3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cards4 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.nav-group { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #77777f; padding: 14px 12px 4px; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.mode-switch button { border: 0; background: transparent; color: var(--muted); font-weight: 700; padding: 8px 6px; border-radius: 9px; }
.mode-switch button.active { background: var(--grad); color: #19191b; }
.sidebar { overflow-y: auto; }

.product { display: flex; flex-direction: column; gap: 12px; }
.product-head { display: flex; gap: 12px; align-items: flex-start; }
.product-head h3 { margin: 2px 0 0; font-size: 15px; line-height: 1.3; }
.tile-ico.big { width: 46px; height: 46px; font-size: 22px; }
.product .price { font-size: 22px; font-weight: 800; }
.facts { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.row-actions { display: flex; gap: 8px; margin-top: auto; }

.switch-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.switch-row:first-of-type { border-top: 0; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.switch { flex: none; width: 40px; height: 22px; border-radius: 99px; background: var(--panel-3); position: relative; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #d8d8de; transition: transform .15s; }
.switch-row input:checked + .switch { background: var(--orange); }
.switch-row input:checked + .switch::after { transform: translateX(18px); background: #fff; }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--orange); outline-offset: 2px; }

.checkout-preview { background: #f7f7f9; color: #1e1e20; border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.checkout-preview .muted { color: #6d6d75; }
.cp-head { display: flex; align-items: center; gap: 10px; }
.cp-price { font-size: 24px; font-weight: 800; }
.cp-methods { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-methods span { background: #fff; border: 1px solid #e2e2e8; border-radius: 8px; padding: 5px 9px; font-size: 12px; font-weight: 600; }
.cp-bump { border: 2px dashed var(--orange); background: #fff7ec; border-radius: 10px; padding: 10px; font-size: 13px; font-weight: 600; }
.cp-coupon { font-size: 13px; color: var(--magenta); font-weight: 700; }

.callout.warn { background: rgba(252, 194, 27, .08); border-color: rgba(252, 194, 27, .4); }
.callout a { color: var(--yellow); }
.wallet-hero { background: linear-gradient(140deg, rgba(230, 25, 126, .25), rgba(247, 148, 29, .12) 60%), var(--panel); }
.wallet-balance { font-size: 36px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 2px; }
.wallet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.wallet-hero .card { background: rgba(30, 30, 32, .55); }
.vcard { aspect-ratio: 1.586; max-width: 360px; border-radius: 16px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(circle at 85% 15%, rgba(252, 194, 27, .35), transparent 45%), linear-gradient(135deg, #2b2b2e, #1a1a1c 60%), #1e1e20; border: 1px solid #4a4a50; margin-bottom: 12px; transition: filter .2s; }
.vcard.frozen { filter: grayscale(1) brightness(.7); }
.vcard-top { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); font-weight: 700; }
.vcard-num { font-size: 19px; letter-spacing: .12em; font-weight: 700; }
.vcard-bottom { display: flex; gap: 16px; align-items: center; font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.vcard-bottom b { margin-left: auto; font-size: 18px; font-style: italic; }
.qr-wrap { display: grid; place-items: center; }
.qr { width: 200px; height: 200px; border-radius: 12px; }

.bank-card h3 { margin: 4px 0; font-size: 16px; }
.bank-card .value { font-size: 22px; font-weight: 800; margin: 4px 0 8px; }
.bank-card.recommended { border-style: dashed; border-color: rgba(247, 148, 29, .6); }
.batch-group { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 12px; }
.batch-head { display: flex; gap: 12px; align-items: center; padding: 10px 14px; background: var(--bg-2); }
.table-wrap.flat { margin: 0; }
dialog.wide { width: min(720px, calc(100vw - 32px)); }
.s-activa, .s-verificado, .s-recuperado { color: #7ee2b3; background: rgba(62, 207, 142, .14); }
.s-atrasada, .s-enviado, .s-borrador { color: #ffd66b; background: rgba(252, 194, 27, .13); }
.s-congelada, .s-expirado { color: #b7b7c0; background: rgba(169, 169, 177, .14); }
.mode-switch.wide { margin: 4px 0 10px; }
.mode-switch.wide button { padding: 10px; }
.demo-bar { background: rgba(252, 194, 27, .1); border-bottom: 1px solid rgba(252, 194, 27, .3); color: #ffd66b; font-size: 12px; font-weight: 600; padding: 7px 28px; }

/* ===== Modo real: acceso, página de pago ===== */
body.loading .app { visibility: hidden; }
body.auth-mode .app { display: none; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(520px, 100%); display: grid; gap: 14px; }
.auth-card > img { justify-self: center; }
.auth-card > p { text-align: center; margin: 0; }
.auth-form { display: grid; gap: 12px; }
.pay-page { min-height: 100vh; }
.pay-wrap { width: min(640px, 100%); margin: 0 auto; padding: 28px 16px 40px; display: grid; gap: 16px; }
.pay-brand { justify-self: center; }
.pay-title { font-size: 1.35rem; margin: 2px 0 0; }
.pay-card { display: grid; gap: 14px; }
.pay-card .price { font-size: 1.8rem; font-weight: 700; }
.pay-methods { display: grid; gap: 10px; }
.pay-methods .btn { width: 100%; justify-content: center; }
.pay-aff { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pay-foot { text-align: center; }
.row-inline { display: flex; gap: 8px; }
.row-inline input { flex: 1; min-width: 0; }
.help.ok { color: #46c27a; }
.help.err { color: #ff6b6b; }
details.card summary { cursor: pointer; }

.pay-card .cp-bump { background: rgba(247,148,29,.12); color: var(--text, #f2f2f4); border: 1px dashed #f7941d; display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; cursor: pointer; }
.pay-card .cp-bump small { color: inherit; opacity: .75; }
