@import url('https://fonts.googleapis.com/css2?family=Archivo:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,800;1,900&family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg: #050505;
  --ink: #0b0b0b;
  --paper: rgba(255, 255, 255, .55);
  --holo: linear-gradient(125deg,
      #ff7eb3 0%, #ff9a8b 12%, #ffe66d 24%, #9dff9a 36%,
      #6ee7ff 48%, #a78bfa 60%, #ff7eb3 72%, #ffe66d 84%, #6ee7ff 100%);
  --radius: 18px;
  --mono: 'Space Mono', ui-monospace, monospace;
  --sans: 'Archivo', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: #fff;
  font-family: var(--sans);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; }

@keyframes holo {
  0%   { background-position: 0% 30%; }
  50%  { background-position: 100% 70%; }
  100% { background-position: 0% 30%; }
}

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

/* =====================================================
   FORMULARIO · ENTRADA
   ===================================================== */
.stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(24px, 6vw, 56px) 14px;
  background:
    radial-gradient(600px 400px at 50% 30%, rgba(167, 139, 250, .12), transparent 70%),
    var(--bg);
}
.stage > div { width: 100%; max-width: 460px; }

.ticket {
  --px: clamp(18px, 6vw, 32px);
  --py: clamp(26px, 7vw, 36px);
  --notch: clamp(16px, 4.5vw, 22px);

  position: relative;
  width: 100%;
  color: var(--ink);
  background: var(--holo);
  background-size: 170% 170%;
  animation: holo 12s ease infinite;
  border-radius: 6px;
  padding: var(--py) var(--px) var(--py);
  box-shadow: 0 30px 80px rgba(255, 126, 179, .15), 0 10px 40px rgba(110, 231, 255, .12);
  overflow: hidden;
}

/* brillo y textura tipo holograma */
.ticket::before {
  content: '';
  position: absolute; inset: 0;
  background:
    repeating-radial-gradient(circle at 80% 20%, rgba(255,255,255,.18) 0 1px, transparent 1px 14px),
    linear-gradient(160deg, transparent 30%, rgba(255,255,255,.45) 45%, transparent 60%);
  mix-blend-mode: soft-light;
  pointer-events: none;
}
.ticket > * { position: relative; }

/* bordes dentados */
.ticket .edge {
  position: absolute; left: 0; right: 0; height: 12px; z-index: 1;
  background: radial-gradient(circle at 50% 50%, var(--bg) 6px, transparent 6.5px) repeat-x;
  background-size: 18px 12px;
}
.ticket .edge.top { top: -6px; }
.ticket .edge.bottom { bottom: -6px; }

/* muescas laterales */
.ticket .notch {
  position: absolute; z-index: 1;
  width: var(--notch); height: var(--notch); border-radius: 50%;
  background: var(--bg);
}
.ticket .notch.l { left: calc(var(--notch) / -2); }
.ticket .notch.r { right: calc(var(--notch) / -2); }
.ticket > .notch.n1 { top: clamp(130px, 34vw, 170px); }

/* ----- cabecera ----- */
.t-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }

