/* =========================================================
   QR Llamador — tema "tech" oscuro
   ========================================================= */
:root {
  --bg: #070a12;
  --bg-2: #0b1020;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .08);
  --border: rgba(148, 163, 255, .16);
  --border-strong: rgba(148, 163, 255, .32);
  --text: #e8ecff;
  --muted: #8a93b8;
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --green: #34f5a4;
  --pink: #f472b6;
  --danger: #ff5c7a;
  --mozo: var(--cyan);
  --cuenta: var(--green);
  --accent: var(--violet);
  --grad: linear-gradient(135deg, #22d3ee 0%, #8b5cf6 100%);
  --grad-cuenta: linear-gradient(135deg, #34f5a4 0%, #22d3ee 100%);
  --radius: 18px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(139, 92, 246, .22), transparent 60%),
    radial-gradient(800px 500px at 110% 10%, rgba(34, 211, 238, .16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  position: relative;
}
/* grilla sutil de fondo */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 255, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 255, .06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
::selection { background: rgba(139, 92, 246, .45); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.mono { font-family: var(--mono); }
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* =========================================================
   Pantalla del cliente (mesa)
   ========================================================= */
.mesa {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  gap: 28px;
  max-width: 460px;
  margin: 0 auto;
}
.mesa-header { text-align: center; }
.mesa-header .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .25em;
  font-size: .72rem;
  color: var(--cyan);
  margin: 0;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(34, 211, 238, .06);
}
.mesa-header .eyebrow::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: blink 2s ease-in-out infinite;
}
.mesa-header h1 {
  font-family: var(--mono);
  font-size: clamp(4rem, 26vw, 7rem);
  line-height: 1;
  margin: 14px 0 0;
  font-weight: 800;
  letter-spacing: -.04em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 28px rgba(139, 92, 246, .45));
}
.mesa-header .sub { margin: 6px 0 0; color: var(--muted); font-size: .95rem; }

.actions { display: grid; gap: 14px; width: 100%; }
.big-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 100px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
  text-align: left;
  overflow: hidden;
  transition: transform .12s ease, border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.big-btn::after { /* brillo de borde */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--g);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .55;
  pointer-events: none;
}
.big-btn.mozo { --g: var(--grad); --c: var(--cyan); }
.big-btn.cuenta { --g: var(--grad-cuenta); --c: var(--green); }
.big-btn:hover { box-shadow: 0 0 0 1px var(--c), 0 10px 40px -10px var(--c); }
.big-btn:active { transform: scale(.98); }
.big-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.big-btn .icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--g);
  color: #06111f;
  box-shadow: 0 8px 28px -6px var(--c);
}
.big-btn .icon svg { width: 28px; height: 28px; }
.big-btn small { display: block; font-weight: 500; font-size: .88rem; color: var(--muted); margin-top: 2px; }
.big-btn .arrow { margin-left: auto; color: var(--c); opacity: .8; font-family: var(--mono); }

.status {
  min-height: 3.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: 14px;
  width: 100%;
  border: 1px solid transparent;
}
.status:empty { visibility: hidden; }
.status.ok { background: rgba(52, 245, 164, .08); border-color: rgba(52, 245, 164, .35); color: var(--green); box-shadow: 0 0 30px -10px var(--green); }
.status.err { background: rgba(255, 92, 122, .08); border-color: rgba(255, 92, 122, .35); color: var(--danger); }
.footer-note { font-size: .8rem; color: var(--muted); text-align: center; font-family: var(--mono); letter-spacing: .02em; }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* =========================================================
   Admin
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(7, 10, 18, .7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--grad);
  color: #06111f;
  box-shadow: 0 0 24px -4px rgba(139, 92, 246, .7);
}
.brand-logo svg { width: 20px; height: 20px; }
.topbar h1 { font-size: 1.05rem; margin: 0; letter-spacing: .01em; }
.topbar h1 span { font-family: var(--mono); color: var(--muted); font-weight: 500; font-size: .8rem; margin-left: 6px; }

.conn {
  font-family: var(--mono);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  display: flex; align-items: center; gap: 8px;
  color: var(--muted);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.conn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.conn.on { color: var(--green); border-color: rgba(52, 245, 164, .35); }
.conn.on::before { background: var(--green); box-shadow: 0 0 10px var(--green); animation: blink 1.6s ease-in-out infinite; }

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  min-height: 42px;
  transition: border-color .2s, background .2s, box-shadow .2s, transform .1s;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary {
  background: var(--grad);
  border-color: transparent;
  color: #06111f;
  box-shadow: 0 8px 30px -10px rgba(139, 92, 246, .9);
}
.btn.primary:hover { box-shadow: 0 10px 36px -8px rgba(34, 211, 238, .8); }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: .88rem; }

