/* TXT 2026 - estilos generales (tema neutro con sidebar oscura) */

:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --side-bg: #101828;
  --side-ink: #cbd5e1;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --ok: #16a34a;
  --warn-bg: #fef3c7;
  --warn-ink: #92400e;
  --err-bg: #fee2e2;
  --err-ink: #991b1b;
  --radius: 12px;
  font-size: 16px;

  --grad-brand: linear-gradient(135deg, #3b82f6, #1d4ed8);
  --grad-page:
    radial-gradient(1100px 640px at 100% -5%, rgba(37, 99, 235, .12), transparent 60%),
    radial-gradient(900px 620px at -10% 110%, rgba(29, 78, 216, .12), transparent 55%);
  --grad-dark:
    radial-gradient(700px 460px at 12% 0%, rgba(59, 130, 246, .30), transparent 60%),
    radial-gradient(620px 460px at 100% 100%, rgba(29, 78, 216, .42), transparent 55%),
    #0b1220;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--grad-page), var(--bg);
  background-attachment: fixed;
  color: var(--ink);
}

#app { display: flex; min-height: 100vh; }

/* ------------------------------- sidebar -------------------------------- */
#sidebar {
  width: 230px;
  flex: 0 0 230px;
  background: var(--grad-dark);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.side-title { font-weight: 700; letter-spacing: .5px; color: #fff; }

.brand-badge {
  display: inline-flex;
  align-items: center;
  background: var(--grad-brand);
  color: #fff;
  font-weight: 800;
  font-size: .72rem;
  border-radius: 8px;
  padding: 6px 9px;
  letter-spacing: 1.5px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .35);
}
.brand-badge--lg { font-size: .85rem; padding: 9px 12px; border-radius: 10px; }

#main-nav { display: flex; flex-direction: column; gap: 6px; }
#main-nav button {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: .92rem;
  letter-spacing: .3px;
  transition: background .15s ease, color .15s ease;
}
#main-nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
#main-nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
#main-nav button.active { background: var(--grad-brand); color: #fff; box-shadow: 0 4px 14px rgba(37, 99, 235, .35); }

#btn-logout {
  margin-top: auto;
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  text-align: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.18);
  font-size: .88rem;
  font-weight: 600;
}
#btn-logout:hover { background: rgba(220,38,38,.25); border-color: rgba(220,38,38,.55); color: #fff; }

/* -------------------------------- layout -------------------------------- */
#view { flex: 1; padding: 34px 40px; max-width: 1200px; margin: 0 auto; width: 100%; }
.view-loading { text-align: center; margin-top: 40vh; }

