/* Estilo Zeus web: barra azul con pestañas, subrayado verde, fondo gris, tarjetas blancas. */
:root {
  --azul: #0b4aa2;
  --azul-osc: #083a80;
  --verde: #22b573;
  --verde-zeus: #2fe02f;
  --turquesa: #1fb5a0;
  --verde-claro: #e6f7ef;
  --fondo: #f2f3f5;
  --borde: #e1e4e8;
  --texto: #1d2330;
  --gris: #6b7280;
  --chip: #eef0f3;
  --rojo: #d93a3a;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--azul); text-decoration: none; }
code { background: var(--chip); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }
.muted { color: var(--gris); }
.hidden { display: none !important; }

/* Barra superior (como Zeus web) */
.topbar { background: var(--azul); color: #fff; }
.topbar-inner { padding: 0 24px; height: 44px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; }
.brand img { height: 18px; width: auto; display: block; }
.brand img.pastilla { height: 26px; background: #fff; border-radius: 6px; padding: 3px 6px; box-sizing: content-box; }
.logo-box { width: 26px; height: 26px; border-radius: 6px; background: #fff; color: var(--azul); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.tabs { display: flex; height: 100%; gap: 0; flex: 1; }
.tabs a, .tabs span { color: #fff; display: flex; align-items: center; padding: 0 16px; font-weight: 600; font-size: 15.5px; border-bottom: 4px solid transparent; border-top: 4px solid transparent; }
.tabs a:hover { background: rgba(255,255,255,.07); }
.tabs a.active { border-bottom-color: var(--verde-zeus); }
.tabs .disabled { opacity: .45; cursor: default; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--turquesa); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 11px; cursor: default; }
.icon-btn { color: #fff; display: grid; place-items: center; opacity: .9; }
.icon-btn:hover { opacity: 1; }

/* Página */
.page { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head h1 { margin: 0 0 4px; font-size: 22px; }
.page-head p { margin: 0 0 20px; }
.card { background: #fff; border: 1px solid var(--borde); border-radius: 8px; padding: 22px 24px; }

/* Portal */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.tool { color: inherit; display: flex; flex-direction: column; gap: 6px; transition: box-shadow .15s, border-color .15s; }
a.tool:hover { border-color: var(--azul); box-shadow: 0 4px 14px rgba(31,63,224,.12); }
.tool h2 { margin: 6px 0 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.tool p { margin: 0; color: var(--gris); flex: 1; }
.tool .link { color: var(--azul); font-weight: 600; margin-top: 8px; }
.tool-icon { width: 40px; height: 40px; border-radius: 8px; background: var(--verde-claro); color: var(--verde); display: grid; place-items: center; font-size: 20px; font-weight: 700; }
.soon { opacity: .6; }
.badge { font-size: 11px; font-weight: 600; background: var(--chip); color: var(--gris); padding: 2px 8px; border-radius: 10px; }

/* Formulario */
.form section { padding: 18px 0; border-bottom: 1px solid var(--borde); }
.form section:first-child { padding-top: 0; }
.form h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.num { width: 22px; height: 22px; border-radius: 50%; background: var(--azul); color: #fff; font-size: 12px; display: grid; place-items: center; }
.count { font-size: 12px; font-weight: 500; color: var(--verde); }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 260px; }
.field.grow { flex: 1; }
.field span { font-weight: 600; font-size: 13px; }
.field small, section > small { color: var(--gris); font-size: 12px; }
.field.cron { margin-top: 12px; max-width: 320px; }
input:not([type]), input[type=text], .search, .field select {
  border: 1px solid var(--borde); border-radius: 6px; padding: 8px 10px; font: inherit; background: #fff;
}
input:focus, .field select:focus { outline: 2px solid rgba(31,63,224,.25); border-color: var(--azul); }
.search { width: 100%; max-width: 380px; margin-bottom: 10px; }

/* Chips (como el filtro "Active" de Zeus) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 16px; background: var(--chip); border: 1px solid transparent; font-size: 13px; user-select: none; }
.chip span em { font-style: normal; color: var(--gris); font-size: 11.5px; }
.chip:hover span { border-color: #c9ced6; }
.chip input:checked + span { background: var(--verde); color: #fff; }
.chip input:checked + span em { color: rgba(255,255,255,.85); }
.chip input[type=checkbox]:checked + span::after { content: "✕"; font-size: 11px; opacity: .9; }
.chip input:focus-visible + span { outline: 2px solid var(--azul); }
.scroll { max-height: 280px; overflow-y: auto; padding: 2px; }
.groups .group { margin-bottom: 12px; }
.group-title { font-size: 12px; font-weight: 600; color: var(--gris); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }

/* Botones (como Reset / Apply filters de Zeus) */
.form-actions, .actions { display: flex; justify-content: space-between; align-items: center; padding-top: 18px; }
.btn, .btn-link { font: inherit; font-weight: 600; cursor: pointer; }
.btn { background: var(--azul); color: #fff; border: 0; border-radius: 6px; padding: 10px 20px; display: inline-block; }
.btn:hover { background: var(--azul-osc); }
.btn:disabled { background: #a9b4ee; cursor: not-allowed; }
.btn-link { background: none; border: 0; color: var(--azul); padding: 10px 0; }
.btn-link:hover { text-decoration: underline; }

/* Avisos, previsualización y confirmación */
.alert { border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; }
.alert.error { background: #fdecec; color: var(--rojo); border: 1px solid #f5c2c2; }
.alert.info { background: #eef2ff; color: var(--azul-osc); border: 1px solid #d3dcff; }
.preview { margin-top: 18px; }
.preview h2 { font-size: 16px; margin: 0 0 10px; }
.preview pre { background: #1d2330; color: #e7eaf0; border-radius: 6px; padding: 14px 16px; overflow-x: auto; font-size: 12.5px; }
.steps { padding-left: 20px; margin: 0 0 14px; }
.steps li { margin-bottom: 4px; }
.done { max-width: 620px; margin: 30px auto; text-align: center; }
.done .steps { text-align: left; display: inline-block; }
.ok-icon { width: 52px; height: 52px; margin: 0 auto 8px; border-radius: 50%; background: var(--verde); color: #fff; font-size: 26px; display: grid; place-items: center; }

/* Pantalla de login (como la de Zeus web) */
.login-page { background: #f6f6f6; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { background: #fff; width: 400px; max-width: 100%; min-height: 540px; border-radius: 5px; box-shadow: 0 12px 40px rgba(0,0,0,.08); padding: 56px 40px 40px; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.login-logo { margin-bottom: 26px; }
.login-logo img { height: 120px; width: auto; }
.wordmark { font-size: 32px; font-weight: 700; color: #0a8cf0; letter-spacing: -.8px; }
.wordmark span { font-weight: 400; color: var(--gris); }
.login-card h1 { font-size: 24px; font-weight: 400; margin: 0 0 14px; color: #2d333a; }
.login-sub { font-size: 14px; color: #2d333a; margin: 0 0 24px; }
.login-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-form label { display: flex; flex-direction: column; gap: 5px; }
.login-form span { font-size: 13px; color: #2d333a; }
.login-form input { border: 1px solid #c2c8d0; border-radius: 3px; padding: 12px 14px; font: inherit; font-size: 15px; }
.login-form input:focus { outline: none; border-color: #0a8cf0; box-shadow: 0 0 0 1px #0a8cf0; }
.login-btn { margin-top: 6px; background: var(--azul); color: #fff; border: 0; border-radius: 3px; padding: 14px; font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; }
.login-btn:hover { background: var(--azul-osc); }
.login-msg { border-radius: 3px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 16px; }
.login-msg.error { background: #fdecec; color: var(--rojo); }
.login-msg.ok { background: var(--verde-claro); color: #157a4b; }
.login-help { font-size: 12.5px; color: var(--gris); margin: 22px 0 0; }

/* Synchs y Changes */
.small { font-size: 12px; }
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { margin: 0; max-width: 320px; }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.auto { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.tabla-card { padding: 0; overflow-x: auto; }
.tabla, .subtabla { width: 100%; border-collapse: collapse; }
.tabla th { text-align: left; font-size: 12px; font-weight: 600; color: var(--gris); text-transform: uppercase; letter-spacing: .4px; padding: 12px 14px; border-bottom: 1px solid var(--borde); white-space: nowrap; }
.tabla td { padding: 12px 14px; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla tr.fila-dag:hover > td { background: #fafbfc; }
.tabla .nombre { font-weight: 600; }
.tabla .vacio { text-align: center; padding: 28px; }
.tabla .alert { margin: 0; }
.col-toggle { width: 34px; padding-right: 0 !important; }
.toggle-btn { background: none; border: 0; cursor: pointer; font-size: 14px; color: var(--gris); width: 24px; height: 24px; border-radius: 4px; }
.toggle-btn:hover { background: var(--chip); color: var(--texto); }
.acciones { text-align: right; white-space: nowrap; }
.tag-tipo { font-size: 12px; background: var(--chip); padding: 3px 9px; border-radius: 10px; white-space: nowrap; }
tr.detalle > td { background: #f8f9fb; padding-top: 4px; }
.subtabla th { text-align: left; font-size: 11.5px; color: var(--gris); font-weight: 600; padding: 6px 10px; }
.subtabla td { padding: 6px 10px; border-bottom: 1px solid var(--borde); font-size: 13px; }
.subtabla tr:last-child td { border-bottom: 0; }

/* Chips de estado (verde / rojo / azul / gris) */
.estado { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px; white-space: nowrap; }
.estado::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.estado.verde { background: var(--verde-claro); color: #157a4b; }
.estado.rojo { background: #fdecec; color: var(--rojo); }
.estado.azul { background: #e8f0fc; color: var(--azul); }
.estado.azul::before { animation: latido 1.2s ease-in-out infinite; }
.estado.gris { background: var(--chip); color: var(--gris); }
@keyframes latido { 50% { opacity: .3; } }

/* Botones pequeños de las tablas */
.btn-sm { font: inherit; font-size: 12.5px; font-weight: 600; border-radius: 5px; padding: 5px 11px; cursor: pointer; display: inline-block; margin-left: 6px; border: 1px solid transparent; }
.btn-play { background: var(--azul); color: #fff; }
.btn-play:hover { background: var(--azul-osc); }
.btn-play:disabled { background: #a9b4ee; cursor: not-allowed; }
.btn-sec { background: #fff; color: var(--azul); border-color: var(--borde); }
.btn-sec:hover { border-color: var(--azul); }

/* Changes */
.repos { margin-bottom: 16px; }
.repos .chip span.activo { background: var(--verde); color: #fff; }
.lista-commits { padding: 0; }
.commit { border-bottom: 1px solid var(--borde); }
.commit:last-child { border-bottom: 0; }
.commit summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 18px; cursor: pointer; }
.commit summary::-webkit-details-marker { display: none; }
.commit summary:hover { background: #fafbfc; }
.commit[open] summary { background: #f8f9fb; }
.commit-main { flex: 1; min-width: 0; }
.commit-titulo { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-img { width: 28px; height: 28px; border-radius: 50%; }
.commit-cuerpo { margin: 0 18px; padding: 10px 12px; background: var(--chip); border-radius: 6px; font-size: 12.5px; white-space: pre-wrap; }
.commit-detalle { padding: 14px 18px 18px; }
.det-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 860px) { .det-grid { grid-template-columns: 1fr; } }
.det-grid h3 { font-size: 13px; margin: 0 0 10px; }
.ficheros { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.ficheros li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.ficheros a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.f-estado { width: 18px; height: 18px; border-radius: 4px; font-size: 11px; font-weight: 700; display: grid; place-items: center; background: var(--chip); color: var(--gris); flex: none; }
.f-estado.added { background: var(--verde-claro); color: #157a4b; }
.f-estado.removed { background: #fdecec; color: var(--rojo); }
.mas { color: #157a4b; font-size: 12px; }
.menos { color: var(--rojo); font-size: 12px; }
.workflow { border: 1px solid var(--borde); border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.wf-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wf-head a { font-weight: 600; }
.pasos { list-style: none; margin: 10px 0 0; padding: 0; }
.paso { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.paso .dot { width: 9px; height: 9px; border-radius: 50%; background: #c9ced6; flex: none; }
.paso.success .dot { background: var(--verde); }
.paso.failed .dot { background: var(--rojo); }
.paso.failed { color: var(--rojo); font-weight: 600; }
.paso.running .dot, .paso.queued .dot { background: var(--azul); animation: latido 1.2s ease-in-out infinite; }
.paso.skipped, .paso.cancelled { color: var(--gris); }

/* Cuenta atrás de la recarga automática (Synchs) */
.cuenta { display: flex; flex-direction: column; gap: 3px; min-width: 104px; font-size: 12px; color: var(--gris); }
.cuenta strong { color: var(--azul); font-variant-numeric: tabular-nums; }
.cuenta-barra { height: 3px; border-radius: 2px; background: var(--borde); overflow: hidden; }
.cuenta-barra span { display: block; height: 100%; width: 100%; background: var(--azul); transition: width 1s linear; }
.cuenta.parada { opacity: .4; }
.cuenta.parada .cuenta-barra span { transition: none; }

/* Fuentes y dbt */
.estado.ambar { background: #fff4e0; color: #a35c00; }
.tile-num.ambar { color: #a35c00; }
.tile-num.verde { color: #157a4b; }
.tile-num.rojo { color: var(--rojo); }
.tile-num.gris { color: var(--gris); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: #fff; border: 1px solid var(--borde); border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; cursor: pointer; }
.tile:hover { border-color: var(--azul); }
.tile.activo { border-color: var(--azul); box-shadow: 0 0 0 2px rgba(11,74,162,.15); }
.tile-num { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-txt { font-size: 12.5px; color: var(--gris); }
tbody.grupo-fuente.hidden { display: none; }
.leyenda { margin-top: 12px; }
.dbt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 860px) { .dbt-grid { grid-template-columns: 1fr; } }
.dbt-card h2, .bloque-titulo { font-size: 15px; margin: 0; }
.dbt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.contadores { display: flex; gap: 22px; flex-wrap: wrap; }
.contador { display: flex; flex-direction: column; }
.bloque { margin-bottom: 16px; }
.tabla-card.bloque .bloque-titulo { padding: 16px 14px 4px; }
.bloque-vacio { padding: 6px 14px 16px; margin: 0; }
.tabla td.mensaje { font-size: 12.5px; color: var(--gris); max-width: 460px; }
.barras { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.barra-fila { display: grid; grid-template-columns: minmax(160px, 280px) 1fr 90px; align-items: center; gap: 12px; }
.barra-nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra { height: 10px; background: var(--chip); border-radius: 5px; overflow: hidden; }
.barra span { display: block; height: 100%; background: var(--azul); border-radius: 5px; }
.barra-valor { font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }
.tabla td.nombre-largo { max-width: 380px; }
.tabla td.nombre-largo code { white-space: normal; word-break: break-all; }

/* Admin DAGs */
.migas { font-size: 13px; color: var(--gris); margin-bottom: 8px; }
.migas a { color: var(--azul); text-decoration: none; }
.head-con-boton { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.head-con-boton .btn { text-decoration: none; white-space: nowrap; }
.badge.activo { background: var(--verde-claro); color: #157a4b; }
.badge.aviso { background: #fff4e0; color: #a35c00; display: inline-block; margin-top: 4px; }
.que-hace { display: flex; gap: 6px; flex-wrap: wrap; }
.tabla td.que-hace { display: table-cell; }
.que-hace .tag-tipo { display: inline-block; margin: 2px 4px 2px 0; }
.bloque-sub { padding: 0 14px; margin: 4px 0 6px; }
.acciones a.btn-sm { text-decoration: none; }
.preview pre.diff span { display: block; }
.preview pre.diff .mas { color: #7ee2a8; }
.preview pre.diff .menos { color: #ff9b9b; }
.zona-peligro { margin-top: 18px; border-color: #f5c2c2; }
.zona-peligro h2 { font-size: 15px; margin: 0 0 6px; color: var(--rojo); }
.zona-peligro .row { align-items: flex-end; }
.btn.peligro { background: var(--rojo); }
.btn.peligro:hover { background: #a4161a; }
.btn-sm.btn-borrar { background: #fff; color: var(--rojo); border-color: #f5c2c2; }
.btn-sm.btn-borrar:hover { background: #fdecec; }
.zona-peligro:target { box-shadow: 0 0 0 3px #f5c2c2; }

/* Formulario ampliado: todas las conexiones, orden de syncs y modos de dbt */
.opciones-linea { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 10px; }
.interruptor { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.interruptor input { width: 16px; height: 16px; accent-color: var(--verde); }
.atenuado { opacity: .35; pointer-events: none; }
.orden { font-variant-numeric: tabular-nums; }
.dbt-modo { margin-top: 12px; }
.dbt-modo.hidden { display: none; }
.form h3.sub { font-size: 13px; margin: 14px 0 8px; display: flex; gap: 8px; align-items: center; }
.scroll.corta { max-height: 150px; }

/* Fuentes en filas con desplegable de tablas (Airbyte y otras fuentes) */
.filas-fuente { display: flex; flex-direction: column; border: 1px solid var(--borde); border-radius: 6px; }
.filas-fuente.scroll { max-height: 330px; }
.fila-fuente { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--borde); flex-wrap: wrap; }
.fila-fuente:last-child { border-bottom: 0; }
.fila-check { display: flex; align-items: center; gap: 10px; cursor: pointer; flex: 1; min-width: 220px; }
.fila-check input { width: 16px; height: 16px; accent-color: var(--verde); }
.fila-check input:checked ~ .fila-nombre { color: #157a4b; font-weight: 600; }
.fila-nombre { font-size: 13.5px; }
.fila-tablas summary { cursor: pointer; font-size: 12.5px; color: var(--azul); list-style: none; }
.fila-tablas summary::-webkit-details-marker { display: none; }
.fila-tablas summary::before { content: "▸ "; }
.fila-tablas[open] summary::before { content: "▾ "; }
.fila-tablas[open] { flex-basis: 100%; }
.tablas-lista { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tablas-lista code { font-size: 12px; }
details.externas { margin-top: 14px; }
details.externas > summary { cursor: pointer; font-size: 13px; font-weight: 600; }
a.badge.aviso { text-decoration: none; margin-right: 4px; }
a.badge.aviso:hover { background: #ffe7bf; }
.done .pr-enlace { margin: -4px 0 14px; font-size: 14px; }
#filtro-linaje { margin: 12px 0 4px; flex-wrap: wrap; }
.chip.chip-sm span { padding: 3px 10px; font-size: 12.5px; }
/* Otras fuentes: dónde se ejecuta cada workflow (solo se ve si está marcado) */
.fila-fuente .donde { display: none; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; color: var(--gris); }
.fila-fuente:has(.fila-check input:checked) .donde { display: inline-flex; }
.fila-fuente .donde input { accent-color: var(--azul); }
.fila-fuente .donde input:checked + span { color: var(--azul); font-weight: 600; }

/* Historial de ejecuciones en Admin DAGs: un punto por ejecución, la más reciente a la derecha */
.historial { display: flex; gap: 3px; margin-top: 4px; }
.historial .punto { width: 10px; height: 10px; border-radius: 3px; background: var(--chip); }
.historial .punto.verde { background: var(--verde); }
.historial .punto.rojo { background: var(--rojo); }
.historial .punto.azul { background: var(--azul); }
.historial .punto.gris { background: #c4c8cf; }
.historial .punto:hover { outline: 2px solid var(--azul); outline-offset: 1px; }
a.estado:hover { text-decoration: none; filter: brightness(.95); }
.aviso-opciones { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.aviso-opciones .field { min-width: 260px; }
.check-linea { display: flex; gap: 8px; align-items: flex-start; }
.check-linea input { margin-top: 3px; }
.nowrap { white-space: nowrap; }
.field select { max-width: 260px; background: #fff; }