.tabs {
  display: flex; gap: 6px;
  margin: 18px auto 0;
  padding: 5px;
  width: fit-content;
  max-width: calc(100% - 32px);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 600;
  transition: color .2s, background .2s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.badge {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px .45em;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--grad);
  color: #06111f;
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 700;
  text-align: center;
}

main.admin { max-width: 1140px; margin: 0 auto; padding: 20px 16px 40px; }

.alerts-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.alerts-head h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--muted);
}
.alerts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}
.alert {
  --c: var(--cyan);
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.025));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 14px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.alert::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--c);
  box-shadow: 0 0 18px var(--c);
}
.alert.cuenta { --c: var(--green); }
.alert.new { animation: glow 1.1s ease 4; }
.alert .table {
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
}
.alert .table small { font-size: .75rem; color: var(--muted); font-weight: 500; letter-spacing: .15em; display: block; }
.alert .label {
  grid-column: 1;
  justify-self: start;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--c);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  background: color-mix(in srgb, var(--c) 10%, transparent);
}
.alert .label svg { width: 15px; height: 15px; }
.alert .time { font-family: var(--mono); font-size: .75rem; color: var(--muted); grid-column: 1; }
.alert .btn { grid-column: 2; grid-row: 1 / span 3; }
.alert .btn:hover { border-color: var(--c); box-shadow: 0 0 20px -6px var(--c); }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 transparent; border-color: var(--border); }
  50% { box-shadow: 0 0 36px -4px var(--c); border-color: var(--c); }
}
.empty {
  text-align: center;
  padding: 56px 16px;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: rgba(255,255,255,.02);
  font-family: var(--mono);
  font-size: .9rem;
}
.empty::before {
  content: "";
  display: block;
  width: 12px; height: 12px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(52,245,164,.12), 0 0 24px var(--green);
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.025));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.qr-layout { display: grid; gap: 18px; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); align-items: start; }
@media (max-width: 760px) { .qr-layout { grid-template-columns: 1fr; } }
.card-title {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--cyan);
}
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .85rem; color: var(--muted); }
.field input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, .35);
  color: var(--text);
  font-family: var(--mono);
  font-size: 1.1rem;
  width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, .18); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.grow { flex: 1; min-width: 100px; }
.center { justify-content: center; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }

.qr-preview { text-align: center; display: grid; justify-items: center; gap: 4px; }
.qr-frame {
  position: relative;
  padding: 14px;
  border-radius: 20px;
  background: var(--grad);
  box-shadow: 0 0 60px -14px rgba(139, 92, 246, .8);
}
.qr-preview img {
  display: block;
  width: min(300px, 70vw);
  aspect-ratio: 1;
  background: #fff;
  border-radius: 10px;
  padding: 6px;
}
.qr-preview .qr-title { font-family: var(--mono); font-size: 1.6rem; font-weight: 800; margin: 14px 0 0; }
.qr-url { font-family: var(--mono); font-size: .72rem; word-break: break-all; color: var(--muted); max-width: 420px; margin: 0 0 12px; }
.error { color: var(--danger); font-weight: 600; min-height: 1.4em; font-size: .9rem; }

/* Login */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.login .card { width: 100%; max-width: 400px; padding: 28px; box-shadow: 0 30px 80px -30px rgba(139, 92, 246, .55); }
.login .brand { margin-bottom: 22px; flex: none; }
.login h1 { margin: 0 0 4px; font-size: 1.5rem; letter-spacing: -.01em; }
.login p { margin: 0 0 22px; }
.login .btn { width: 100%; }

@media (max-width: 520px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  .brand { flex-basis: 100%; }
  .topbar h1 span { display: none; }
}

/* =========================================================
   Hoja de impresión de QR (siempre en blanco y negro)
   ========================================================= */
.print-sheet { display: none; }
@media print {
  body { background: #fff !important; }
  body::before { display: none; }
  body > *:not(.print-sheet) { display: none !important; }
  .print-sheet {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 12mm;
    color: #000;
    background: #fff;
  }
  .print-item { text-align: center; break-inside: avoid; border: 1px dashed #999; padding: 8mm; border-radius: 4mm; }
  .print-item img { width: 60mm; height: 60mm; }
  .print-item h2 { margin: 2mm 0 0; font-size: 20pt; }
  .print-item p { margin: 1mm 0 0; font-size: 10pt; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.mesa-header h1.msg { font-size: clamp(2.2rem, 11vw, 3.4rem); letter-spacing: -.02em; }
