/* ── Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #0e1116;
  --bg-soft: #151a22;
  --bg-panel: #171d27;
  --line: #262e3b;
  --line-soft: #1f2630;
  --txt: #e6eaf2;
  --txt-dim: #98a2b3;
  --txt-faint: #6b7686;
  --accent: #5b8cff;
  --accent-hi: #7ba2ff;
  --accent-soft: #5b8cff1f;
  --ok: #3ecf8e;
  --warn: #f0b429;
  --err: #f2555a;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(900px 400px at 50% -180px, #1c2740 0%, transparent 70%);
  color: var(--txt);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(880px, 100% - 2.5rem); margin-inline: auto; }

h1, h2 { line-height: 1.2; }
a { color: var(--accent); }

/* ── Cabecera ─────────────────────────────────────────────────── */
.topbar { padding: 2.6rem 0 1.6rem; text-align: center; }
.topbar h1 { margin: 0 0 .4rem; font-size: clamp(1.5rem, 4vw, 2rem); letter-spacing: -.02em; }
.sub { margin: 0 auto; max-width: 46ch; color: var(--txt-dim); }
.sub strong { color: var(--txt); font-weight: 600; }

.badges { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: 1.1rem; }
.badge {
  padding: .3rem .7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--txt-dim);
  font-size: .78rem;
  white-space: nowrap;
}
.badge.ok { border-color: #215c43; background: #10281f; color: #79e0b4; }
.badge sup { font-size: .6rem; }

/* ── Zona de arrastre ────────────────────────────────────────── */
.dropzone {
  display: grid;
  justify-items: center;
  gap: .3rem;
  padding: 2.6rem 1.5rem;
  border: 2px dashed var(--line);
  border-radius: 16px;
  background: var(--bg-soft);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: #171e2b; outline: none; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); }
.dz-icon { color: var(--accent); margin-bottom: .3rem; }
.dz-main { margin: 0; font-size: 1.08rem; font-weight: 600; }
.dz-sub { margin: 0; color: var(--txt-dim); }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.dz-formats { margin: .9rem 0 0; color: var(--txt-faint); font-size: .76rem; font-family: var(--mono); }

/* ── Paneles ─────────────────────────────────────────────────── */
.panel {
  margin-top: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel);
  overflow: hidden;
}
.panel-title {
  display: flex; align-items: center; gap: .6rem;
  margin: 0; padding: .9rem 1.1rem;
  font-size: .82rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--txt-dim);
  border-bottom: 1px solid var(--line-soft);
}
.panel-title .count {
  padding: .1rem .45rem; border-radius: 999px;
  background: var(--bg-soft); color: var(--txt-faint);
  font-size: .72rem; letter-spacing: 0; text-transform: none;
}
.panel-title .spacer { flex: 1; }
.toggle { background: none; border: 0; padding: 0; font: inherit; font-size: .72rem; cursor: pointer; }

/* ── Opciones ────────────────────────────────────────────────── */
.opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.1rem 1.4rem;
  padding: 1.1rem;
}
.opts[hidden] { display: none; }

.opt label {
  display: flex; align-items: baseline; gap: .4rem;
  margin-bottom: .4rem;
  font-size: .82rem; font-weight: 600; color: var(--txt);
}
.opt .val { color: var(--accent); font-weight: 500; font-size: .76rem; font-family: var(--mono); }
.hint { margin: .4rem 0 0; color: var(--txt-faint); font-size: .74rem; line-height: 1.4; }

select, input[type="range"] { width: 100%; }

select {
  padding: .5rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--txt);
  font: inherit; font-size: .87rem;
  cursor: pointer;
}
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

input[type="range"] { accent-color: var(--accent); cursor: pointer; }