.t-logo { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; min-width: 0; }
.t-logo img { max-width: clamp(100px, 32vw, 160px); max-height: 72px; object-fit: contain; }
.logo-placeholder {
  width: clamp(96px, 28vw, 120px); height: clamp(52px, 15vw, 64px);
  border: 2px dashed rgba(0,0,0,.45); border-radius: 10px;
  display: grid; place-items: center;
  font: 700 11px var(--mono); letter-spacing: .1em; color: rgba(0,0,0,.6);
}
.t-icons { display: flex; gap: 6px; }
.t-icons span {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: 16px;
  background: rgba(255,255,255,.5);
}
.t-icons .smile { background: #ffe34d; border: 1.5px solid #111; font-size: 17px; }

.barcode-box {
  background: #fff; padding: 8px 8px 6px;
  width: clamp(112px, 34vw, 150px); flex-shrink: 0;
}
.barcode {
  height: clamp(40px, 12vw, 54px);
  background: repeating-linear-gradient(90deg,
    #000 0 2px, transparent 2px 4px, #000 4px 5px, transparent 5px 8px,
    #000 8px 11px, transparent 11px 12px, #000 12px 13px, transparent 13px 16px);
}
.barcode-box .code-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 6px; }
.barcode-box small { font: 700 9px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barcode-box .badge { background: #000; color: #fff; font: 900 clamp(14px, 4.4vw, 18px) var(--sans); padding: 2px 8px; }

/* ----- título ----- */
.t-title { margin-top: clamp(18px, 5vw, 26px); display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 2px 10px; }
.t-title .num { grid-column: 1; grid-row: 1; font: 700 clamp(12px, 3.4vw, 14px) var(--mono); }
.t-title .event {
  grid-column: 2; grid-row: 1; text-align: right;
  font: 800 italic clamp(11px, 3.2vw, 13px)/1.15 var(--sans); text-transform: uppercase;
}
.t-title h1 {
  grid-column: 1 / -1; grid-row: 2;
  font: 900 clamp(42px, 15.5vw, 74px)/.88 var(--sans);
  letter-spacing: -.02em; text-transform: uppercase;
  white-space: nowrap; /* una palabra por línea; el tamaño se ajusta con JS */
}
.t-sub {
  border-top: 2.5px solid var(--ink);
  margin-top: 12px; padding-top: 6px;
  font: 800 italic clamp(16px, 5vw, 22px) var(--sans); text-transform: uppercase; letter-spacing: -.01em;
}
.t-sub sup { font-size: .55em; }

/* ----- formulario ----- */
.t-form { margin-top: clamp(16px, 5vw, 22px); display: grid; gap: 14px; }

.field label {
  display: block;
  font: 800 11px var(--sans); text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 5px;
}
.field label .req { color: #d6005c; }

.input, .select {
  width: 100%; min-width: 0;
  background: var(--paper);
  border: 1.5px solid rgba(0,0,0,.75);
  border-radius: 0;
  padding: 13px 14px;
  font: 600 16px var(--sans); /* 16px evita el zoom automático en iPhone */
  color: var(--ink);
  outline: none;
  transition: background .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: rgba(0,0,0,.4); font-weight: 400; }
.input:focus, .select:focus { background: rgba(255,255,255,.85); box-shadow: 4px 4px 0 #000; }
.select {
  background-image:
    linear-gradient(45deg, transparent 50%, #000 50%),
    linear-gradient(135deg, #000 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
  background-color: var(--paper);
  padding-right: 40px; cursor: pointer;
}

.input-group { display: flex; }
.input-group .prefix {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px; flex-shrink: 0;
  background: #000; color: #fff;
  font: 700 14px var(--mono); white-space: nowrap;
}
.input-group .input { border-left: 0; }
.at-group .prefix { font-size: 16px; }

.field .error {
  display: inline-block; margin-top: 5px; padding: 3px 7px;
  background: #000; color: #ff8fb1; font: 700 12px/1.3 var(--sans);
}
.field.has-error .input, .field.has-error .select { border-color: #d6005c; border-width: 2px; }
.form-alert {
  background: #000; color: #fff; padding: 10px 12px; font: 700 13px var(--sans);
  border-left: 4px solid #ff4d8d;
}
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.btn-submit {
  margin-top: 4px; width: 100%;
  background: #000; color: #fff; border: 0;
  padding: clamp(14px, 4vw, 17px) 16px;
  font: 900 clamp(15px, 4.6vw, 18px) var(--sans); text-transform: uppercase; letter-spacing: .06em;
  cursor: pointer; text-decoration: none; text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .15s, box-shadow .15s;
}
.btn-submit:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 rgba(255,255,255,.7); }
.btn-submit:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* confirmación */
.t-confirm { margin-top: clamp(16px, 5vw, 22px); display: grid; gap: 14px; }
.t-confirm .lead { font: 800 clamp(17px, 5vw, 20px)/1.2 var(--sans); }
.t-confirm dl {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px;
  border-block: 1.5px solid rgba(0,0,0,.7); padding: 14px 0;
}
.t-confirm dt { font: 800 11px var(--sans); text-transform: uppercase; letter-spacing: .08em; }
.t-confirm dd { font: 600 15px var(--sans); overflow-wrap: anywhere; }
.t-confirm .hint { font: 700 12px/1.45 var(--mono); }

/* talón desprendible */
.t-stub {
  margin: 26px calc(var(--px) * -1) calc(var(--py) * -1);
  padding: 24px var(--px) var(--py);
  border-top: 2.5px dashed rgba(0, 0, 0, .75);
  display: grid; grid-template-columns: 1fr minmax(120px, 46%); gap: 16px; align-items: center;
}
.t-stub .notch { top: calc(var(--notch) / -2 - 1px); }
.stub-info { min-width: 0; }
.stub-info b { display: block; font: 900 clamp(18px, 5.5vw, 22px)/1 var(--sans); text-transform: uppercase; }
.stub-info span { display: block; font: 800 italic 12px var(--sans); text-transform: uppercase; margin-top: 4px; }
.stub-info small { display: block; font: 700 9px/1.4 var(--mono); margin-top: 8px; opacity: .8; }
.t-foot { background: #fff; padding: 8px 8px 5px; }
.t-foot .barcode { height: clamp(38px, 11vw, 48px); }
.t-foot small { display: block; text-align: right; font: 700 10px var(--mono); margin-top: 4px; }

.credit {
  margin-top: 22px; text-align: center;
  font: 700 12px var(--mono); letter-spacing: .3em; color: rgba(255,255,255,.5);
}

@media (max-width: 360px) {
  .t-head { flex-direction: column-reverse; }
  .barcode-box { width: 100%; }
  .t-stub { grid-template-columns: 1fr; }
}

/* =====================================================
   PANEL ADMIN
   ===================================================== */
.admin { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: #0c0c0c; border-right: 1px solid #1d1d1d;
  padding: 26px 18px; display: flex; flex-direction: column; gap: 28px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { max-width: 160px; max-height: 48px; object-fit: contain; }
.brand strong { font: 900 16px var(--sans); letter-spacing: .02em; display: block; }
.brand small { font: 400 11px var(--mono); color: #777; }
.holo-dot {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: var(--holo); background-size: 300% 300%; animation: holo 10s ease infinite;
}
.logout-mobile { display: none; }

.nav { display: grid; gap: 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; white-space: nowrap;
  padding: 12px 14px; border-radius: 10px;
  color: #aaa; text-decoration: none; font: 600 14px var(--sans);
  transition: background .15s, color .15s;
}
.nav a:hover { background: #161616; color: #fff; }
.nav a.active { background: #fff; color: #000; }
.nav a .count { margin-left: auto; font: 700 11px var(--mono); background: #222; color: #fff; padding: 2px 8px; border-radius: 20px; }
.nav a.active .count { background: #000; }
.sidebar .bottom { margin-top: auto; font: 400 12px/1.8 var(--mono); color: #666; }
.sidebar .bottom a { color: #999; }

.role-tag {
  display: inline-block; padding: 3px 9px; border-radius: 20px; white-space: nowrap;
  font: 700 11px var(--sans); background: #222; color: #ccc;
}
.role-tag.role-admin { background: var(--holo); background-size: 300% 300%; color: #000; }

.main { padding: 34px clamp(16px, 3.5vw, 40px) 60px; min-width: 0; }
.main header {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.main h2 { font: 900 clamp(26px, 6vw, 34px) var(--sans); letter-spacing: -.02em; text-transform: uppercase; }
.main header p { color: #888; font-size: 14px; margin-top: 4px; max-width: 620px; }
.main header p b { color: #ccc; }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 20px; font: 600 14px var(--sans); }
.alert.ok { background: rgba(157, 255, 154, .12); color: #9dff9a; border: 1px solid rgba(157,255,154,.3); }
.alert.err { background: rgba(255, 107, 139, .12); color: #ff8fa6; border: 1px solid rgba(255,107,139,.3); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat {
  background: #0f0f0f; border: 1px solid #1f1f1f; border-radius: var(--radius);
  padding: 16px 18px; position: relative; overflow: hidden; min-width: 0;
}
.stat::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--holo); background-size: 300% 100%; animation: holo 10s ease infinite;
}
.stat small { font: 700 11px var(--mono); color: #888; text-transform: uppercase; letter-spacing: .06em; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat b { display: block; font: 900 clamp(26px, 6vw, 34px) var(--sans); margin-top: 6px; }

.card { background: #0f0f0f; border: 1px solid #1f1f1f; border-radius: var(--radius); overflow: hidden; min-width: 0; }

.toolbar { display: flex; gap: 10px; padding: 14px; border-bottom: 1px solid #1f1f1f; flex-wrap: wrap; }
.toolbar .search, .toolbar select {
  background: #151515; border: 1px solid #262626; border-radius: 10px;
  padding: 11px 14px; color: #fff; font: 500 16px var(--sans); outline: none; min-width: 0;
}
.toolbar .search { flex: 1 1 240px; }
.toolbar select { flex: 0 1 200px; }
.toolbar .search:focus { border-color: #555; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 11px 18px; cursor: pointer;
  font: 700 14px var(--sans); text-decoration: none; white-space: nowrap;
}
.btn-light { background: #fff; color: #000; }
.btn-dark { background: #1a1a1a; color: #fff; border: 1px solid #2a2a2a; }
.btn-holo { background: var(--holo); background-size: 300% 300%; animation: holo 10s ease infinite; color: #000; }
.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 8px; }
.btn-danger { background: transparent; color: #ff6b8b; border: 1px solid #3a1a22; }

/* tabla */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font: 700 11px var(--mono); color: #777; text-transform: uppercase; letter-spacing: .08em;
  padding: 14px 16px; border-bottom: 1px solid #1f1f1f; white-space: nowrap;
}
td { padding: 14px 16px; border-bottom: 1px solid #181818; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #131313; }
td .ig { color: #c8b6ff; text-decoration: none; }
td .tel { color: inherit; text-decoration: none; }
td .tel:hover { color: #9dff9a; }
.muted { color: #777; font: 400 12px var(--mono); }
.cell-actions { display: flex; gap: 6px; }
.cell-actions form { display: inline; }

.pill {
  display: inline-block; padding: 4px 10px; border-radius: 20px;
  font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .04em; color: #000; background: #eee;
}
.pill.vip { background: linear-gradient(90deg, #ffe66d, #ff9a8b); }
.pill.gen { background: #6ee7ff; }
.pill.fre { background: #9dff9a; }
.pill.bks { background: #a78bfa; }
.pill.pnk { background: #ff7eb3; }

.empty { padding: 40px 20px; text-align: center; color: #777; }
.pager {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; border-top: 1px solid #1f1f1f; flex-wrap: wrap;
}
.pager div { display: flex; gap: 8px; }

/* filas (listas y usuarios) */
.types-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }

.type-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  padding: 16px 18px; border-bottom: 1px solid #181818;
}
.type-row:last-child { border-bottom: 0; }
.type-row .code {
  width: 52px; height: 52px; display: grid; place-items: center; flex-shrink: 0;
  background: #000; color: #fff; font: 900 15px var(--sans); border: 1px solid #2a2a2a;
}
.type-row .code.on { background: var(--holo); background-size: 300% 300%; color: #000; border: 0; }
.type-row .code.avatar { border-radius: 50%; }
.type-info { min-width: 0; }
.type-row h4 { font: 800 16px var(--sans); overflow-wrap: anywhere; }
.type-row h4 .you { color: #777; font: 400 12px var(--mono); }
.type-row p { color: #777; font: 400 12px var(--mono); margin-top: 3px; overflow-wrap: anywhere; }
.type-row .actions { display: flex; gap: 8px; }
.type-row .actions form { display: inline; }
.switch-form { display: contents; }

.switch { position: relative; width: 42px; height: 24px; display: inline-block; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; background: #2a2a2a; border-radius: 20px; cursor: pointer; transition: .2s; }
.switch span::after {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + span { background: #9dff9a; }
.switch input:checked + span::after { transform: translateX(18px); background: #000; }

/* formularios del panel */
.form-card { padding: 22px; }
.form-card h3 { font: 900 18px var(--sans); text-transform: uppercase; margin-bottom: 6px; }
.form-card label { display: block; font: 700 11px var(--mono); color: #888; text-transform: uppercase; margin: 14px 0 6px; }
.form-card input[type=text], .form-card input[type=email], .form-card input[type=password], .form-card select {
  width: 100%; background: #151515; border: 1px solid #262626; border-radius: 10px;
  padding: 12px 14px; color: #fff; font: 500 16px var(--sans); outline: none;
}
.form-card input:focus, .form-card select:focus { border-color: #555; }
.form-card .btn { width: 100%; margin-top: 20px; }
.form-card .btn + .btn { margin-top: 10px; }
.form-card .help { margin-top: 12px; color: #777; font: 400 12px/1.6 var(--sans); }
.form-card .help b { color: #bbb; }
.form-card .check { display: flex; gap: 8px; align-items: center; text-transform: none; font: 500 13px var(--sans); color: #bbb; }

.preview-ticket {
  margin-top: 20px; border-radius: 6px; padding: 14px 16px; color: #000; gap: 10px;
  background: var(--holo); background-size: 300% 300%; animation: holo 12s ease infinite;
  display: flex; justify-content: space-between; align-items: center;
}
.preview-ticket b { font: 900 20px var(--sans); text-transform: uppercase; overflow-wrap: anywhere; }
.preview-ticket span { background: #000; color: #fff; font: 900 14px var(--sans); padding: 3px 8px; }

.logo-field { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-preview {
  width: 110px; height: 64px; flex-shrink: 0; border-radius: 10px;
  background: var(--holo); background-size: 170% 170%;
  display: grid; place-items: center; overflow: hidden;
}
.logo-preview img { max-width: 94px; max-height: 50px; object-fit: contain; }
.logo-preview span { font: 700 11px var(--mono); color: #000; }
.logo-field input[type=file] { color: #aaa; font: 500 13px var(--sans); min-width: 0; max-width: 100%; }

.login-card { width: 100%; max-width: 380px; margin: 0 auto; }
.login-card .brand { margin-bottom: 18px; }

/* ---------- responsive panel ---------- */
@media (max-width: 1150px) {
  .types-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .admin { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 10; height: auto;
    padding: 12px 14px 10px; gap: 10px; border-right: 0; border-bottom: 1px solid #1d1d1d;
    background: rgba(12, 12, 12, .92); backdrop-filter: blur(10px);
  }
  .brand { justify-content: space-between; }
  .brand > div { margin-right: auto; }
  .holo-dot { width: 30px; height: 30px; }
  .logout-mobile {
    display: inline-block; color: #999; font: 600 13px var(--sans); text-decoration: none;
    padding: 6px 10px; border: 1px solid #2a2a2a; border-radius: 8px;
  }
  .nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 9px 12px; font-size: 13px; flex-shrink: 0; }
  .sidebar .bottom { display: none; }
  .main { padding-top: 22px; }
}

@media (max-width: 700px) {
  .main header .btn { width: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .toolbar .search, .toolbar select, .toolbar .btn { flex: 1 1 100%; }

  /* tabla → tarjetas */
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { padding: 14px 16px; border-bottom: 1px solid #1f1f1f; }
  table.responsive tr:last-child { border-bottom: 0; }
  table.responsive td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 5px 0; border: 0; white-space: normal; text-align: right; overflow-wrap: anywhere;
  }
  table.responsive td::before {
    content: attr(data-label); flex-shrink: 0;
    font: 700 10px var(--mono); color: #666; text-transform: uppercase; letter-spacing: .08em; text-align: left;
  }
  table.responsive td[data-label="#"] { display: none; }
  table.responsive td.cell-title { font-size: 16px; padding-bottom: 8px; }
  table.responsive td.cell-title::before { display: none; }
  table.responsive td.cell-actions { justify-content: flex-end; padding-top: 10px; }
  table.responsive td.cell-actions::before { display: none; }

  .type-row { grid-template-columns: auto minmax(0, 1fr) auto; padding: 14px; gap: 12px; }
  .type-row .actions { grid-column: 1 / -1; }
  .type-row .actions > * { flex: 1; }
  .type-row .actions .btn { width: 100%; }
}

/* ============ LOGO + FIRMA ============ */
.t-logo img { max-width: clamp(140px, 44vw, 210px); max-height: 90px; }

/* en el panel oscuro el logo va sobre una placa holográfica para que se vea siempre */
.brand-logo {
  display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 10px;
  background: var(--holo); background-size: 170% 170%; animation: holo 12s ease infinite;
}
.brand-logo img { max-width: 130px; max-height: 40px; display: block; }

.made-by {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 26px; text-decoration: none;
  color: rgba(255,255,255,.35); font: 700 10px var(--mono); letter-spacing: .2em; text-transform: uppercase;
  opacity: .7; transition: opacity .2s;
}
.made-by img { height: 22px; width: auto; }
.made-by:hover { opacity: 1; }
.stage-login { grid-template-rows: 1fr auto; }
.stage-login .made-by { align-self: end; }
.sidebar .made-by { justify-content: flex-start; margin-top: 14px; letter-spacing: .12em; }
.sidebar .made-by img { height: 18px; }
@media (max-width: 900px) { .brand-logo img { max-height: 30px; } }

/* ============ NOVEDADES (después de cada actualización) ============ */
.update-banner {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 16px 18px; margin-bottom: 20px; border-radius: 16px; color: #000;
  background: var(--holo); background-size: 200% 200%; animation: holo 12s ease infinite;
}
.update-banner .ub-body { min-width: 0; }
.update-banner b { display: block; font: 900 16px var(--sans); }
.update-banner .ub-sub { display: block; margin-top: 2px; font: 600 13px var(--sans); opacity: .75; }
.update-banner ul { margin: 8px 0 0 18px; font: 600 14px/1.5 var(--sans); }
.update-banner form { flex-shrink: 0; }
@media (max-width: 560px) {
  .update-banner { flex-direction: column; }
  .update-banner form, .update-banner .btn { width: 100%; }
}
.changes { margin: 6px 0 0 18px; color: #ccc; font: 500 13px/1.6 var(--sans); }
.version-box b.mono { font: 700 18px var(--mono); }
.sidebar .version { color: #555; font-size: 11px; }

/* ============ FIESTAS ============ */

/* formulario público: elegir fiesta */
.party-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.party-option { cursor: pointer; display: block; margin: 0 !important; }
.party-option input { position: absolute; opacity: 0; pointer-events: none; }
.party-option span {
  display: block; padding: 10px 12px; height: 100%;
  background: var(--paper); border: 1.5px solid rgba(0,0,0,.75);
  transition: background .15s, box-shadow .15s, color .15s;
}
.party-option b { display: block; font: 900 16px var(--sans); text-transform: uppercase; letter-spacing: 0; }
.party-option small { display: block; font: 600 11px var(--sans); text-transform: none; letter-spacing: 0; opacity: .8; margin-top: 2px; }
.party-option input:checked + span { background: #000; color: #fff; box-shadow: 4px 4px 0 rgba(0,0,0,.25); }
.party-option input:focus-visible + span { outline: 2px solid #000; outline-offset: 2px; }
.t-confirm .dl-full { grid-column: 1 / -1; }
.t-confirm .dl-full dd { text-transform: capitalize; font-weight: 800; }

/* panel: barra de fechas */
.party-tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin-bottom: 14px;
  scrollbar-width: thin; scrollbar-color: #333 transparent;
}
.party-tab {
  flex: 0 0 auto; min-width: 74px; text-align: center; text-decoration: none;
  padding: 10px 10px 9px; border-radius: 14px;
  background: #0f0f0f; border: 1px solid #222; color: #bbb;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  transition: border-color .15s, background .15s;
}
.party-tab:hover { border-color: #444; color: #fff; }
.party-tab .pt-day, .party-tab .pt-month { font: 700 10px var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.party-tab b { font: 900 24px/1.05 var(--sans); color: #fff; }
.party-tab small { font: 600 10px var(--sans); color: #777; margin-top: 3px; white-space: nowrap; }
.party-tab.past { opacity: .55; }
.party-tab.active {
  opacity: 1; color: #000; border-color: transparent;
  background: var(--holo); background-size: 200% 200%; animation: holo 12s ease infinite;
}
.party-tab.active b, .party-tab.active small { color: #000; }
.party-tab.all b { font-size: 20px; }

.stats.in-card { padding: 14px; margin: 0; border-bottom: 1px solid #1f1f1f; }
.stats.in-card .stat { background: #131313; }
.result-count { padding: 10px 16px 0; font: 700 12px var(--mono); color: #9dff9a; }

/* búsqueda en vivo */
.search-wrap { position: relative; flex: 1 1 240px; display: flex; min-width: 0; }
.search-wrap .search { flex: 1; padding-right: 40px; }
.search-spinner {
  position: absolute; right: 14px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  border: 2px solid #333; border-top-color: #fff; border-radius: 50%;
  opacity: 0; transition: opacity .15s; animation: spin .7s linear infinite;
}
.toolbar.loading .search-spinner { opacity: 1; }
#live { transition: opacity .15s; }
.toolbar.loading + #live { opacity: .55; }
@keyframes spin { to { transform: rotate(360deg); } }

/* fecha de registro destacada */
.reg-date { display: inline-flex; flex-direction: column; line-height: 1.25; }
.reg-date b {
  display: inline-block; align-self: flex-start; padding: 3px 8px; border-radius: 6px;
  background: #fff; color: #000; font: 800 12px var(--sans); text-transform: uppercase; letter-spacing: .02em;
}
.reg-date span { font: 400 11px var(--mono); color: #888; margin-top: 4px; }
.party-chip {
  display: inline-block; padding: 3px 9px; border-radius: 20px; border: 1px solid #333;
  font: 700 11px var(--sans); text-transform: uppercase; color: #ddd;
}

/* pestaña Fiestas */
.date-block {
  width: 58px; flex-shrink: 0; text-align: center; padding: 6px 0; border-radius: 12px;
  background: #000; border: 1px solid #2a2a2a; color: #aaa;
}
.date-block small { display: block; font: 700 10px var(--mono); text-transform: uppercase; }
.date-block b { display: block; font: 900 22px/1.1 var(--sans); color: #fff; }
.date-block.on { background: var(--holo); background-size: 300% 300%; border: 0; color: #000; }
.date-block.on b { color: #000; }
.party-row.is-past { opacity: .6; }
.state-open { color: #9dff9a; }
.form-card input[type=date] {
  width: 100%; background: #151515; border: 1px solid #262626; border-radius: 10px;
  padding: 11px 14px; color: #fff; font: 500 16px var(--sans); outline: none; color-scheme: dark;
}

@media (max-width: 700px) {
  table.responsive td.cell-date { justify-content: flex-start; padding-bottom: 6px; }
  table.responsive td.cell-date::before { display: none; }
  .reg-date { flex-direction: row; align-items: center; gap: 8px; }
  .reg-date span { margin-top: 0; }
  .stats.in-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.type-row p a.link { color: #c8b6ff; text-decoration: none; }
.type-row p a.link:hover { text-decoration: underline; }

/* =====================================================
   TARJETAS DE FORMULARIO (agregar / editar / ajustes)
   ===================================================== */
.form-card:has(.add-body) { padding: 0; }
.add-body { padding: 22px; }
.add-toggle, .fc-close { display: none; }

.fc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.fc-head h3 { margin: 0; font: 900 18px var(--sans); text-transform: uppercase; letter-spacing: -.01em; }
.fc-head p { margin-top: 2px; color: #888; font: 400 13px/1.35 var(--sans); }
.fc-icon {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px;
  display: grid; place-items: center; font-size: 20px;
  background: var(--holo); background-size: 200% 200%; animation: holo 12s ease infinite;
}

.fc-field { margin-top: 14px; min-width: 0; }
.fc-head + .fc-field, .fc-preview + .fc-field, .fc-preview + .fc-row .fc-field { margin-top: 0; }
.form-card .fc-field > label {
  display: block; margin: 0 0 7px;
  font: 600 12.5px var(--sans); color: #bbb; text-transform: none; letter-spacing: 0;
}
.fc-field label small { color: #666; font-weight: 400; }
.fc-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; }
.fc-row + .help { margin-top: 8px; }

.form-card .fc-field input[type=text],
.form-card .fc-field input[type=email],
.form-card .fc-field input[type=password],
.form-card .fc-field input[type=date] {
  width: 100%; height: 48px; padding: 0 14px;
  background: #141414; border: 1px solid #2a2a2a; border-radius: 12px;
  color: #fff; font: 500 16px var(--sans); outline: none; color-scheme: dark;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.form-card .fc-field input::placeholder { color: #555; }
.form-card .fc-field input:focus {
  border-color: #a78bfa; background: #171717;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, .18);
}
.form-card .fc-field .code-input { text-align: center; text-transform: uppercase; font-weight: 800; letter-spacing: .12em; }

/* contraseña con botón ver */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 50px !important; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 36px; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; font-size: 16px; opacity: .45; transition: opacity .15s, background .15s;
}
.pw-eye:hover, .pw-eye.on { opacity: 1; background: #222; }

/* selector segmentado (repetir semanas) */
.seg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; background: #141414; border: 1px solid #2a2a2a; border-radius: 12px; padding: 4px; }
.form-card .seg label { margin: 0; display: block; cursor: pointer; text-transform: none; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; text-align: center; padding: 10px 2px; border-radius: 9px;
  font: 700 12.5px var(--sans); color: #999; white-space: nowrap; transition: background .15s, color .15s;
}
.seg label:hover span { color: #fff; }
.seg input:checked + span { background: #fff; color: #000; }
.seg input:focus-visible + span { outline: 2px solid #a78bfa; }

/* rol: tarjetas de opción */
.role-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-card .role-options label { margin: 0; cursor: pointer; text-transform: none; display: block; }
.role-options input { position: absolute; opacity: 0; pointer-events: none; }
.role-options span {
  display: block; height: 100%; padding: 12px; border-radius: 12px;
  background: #141414; border: 1px solid #2a2a2a; transition: border-color .15s, background .15s;
}
.role-options b { display: block; font: 800 14px var(--sans); color: #fff; }
.role-options small { display: block; margin-top: 4px; font: 400 12px/1.35 var(--sans); color: #888; }
.role-options input:checked + span { border-color: #a78bfa; background: rgba(167, 139, 250, .1); box-shadow: inset 0 0 0 1px #a78bfa; }
.role-options input:focus-visible + span { outline: 2px solid #a78bfa; outline-offset: 2px; }

/* vistas previas */
.fc-preview { margin: 0 0 18px; }
.party-preview {
  display: flex; align-items: center; gap: 14px; padding: 12px;
  border-radius: 14px; background: #141414; border: 1px dashed #333;
}
.party-preview .date-block { width: 62px; }
.party-preview b[data-pv="nombre"] { display: block; font: 800 16px var(--sans); overflow-wrap: anywhere; }
.party-preview span[data-pv="rango"] { display: block; margin-top: 3px; font: 400 12px var(--mono); color: #9dff9a; }
.party-preview small { text-transform: uppercase; }

/* acciones */
.fc-actions { display: flex; gap: 10px; margin-top: 22px; }
.form-card .fc-actions .btn { margin: 0; flex: 1; height: 48px; font-size: 15px; border-radius: 12px; }
.form-card .fc-actions .btn-dark { flex: 0 1 auto; }
.form-card .fc-actions .btn:only-child { flex: 1; }

/* logo */
.file-drop {
  display: flex !important; align-items: center; gap: 14px; cursor: pointer;
  padding: 10px; border-radius: 14px; border: 1px dashed #333; background: #141414;
  transition: border-color .15s; margin: 0 !important; text-transform: none !important;
}
.file-drop:hover { border-color: #666; }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-txt b { display: block; font: 700 14px var(--sans); color: #fff; }
.file-txt small { display: block; font: 400 12px var(--sans); color: #777; margin-top: 2px; overflow-wrap: anywhere; }
.form-card .check { margin-top: 12px; }

.version-box { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.version-box div { background: #141414; border: 1px solid #2a2a2a; border-radius: 12px; padding: 12px 14px; }
.version-box small { display: block; font: 700 10px var(--mono); color: #777; text-transform: uppercase; letter-spacing: .08em; }
.version-box b { display: block; font: 900 22px var(--sans); margin-top: 4px; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 20px; align-items: start; }

/* ---------- escritorio: formulario fijo a la derecha ---------- */
@media (min-width: 1151px) {
  .types-grid > .add-card { position: sticky; top: 24px; }
  .types-grid { grid-template-columns: minmax(0, 1fr) 360px; }
}

/* ---------- celular / tablet: formulario arriba y plegable ---------- */
@media (max-width: 1150px) {
  .types-grid > .add-card { order: -1; scroll-margin-top: 130px; }
  .add-card:not(.open) { background: transparent; border: 0; overflow: visible; }
  .add-card:not(.open) .add-body { display: none; }
  .add-card.open .add-toggle { display: none; }
  .add-toggle {
    display: flex; align-items: center; justify-content: center; width: 100%; height: 52px;
    border: 1.5px dashed #3a3a3a; border-radius: var(--radius); background: #0f0f0f; cursor: pointer;
    color: #fff; font: 800 15px var(--sans); letter-spacing: .02em;
    transition: border-color .15s, background .15s;
  }
  .add-toggle:hover, .add-toggle:active { border-color: #a78bfa; background: #141414; }
  .fc-close {
    display: grid; place-items: center; margin-left: auto; flex-shrink: 0;
    width: 36px; height: 36px; border-radius: 10px; border: 1px solid #2a2a2a;
    background: #141414; color: #aaa; font-size: 14px; cursor: pointer;
  }
  .add-card.open { animation: fc-in .2s ease; }
  @keyframes fc-in { from { opacity: 0; transform: translateY(-6px); } }
}

@media (max-width: 480px) {
  .add-body { padding: 18px 16px; }
  .fc-row { grid-template-columns: minmax(0, 1fr) 84px; }
  .role-options { grid-template-columns: 1fr; }
  .seg span { font-size: 12px; padding: 10px 0; }
  .fc-actions { flex-direction: column-reverse; }
  .form-card .fc-actions .btn-dark { flex: 1; }
}

/* =====================================================
   LISTAS A TODO EL ANCHO + VENTANAS (crear / editar)
   ===================================================== */
.list-card { width: 100%; }
.main header > .btn { flex-shrink: 0; }

.empty-state { padding: 48px 20px; text-align: center; color: #888; }
.empty-state span { display: block; font-size: 38px; margin-bottom: 8px; }
.empty-state p { margin-bottom: 16px; }

dialog.modal {
  padding: 0; border: 0; background: transparent; color: #fff;
  width: min(480px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 48px);
  margin: auto; overflow: visible;
}
dialog.modal::backdrop { background: rgba(0, 0, 0, .7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog.modal .form-card {
  background: #0f0f0f; border: 1px solid #262626; border-radius: 22px;
  max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(167, 139, 250, .08);
}
dialog.modal[open] { animation: modal-in .2s ease; }
dialog.modal[open]::backdrop { animation: fade-in .2s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }

dialog.modal .fc-close {
  display: grid; place-items: center; margin-left: auto; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid #2a2a2a;
  background: #141414; color: #aaa; font-size: 14px; cursor: pointer; transition: color .15s, border-color .15s;
}
dialog.modal .fc-close:hover { color: #fff; border-color: #555; }
dialog.modal:not(.is-edit) [data-only="edit"],
dialog.modal.is-edit [data-only="create"] { display: none; }
dialog.modal .fc-actions .btn { width: auto; }
dialog.modal .fc-actions .btn-dark { flex: 0 0 auto; padding: 0 20px; }

/* celular: panel que sube desde abajo */
@media (max-width: 700px) {
  dialog.modal {
    width: 100%; max-height: 94dvh; margin: auto 0 0;
  }
  dialog.modal .form-card {
    border-radius: 22px 22px 0 0; border-bottom: 0; max-height: 94dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  dialog.modal .form-card::before {
    content: ''; display: block; width: 40px; height: 4px; border-radius: 4px;
    background: #333; margin: 10px auto 0;
  }
  dialog.modal[open] { animation: sheet-up .25s cubic-bezier(.2, .8, .2, 1); }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  dialog.modal .fc-actions { flex-direction: row; }
  dialog.modal .fc-actions .btn-holo { flex: 1; }
}

/* Nº de entrada en el panel */
.cell-title strong { display: block; }
.ticket-code {
  display: inline-block; margin-top: 4px; padding: 1px 7px; border-radius: 6px;
  background: #1c1c1c; border: 1px solid #2c2c2c; color: #ccc;
  font: 700 11px var(--mono); letter-spacing: .04em;
}
@media (max-width: 700px) {
  table.responsive td.cell-title { flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; }
}
