:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel2: #273449;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --pri: #2563eb;
  --pri-h: #1d4ed8;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: #60a5fa; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; font-size: 18px; }
.container { max-width: 1000px; margin: 0 auto; padding: 24px; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.card.narrow { width: 100%; max-width: 380px; }
h1 { font-size: 22px; margin: 0 0 4px; text-wrap: balance; }
h2 { font-size: 16px; margin: 0 0 14px; text-wrap: balance; }
.muted { color: var(--muted); font-size: 13px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); font-size: 14px;
}
textarea { resize: vertical; min-height: 70px; font-family: ui-monospace, monospace; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }
.check { display: flex; align-items: center; gap: 8px; margin: 14px 0; }
.check input { width: auto; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 10px 16px; border-radius: 8px; border: 1px solid var(--pri);
  background: var(--pri); color: #fff; font-weight: 600; font-size: 14px; text-decoration: none;
  transition: background-color .15s ease, scale .1s ease;
}
.btn:hover { background: var(--pri-h); }
.btn:active { scale: 0.96; }
.btn.sec { background: transparent; color: var(--text); border-color: var(--border); }
.btn.sec:hover { background: var(--panel2); }
.btn.danger { background: transparent; color: #fca5a5; border-color: #7f1d1d; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.full { width: 100%; justify-content: center; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.archivos, .bytes { font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: rgba(34,197,94,.15); color: #4ade80; }
.badge.error { background: rgba(239,68,68,.15); color: #fca5a5; }
.badge.run { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge.idle { background: rgba(148,163,184,.15); color: var(--muted); }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert.ok { background: rgba(34,197,94,.12); border: 1px solid #14532d; color: #86efac; }
.alert.err { background: rgba(239,68,68,.12); border: 1px solid #7f1d1d; color: #fca5a5; }
.flex { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.mono { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); word-break: break-all; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--green); }
.dot.off { background: var(--muted); }
pre.log { background: #0b1220; border: 1px solid var(--border); border-radius: 8px; padding: 12px; max-height: 320px; overflow: auto; font-size: 12px; }

/* ─── Mobile: la tabla se convierte en cards ─────────────────────────────── */
@media (max-width: 720px) {
  .container { padding: 16px 14px; }
  .topbar { padding: 12px 16px; }
  .flex.between { flex-wrap: wrap; }
  .btn.sm { min-height: 40px; }

  /* El contenedor de la tabla se aplana para no anidar card dentro de card. */
  .table-wrap { background: transparent; border: none; box-shadow: none; padding: 0; }

  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }

  /* Cada fila es un card. */
  tr {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
  }

  /* Cada celda: etiqueta (data-label) a la izquierda, valor a la derecha. */
  td {
    border-bottom: none;
    padding: 7px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px 14px;
  }
  td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    flex: 0 0 auto;
  }

  /* El mensaje de error del estado salta a su propia línea, ancho completo. */
  td.estado .mono { flex-basis: 100%; text-align: left; }

  /* Celda principal (nombre + rutas): bloque, hace de encabezado del card. */
  td.cell-main {
    display: block;
    padding: 0 0 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
  }
  td.cell-main strong { font-size: 15px; }

  /* Acciones: botones a todo el ancho y táctiles. */
  td.cell-actions { display: block; padding-top: 10px; }
  td.cell-actions .actions { gap: 8px; }
  td.cell-actions .actions > *,
  td.cell-actions .actions form { flex: 1 1 calc(50% - 6px); }
  td.cell-actions .actions form { display: flex; margin: 0; }
  td.cell-actions .btn { width: 100%; justify-content: center; min-height: 42px; }
}