.opt.check {
  grid-column: 1 / -1;
  display: grid; gap: .7rem;
  align-content: start;
  padding-top: .2rem;
}
.check-label { display: flex; gap: .6rem; align-items: start; cursor: pointer; margin: 0 !important; }
.check-label input { margin-top: .25rem; accent-color: var(--accent); width: 15px; height: 15px; flex: none; cursor: pointer; }
.check-label span { font-weight: 500; font-size: .87rem; }
.check-label small { display: block; margin-top: .15rem; color: var(--txt-faint); font-size: .74rem; font-weight: 400; }
code { font-family: var(--mono); font-size: .9em; background: #0b0f15; padding: .05rem .3rem; border-radius: 4px; }

/* ── Cola ────────────────────────────────────────────────────── */
.queue { margin: 0; padding: 0; list-style: none; }
.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .3rem 1rem;
  align-items: center;
  padding: .8rem 1.1rem;
  border-bottom: 1px solid var(--line-soft);
}
.item:last-child { border-bottom: 0; }
.item .name {
  font-weight: 600; font-size: .9rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item .meta { grid-column: 1; color: var(--txt-faint); font-size: .76rem; font-family: var(--mono); }
.item .side { grid-column: 2; grid-row: 1 / span 2; text-align: right; }

.status { font-size: .74rem; font-weight: 600; white-space: nowrap; }
.status.pend { color: var(--txt-faint); }
.status.work { color: var(--accent); }
.status.done { color: var(--ok); }
.status.fail { color: var(--err); }
.status.skip { color: var(--warn); }

.item .progress { grid-column: 1 / -1; margin-top: .5rem; }
.item .pct { font-size: .74rem; color: var(--txt-dim); font-family: var(--mono); }

.progress {
  height: 6px;
  border-radius: 999px;
  background: #0b0f15;
  overflow: hidden;
}
.progress .bar {
  height: 100%; width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  transition: width .25s ease;
}
.progress.done .bar { background: var(--ok); }
.progress.fail .bar { background: var(--err); }

/* ── Botones ─────────────────────────────────────────────────── */
.btn {
  padding: .65rem 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--txt);
  font: inherit; font-size: .88rem; font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #08101f; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hi); }
.btn.danger { background: #3a1c20; color: #ff9ea1; border-color: #5c2a2f; }
.btn.ghost { background: none; color: var(--txt-dim); border-color: var(--line); }
.btn.sm { padding: .3rem .6rem; font-size: .74rem; font-weight: 500; }
.btn.link {
  background: none; border: 0; padding: 0;
  color: var(--accent); font-size: .8rem; text-decoration: underline;
}

.actions {
  position: sticky; bottom: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: .7rem;
  margin-top: 1.4rem; padding: .85rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #141922f2;
  backdrop-filter: blur(8px);
  z-index: 5;
}
.actions-note { color: var(--txt-faint); font-size: .78rem; }

/* ── Barra del motor ─────────────────────────────────────────── */
.engine-bar { margin-top: 1.4rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-panel); }
.eb-label { display: flex; align-items: center; gap: .5rem; font-size: .87rem; font-weight: 600; margin-bottom: .7rem; }
.eb-note { margin-top: .6rem; color: var(--txt-faint); font-size: .74rem; }

.spinner {
  width: 14px; height: 14px; flex: none;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.engine-error {
  margin-top: 1.4rem; padding: .9rem 1.1rem;
  border: 1px solid #5c2a2f; border-radius: var(--radius);
  background: #26161a; color: #ffb3b5; font-size: .85rem;
}

/* ── Log ─────────────────────────────────────────────────────── */
.log-wrap { margin-top: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-panel); }
.log-wrap summary { padding: .8rem 1.1rem; cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--txt-dim); text-transform: uppercase; letter-spacing: .07em; }
.log-wrap summary:hover { color: var(--txt); }
.log-wrap pre {
  margin: 0; padding: 0 1.1rem 1rem;
  max-height: 320px; overflow: auto;
  color: var(--txt-faint); font-family: var(--mono); font-size: .72rem;
  white-space: pre-wrap; word-break: break-word;
}

/* ── Pie ─────────────────────────────────────────────────────── */
.footnote { margin: 1.8rem 0 3rem; color: var(--txt-faint); font-size: .74rem; line-height: 1.6; text-align: center; }
.footnote em { color: var(--txt-dim); }

@media (max-width: 560px) {
  .item { grid-template-columns: 1fr; }
  .item .side { grid-column: 1; grid-row: auto; text-align: left; margin-top: .3rem; }
  .actions { flex-direction: column; align-items: stretch; }
}

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