.view h2 { margin: 0 0 6px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.narrow { max-width: 760px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
}

.muted { color: var(--muted); }
.small { font-size: .84rem; }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.card.mini { padding: 14px 16px; font-size: .92rem; }

.hero {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--grad-dark);
  border: none;
  color: #e2e8f0;
}
.hero h3 { margin: 0 0 6px; font-size: 1.25rem; color: #fff; }
.hero p { margin: 0; color: #94a3b8; }
.hero .muted { color: #94a3b8; }
.hero .btn-accent { background: #fff; color: var(--accent-2); box-shadow: 0 8px 20px rgba(2, 6, 23, .35); }
.hero .btn-accent:hover:not(:disabled) { filter: none; background: #f1f5f9; }

/* ------------------------------- botones -------------------------------- */
.btn {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: inline-block;
  text-align: center;
  font-weight: 600;
  font-size: .92rem;
  padding: 10px 18px;
  border-radius: 10px;
  transition: filter .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary,
.btn-accent {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .30);
}
.btn-primary:hover:not(:disabled),
.btn-accent:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 8px 22px rgba(37, 99, 235, .38); }
.btn-success { background: linear-gradient(135deg, #22c55e, #15803d); color: #fff; box-shadow: 0 6px 18px rgba(22, 163, 74, .28); }
.btn-success:hover:not(:disabled) { filter: brightness(1.06); }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.btn-ghost:hover:not(:disabled) { background: var(--bg); }
.btn-danger-ghost { border: 1px solid #fecaca; color: #b91c1c; background: #fff; }
.btn-danger-ghost:hover:not(:disabled) { background: #fef2f2; }
.btn-big { font-size: 1.02rem; padding: 14px 26px; }
.btn-block { width: 100%; margin-top: 6px; }
.btn-icon { all: unset; cursor: pointer; font-size: 1rem; padding: 4px 8px; border-radius: 8px; }
.btn-icon:hover { background: var(--bg); }

/* -------------------------------- forms --------------------------------- */
label { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 6px; }
input, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: .95rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid rgba(37,99,235,.35); border-color: var(--accent); }
textarea { resize: vertical; font-family: Consolas, monospace; line-height: 1.5; }
.hint { font-size: .82rem; color: var(--muted); margin: 6px 0 0; }
code { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; font-size: .85em; }

.alert { border-radius: 10px; padding: 10px 14px; font-size: .9rem; margin: 12px 0 0; }
.alert-error { background: var(--err-bg); color: var(--err-ink); border: 1px solid #fecaca; }
.alert-ok { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid #fde68a; }

/* ---------------------------- barra de progreso ------------------------- */
.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(37, 99, 235, .18);
  overflow: hidden;
  z-index: 100;
}
.progress > span {
  display: block;
  height: 100%;
  width: 40%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  animation: progress-slide 1.1s ease-in-out infinite;
}
@keyframes progress-slide {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(120%); }
  100% { transform: translateX(260%); }
}

.login-progress {
  margin-top: 14px;
  height: 6px;
  border-radius: 999px;
  background: rgba(37, 99, 235, .15);
  overflow: hidden;
}
.login-progress > span {
  display: block;
  height: 100%;
  width: 40%;
  background: var(--accent);
  border-radius: 999px;
  animation: progress-slide 1.1s ease-in-out infinite;
}

/* --------------------------------- login -------------------------------- */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
}

.login-aside {
  position: relative;
  overflow: hidden;
  color: #e2e8f0;
  background: var(--grad-dark);
  padding: 56px 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}
.login-aside__brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.05rem; color: #fff; letter-spacing: .4px; }
.login-aside__pitch h2 { margin: 0 0 14px; font-size: 1.9rem; line-height: 1.25; color: #fff; letter-spacing: -.01em; }
.login-aside__pitch p { margin: 0; max-width: 42ch; color: #94a3b8; font-size: 1rem; line-height: 1.6; }
.login-aside__foot { margin: 0; font-size: .82rem; color: #64748b; }

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.login-box {
  width: 100%;
  max-width: 400px;
  padding: 34px 32px 30px;
  box-shadow: 0 20px 50px rgba(2, 6, 23, .12);
}
.login-box__head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.login-box__head h1 { font-size: 1.35rem; margin: 0 0 2px; letter-spacing: -.01em; }
.login-box__head p { margin: 0; font-size: .9rem; }
.login-box label:first-of-type { margin-top: 0; }
.login-box .btn-block { margin-top: 20px; padding: 12px 18px; }

.input-affix { position: relative; }
.input-affix input { padding-right: 44px; }
.input-affix__btn {
  all: unset;
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: .95rem;
  line-height: 1;
  color: var(--muted);
}
.input-affix__btn:hover { background: var(--bg); color: var(--ink); }

@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; }
  .login-aside { display: none; }
}

/* -------------------------------- wizard -------------------------------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 50;
}
.modal {
  width: 760px; max-width: 100%;
  max-height: 90vh; overflow: auto;
  display: block;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-head h3 { margin: 0; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.modal-foot span { flex: 1; }

.resumen { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 4px; font-size: .95rem; }

.preview {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  font-family: Consolas, "Courier New", monospace;
  font-size: .72rem;
  line-height: 1.45;
  overflow: auto;
  max-height: 320px;
  white-space: pre;
  margin: 6px 0 0;
}
#wiz-preview-wrap h4 { margin: 14px 0 4px; }

/* ------------------------------- historial ------------------------------ */
.hist-list { display: grid; gap: 12px; margin-top: 16px; }
.hist-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.hist-info { display: grid; gap: 4px; }
.hist-stats { display: flex; gap: 18px; margin-top: 4px; font-size: .92rem; }
.hist-stats strong { font-size: 1rem; }
.hist-actions { display: flex; gap: 8px; }
.empty { text-align: center; padding: 46px 20px; margin-top: 16px; line-height: 1.7; }

/* ----------------------------- configuracion ---------------------------- */
.form-card { margin-top: 16px; }

.cfg-cols {
  margin: 20px 0 4px;
  padding: 16px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(37, 99, 235, .05), transparent);
}
.cfg-cols legend { font-weight: 700; font-size: .92rem; padding: 0 6px; }
.cfg-cols__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.cfg-col label { margin: 0 0 6px; }
.cfg-col__input {
  text-align: center;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 2px;
}
.cfg-actions { display: flex; gap: 10px; margin-top: 18px; }

.cfg-modulo { display: flex; gap: 8px; margin-bottom: 8px; }
.cfg-modulo__valor { flex: 0 0 130px; text-align: right; font-weight: 600; }
.cfg-modulo__etq { flex: 1; }
.cfg-modulo__del { flex: none; align-self: center; color: var(--muted); }
.cfg-modulo__del:hover { color: var(--err-ink); background: var(--err-bg); }

.btn-sm { padding: 6px 12px; font-size: .84rem; }

/* -------------------------- tablas y estadística ------------------------ */
.tabla-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; }
.tabla { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabla th, .tabla td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tabla th { background: var(--bg); font-weight: 700; }
.tabla tr:last-child td { border-bottom: none; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla .fila-error td { background: #fef2f2; }
.tabla .db { display: block; margin-top: 3px; }
.mono { font-family: Consolas, "Courier New", monospace; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.pill-ok { background: #dcfce7; color: #14532d; }
.pill-error { background: var(--err-bg); color: var(--err-ink); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.stat {
  padding: 16px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--grad-brand);
  color: #fff;
  text-align: center;
}
.stat:nth-child(n+4) { background: #fff; color: var(--ink); }
.stat__n {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat__l { display: block; font-size: .78rem; opacity: .85; margin-top: 4px; }

.modal-wide { width: 960px; max-height: 92vh; }
#wiz-paso1, #wiz-paso2 { max-width: 580px; }

/* ------------------------------ responsive ------------------------------ */
@media (max-width: 900px) {
  #app { flex-direction: column; }
  #sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; flex-wrap: wrap;
  }
  #main-nav { flex-direction: row; flex-wrap: wrap; }
  #btn-logout { margin-top: 0; margin-left: auto; }
  #view { padding: 22px 16px; }
}
