/* Layout: app de una columna, máx. 640 px, encabezado fijo con selector de función y pestañas deslizables. */
:root {
  --bg: #0e0b09; --surface: #18130f; --surface-2: #221b15; --line: rgba(212, 179, 127, .16);
  --fg: #f3ece1; --muted: #a39782; --gold: #d4b37f; --gold-ink: #1b1209;
  --ok: #5cc48a; --warn: #e6b450; --bad: #ec6a58; --cyan: #33d2ff; --red: #fc0008;
  --display: "Cormorant Garamond", Georgia, serif; --body: "Manrope", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--fg); }
body { margin: 0; font: 15px/1.45 var(--body); font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent; }
body.noscroll { overflow: hidden; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; text-wrap: balance; margin: 0 0 .5rem; letter-spacing: .01em; }
h1 { font-size: 2.6rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.3rem; }
.h { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); } .sm { font-size: .84rem; }
.okc { color: var(--ok); font-weight: 600; } .warnc { color: var(--warn); font-weight: 600; } .badc { color: var(--bad); }
.wrap { max-width: 640px; margin: 0 auto; padding-block: 16px 64px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 14px; }
.center { display: grid; place-items: center; gap: 12px; min-height: 40vh; text-align: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* demo */
.demobar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); background: var(--cyan); color: #00222e; font-size: .82rem; font-weight: 600; }
.demobar select { background: #fff; color: #00222e; border: 0; border-radius: 8px; padding: 4px 8px; font-weight: 600; max-width: 100%; }
.linkbtn { background: none; border: 0; text-decoration: underline; cursor: pointer; color: inherit; padding: 4px; font-weight: 600; }

/* encabezado */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: linear-gradient(180deg, #1d140d, var(--bg)); border-bottom: 1px solid var(--line); }
.top-in, .evsel, .tabs { max-width: 640px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.top-in { display: flex; align-items: center; justify-content: space-between; padding-block: 12px 6px; }
.brand img { height: 22px; display: block; }
.me { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--gold); background: var(--surface-2); color: var(--gold); font-weight: 700; cursor: pointer; }
.evsel { display: flex; flex-direction: column; gap: 2px; padding-block: 4px 8px; }
.evsel select { background: transparent; border: 0; font-family: var(--display); font-size: 1.35rem; font-weight: 600; color: var(--fg); padding: 0; max-width: 100%; text-overflow: ellipsis; }
.evsel select option { background: var(--surface); }
.evdate { color: var(--gold); font-size: .82rem; letter-spacing: .04em; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-block: 0 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 12px; color: var(--muted); cursor: pointer; font-weight: 600; font-size: .9rem; }
.tab.on { color: var(--fg); border-bottom-color: var(--gold); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--warn); color: var(--gold-ink); font-size: .72rem; line-height: 20px; text-align: center; }

/* bloques */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card > h2 { margin: 0; }
.empty { text-align: center; padding: 40px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty.sm { padding: 24px 12px; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hero-stats.three { grid-template-columns: repeat(3, 1fr); }
.big { background: var(--surface-2); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; border: 1px solid var(--line); min-width: 0; }
.big .k { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.big .v { font-family: var(--display); font-size: 2.6rem; line-height: 1.05; color: var(--gold); font-weight: 600; font-variant-numeric: lining-nums tabular-nums; }
.big .s { font-size: .82rem; color: var(--muted); }
.quota { display: flex; flex-direction: column; gap: 6px; }
.qhead { display: flex; justify-content: space-between; gap: 8px; font-size: .92rem; }
.qhead i { color: var(--muted); font-style: normal; font-weight: 400; }
.qbar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.qbar span { display: block; height: 100%; background: var(--gold); border-radius: 4px; }
.qnote { font-size: .8rem; color: var(--muted); }
.money { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; margin: 0; }
.money dt { color: var(--muted); } .money dd { margin: 0; text-align: right; font-weight: 600; }
.money .neg { color: var(--bad); }
.money .tot { border-top: 1px solid var(--line); padding-top: 8px; color: var(--fg); font-weight: 700; }
.money dd.tot { color: var(--gold); font-size: 1.1rem; }
.note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: .9rem; }
.note.warn { color: var(--warn); }
.log { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; max-height: 260px; overflow-y: auto; }

/* listas */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; min-width: 0; }
.item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.item.tk .line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.as-btn { width: 100%; text-align: left; cursor: pointer; color: var(--fg); }
.as-btn:hover { border-color: var(--line); }
.left { text-align: left; }
.num { font-family: var(--display); font-size: 1.15rem; color: var(--gold); font-variant-numeric: lining-nums tabular-nums; min-width: 4.2em; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--surface); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.pill.in { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 40%, transparent); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); cursor: pointer; font-weight: 600; font-size: .86rem; }
.chip.on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.chip span { opacity: .75; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; } .row.between { justify-content: space-between; } .center-r { justify-content: center; }
.center-t { text-align: center; }

/* botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); font-weight: 700; cursor: pointer; text-decoration: none; font-size: .92rem; }
.btn.sm { padding: 7px 11px; font-size: .82rem; border-radius: 10px; }
.btn.big { padding: 16px 22px; font-size: 1.05rem; }
.btn.gold { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.btn.ok { background: var(--ok); color: #06240f; border-color: var(--ok); }
.btn.danger { background: var(--bad); color: #2a0703; border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.danger-ghost { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn:focus-visible, .chip:focus-visible, .tab:focus-visible, .as-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* formularios */
.form { display: flex; flex-direction: column; gap: 6px; }
.form label, .card > label { font-size: .8rem; color: var(--muted); font-weight: 600; margin-top: 6px; }
input, select, textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-width: 0; }
input[type=file] { padding: 9px; }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; }
.form .btn[type=submit] { margin-top: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two > div, .four > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.four { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--fg) !important; font-size: .9rem !important; }
.search { font-size: 1rem; }
.help summary { cursor: pointer; color: var(--gold); font-weight: 600; font-size: .9rem; }
.help ul { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; color: var(--muted); }
.help b { color: var(--fg); }

/* vender */
.pay { background: linear-gradient(150deg, #33220f, var(--surface) 70%); }
.pay-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; }
.pay .k { display: block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.alias { font-size: 1.25rem; word-break: break-all; }
.price { font-family: var(--display); font-size: 2rem; color: var(--gold); font-variant-numeric: lining-nums; }
.qline { font-size: .9rem; }
.commission { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--surface-2); }

/* puerta */
.door-top { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }
.scan { height: 100%; font-size: 1.15rem; }
.reader { width: 100%; min-height: 220px; border-radius: 12px; overflow: hidden; background: #000; }
.reader video { width: 100% !important; }
.scanres { margin-top: 10px; border-radius: 14px; padding: 16px; display: none; flex-direction: column; gap: 4px; text-align: center; }
.scanres.good, .scanres.badr { display: flex; }
.scanres b { font-size: 1.5rem; letter-spacing: .06em; }
.scanres.good { background: var(--ok); color: #04210d; }
.scanres.badr { background: var(--bad); color: #2a0703; }
.filebtn { margin-top: 10px; align-self: center; }

/* login: triángulo — la S arriba, el saludo al centro, los dos emblemas como base */
.login { min-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); display: grid; grid-template-rows: 1fr auto 1fr; justify-items: center; align-items: center; gap: 28px;
  padding-block: 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, .35) 100%), var(--tela) center / cover no-repeat, #0b0908; }
.login-s { height: clamp(150px, 26vh, 260px); align-self: end; filter: drop-shadow(0 6px 24px rgba(0, 0, 0, .6)); }
.login-mid { display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }
.login-mid h1 { font-size: clamp(1.7rem, 6vw, 2.4rem); color: var(--fg); margin: 0; text-shadow: 0 2px 16px rgba(0, 0, 0, .8); }
.login-base { width: 100%; max-width: 560px; display: flex; justify-content: space-between; align-self: start; }
.emblem { --d: clamp(128px, 38vw, 190px); width: var(--d); height: var(--d); flex: none; border: 3px solid var(--red); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--d) * .05); background: rgba(0, 0, 0, .35); }
.emblem img { width: calc(var(--d) * .66); height: auto; flex: none; }
.emblem .rule { width: calc(var(--d) * .7); flex: none; height: 2px; background: var(--red); }
.emblem .sub { color: var(--red); font-family: "Montserrat", var(--body); font-weight: 500; letter-spacing: .16em; font-size: clamp(.62rem, 2.4vw, .86rem); line-height: 1.25; text-align: center; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .7); display: flex; align-items: flex-end; justify-content: center; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 700px) { .modal { align-items: center; } .sheet { border-radius: 20px; } }
.x { position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; border: 0; background: none; color: var(--muted); font-size: 1.6rem; cursor: pointer; }
.sheet h3 { padding-right: 36px; }
.receipt { width: 100%; border-radius: 10px; background: #fff; }
.ticket-img { width: min(100%, 340px); align-self: center; border-radius: 18px; }
.tablewrap { overflow-x: auto; } table { border-collapse: collapse; font-size: .8rem; } td, th { border: 1px solid var(--line); padding: 4px 8px; text-align: left; white-space: nowrap; }

/* avisos */
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--fg); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 600; max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0, 0, 0, .4); transition: opacity .4s; }
.toast.ok { background: var(--ok); color: #04210d; } .toast.bad { background: var(--bad); color: #2a0703; }
.toast.out { opacity: 0; }
@media (max-width: 420px) { .four { grid-template-columns: 1fr 1fr; } .hero-stats.three .v { font-size: 2rem; } }

.item > select { width: auto; max-width: 52%; flex: none; }
.demobar select { flex: 1 1 180px; min-width: 0; }
.item .grow { overflow-wrap: anywhere; }

.seed { border-color: var(--gold); background: linear-gradient(150deg, #33220f, var(--surface) 70%); }
