/* Estilos compartidos del panel y de la puerta. Pensado primero para teléfonos. */
:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #f8f6f1;
  --ink: #15130f;
  --ink-2: #5b554b;
  --line: #e2ddd2;
  --brand: #b3122c;
  --brand-ink: #ffffff;
  --gold: #b88a12;
  --ok: #138a3e;
  --ok-bg: #e6f5ec;
  --warn: #a86400;
  --warn-bg: #fff3dc;
  --bad: #c01b1b;
  --bad-bg: #fde8e8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 16, 8, .06), 0 4px 16px rgba(20, 16, 8, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12110f;
    --surface: #1c1a17;
    --surface-2: #24211d;
    --ink: #f3efe7;
    --ink-2: #a9a194;
    --line: #34302a;
    --brand: #e0364f;
    --gold: #e0b43c;
    --ok: #3cc46e;
    --ok-bg: #173022;
    --warn: #f0a735;
    --warn-bg: #33270f;
    --bad: #ff5a5a;
    --bad-bg: #3a1717;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a { color: var(--brand); }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.stack > * + * { margin-top: 12px; }

/* ---------- barra superior */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: #15130f; color: #fff; border-bottom: 1px solid #2c2822;
  padding: 10px 16px; display: flex; gap: 12px; align-items: center;
}
.topbar .brand { font-weight: 800; letter-spacing: .06em; font-size: .95rem; white-space: nowrap; }
.topbar .brand span { color: var(--gold); }
.topbar select {
  background: #2a2722; color: #fff; border: 1px solid #3d3830; border-radius: 10px;
  padding: 7px 10px; font: inherit; font-size: .9rem; min-width: 0; flex: 1 1 auto; max-width: 420px;
}
.topbar .who { font-size: .8rem; opacity: .75; white-space: nowrap; }
.topbar button { background: transparent; color: #fff; border: 1px solid #4a443b; }

.tabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 52px; z-index: 15; scrollbar-width: none;
}
.tabs a {
  text-decoration: none; color: var(--ink-2); padding: 8px 14px; border-radius: 999px;
  font-weight: 600; font-size: .92rem; white-space: nowrap;
}
.tabs a.on { background: var(--ink); color: var(--bg); }

main { max-width: 980px; margin: 0 auto; padding: 16px; }

/* ---------- tarjetas y formularios */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; color: var(--ink-2); font-size: .82rem; margin-top: 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 46px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); background: var(--surface); }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--ok); }
input[type="color"] { padding: 4px; height: 46px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

button, .btn {
  font: inherit; font-weight: 700; cursor: pointer; border-radius: 12px; padding: 11px 16px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); min-height: 46px;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn-block { width: 100%; }
.btn-big { min-height: 58px; font-size: 1.1rem; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .85rem; border-radius: 10px; }

/* botones de selección (segmentos) */
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { flex: 1 1 auto; font-weight: 600; }
.seg button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* tarjetas de zona */
.zones { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.zone {
  text-align: left; display: block; padding: 12px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--surface); position: relative; overflow: hidden; min-height: 86px;
}
.zone::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--c); }
.zone .zn { font-weight: 800; font-size: .95rem; padding-left: 6px; }
.zone .zp { padding-left: 6px; font-size: .9rem; }
.zone .za { padding-left: 6px; font-size: .78rem; color: var(--ink-2); font-weight: 500; }
.zone.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset; }
.zone:disabled { opacity: .4; }

.palcos { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.palcos button { flex-direction: column; gap: 0; padding: 6px; min-height: 58px; }
.palcos button b { font-size: 1.1rem; }
.palcos button span { font-size: .7rem; font-weight: 500; color: var(--ink-2); }
.palcos button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.palcos button.on span { color: inherit; opacity: .8; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 52px; font-size: 1.4rem; }
.stepper output { font-size: 1.6rem; font-weight: 800; min-width: 40px; text-align: center; }

.total {
  background: var(--ink); color: var(--bg); border-radius: 12px; padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.total b { font-size: 1.5rem; }

.check {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px;
  background: var(--warn-bg); border: 1.5px solid var(--warn); font-weight: 600; margin: 0;
}

/* tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; background: var(--c, var(--ink)); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--c); vertical-align: -1px; margin-right: 6px; border: 1px solid rgba(0,0,0,.15); }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 700; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.neutral { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--ink-2); }

.list-item {
  display: flex; gap: 12px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line);
  cursor: pointer; text-decoration: none; color: inherit;
}
.list-item:hover { background: var(--surface-2); }

/* entradas generadas */
.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.ticket-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ticket-card img { display: block; width: 100%; background: #fff; }
.ticket-card .actions { display: flex; gap: 8px; padding: 10px; flex-wrap: wrap; }
.ticket-card .actions > * { flex: 1 1 auto; }
.ticket-card.void img { filter: grayscale(1); opacity: .35; }

/* aviso flotante */
#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600;
  max-width: calc(100% - 32px); box-shadow: var(--shadow); transition: opacity .2s; opacity: 0; pointer-events: none;
}
#toast.show { opacity: 1; }
#toast.err { background: var(--bad); color: #fff; }

dialog {
  border: 0; border-radius: 16px; padding: 0; max-width: min(460px, calc(100% - 32px)); width: 100%;
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
dialog::backdrop { background: rgba(10, 8, 5, .55); }
dialog .dlg-body { padding: 20px; }
dialog .dlg-actions { display: flex; gap: 10px; padding: 0 20px 20px; }
dialog .dlg-actions > * { flex: 1; }
.summary-list { margin: 0; padding: 0; list-style: none; }
.summary-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.summary-list li span:first-child { color: var(--ink-2); }
.summary-list li span:last-child { font-weight: 700; text-align: right; }

/* pantalla de ingreso */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 380px; }
.login .logo { font-weight: 900; letter-spacing: .1em; font-size: 1.3rem; text-align: center; margin-bottom: 18px; }
.login .logo span { color: var(--brand); }
.err-msg { color: var(--bad); font-weight: 600; font-size: .9rem; min-height: 1.2em; }
.empty { text-align: center; padding: 32px 16px; color: var(--ink-2); }
