:root {
  --bg: #0f1218; --panel: #171c26; --panel2: #1e2532; --line: #2a3242;
  --txt: #e6e9ef; --muted: #8b95a7; --accent: #4c8dff; --accent2: #2f6fd6;
  --ok: #2ecc71; --run: #4c8dff; --err: #ff5a5f; --warn: #f5a623; --gray: #6b7280;
  --radius: 10px; --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg); color: var(--txt); line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-size: .86rem; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .8rem 1.5rem; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.05rem; }
.topbar nav { display: flex; align-items: center; gap: 1.2rem; flex: 1; }
.topbar .spacer { flex: 1; }
.whoami { color: var(--muted); font-size: .9rem; }

.container { max-width: 1080px; margin: 0 auto; padding: 1.5rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
h1 { font-size: 1.4rem; margin: 0; } h2 { font-size: 1.05rem; margin: 1.6rem 0 .8rem; }

/* Botones */
.btn, .btn-ghost, .btn-danger {
  display: inline-block; padding: .5rem .9rem; border-radius: var(--radius);
  border: 1px solid var(--line); cursor: pointer; font-size: .9rem; font-family: inherit;
}
.btn { background: var(--accent); color: #fff; border-color: var(--accent2); }
.btn:hover { background: var(--accent2); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--txt); }
.btn-ghost:hover { background: var(--panel2); text-decoration: none; }
.btn-danger { background: transparent; color: var(--err); border-color: var(--err); }
.btn-danger:hover { background: rgba(255,90,95,.12); }
.btn-cutover { background: transparent; color: var(--warn); border-color: var(--warn); font-weight: 600; }
.btn-cutover:hover { background: rgba(245,166,35,.14); }

/* Tabla */
.grid { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
.grid th, .grid td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--line); }
.grid th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.grid tr:last-child td { border-bottom: none; }

/* Badges de estado */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 20px; font-size: .78rem; font-weight: 600; text-transform: capitalize; }
.badge.queued { background: rgba(107,114,128,.25); color: #cbd2df; }
.badge.running { background: rgba(76,141,255,.2); color: #8fb6ff; }
.badge.done { background: rgba(46,204,113,.18); color: #6ee7a0; }
.badge.error { background: rgba(255,90,95,.18); color: #ff8a8e; }
.badge.paused { background: rgba(245,166,35,.18); color: #f7c063; }
.badge.pending { background: rgba(107,114,128,.2); color: #aeb6c4; }
.badge.skipped { background: rgba(107,114,128,.15); color: #9aa3b2; }

/* Barras de progreso */
.bar { height: 7px; background: var(--panel2); border-radius: 20px; overflow: hidden; display: inline-block; width: 140px; vertical-align: middle; }
.bar-fill { height: 100%; background: var(--accent); transition: width .4s ease; }
.pct { margin-left: .5rem; color: var(--muted); font-size: .8rem; }

/* Cards / forms */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin-bottom: 1.4rem; }
.form label { display: block; margin-bottom: .9rem; font-size: .9rem; color: var(--muted); }
.form input, .form textarea, .form select {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .7rem;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--txt); font-size: .95rem; font-family: inherit;
}
.form textarea { font-family: var(--mono); font-size: .85rem; }
.form small { color: var(--muted); font-size: .78rem; }
.form .row { display: flex; gap: 1rem; }
.form .row label { flex: 1; }
.form .row label.narrow { max-width: 140px; }
.hint { color: var(--muted); font-size: .85rem; }
.hint code, .form code { background: var(--panel2); padding: .1rem .35rem; border-radius: 5px; font-family: var(--mono); font-size: .82rem; }

.empty { padding: 2.5rem; text-align: center; color: var(--muted); background: var(--panel); border-radius: var(--radius); border: 1px dashed var(--line); }
.alert { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.alert.error { background: rgba(255,90,95,.12); color: #ff8a8e; border: 1px solid rgba(255,90,95,.3); }

/* Detalle cuenta */
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem 1.5rem; }
.meta .k { color: var(--muted); font-size: .8rem; display: inline-block; min-width: 130px; }
.actions { display: flex; gap: .6rem; margin: 1rem 0; flex-wrap: wrap; }
.actions form { margin: 0; }
.steps { display: flex; flex-direction: column; gap: .7rem; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.step-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.step-name { font-weight: 600; font-family: var(--mono); font-size: .9rem; }
.step .bar { width: 100%; }
.step-detail { color: var(--muted); margin-top: .4rem; min-height: 1.1em; }
.log { background: #0a0d12; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; font-family: var(--mono); font-size: .8rem; max-height: 420px; overflow: auto; white-space: pre-wrap; color: #c6d0df; }

/* Login */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 2rem; width: 340px; }
.login-card h1 { text-align: center; margin: 0; }
.login-card .sub { text-align: center; color: var(--muted); margin: .3rem 0 1.4rem; font-size: .9rem; }
.login-card label { display: block; margin-bottom: 1rem; font-size: .85rem; color: var(--muted); }
.login-card input { display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; color: var(--txt); }
.login-card .btn { width: 100%; text-align: center; margin-top: .5rem; }

/* Página /accesos */
.muted { color: var(--muted); }
.acc-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 8px 0 16px; }
.acc-tools input[type=search] { flex: 1 1 320px; background: var(--panel2); border: 1px solid var(--line);
  color: var(--txt); border-radius: var(--radius); padding: 8px 12px; font: inherit; }
.acc-tools input[type=search]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.acc-server { margin-bottom: 28px; }
.acc-server h2 { font-size: 16px; margin: 0 0 8px; }
.acc-server h2 small { color: var(--muted); font-weight: normal; margin-left: 8px; }
.acc-grid .btn-ghost { padding: 2px 8px; font-size: 12px; }
.acc-pw { white-space: nowrap; }
.pw { display: inline-block; min-width: 10ch; }
