/* =============================================================
   GSI FABRIL · SISTEMA DE TICKETS
   Hoja única. Paleta tomada del logotipo (pizarra #3E466A, acero #939597).
   ============================================================= */

@property --iris {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 0%;
}

:root {
  --brand: #3e466a;
  --brand-deep: #262c4a;
  --brand-ink: #1a1f36;
  --steel: #939597;
  --steel-soft: #c9cbcf;
  --concrete: #eceef1;
  --paper: #ffffff;
  --ink: #161a2c;
  --muted: #646a7a;
  --line: #dcdfe5;
  --line-soft: #e9ebef;
  --signal: #d99a12;
  --signal-soft: #fdf3dc;
  --ok: #1e7a52;
  --ok-soft: #e6f4ec;
  --danger: #b3261e;
  --danger-soft: #fcebea;
  --focus: 0 0 0 3px rgba(62, 70, 106, .28);

  --font: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --shadow-card: 0 1px 2px rgba(22, 26, 44, .05), 0 18px 48px -18px rgba(22, 26, 44, .22);
  --shadow-pop: 0 30px 80px -20px rgba(16, 20, 40, .45);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--concrete); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--concrete);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- botones ---------- */
.btn {
  --bg: var(--paper); --fg: var(--ink); --bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px; padding: 0 20px;
  border: 1px solid var(--bd); border-radius: var(--r-md);
  background: var(--bg); color: var(--fg);
  font-weight: 600; font-size: 15px; letter-spacing: .005em;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .12s ease, box-shadow .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--steel-soft); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-primary { --bg: var(--brand); --fg: #fff; --bd: var(--brand); box-shadow: 0 8px 20px -10px rgba(38, 44, 74, .7); }
.btn-primary:hover { --bg: var(--brand-deep); --bd: var(--brand-deep); }
.btn-danger { --bg: var(--danger); --fg: #fff; --bd: var(--danger); }
.btn-danger:hover { --bg: #8f1d17; --bd: #8f1d17; }
.btn-ghost { --bg: transparent; --bd: transparent; --fg: var(--muted); }
.btn-ghost:hover { --bg: rgba(62, 70, 106, .07); --fg: var(--ink); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: var(--r-sm); }
.btn .icon { width: 18px; height: 18px; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
.btn.is-loading .icon { display: none; }

.link-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin: -8px -12px;
  border: 0; border-radius: var(--r-sm); background: none;
  color: var(--brand); font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none;
  transition: background .18s ease;
}
.link-btn:hover { background: rgba(62, 70, 106, .08); }

/* ---------- campos ---------- */
.input, .textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  padding: 0 16px;
  min-height: 56px;
  font-size: 17px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.textarea { padding: 14px 16px; min-height: 160px; resize: vertical; line-height: 1.55; font-size: 16px; }
.input::placeholder, .textarea::placeholder { color: #9aa0ab; }
.input:hover, .textarea:hover { border-color: var(--steel-soft); }
.input:focus, .textarea:focus { border-color: var(--brand); box-shadow: var(--focus); }
.is-invalid .input, .is-invalid .textarea, .input.is-invalid { border-color: var(--danger); }
.field-error {
  min-height: 22px; margin: 8px 0 0;
  color: var(--danger); font-size: 14px; font-weight: 500;
  opacity: 0; transform: translateY(-4px);
  transition: opacity .2s ease, transform .2s ease;
}
.is-invalid .field-error { opacity: 1; transform: none; }
.shake { animation: shake .42s var(--ease); }

/* =============================================================
   SPLASH · 3 segundos
   ============================================================= */
.splash {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: var(--paper);
  overflow: hidden;
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent var(--iris), #000 calc(var(--iris) + .5%));
          mask: radial-gradient(circle at 50% 50%, transparent var(--iris), #000 calc(var(--iris) + .5%));
}
.splash::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center center;
  opacity: 0;
  animation: fadeIn .8s ease .1s forwards;
}
.splash-axis { position: absolute; background: var(--brand); }
.splash-axis-h { left: 0; right: 0; top: 50%; height: 1px; transform: scaleX(0); animation: axisX .75s var(--ease-out) forwards, axisDockY .65s var(--ease) 1.15s forwards; }
.splash-axis-v { top: 0; bottom: 0; left: 50%; width: 1px; transform: scaleY(0); animation: axisY .75s var(--ease-out) .1s forwards, axisDockX .65s var(--ease) 1.15s forwards; }

/* La mira se dibuja, fija el centro y se acomoda sobre la mira del logotipo */
.splash-reticle {
  position: absolute; left: 50%; top: 50%;
  width: min(300px, 70vw); height: min(300px, 70vw);
  margin: calc(min(300px, 70vw) / -2) 0 0 calc(min(300px, 70vw) / -2);
  animation: reticleDock .65s var(--ease) 1.15s forwards;
}
.splash-reticle svg { display: block; width: 100%; height: 100%; overflow: visible; }
.splash-reticle .ring { fill: none; stroke: var(--brand); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.ring-outer { stroke-dasharray: 680; stroke-dashoffset: 680; animation: draw .85s var(--ease-out) .25s forwards; }
.ring-inner { stroke-dasharray: 390; stroke-dashoffset: -390; stroke: var(--steel) !important; animation: draw .7s var(--ease-out) .45s forwards; }
.splash-reticle .lock { fill: var(--steel); transform-origin: 120px 120px; transform: scale(0); animation: lockOn .45s cubic-bezier(.3, 1.6, .5, 1) .8s forwards; }
.splash-reticle .ticks { stroke: var(--brand); stroke-width: 2.4; stroke-linecap: round; transform-origin: 120px 120px; opacity: 0; animation: ticks .8s var(--ease-out) .3s forwards; }

.splash-core { position: relative; z-index: 2; text-align: center; padding: 24px; }
.splash-logo {
  width: min(520px, 84vw); height: auto; margin: 0 auto;
  opacity: 0; filter: blur(6px);
  animation: logoIn .55s ease 1.45s forwards;
}
.splash-title {
  margin: -6px 0 0;
  font-size: clamp(24px, 3.6vw, 40px);
  font-weight: 700; font-stretch: 118%;
  letter-spacing: -.01em;
  color: var(--brand-ink);
  display: flex; justify-content: center; gap: .3em;
}
.splash-title span { display: inline-block; opacity: 0; transform: translateY(60%); animation: wordUp .5s var(--ease-out) forwards; }
.splash-title span:nth-child(1) { animation-delay: 1.62s; }
.splash-title span:nth-child(2) { animation-delay: 1.72s; }
.splash-title span:nth-child(3) { animation-delay: 1.82s; }

.splash.is-leaving { animation: irisOpen .55s cubic-bezier(.7, 0, .3, 1) forwards; pointer-events: none; }
.has-splash { overflow: hidden; }
.has-splash .app-shell { opacity: 0; transform: scale(.985); }
.app-shell { transition: opacity .6s ease, transform .8s var(--ease-out); }
.is-ready .app-shell { opacity: 1; transform: none; }

@keyframes axisX { to { transform: scaleX(1); } }
@keyframes axisY { to { transform: scaleY(1); } }
/* Sin JS el acomodo es genérico; app.js calcula el punto exacto del logotipo. */
@keyframes axisDockX { to { opacity: 0; } }
@keyframes axisDockY { to { opacity: 0; } }
@keyframes reticleDock { 70% { opacity: 1; } to { transform: scale(.6); opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes lockOn { 60% { transform: scale(1.12); } to { transform: scale(1); } }
@keyframes ticks { from { opacity: 0; transform: rotate(-45deg) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes logoIn { to { opacity: 1; transform: none; filter: none; } }
@keyframes wordUp { to { opacity: 1; transform: none; } }
@keyframes irisOpen { from { --iris: 0%; opacity: 1; } 75% { opacity: 1; } to { --iris: 150%; opacity: 0; } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }

/* =============================================================
   PÚBLICO
   ============================================================= */
.public {
  background-color: var(--concrete);
  background-image:
    linear-gradient(rgba(62, 70, 106, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(62, 70, 106, .045) 1px, transparent 1px);
  background-size: 48px 48px;
}
.backdrop-mark {
  position: fixed; right: -180px; bottom: -180px; z-index: 0;
  width: 560px; height: 560px; pointer-events: none;
  color: rgba(62, 70, 106, .07);
}
.backdrop-mark svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1; }

.app-shell { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  width: min(1180px, 100% - 32px); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 0;
}
.topbar .brand img { width: 150px; height: auto; margin: -18px 0; }

.intake {
  flex: 1;
  width: min(1180px, 100% - 32px); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 88px);
  align-items: start;
  padding: clamp(16px, 5vh, 56px) 0 48px;
}
.display {
  margin: 0;
  font-size: clamp(44px, 6.4vw, 84px);
  line-height: .92;
  font-weight: 800; font-stretch: 122%;
  letter-spacing: -.035em;
  color: var(--brand-ink);
}
.lede { margin: 22px 0 0; max-width: 34ch; font-size: 18px; color: var(--muted); }

.steps { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 2px; max-width: 300px; }
.steps li { position: relative; }
.steps button {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 9px 10px; border: 0; border-radius: var(--r-sm); background: none;
  font-size: 15px; color: var(--muted); text-align: left; cursor: default;
  transition: background .2s ease, color .2s ease;
}
.steps .num {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 1.5px solid var(--steel-soft);
  font-size: 13px; font-weight: 600;
  transition: background .25s ease, border-color .25s ease, color .25s ease, transform .3s var(--ease);
}
.steps .num .icon { width: 15px; height: 15px; stroke-width: 2.6; display: none; }
.steps li.is-current button { color: var(--ink); font-weight: 600; background: rgba(255, 255, 255, .7); }
.steps li.is-current .num { background: var(--brand); border-color: var(--brand); color: #fff; transform: scale(1.08); }
.steps li.is-done button { color: var(--ink); cursor: pointer; }
.steps li.is-done button:hover { background: rgba(255, 255, 255, .7); }
.steps li.is-done .num { background: var(--paper); border-color: var(--brand); color: var(--brand); }
.steps li.is-done .num b { display: none; }
.steps li.is-done .num .icon { display: block; }
.steps .val { margin-left: auto; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); font-weight: 400; }

.card {
  position: relative;
  background: var(--paper);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(220, 223, 229, .8);
}
.wizard { padding: clamp(24px, 4vw, 44px); overflow: hidden; }
.meter-row { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--muted); }
.meter { flex: 1; height: 4px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: inherit; transition: width .5s var(--ease); }

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 20px 0 0; padding: 14px 16px; border-radius: var(--r-md);
  font-size: 15px; line-height: 1.45;
}
.alert .icon { margin-top: 1px; }
.alert-error { background: var(--danger-soft); color: #7d1a14; }
.alert-success { background: var(--ok-soft); color: #145338; }

.wizard-viewport { position: relative; margin-top: 32px; min-height: 250px; }
.step { border: 0; margin: 0; padding: 0; min-width: 0; display: none; }
.step.is-active { display: block; }
.step.enter-next { animation: stepInNext .42s var(--ease-out); }
.step.enter-prev { animation: stepInPrev .42s var(--ease-out); }
@keyframes stepInNext { from { opacity: 0; transform: translateX(28px); } }
@keyframes stepInPrev { from { opacity: 0; transform: translateX(-28px); } }

.q { display: block; padding: 0; margin: 0; font-size: clamp(26px, 3vw, 34px); line-height: 1.15; font-weight: 700; letter-spacing: -.02em; color: var(--brand-ink); }
.q-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 18px; border-radius: var(--r-md); background: var(--concrete); color: var(--brand); }
.q-icon .icon { width: 22px; height: 22px; }
.hint { margin: 8px 0 24px; color: var(--muted); }
.counter { display: block; margin-top: 6px; text-align: right; font-size: 13px; color: var(--muted); }
.counter.is-near { color: var(--signal); }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 14px 16px;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  font-weight: 600; letter-spacing: .01em;
  transition: border-color .18s ease, background .18s ease, transform .15s ease;
}
.choice span::before {
  content: ""; width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--steel-soft); background: var(--paper);
  transition: border .2s var(--ease), background .2s ease;
}
.choice:hover span { border-color: var(--steel-soft); }
.choice:active span { transform: scale(.98); }
.choice input:checked + span { border-color: var(--brand); background: rgba(62, 70, 106, .05); }
.choice input:checked + span::before { border: 5.5px solid var(--brand); }
.choice input:focus-visible + span { box-shadow: var(--focus); }
.is-invalid .choice span { border-color: rgba(179, 38, 30, .45); }

.review { margin: 0; border-top: 1px solid var(--line-soft); }
.review > div { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.review dt { color: var(--muted); font-size: 14px; padding-top: 1px; }
.review dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.review .edit { border: 0; background: none; padding: 2px 6px; margin: -2px -6px; border-radius: 6px; color: var(--brand); font-size: 14px; font-weight: 600; cursor: pointer; }
.review .edit:hover { background: rgba(62, 70, 106, .08); }

.wizard-nav { display: flex; justify-content: flex-start; align-items: center; gap: 12px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line-soft); }
.wizard-nav .btn-primary { min-width: 180px; }
.kbd-hint { margin-left: auto; font-size: 13px; color: var(--muted); }
#backBtn.is-hidden { visibility: hidden; }
.kbd-hint kbd { font: inherit; font-weight: 600; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--paper); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.foot { width: min(1180px, 100% - 32px); margin: 0 auto; padding: 24px 0 28px; font-size: 13px; color: var(--muted); }

/* sin JavaScript: se muestran todos los pasos */
.no-js .step { display: block; margin-bottom: 36px; }
.no-js .step[data-step="review"], .no-js .meter-row, .no-js #backBtn, .no-js #nextBtn, .no-js .steps { display: none; }
.js .nojs-submit { display: none; }

/* =============================================================
   MODALES Y AVISOS
   ============================================================= */
.modal-root { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 16px; }
.modal-scrim { position: absolute; inset: 0; background: rgba(22, 26, 44, .46); backdrop-filter: blur(3px); animation: fadeIn .25s ease both; opacity: 0; }
.modal {
  position: relative; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  padding: 28px; animation: popIn .38s var(--ease-out) both;
}
.modal.is-wide { width: min(560px, 100%); }
.modal-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; margin-bottom: 18px; background: var(--concrete); color: var(--brand); }
.modal-icon .icon { width: 26px; height: 26px; }
.modal-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.modal-icon.is-ok { background: var(--ok-soft); color: var(--ok); }
.modal h2 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: -.015em; color: var(--brand-ink); }
.modal p { margin: 8px 0 0; color: var(--muted); }
.modal-body { margin-top: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.modal-close:hover { background: var(--concrete); color: var(--ink); }
.modal-root.is-closing .modal { animation: popOut .2s ease forwards; }
.modal-root.is-closing .modal-scrim { animation: fadeOut .2s ease forwards; }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes popOut { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

.form-stack { display: grid; gap: 14px; }
.form-stack label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.form-stack .input { min-height: 50px; font-size: 16px; }

/* progreso de envío */
.progress-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 4px; }
.progress-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: var(--muted); transition: color .3s ease; }
.progress-list .dot { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--line); transition: background .3s ease, border-color .3s ease; }
.progress-list .dot .icon { width: 14px; height: 14px; stroke-width: 2.8; color: #fff; transform: scale(0); transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }
.progress-list li.is-active { color: var(--ink); }
.progress-list li.is-active .dot { border-color: var(--brand); border-right-color: transparent; animation: spin .8s linear infinite; }
.progress-list li.is-done { color: var(--ink); }
.progress-list li.is-done .dot { background: var(--ok); border-color: var(--ok); }
.progress-list li.is-done .dot .icon { transform: scale(1); }

/* éxito */
.success-mark { width: 72px; height: 72px; margin: 0 0 18px; }
.success-mark circle { fill: none; stroke: var(--ok); stroke-width: 2; stroke-dasharray: 190; stroke-dashoffset: 190; animation: draw .6s var(--ease-out) forwards; }
.success-mark path { fill: none; stroke: var(--ok); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .4s var(--ease-out) .45s forwards; }
.folio {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 20px; padding: 14px 14px 14px 18px;
  border: 1.5px dashed var(--steel-soft); border-radius: var(--r-md); background: #fafbfc;
}
.folio strong { font-size: 20px; letter-spacing: .01em; color: var(--brand-ink); white-space: nowrap; }
.folio small { display: block; font-size: 13px; color: var(--muted); }

/* toasts */
.toasts { position: fixed; z-index: 1100; right: 20px; top: 20px; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  position: relative; overflow: hidden; pointer-events: auto;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 40px 14px 16px; border-radius: var(--r-md);
  background: var(--brand-ink); color: #fff; box-shadow: var(--shadow-pop);
  font-size: 15px; line-height: 1.45;
  animation: toastIn .45s var(--ease-out) both;
}
.toast .icon { margin-top: 1px; }
.admin .toasts { right: auto; left: 20px; top: auto; bottom: 20px; }
.toast.is-ok .icon { color: #7fd3a8; }
.toast.is-error .icon { color: #ff9b94; }
.toast.is-warn .icon { color: #f5c75e; }
.toast button { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: rgba(255, 255, 255, .6); cursor: pointer; }
.toast button:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.toast button .icon { width: 16px; height: 16px; margin: 0; color: inherit !important; }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: rgba(255, 255, 255, .25); transform-origin: left; animation: toastTimer var(--t, 4500ms) linear forwards; }
.toast.is-leaving { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
@keyframes toastTimer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* =============================================================
   CONSULTA DE TICKET (público)
   ============================================================= */
.status-page { width: min(760px, 100% - 32px); margin: 0 auto; padding: 16px 0 48px; flex: 1; }
.status-card { padding: clamp(24px, 4vw, 40px); }
.status-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.status-head h1 { margin: 0; font-size: clamp(28px, 4.2vw, 40px); line-height: 1.05; font-weight: 800; font-stretch: 112%; letter-spacing: -.02em; color: var(--brand-ink); }
.status-head .sub { margin: 6px 0 0; color: var(--muted); }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 8px; margin: -4px -8px; border-radius: 6px; color: var(--brand); font-weight: 600; font-size: 14px; cursor: pointer; }
.copy-btn:hover { background: rgba(62, 70, 106, .08); }
.copy-btn .icon { width: 16px; height: 16px; }

.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 10px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.is-open { background: var(--signal-soft); color: #8a5d00; }
.pill.is-open::before { animation: pulse 1.8s ease-in-out infinite; }
.pill.is-closed { background: var(--ok-soft); color: var(--ok); }
@keyframes pulse { 50% { opacity: .35; } }

.timeline { list-style: none; margin: 30px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; position: relative; }
.timeline::before { content: ""; position: absolute; top: 13px; left: 14px; right: 50%; height: 2px; background: var(--line); }
.timeline.is-closed::before { background: var(--ok); }
.timeline li { position: relative; padding-top: 40px; font-size: 14px; color: var(--muted); }
.timeline li::before { content: ""; position: absolute; top: 0; left: 0; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--paper); box-sizing: border-box; }
.timeline li.is-done::before { background: var(--ok); border-color: var(--ok); box-shadow: inset 0 0 0 5px var(--paper); }
.timeline li.is-waiting::before { border-color: var(--signal); border-style: dashed; animation: spin 6s linear infinite; }
.timeline b { display: block; color: var(--ink); font-size: 15px; }

.details { margin: 28px 0 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line-soft); }
.details > div { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.details > div:nth-child(odd):not(.wide) { padding-right: 16px; }
.details .wide { grid-column: 1 / -1; }
.details dt { font-size: 14px; color: var(--muted); }
.details dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.solution-box { margin-top: 24px; padding: 18px 20px; border-radius: var(--r-md); background: var(--ok-soft); }
.solution-box h2 { margin: 0 0 6px; font-size: 15px; color: var(--ok); }
.solution-box p { margin: 0; white-space: pre-line; }
.status-actions { display: flex; gap: 10px; margin-top: 28px; flex-wrap: wrap; }

.lookup-card { padding: clamp(24px, 4vw, 40px); max-width: 480px; margin: 0 auto; }
.lookup-card h1 { margin: 0; font-size: 30px; line-height: 1.1; letter-spacing: -.02em; color: var(--brand-ink); }
.lookup-card > p { margin: 8px 0 22px; color: var(--muted); }

/* =============================================================
   ADMIN · LOGIN
   ============================================================= */
.login-page {
  min-height: 100vh;
  background-color: var(--brand-ink);
  background-image:
    radial-gradient(circle at 50% 30%, rgba(147, 149, 151, .16), transparent 45%),
    linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: auto, 48px 48px, 48px 48px;
}
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); padding: 36px 32px 30px; }
.login-card .logo { width: 210px; margin: -22px auto -10px; }
.login-card h1 { margin: 0; text-align: center; font-size: 26px; letter-spacing: -.015em; color: var(--brand-ink); }
.login-card .sub { margin: 4px 0 26px; text-align: center; color: var(--muted); font-size: 15px; }
.input-wrap { position: relative; }
.input-wrap > .icon { position: absolute; left: 15px; top: 50%; translate: 0 -50%; color: var(--steel); pointer-events: none; transition: color .18s ease; }
.input-wrap .input { padding-left: 46px; }
.input-wrap:focus-within > .icon { color: var(--brand); }
.eye-btn { position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; }
.eye-btn:hover { background: var(--concrete); color: var(--ink); }
.login-card .btn-primary { width: 100%; margin-top: 6px; }
.login-foot { margin-top: 22px; text-align: center; font-size: 14px; }
.login-foot a { color: var(--muted); text-decoration: none; }
.login-foot a:hover { color: var(--ink); }

/* =============================================================
   ADMIN · PANEL
   ============================================================= */
.admin { background: var(--concrete); }
.admin-bar { position: sticky; top: 0; z-index: 50; background: var(--brand-ink); color: #fff; }
.admin-bar-inner { width: min(1320px, 100% - 32px); margin: 0 auto; height: 64px; display: flex; align-items: center; gap: 20px; }
.admin-bar .logo { flex: none; width: 104px; height: 38px; object-fit: cover; object-position: 50% 50%; padding: 0 6px; background: #fff; border-radius: 8px; }
.admin-bar .title { font-size: 15px; color: rgba(255, 255, 255, .7); padding-left: 20px; border-left: 1px solid rgba(255, 255, 255, .16); }
.admin-bar .spacer { flex: 1; }
.admin-bar a, .admin-bar button { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px; border-radius: var(--r-sm); border: 0; background: none; color: rgba(255, 255, 255, .82); text-decoration: none; font-size: 14px; font-weight: 500; cursor: pointer; }
.admin-bar a:hover, .admin-bar button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.admin-bar .icon { width: 18px; height: 18px; }

.admin-main { width: min(1320px, 100% - 32px); margin: 0 auto; padding: 32px 0 64px; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.admin-head h1 { margin: 0; font-size: clamp(30px, 3.6vw, 42px); line-height: 1; font-weight: 800; font-stretch: 118%; letter-spacing: -.03em; color: var(--brand-ink); }
.admin-head p { margin: 8px 0 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 28px 0 24px; background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.stat { padding: 20px 24px; border-left: 1px solid var(--line-soft); }
.stat:first-child { border-left: 0; }
.stat dt { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat dt::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--steel-soft); }
.stat.is-open dt::before { background: var(--signal); }
.stat.is-closed dt::before { background: var(--ok); }
.stat.is-total dt::before { background: var(--brand); }
.stat dd { margin: 6px 0 0; font-size: 34px; line-height: 1; font-weight: 700; font-stretch: 112%; letter-spacing: -.02em; }
.stat dd.is-bump { animation: bump .5s var(--ease-out); }
@keyframes bump { 40% { transform: translateY(-4px); color: var(--brand); } }

.panel { background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 16px; border-bottom: 1px solid var(--line-soft); }
.segmented { display: inline-flex; padding: 4px; border-radius: var(--r-md); background: var(--concrete); position: relative; }
.segmented a { position: relative; z-index: 1; padding: 8px 14px; border-radius: 9px; text-decoration: none; font-size: 14px; font-weight: 600; color: var(--muted); transition: color .2s ease; display: inline-flex; gap: 8px; align-items: center; }
.segmented a .n { font-weight: 500; opacity: .75; }
.segmented a:hover { color: var(--ink); }
.segmented a.is-active { color: var(--ink); background: var(--paper); box-shadow: 0 1px 3px rgba(22, 26, 44, .12); }
.search { position: relative; flex: 1; min-width: 220px; }
.search .icon { position: absolute; left: 13px; top: 50%; translate: 0 -50%; color: var(--steel); pointer-events: none; }
.search .input { min-height: 44px; padding-left: 42px; font-size: 15px; border-radius: 10px; }
.toolbar .btn { min-height: 44px; }

.t-wrap { overflow-x: auto; }
.t { width: 100%; border-collapse: collapse; font-size: 15px; }
.t th { text-align: left; font-weight: 500; font-size: 13px; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.t td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.t tbody tr { cursor: pointer; transition: background .15s ease; }
.t tbody tr:hover { background: #f7f8fa; }
.t tbody tr:last-child td { border-bottom: 0; }
.t tbody tr.is-flash { animation: rowFlash 1.4s ease; }
.t .folio-cell { font-weight: 600; white-space: nowrap; color: var(--brand-ink); }
.t .muted { color: var(--muted); white-space: nowrap; }
.t .report-cell { color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t .go { width: 40px; color: var(--steel); }
.t .go .icon { transition: transform .2s var(--ease); }
.t tbody tr:hover .go .icon { transform: translateX(3px); color: var(--brand); }
.t tr.is-hidden { display: none; }
.t .meta-line { display: none; }
@keyframes rowFlash { 0%, 40% { background: var(--ok-soft); } }
.empty-state { padding: 56px 16px; text-align: center; color: var(--muted); }
.empty-state .icon { width: 36px; height: 36px; margin: 0 auto 12px; color: var(--steel); stroke-width: 1.4; }
.empty-state b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }
.t-foot { padding: 12px 16px; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line-soft); }

/* panel lateral de detalle */
.drawer-root { position: fixed; inset: 0; z-index: 800; }
.drawer-root .modal-scrim { animation: fadeIn .25s ease forwards; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  background: var(--paper); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
  animation: drawerIn .42s var(--ease-out) both;
}
.drawer-root.is-closing .drawer { animation: drawerOut .25s ease forwards; }
.drawer-root.is-closing .modal-scrim { animation: fadeOut .25s ease forwards; }
@keyframes drawerIn { from { transform: translateX(100%); } }
@keyframes drawerOut { to { transform: translateX(100%); } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line-soft); }
.drawer-head h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.01em; color: var(--brand-ink); font-stretch: 110%; }
.drawer-head .modal-close { position: static; flex: none; }
.drawer-body { flex: 1; overflow: auto; padding: 4px 24px 24px; }
.drawer-body .details { margin-top: 8px; border-top: 0; }
.report-box { white-space: pre-line; }
.close-form { margin-top: 24px; padding: 20px; border-radius: var(--r-md); background: #f7f8fa; border: 1px solid var(--line-soft); }
.close-form label { display: block; font-weight: 600; margin-bottom: 4px; }
.close-form p { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.close-form .textarea { min-height: 130px; background: var(--paper); }
.close-form .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }

/* =============================================================
   RESPONSIVO
   ============================================================= */
@media (max-width: 960px) {
  .intake { grid-template-columns: 1fr; gap: 24px; padding-top: 4px; }
  .display { font-size: clamp(40px, 11vw, 64px); }
  .lede { font-size: 17px; margin-top: 14px; }
  .steps { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 640px) {
  .topbar .brand img { width: 120px; }
  .link-btn span { display: none; }
  .wizard { border-radius: 16px; }
  .choice-grid { grid-template-columns: 1fr; }
  .review > div { grid-template-columns: 1fr auto; }
  .review dt { grid-column: 1; }
  .review dd { grid-column: 1 / -1; grid-row: 2; }
  .review .edit { grid-column: 2; grid-row: 1; }
  .wizard-nav .btn-primary { min-width: 0; flex: 1; }
  .kbd-hint { display: none; }
  .details { grid-template-columns: 1fr; }
  .details > div:nth-child(odd):not(.wide) { padding-right: 0; }
  .timeline li { font-size: 13px; }
  .toasts { left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; }
  @keyframes toastIn { from { opacity: 0; transform: translateY(24px); } }
  @keyframes toastOut { to { opacity: 0; transform: translateY(24px); } }
  .modal { padding: 24px 20px; }
  .modal-actions .btn { flex: 1; }
  .admin-bar .title, .admin-bar .label { display: none; }
  .admin-main { padding-top: 22px; }
  .stat { padding: 16px; }
  .stat dd { font-size: 24px; white-space: nowrap; }
  .admin .toasts { left: 16px; right: 16px; }
  .toolbar .segmented { width: 100%; }
  .segmented a { flex: 1; justify-content: center; padding: 8px 6px; }
  .toolbar .btn { flex: 1; }
  .t thead { display: none; }
  .t, .t tbody, .t tr, .t td { display: block; }
  .t tbody tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
  .t td { padding: 0; border: 0; }
  .t td[data-col="folio"] { grid-column: 1; }
  .t td[data-col="estado"] { grid-column: 2; grid-row: 1; }
  .t td[data-col="nombre"] { grid-column: 1 / -1; }
  .t td[data-col="fecha"], .t td[data-col="area"], .t td[data-col="ubicacion"], .t td[data-col="reporte"], .t td.go { display: none; }
  .t td.meta-line { display: block; grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .splash-axis, .splash-reticle { display: none; }
  .splash-logo, .splash-title span { opacity: 1; transform: none; filter: none; }
}
