:root {
  --bg:          #0E1116;
  --bg-2:        #141921;
  --surface:     #181E27;
  --surface-2:   #1E2630;
  --border:      #28313D;
  --border-soft: #202833;
  --text:        #EAEEF3;
  --muted:       #93A0AE;
  --faint:       #5E6B79;

  --accent:      #F8A23B;
  --accent-2:    #FF7A59;
  --accent-ink:  #2A1B07;

  --st-pendiente: #5B8DEF;
  --st-progreso:  #F8A23B;
  --st-corregido: #3FB950;
  --st-nodisp:    #E5534B;
  --st-cerrado:   #79828D;

  --font-display: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body:    system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, monospace;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px -20px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(248,162,59,.08), transparent 60%),
    radial-gradient(700px 500px at -5% 0%, rgba(91,141,239,.06), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px 80px; }

/* ---- Encabezado de marca ---- */
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 26px 0 22px;
}
.brand .glyph {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 20px;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px -8px rgba(248,162,59,.6);
}
.brand h1 {
  margin: 0; font-family: var(--font-display);
  font-size: 18px; font-weight: 700; letter-spacing: -.01em;
}
.brand .sub { margin: 0; font-size: 12.5px; color: var(--muted); letter-spacing: .02em; }

/* ---- Hero ---- */
.hero { padding: 14px 0 26px; }
.hero .eyebrow {
  font-size: 11.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent);
}
.hero h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(26px, 6vw, 36px); line-height: 1.1; letter-spacing: -.02em;
  margin: 10px 0 10px;
}
.hero p { margin: 0; color: var(--muted); font-size: 15.5px; max-width: 52ch; }

/* ---- Tabs ---- */
.tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--bg-2); border: 1px solid var(--border-soft);
  border-radius: 12px; margin-bottom: 22px;
}
.tab {
  flex: 1; border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 13.5px;
  padding: 10px 8px; border-radius: 8px; color: var(--muted); background: transparent;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.03) inset; }

/* ---- Card / panel ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card + .card { margin-top: 16px; }

/* ---- Formularios ---- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
label .hint { font-weight: 400; color: var(--faint); }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 96px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(248,162,59,.15);
}
select { appearance: none; background-image:
  linear-gradient(45deg, transparent 50%, var(--muted) 50%),
  linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 53%, calc(100% - 13px) 53%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 36px;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 540px) { .row { grid-template-columns: 1fr; } }

/* ---- Botones ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; cursor: pointer; border: 0;
  padding: 12px 18px; border-radius: var(--radius-sm); transition: transform .08s, filter .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  width: 100%;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--faint); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---- Status pills ---- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 650; letter-spacing: .01em;
  padding: 4px 11px 4px 9px; border-radius: 999px;
  border: 1px solid transparent;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.pendiente    { color: var(--st-pendiente); background: rgba(91,141,239,.12);  border-color: rgba(91,141,239,.25); }
.pill.en_progreso  { color: var(--st-progreso);  background: rgba(248,162,59,.12);  border-color: rgba(248,162,59,.25); }
.pill.corregido    { color: var(--st-corregido); background: rgba(63,185,80,.12);   border-color: rgba(63,185,80,.25); }
.pill.no_disponible{ color: var(--st-nodisp);    background: rgba(229,83,75,.12);   border-color: rgba(229,83,75,.25); }
.pill.cerrado      { color: var(--st-cerrado);   background: rgba(121,130,141,.12); border-color: rgba(121,130,141,.25); }

/* ---- Ticket (elemento signature) ---- */
.ticket {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 24px; text-align: center;
}
.ticket::before, .ticket::after {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  top: 50%; transform: translateY(-50%);
}
.ticket::before { left: -12px; }
.ticket::after  { right: -12px; }
.ticket .label { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.ticket .folio {
  font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(28px, 8vw, 40px); letter-spacing: .04em;
  margin: 8px 0 4px; color: var(--text);
}
.ticket .copy {
  margin-top: 10px; font-size: 12.5px; color: var(--accent);
  background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600;
}

/* ---- Lista de reportes ---- */
.report {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 15px 16px; transition: border-color .15s, background .15s;
}
.report:hover { border-color: var(--faint); background: var(--surface-2); }
.report + .report { margin-top: 10px; }
.report .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.report .folio { font-family: var(--font-mono); font-weight: 650; font-size: 14px; }
.report .title { font-weight: 600; font-size: 14.5px; margin: 2px 0; }
.report .meta { font-size: 12.5px; color: var(--muted); }

/* ---- Timeline ---- */
.timeline { margin-top: 16px; padding-left: 4px; }
.tl-item { position: relative; padding: 0 0 16px 22px; }
.tl-item::before { content: ""; position: absolute; left: 3px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.tl-item::after { content: ""; position: absolute; left: 7px; top: 13px; bottom: -2px; width: 1px; background: var(--border); }
.tl-item:last-child::after { display: none; }
.tl-item .tl-status { font-weight: 600; font-size: 13.5px; }
.tl-item .tl-date { font-size: 12px; color: var(--faint); }
.tl-item .tl-note { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ---- Detalle ---- */
.detail-row { display: flex; gap: 10px; font-size: 13.5px; padding: 7px 0; border-top: 1px solid var(--border-soft); }
.detail-row:first-of-type { border-top: 0; }
.detail-row .k { color: var(--muted); min-width: 110px; }
.detail-row .v { color: var(--text); }
.answer {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: rgba(248,162,59,.08); border: 1px solid rgba(248,162,59,.22);
}
.answer .k { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.answer .v { margin-top: 4px; font-size: 14px; }

/* ---- Estados auxiliares ---- */
.note { font-size: 13px; color: var(--muted); margin-top: 12px; text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; font-size: 14px; }
.error-msg { color: var(--st-nodisp); font-size: 13.5px; margin-top: 12px; }
.success-msg { color: var(--st-corregido); font-size: 13.5px; }
.hidden { display: none !important; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.sectionhead { font-family: var(--font-display); font-weight: 650; font-size: 16px; margin: 0 0 4px; }
.muted { color: var(--muted); }
.back {
  background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit;
  font-size: 13.5px; font-weight: 600; padding: 0; margin-bottom: 16px; display: inline-flex; gap: 6px; align-items: center;
}
.back:hover { color: var(--text); }

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