:root {
   --fondo: #f3f4f6; --tarjeta: #ffffff; --texto: #1f2937; --tenue: #6b7280; --borde: #e5e7eb;
   --primario: #0f766e; --primarioTexto: #ffffff; --barra: #111827; --barraTexto: #e5e7eb;
   --verde: #16a34a; --rojo: #dc2626; --ambar: #d97706; --gris: #9ca3af;
   --logFondo: #0b1020; --logTexto: #d1d5db;
}
@media (prefers-color-scheme: dark) {
   :root {
      --fondo: #0f141a; --tarjeta: #171d25; --texto: #e5e7eb; --tenue: #9ca3af; --borde: #2a323d;
      --primario: #14b8a6; --primarioTexto: #04201d; --barra: #0b0f14; --barraTexto: #e5e7eb;
   }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fondo); color: var(--texto); }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
h2 { font-size: 15px; margin: 0 0 10px; }
code { font-size: 12px; }

.barra { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 16px; background: var(--barra); color: var(--barraTexto); }
.barra nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.barra nav a { color: var(--barraTexto); text-decoration: none; padding: 6px 12px; border-radius: 6px; }
.barra nav a:hover { background: rgba(255,255,255,.08); }
.barra nav a.activo { background: var(--primario); color: var(--primarioTexto); }
.barra nav a.salir { margin-left: auto; }
.marca { font-weight: 700; font-size: 16px; }
.marca span { color: var(--primario); font-weight: 600; }

.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 10px; padding: 16px; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.nota { color: var(--tenue); font-size: 12px; margin: 0 0 12px; }
.error { color: var(--rojo); font-weight: 600; }
.aviso { background: rgba(217,119,6,.12); color: var(--ambar); border-radius: 6px; padding: 8px 10px; }

table.estado { width: 100%; border-collapse: collapse; }
table.estado td { padding: 6px 0; border-bottom: 1px solid var(--borde); vertical-align: top; }
table.estado tr:last-child td { border-bottom: 0; }
table.estado td:first-child { white-space: nowrap; padding-right: 12px; }
table.estado td:last-child { color: var(--tenue); word-break: break-word; }
.punto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.punto.verde { background: var(--verde); } .punto.rojo { background: var(--rojo); } .punto.gris { background: var(--gris); }

.herramientas { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.herramientas input[type=search] { flex: 1; min-width: 220px; }
input, select, button { font: inherit; color: var(--texto); }
input, select { padding: 7px 10px; border: 1px solid var(--borde); border-radius: 6px; background: var(--tarjeta); max-width: 100%; }
button { padding: 7px 14px; border: 0; border-radius: 6px; background: var(--primario); color: var(--primarioTexto); cursor: pointer; font-weight: 600; }
button:disabled { opacity: .6; cursor: default; }
button.secundario { background: transparent; color: var(--texto); border: 1px solid var(--borde); }
button.chico { padding: 4px 10px; font-size: 12px; }

.tablaScroll { overflow-x: auto; }
table.datos { width: 100%; border-collapse: collapse; }
table.datos th { text-align: left; font-size: 12px; color: var(--tenue); font-weight: 600; padding: 8px; border-bottom: 2px solid var(--borde); white-space: nowrap; }
table.datos td { padding: 8px; border-bottom: 1px solid var(--borde); vertical-align: top; }
table.datos td.num { text-align: right; white-space: nowrap; }
table.datos td.acciones { white-space: nowrap; text-align: right; }
table.datos td.acciones button + button { margin-left: 4px; }
td.excede { color: var(--rojo); font-weight: 700; }
tr.filaDetalle td { background: rgba(15,118,110,.05); }
.detalle { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.detalle dt { color: var(--tenue); }
.detalle dd { margin: 0; }
.etiqueta { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.etiqueta.verde { background: rgba(22,163,74,.14); color: var(--verde); }
.etiqueta.ambar { background: rgba(217,119,6,.14); color: var(--ambar); }
.etiqueta.rojo  { background: rgba(220,38,38,.14); color: var(--rojo); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal[hidden] { display: none; }
.ventana { width: 100%; max-width: 520px; }
.ventana label, .acceso label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 13px; }
.ventana label select, .ventana label input, .acceso label input { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
.botones { display: flex; justify-content: flex-end; gap: 8px; }

pre.log { background: var(--logFondo); color: var(--logTexto); padding: 12px; border-radius: 8px; height: calc(100vh - 230px); min-height: 300px;
          overflow: auto; margin: 0; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }

body.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.acceso { width: 100%; max-width: 360px; }
.acceso .marca { margin-bottom: 16px; font-size: 20px; }
.acceso button { width: 100%; margin-top: 4px; }
