/* =====================================================================
   ARALIA — Consola admin (<cliente>-admin / <cliente>-dev-admin)
   Extiende aralia.css. Más densa que el portal: tablas compactas,
   monoespaciada para versiones/SHA, acento ámbar cuando el ambiente es DEV.
   ===================================================================== */

:root {
  --env: var(--leaf-500);
  --env-soft: var(--leaf-100);
  --env-ink: var(--leaf-600);
  --amber-400: #f0a73a;
  --code-bg: #0b1726;
  --diff-add: rgba(42, 166, 118, .16);
  --diff-del: rgba(209, 75, 75, .16);
}
body.env-dev { --env: var(--amber-400); --env-soft: var(--warn-100); --env-ink: #9a5f0c; }
body.admin { background: var(--bg-soft); font-size: 15px; }
body.admin .table { font-size: .86rem; }
body.admin .table td { padding: 10px 14px; }
body.admin .table th { padding: 11px 14px; }
.mono { font-family: var(--font-mono); font-size: .82em; letter-spacing: -.01em; }
.nowrap { white-space: nowrap; }
.w-full { width: 100%; }

/* ---------- Sidebar ---------- */
.sidebar__brand { justify-content: space-between; padding-bottom: 14px; }
.sidebar__brand a { display: flex; align-items: center; gap: 10px; }
.sidebar__brand .brand-tag { font: 600 .66rem/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: #8ea4bc; padding: 5px 7px; border: 1px solid rgba(255,255,255,.14); border-radius: 6px; }
.sidebar .sidebar__section:first-of-type { padding-top: 6px; }
.tenant-select { position: relative; margin: 0 4px 10px; }
.tenant-select select {
  appearance: none; width: 100%; padding: 12px 36px 12px 46px; border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); color: #fff;
  font: 600 .9rem/1.2 var(--font-body);
}
.tenant-select select:hover { background: rgba(255,255,255,.09); }
.tenant-select select option { color: var(--text); }
.tenant-select__logo { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 8px; background: var(--steel-500); color: #fff; display: grid; place-items: center; font: 700 .7rem var(--font-display); pointer-events: none; }
.tenant-select .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #8ea4bc; pointer-events: none; width: 16px; }
.env-switch { margin: 0 4px 6px; padding: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.08); }
.env-switch button {
  height: 34px; border: 0; border-radius: 9px; background: transparent; color: #8ea4bc; cursor: pointer;
  font: 700 .74rem/1 var(--font-body); letter-spacing: .1em; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.env-switch button:hover { color: #fff; }
.env-switch button .dot { background: currentColor; opacity: .7; }
.env-switch button[data-env="prod"].is-active { background: var(--leaf-500); color: #fff; box-shadow: 0 2px 8px rgba(42,166,118,.35); }
.env-switch button[data-env="dev"].is-active { background: var(--amber-400); color: #3b2405; box-shadow: 0 2px 8px rgba(240,167,58,.35); }
.env-switch button.is-active .dot { opacity: 1; }
.env-host { margin: 0 6px 4px; font: 500 .74rem/1.4 var(--font-mono); color: #8ea4bc; display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env-host .icon { width: 13px; height: 13px; }
.sidebar__foot .avatar { background: var(--steel-500); }
.sidebar__foot .icon-btn { margin-left: auto; color: #8ea4bc; }
.sidebar__foot .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-overlay { display: none; }
@media (max-width: 1024px) {
  .app.is-nav-open .nav-overlay { display: block; position: fixed; inset: 0; background: rgba(8,19,31,.45); z-index: 44; }
}

/* ---------- Topbar ---------- */
.topbar { box-shadow: inset 0 3px 0 var(--env); }
.topbar__left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar__right { display: flex; align-items: center; gap: 10px; flex: none; }
.host-chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font: 500 .8rem var(--font-mono); color: var(--text-muted); white-space: nowrap; }
.host-chip .icon { width: 14px; height: 14px; }
.env-pill .dot { background: currentColor; width: 7px; height: 7px; }
body.env-dev .env-pill--dev { box-shadow: 0 0 0 1px rgba(217,138,28,.35); }
@media (max-width: 760px) { .host-chip, .topbar .btn-portal { display: none; } }

/* Franja DEV */
.env-banner { display: none; }
body.env-dev .env-banner {
  display: flex; align-items: center; gap: 10px; padding: 9px 28px; font-size: .84rem; color: #7a4a08;
  background: repeating-linear-gradient(135deg, #fdf1dc 0 14px, #fbe8c6 14px 28px); border-bottom: 1px solid #f1d39f;
}
body.env-dev .env-banner strong { color: #5e3905; }
@media (max-width: 1024px) { body.env-dev .env-banner { padding: 9px 16px; } }

/* ---------- Encabezado de página ---------- */
.page-head__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; color: var(--text-muted); font-size: .86rem; }
.page-head__meta .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--border-strong); }
.content { max-width: 1480px; width: 100%; }

/* ---------- KPI tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.tiles--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1280px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .tiles--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .tiles, .tiles--4 { grid-template-columns: 1fr 1fr; gap: 12px; } }
@media (max-width: 420px) { .tiles, .tiles--4 { grid-template-columns: 1fr; } }
.tile { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.tile__label { display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.tile__label .icon { width: 15px; height: 15px; color: var(--steel-400); }
.tile__value { font: 700 1.55rem/1.15 var(--font-display); color: var(--navy-900); font-variant-numeric: tabular-nums; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.tile__value small { font: 500 .8rem var(--font-body); color: var(--text-subtle); letter-spacing: 0; }
.tile__sub { font-size: .8rem; color: var(--text-muted); }
.tile .progress { height: 6px; margin-top: 4px; }
.delta-up { color: var(--danger-500); font-weight: 600; }
.delta-down { color: var(--leaf-600); font-weight: 600; }

/* ---------- Layout de paneles ---------- */
.cols { display: grid; gap: 24px; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.cols--even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cols--side { grid-template-columns: minmax(0, 1fr) 380px; }
@media (max-width: 1180px) { .cols, .cols--side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .cols--even { grid-template-columns: minmax(0, 1fr); } }
.panel { overflow: hidden; }
.panel__head .muted { font-size: .84rem; }
.panel__head h3 { display: flex; align-items: center; gap: 8px; }
.panel__head h3 .icon { color: var(--steel-400); }
.panel__body--flush { padding: 0; }
.panel .table-wrap { border: 0; border-radius: 0; }
.panel__foot { padding: 12px 22px; border-top: 1px solid var(--border); font-size: .85rem; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .85rem; }
.link-arrow .icon { width: 15px; height: 15px; }

/* ---------- Alertas ---------- */
.alert-list { display: grid; }
.alert-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--border); color: inherit; align-items: start; }
.alert-item:last-child { border-bottom: 0; }
.alert-item:hover { background: var(--mist-25); color: inherit; }
.alert-item__icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.alert-item__icon .icon { width: 17px; height: 17px; }
.alert-item--danger .alert-item__icon { background: var(--danger-100); color: #a83232; }
.alert-item--warn .alert-item__icon { background: var(--warn-100); color: #9a5f0c; }
.alert-item--info .alert-item__icon { background: var(--info-100); color: var(--navy-700); }
.alert-item strong { display: block; font-size: .9rem; color: var(--navy-900); line-height: 1.35; }
.alert-item p { margin: 2px 0 0; font-size: .82rem; color: var(--text-muted); line-height: 1.45; }
.alert-item time { font-size: .76rem; color: var(--text-subtle); white-space: nowrap; }

/* ---------- Versiones dev/prod lado a lado ---------- */
.ver { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 8px; font: 500 .8rem/1 var(--font-mono); background: var(--bg-sunken); color: var(--navy-800); white-space: nowrap; }
.ver--prod { background: var(--leaf-100); color: var(--leaf-600); }
.ver--dev { background: var(--warn-100); color: #8a5208; }
.ver--none { background: transparent; border: 1px dashed var(--border-strong); color: var(--text-subtle); font-family: var(--font-body); }
.ver .dot { width: 6px; height: 6px; background: currentColor; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.sync .icon { width: 15px; height: 15px; }
.sync--ahead { color: #9a5f0c; }
.sync--ok { color: var(--leaf-600); }
.sync--new { color: var(--steel-500); }
.model-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.model-cell__icon { width: 34px; height: 34px; border-radius: 10px; background: var(--info-100); color: var(--navy-700); display: grid; place-items: center; flex: none; }
.model-cell__icon .icon { width: 17px; height: 17px; }
.model-cell strong { display: block; color: var(--navy-900); font-size: .9rem; line-height: 1.3; }
.model-cell small { color: var(--text-subtle); font: 400 .74rem var(--font-mono); }
.is-current-env { position: relative; }
.th-env { display: inline-flex; align-items: center; gap: 6px; }
.th-env .dot { width: 7px; height: 7px; }
th.col-current { color: var(--env-ink) !important; box-shadow: inset 0 -2px 0 var(--env); }

/* ---------- Estados CI ---------- */
.ci { display: inline-flex; align-items: center; gap: 4px; }
.ci-step { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 6px; font: 600 .7rem/1 var(--font-body); background: var(--bg-sunken); color: var(--text-muted); white-space: nowrap; }
.ci-step .icon { width: 12px; height: 12px; stroke-width: 2.4; }
.ci-step--ok { background: var(--leaf-100); color: var(--leaf-600); }
.ci-step--fail { background: var(--danger-100); color: #a83232; }
.ci-step--run { background: var(--info-100); color: var(--navy-700); }
.ci-step--run .icon { animation: spin 1s linear infinite; }
.ci-step--skip, .ci-step--wait { background: transparent; border: 1px dashed var(--border-strong); color: var(--text-subtle); }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ---------- Modelos: selector ---------- */
.model-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1180px) { .model-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .model-picker { grid-template-columns: 1fr; } }
.model-card { text-align: left; background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; cursor: pointer; display: grid; gap: 10px; font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.model-card:hover { border-color: var(--steel-200); box-shadow: var(--shadow-sm); }
.model-card.is-active { border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(53,91,135,.14); }
.model-card__vers { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.model-card__vers .lbl { font-size: .68rem; font-weight: 700; letter-spacing: .08em; color: var(--text-subtle); }

/* Detalle de modelo */
.model-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; flex-wrap: wrap; padding: 20px 22px; }
.model-head h2 { font-size: 1.35rem; margin: 0 0 6px; }
.repo-link { display: inline-flex; align-items: center; gap: 8px; font: 500 .84rem var(--font-mono); color: var(--steel-500); word-break: break-all; }
.repo-link .icon { width: 16px; height: 16px; }
.env-cards { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0; border-top: 1px solid var(--border); }
.env-card { padding: 18px 22px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.env-card__top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.env-card__ver { font: 600 1.35rem/1.1 var(--font-mono); color: var(--navy-900); letter-spacing: -.02em; word-break: break-all; }
.env-card__meta { font-size: .8rem; color: var(--text-muted); display: grid; gap: 2px; }
.env-card__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.env-card.is-current { background: linear-gradient(180deg, color-mix(in srgb, var(--env-soft) 55%, #fff) 0%, #fff 100%); }
.env-flow { display: grid; place-items: center; padding: 0 6px; color: var(--text-subtle); border-left: 1px dashed var(--border); border-right: 1px dashed var(--border); }
.env-flow__inner { display: grid; justify-items: center; gap: 6px; font-size: .74rem; text-align: center; max-width: 120px; }
.env-flow .icon { width: 22px; height: 22px; color: var(--steel-400); }
@media (max-width: 760px) {
  .env-cards { grid-template-columns: 1fr; }
  .env-flow { border: 0; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); padding: 8px; }
  .env-flow .icon { transform: rotate(90deg); }
}

/* Ramas */
.branch-list { display: grid; }
.branch { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 22px; border-bottom: 1px solid var(--border); font-size: .86rem; }
.branch:last-child { border-bottom: 0; }
.branch > .icon { color: var(--text-subtle); }
.branch__name { font: 600 .84rem var(--font-mono); color: var(--navy-900); }
.branch__msg { color: var(--text-muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch__right { display: flex; align-items: center; gap: 8px; }
@media (max-width: 520px) { .branch { grid-template-columns: auto minmax(0, 1fr); } .branch__right { grid-column: 2; } }

/* Tabla de versiones */
.vtable tbody tr { cursor: pointer; }
.vtable tr.is-selected td { background: #eef4fb; }
.vtable tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--navy-700); }
.vtag { font: 600 .84rem var(--font-mono); color: var(--navy-900); }
.sha { font: 500 .78rem var(--font-mono); color: var(--steel-500); background: var(--mist-50); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border); }
.who { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.who .avatar--sm { font-size: .6rem; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.btn--xs { height: 28px; padding: 0 10px; font-size: .78rem; gap: 6px; }
.btn--xs .icon { width: 14px; height: 14px; }
.btn--amber { --btn-bg: var(--amber-400); --btn-fg: #3b2405; }
.btn--amber:hover { --btn-bg: #e89a26; }
.msg-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Visor de código / YAML / diff ---------- */
.code { background: var(--code-bg); color: #d3e1f0; font: 400 .8rem/1.7 var(--font-mono); overflow: auto; max-height: 560px; counter-reset: ln; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.code__line { display: block; padding: 0 18px 0 0; white-space: pre; }
.code__line::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 44px; padding-right: 14px; text-align: right; color: #43586f; user-select: none; }
.code__line:hover { background: rgba(255,255,255,.03); }
.y-c { color: #5f7690; font-style: italic; }
.y-k { color: #8fb7e0; }
.y-s { color: #9fdcbc; }
.y-n { color: #f2c46d; }
.y-p { color: #cf9fe8; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px 10px 18px; background: #0f1e31; color: #8ea4bc; font: 500 .78rem var(--font-mono); border-bottom: 1px solid #1a2b42; }
.code-head .icon-btn { color: #8ea4bc; width: 30px; height: 30px; }
.code-head .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.diff { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: auto; max-height: 300px; font: 400 .76rem/1.6 var(--font-mono); }
.diff__line { display: grid; grid-template-columns: 22px minmax(0, 1fr); white-space: pre; padding-right: 12px; color: var(--text-muted); }
.diff__line span:first-child { text-align: center; color: var(--text-subtle); user-select: none; }
.diff__line--add { background: var(--diff-add); color: #155e43; }
.diff__line--add span:first-child { color: var(--leaf-600); font-weight: 700; }
.diff__line--del { background: var(--diff-del); color: #8f2a2a; }
.diff__line--del span:first-child { color: var(--danger-500); font-weight: 700; }
.diff__hunk { background: var(--info-100); color: var(--navy-700); padding: 3px 12px; font-size: .72rem; }
.diff-stats { display: inline-flex; gap: 10px; font: 600 .78rem var(--font-mono); }
.diff-stats .add { color: var(--leaf-600); } .diff-stats .del { color: var(--danger-500); }
.change-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.change-chip { display: inline-flex; gap: 6px; align-items: center; font-size: .76rem; padding: 4px 9px; border-radius: 8px; background: var(--mist-50); border: 1px solid var(--border); color: var(--text-muted); }
.change-chip b { color: var(--navy-900); font-weight: 600; }

/* ---------- Modal grande ---------- */
.modal--lg { width: min(760px, 100%); }
.modal__head h3 { margin: 0; font-size: 1.15rem; }
.modal__head p { margin: 4px 0 0; color: var(--text-muted); font-size: .88rem; }
.modal__body { display: grid; gap: 18px; }
.modal__foot { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 4px; flex-wrap: wrap; }
.promo-route { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--mist-50); border: 1px solid var(--border); }
.promo-route__side { display: grid; gap: 4px; min-width: 0; }
.promo-route__side small { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-subtle); }
.promo-route__side .ver { justify-self: start; font-size: .9rem; height: 30px; }
.promo-route__side span.muted { font-size: .78rem; }
.promo-route > .icon { color: var(--steel-400); width: 22px; height: 22px; }
.checklist { display: grid; gap: 8px; }
.checklist .check { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; align-items: flex-start; line-height: 1.4; }
.checklist .check input { margin-top: 2px; }
.checklist .check small { display: block; color: var(--text-subtle); font-size: .78rem; }
.checklist .check.is-auto { background: var(--mist-25); }
.confirm-name { font: 600 .82rem var(--font-mono); background: var(--bg-sunken); padding: 2px 6px; border-radius: 5px; color: var(--navy-900); }
.section-label { font: 700 .72rem/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--text-subtle); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: .84rem; line-height: 1.5; }
.callout .icon { flex: none; margin-top: 2px; }
.callout--warn { background: var(--warn-100); color: #7a4a08; }
.callout--info { background: var(--info-100); color: var(--navy-700); }
.callout--danger { background: var(--danger-100); color: #8f2a2a; }

/* ---------- Drawer de progreso ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(8,19,31,.45); backdrop-filter: blur(2px); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .25s; }
.drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: #fff; z-index: 56; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .3s var(--ease); display: flex; flex-direction: column; }
.drawer.is-open { transform: none; }
.drawer__head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.drawer__head h3 { margin: 0 0 4px; font-size: 1.1rem; }
.drawer__head p { margin: 0; font-size: .84rem; color: var(--text-muted); }
.drawer__body { padding: 20px 24px; overflow: auto; display: grid; gap: 18px; align-content: start; flex: 1; }
.drawer__foot { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .84rem; }
.drawer .console { height: 260px; font-size: .76rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.step { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; font-size: .88rem; color: var(--text-subtle); position: relative; }
.step__icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--border-strong); background: #fff; position: relative; z-index: 1; }
.step__icon .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.step:not(:last-child)::after { content: ""; position: absolute; left: 12.5px; top: 34px; bottom: -10px; width: 1.5px; background: var(--border); }
.step small { font: 500 .76rem var(--font-mono); color: var(--text-subtle); }
.step.is-run { color: var(--navy-900); font-weight: 600; }
.step.is-run .step__icon { border-color: var(--steel-500); color: var(--steel-500); }
.step.is-done { color: var(--text); }
.step.is-done .step__icon { background: var(--leaf-500); border-color: var(--leaf-500); color: #fff; }
.step.is-done::after { background: var(--leaf-500); }
.step.is-fail .step__icon { background: var(--danger-500); border-color: var(--danger-500); color: #fff; }

/* ---------- Datos y conexiones ---------- */
.channel { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-size: .84rem; font-weight: 500; }
.channel__icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.channel__icon .icon { width: 15px; height: 15px; }
.channel--sharepoint .channel__icon, .channel--onedrive .channel__icon { background: #e3eefa; color: #1e5a96; }
.channel--drive .channel__icon { background: #e6f4ea; color: #1f7a45; }
.channel--upload .channel__icon { background: var(--bg-sunken); color: var(--navy-700); }
.channel small { display: block; color: var(--text-subtle); font-size: .72rem; font-weight: 400; }
.path { font: 400 .76rem var(--font-mono); color: var(--text-muted); max-width: 260px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow { display: grid; gap: 3px; font: 500 .76rem var(--font-mono); }
.flow span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.flow .icon { width: 12px; height: 12px; color: var(--text-subtle); }
.flow .to-stg { color: var(--navy-700); }
.flow .to-mdl { color: var(--leaf-600); }
.row-note { font-size: .74rem; margin-top: 3px; display: block; }
.row-note--danger { color: #a83232; } .row-note--warn { color: #9a5f0c; }
.secret { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 22px; border-bottom: 1px solid var(--border); }
.secret:last-child { border-bottom: 0; }
.secret__icon { width: 36px; height: 36px; border-radius: 10px; background: var(--navy-900); color: #cfe0f1; display: grid; place-items: center; }
.secret__icon .icon { width: 16px; height: 16px; }
.secret strong { display: block; font: 600 .84rem var(--font-mono); color: var(--navy-900); word-break: break-all; }
.secret p { margin: 2px 0 0; font-size: .78rem; color: var(--text-muted); }
.secret__value { font: 500 .76rem var(--font-mono); color: var(--text-subtle); margin-top: 4px; word-break: break-all; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.secret__actions { display: flex; gap: 4px; }
@media (max-width: 520px) { .secret { grid-template-columns: 36px minmax(0, 1fr); } .secret__actions { grid-column: 2; } }
.schema-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; gap: 2px; background: #fff; }
.schema-bar span { display: block; height: 100%; }
.schema-bar span:first-child { border-radius: 999px 0 0 999px; } .schema-bar span:last-child { border-radius: 0 999px 999px 0; }
.schema-list { display: grid; }
.schema { display: grid; grid-template-columns: 12px 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 22px; border-top: 1px solid var(--border); font-size: .84rem; }
.schema i { width: 10px; height: 10px; border-radius: 3px; }
.schema b { font: 600 .86rem var(--font-mono); color: var(--navy-900); }
.schema .muted { font-size: .8rem; line-height: 1.4; }
.schema__nums { text-align: right; font-variant-numeric: tabular-nums; font-size: .8rem; white-space: nowrap; }
.schema__nums strong { display: block; color: var(--navy-900); font-size: .86rem; }
@media (max-width: 520px) { .schema { grid-template-columns: 12px 48px minmax(0, 1fr); } .schema__nums { grid-column: 3; text-align: left; } }

/* ---------- Filtros ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg-sunken); gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; font: 600 .8rem var(--font-body); color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.seg button.is-active { background: #fff; color: var(--navy-900); box-shadow: var(--shadow-sm); }
.search { position: relative; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-subtle); width: 16px; }
.search .input { padding-left: 34px; height: 36px; font-size: .86rem; width: 220px; }
.filters .select--sm { width: auto; min-width: 150px; padding-right: 28px; }
@media (max-width: 640px) { .search, .search .input, .filters .select--sm { width: 100%; } .filters > * { flex: 1 1 100%; } .seg { justify-content: stretch; } .seg button { flex: 1; } }
.count-note { font-size: .82rem; color: var(--text-muted); }

/* ---------- Usuarios ---------- */
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-cell strong { display: block; font-size: .88rem; color: var(--navy-900); line-height: 1.3; }
.user-cell small { color: var(--text-subtle); font-size: .78rem; }
.role-select { height: 32px; font-size: .82rem; padding: 0 28px 0 10px; border-radius: 8px; width: auto; }
.role { font: 600 .74rem var(--font-mono); padding: 3px 8px; border-radius: 6px; background: var(--info-100); color: var(--navy-700); white-space: nowrap; }
.role--ti { background: #ece7f7; color: #5a3c97; }
.role--admin { background: var(--navy-800); color: #fff; }
.recipient { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 22px; border-bottom: 1px solid var(--border); }
.recipient strong { font: 500 .84rem var(--font-mono); color: var(--navy-900); word-break: break-all; }
.recipient small { display: block; color: var(--text-subtle); font-size: .76rem; }
.inline-form { display: flex; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--mist-25); }
.inline-form .input { height: 36px; font-size: .86rem; }
.role-legend { display: grid; gap: 10px; font-size: .82rem; color: var(--text-muted); }
.role-legend div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; align-items: start; }

/* ---------- Monitoreo ---------- */
.chart-box { position: relative; height: 260px; }
.chart-box--sm { height: 200px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--text-muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: 150px minmax(0, 1fr) 70px; gap: 12px; align-items: center; font-size: .84rem; }
.hbar__track { height: 10px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.hbar__fill { height: 100%; border-radius: 999px; background: var(--steel-500); }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; color: var(--navy-900); font-weight: 600; }
@media (max-width: 520px) { .hbar { grid-template-columns: 1fr 64px; } .hbar__track { grid-column: 1 / -1; grid-row: 2; } }
.err-item { border-bottom: 1px solid var(--border); }
.err-item:last-child { border-bottom: 0; }
.err-item summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; padding: 13px 22px; align-items: start; }
.err-item summary::-webkit-details-marker { display: none; }
.err-item summary:hover { background: var(--mist-25); }
.err-item__icon { width: 30px; height: 30px; border-radius: 9px; background: var(--danger-100); color: #a83232; display: grid; place-items: center; }
.err-item__icon .icon { width: 15px; height: 15px; }
.err-item strong { font-size: .88rem; color: var(--navy-900); display: block; }
.err-item code { font-size: .76rem; color: #a83232; display: block; margin-top: 2px; word-break: break-word; }
.err-item summary > .icon { transition: transform .2s; color: var(--text-subtle); margin-top: 6px; }
.err-item[open] summary > .icon { transform: rotate(90deg); }
.err-item .console { height: auto; max-height: 240px; margin: 0 22px 16px; font-size: .74rem; }

/* ---------- Configuración ---------- */
.settings-grid { display: grid; gap: 16px 24px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .settings-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 10px 16px; font-size: .86rem; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; color: var(--navy-900); font-weight: 500; word-break: break-word; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; } }
.danger-zone { border-color: #f0c4c4; }
.danger-zone .panel__head { background: #fdf6f6; }

/* ---------- Login ---------- */
.auth__side .auth-quote { max-width: 440px; }
.auth__side h2 { color: #fff; font-size: clamp(1.6rem, 2.4vw, 2.2rem); }
.auth__side p { color: #c6d6e8; }
.auth__side .auth-points { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; color: #c6d6e8; font-size: .92rem; }
.auth__side .auth-points li { display: flex; gap: 10px; align-items: center; }
.auth__side .auth-points .icon { color: var(--steel-200); }
.auth__side::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(8,19,31,.75) 0%, rgba(12,28,50,.4) 60%, rgba(8,19,31,.85) 100%); pointer-events: none; }
.auth__side > * { z-index: 1; }
.ms-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--border-strong); background: #fff; font: 600 .95rem var(--font-body); color: var(--navy-900); cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.ms-btn:hover { border-color: var(--steel-400); box-shadow: var(--shadow); color: var(--navy-900); }
.ms-logo { width: 18px; height: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.ms-logo i:nth-child(1) { background: #f25022; } .ms-logo i:nth-child(2) { background: #7fba00; } .ms-logo i:nth-child(3) { background: #00a4ef; } .ms-logo i:nth-child(4) { background: #ffb900; }
.auth-host { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--mist-50); border: 1px solid var(--border); font: 500 .8rem var(--font-mono); color: var(--text-muted); }
.auth-env { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.auth-env label { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: .86rem; }
.auth-env label:has(input:checked) { border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(53,91,135,.12); }
.auth-env input { accent-color: var(--navy-700); }

/* Utilidades */
.hide-md { }
@media (max-width: 1180px) { .hide-md { display: none; } }
@media (max-width: 640px) { .hide-sm { display: none !important; } .page-head h1 { font-size: 1.4rem; } }

/* ---------- Ajustes tras revisión visual ---------- */
.side-link { white-space: nowrap; }
.side-link > span:nth-of-type(1) { overflow: hidden; text-overflow: ellipsis; }
.model-cell strong { white-space: nowrap; }
.model-cell > div { min-width: 0; }
.model-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-card .model-cell strong { white-space: normal; }
.model-card__vers { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
.model-card__vers .ver { justify-self: start; }
.state-cell { min-width: 150px; max-width: 240px; white-space: normal; }
.auth__side > img:not(.bg) { align-self: flex-start; }
.ver-select { font-family: var(--font-mono); }
.side-link { gap: 11px; font-size: .9rem; }
.side-link .badge { padding: 0 7px; }
.side-link .badge::before { display: none; }
@media (max-width: 1600px) { .hide-lg { display: none; } }
.section-label .link-arrow { text-transform: none; letter-spacing: 0; }
/* Sin desborde horizontal en móvil */
.content > *, .cols > *, .page-head > *, .env-card, .model-head > div { min-width: 0; }
.page-head__meta, .env-card__top, .repo-link { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .crumbs > span, .crumbs > .icon { display: none; }
  .topbar__right { gap: 6px; }
  .env-card__top .mono { display: none; }
  .panel__head { padding: 14px 16px; }
  .model-head, .env-card { padding: 16px; }
  .alert-item { grid-template-columns: 30px minmax(0, 1fr); padding: 12px 16px; }
  .alert-item time { grid-column: 2; }
  body.env-dev .env-banner { font-size: .78rem; }
}
.secret__value .subtle { font-family: var(--font-body); }
.channel .path { max-width: 230px; margin-top: 2px; }
.state-cell { min-width: 180px; }
.channel .path { max-width: 210px; }
.state-cell { min-width: 160px; max-width: 200px; }
.modal__head .icon-btn, .drawer__head .icon-btn { flex: none; }
.kv { margin: 0; }

/* ---------- Demo PET: KPIs de turnos, changelog, tags y marca ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--border); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.kpi { background: #fff; padding: 14px 18px; display: grid; gap: 2px; min-width: 0; }
.kpi span { font-size: .74rem; font-weight: 600; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .06em; }
.kpi strong { font: 700 1.5rem var(--font-display, inherit); color: var(--navy-900); font-variant-numeric: tabular-nums; }
.kpi small { font-size: .78rem; color: var(--text-muted); }
.rule-checks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 18px; padding: 16px 18px; }
.rule-check { display: flex; gap: 8px; align-items: flex-start; font-size: .84rem; color: var(--navy-900); min-width: 0; }
.rule-check .icon { width: 16px; height: 16px; color: var(--leaf-600); flex: none; margin-top: 2px; }
.rule-check b { font-weight: 600; display: block; }
.rule-check small { display: block; color: var(--text-subtle); font-size: .76rem; }
.changelog { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: .86rem; color: var(--text); }
.changelog li::marker { color: var(--leaf-600); }
.tag-list { display: grid; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.tag-row { display: grid; grid-template-columns: auto auto auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 14px; font-size: .84rem; color: var(--text); text-decoration: none; }
.tag-row + .tag-row { border-top: 1px solid var(--border); }
.tag-row:hover { background: var(--mist-25); }
.tag-row .icon { width: 15px; height: 15px; color: var(--steel-400); }
.tag-row__msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.brand-preview { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--mist-25); }
.brand-preview__logo { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; color: #fff; font: 800 1rem var(--font-display, inherit); letter-spacing: .04em; }
.brand-preview__logo .icon { width: 18px; height: 18px; }
.brand-preview strong { display: block; color: var(--navy-900); }
.brand-preview small { color: var(--text-subtle); font-size: .78rem; }
@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .rule-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rule-checks { grid-template-columns: 1fr; } .tag-row { grid-template-columns: auto auto minmax(0, 1fr) auto; } .tag-row .mono { display: none; } }
