:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e5ea;
  --text: #1c2129;
  --muted: #667085;
  --accent: #2f6fde;
  --ok: #1f9d55;
  --warn: #d98a00;
  --crit: #d93025;
  --ok-soft: #e7f6ed;
  --warn-soft: #fff4dc;
  --crit-soft: #fde8e7;
  --log-bg: #0f1419;
  --log-text: #d6dde6;
  --log-ts: #6b7a8c;
  --log-warn: #f0b429;
  --log-error: #ff6b61;
  /* Series de las gráficas: paleta categórica validada (orden fijo, apta para daltonismo). */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161b22;
    --surface-2: #1d232c;
    --border: #2a313c;
    --text: #e4e8ee;
    --muted: #8b95a5;
    --accent: #6ea2ff;
    --ok: #3fbf74;
    --warn: #f0b429;
    --crit: #ff6b61;
    --ok-soft: #12291c;
    --warn-soft: #2e2510;
    --crit-soft: #331816;
    --shadow: none;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 15px; margin: 28px 0 12px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
.count { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 500; color: var(--muted); }

/* Barra superior */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.server-name { color: var(--muted); border-left: 1px solid var(--border); padding-left: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.current-user { font-size: 13px; }
.nav { display: flex; gap: 2px; }
.nav a { white-space: nowrap; padding: 5px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { color: var(--text); background: var(--surface-2); }
.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 16px 48px; }

/* Botones y formularios */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font: inherit; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--crit); border-color: var(--crit); }
.btn-danger:hover { background: var(--crit-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn[aria-pressed="true"] { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.btn[aria-pressed="true"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite; }
input, select {
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  min-height: 34px; padding: 5px 9px; width: 100%;
}
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 6px; }
label.check input { width: auto; min-height: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.alert { padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.alert-crit { background: var(--crit-soft); color: var(--crit); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.h2-link.h2-link-next { margin-left: 14px; }
.link { color: var(--accent); }
.link:hover { text-decoration: underline; }
.h2-link { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--accent); }
.h2-link:hover { text-decoration: underline; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-head h1 { font-size: 20px; }
.page-head p { margin: 4px 0 0; max-width: 760px; }

/* Semáforo */
.dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.dot-lg { width: 14px; height: 14px; }
.level-ok .dot, .bar-fill.level-ok { background: var(--ok); }
.level-warn .dot, .bar-fill.level-warn { background: var(--warn); }
.level-crit .dot, .bar-fill.level-crit { background: var(--crit); }
.level-crit > .dot-lg { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.banner {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: var(--radius);
  border: 1px solid var(--border);
}
.banner.level-ok { background: var(--ok-soft); }
.banner.level-warn { background: var(--warn-soft); }
.banner.level-crit { background: var(--crit-soft); }
.banner-text { display: flex; flex-direction: column; min-width: 0; }
.banner-text strong { font-size: 17px; overflow-wrap: anywhere; }
.banner-side { margin-left: auto; font-size: 12px; text-align: right; }

/* Sistema operativo */
.sysinfo { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 16px; padding: 12px 16px; }
.sys-item { display: flex; flex-direction: column; min-width: 0; }
.sys-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.sys-ok { color: var(--ok); }
.sys-warn { color: var(--warn); font-weight: 500; overflow-wrap: anywhere; }

/* Métricas */
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 16px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.metric-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.metric-title { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.metric-value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric-net { display: flex; flex-wrap: wrap; gap: 4px 14px; font-weight: 600; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.metric-sub { color: var(--muted); font-size: 12px; margin-top: 6px; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.bar-fill { display: block; height: 100%; border-radius: 3px; transition: width .4s; }

/* Requiere atención */
.attention { list-style: none; margin: 0; padding: 4px 0; }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 9px 14px; }
.row:hover { background: var(--surface-2); }
.row-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.level-crit .row-reason { color: var(--crit); }
.level-warn .row-reason { color: var(--warn); }
.row-when { font-size: 12px; }

/* Avisos */
.count-crit { background: var(--crit-soft); border-color: var(--crit); color: var(--crit); }
.channels { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 500; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); background: var(--surface); }
.chip-ok { color: var(--ok); border-color: var(--ok); }
.chip-crit { color: var(--crit); border-color: var(--crit); background: var(--crit-soft); }
.alert-list { list-style: none; margin: 0; padding: 4px 0; }
.alert-item { display: grid; grid-template-columns: 22px 92px minmax(120px, 240px) minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 7px 14px; }
.alert-item.alert-empty { display: block; }
.alert-item + .alert-item { border-top: 1px solid var(--border); }
.alert-time { font-size: 12px; font-variant-numeric: tabular-nums; }
.alert-subject { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-subject a:hover { text-decoration: underline; }
.alert-subject .muted { font-weight: 400; margin-left: 4px; }
.alert-item.kind-resolved .alert-text { color: var(--ok); }
.alert-item.level-crit:not(.kind-resolved) .alert-text { color: var(--crit); }
.alert-item.level-warn:not(.kind-resolved) .alert-text { color: var(--warn); }

/* Aplicaciones */
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.app { display: flex; flex-direction: column; overflow: hidden; position: relative; }
/* En el panel, toda la tarjeta despliega sus contenedores; el nombre lleva a la aplicación y cada servicio a su contenedor. */
.app-toggle {
  display: grid; place-items: center; width: 22px; height: 22px; padding: 0;
  background: none; border: 0; color: var(--muted); cursor: pointer;
}
.app-toggle::after { content: ""; position: absolute; inset: 0; }
.app-toggle:focus-visible { outline: none; }
.app:has(.app-toggle:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.app-collapsible:hover { border-color: var(--accent); }
.app-collapsible:hover .app-toggle { color: var(--text); }
.chevron { width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.app-collapsible:not(.collapsed) .chevron { transform: translateY(2px) rotate(-135deg); }
.app-collapsible.collapsed .app-services { display: none; }
.app-collapsible.collapsed .app-head { padding-bottom: 12px; }
.app-link, .app .services a { position: relative; z-index: 1; }
.app-link:hover { text-decoration: underline; }
.app-detail .services { padding: 6px 0; }
.app.level-warn { border-top: 3px solid var(--warn); }
.app.level-crit { border-top: 3px solid var(--crit); }
.app-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; }
.app-head h3 { font-size: 15px; overflow-wrap: anywhere; }
.app-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.services { list-style: none; margin: 0; padding: 0 0 6px; }
.service {
  display: grid; grid-template-columns: auto minmax(60px, auto) minmax(0, 1fr) 52px 64px;
  align-items: center; gap: 10px; padding: 6px 14px;
}
.service:hover { background: var(--surface-2); }
.service-name { font-weight: 500; }
.service-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.level-crit .service-status { color: var(--crit); }
.level-warn .service-status { color: var(--warn); }
.service-num { text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.app-foot { margin-top: auto; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12px; }

/* Varios servidores */
.server-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.server-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text);
}
.server-chip:hover { border-color: var(--accent); }
.server-chip.current { background: var(--surface-2); }
.server-chip.level-crit { border-color: var(--crit); }
.server-chip-note { font-size: 12px; color: var(--muted); }
.server-chip.level-crit .server-chip-note { color: var(--crit); }
.servers { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; margin-top: 16px; align-items: start; }
.server-card { display: flex; flex-direction: column; overflow: hidden; }
.server-card.level-warn { border-top: 3px solid var(--warn); }
.server-card.level-crit { border-top: 3px solid var(--crit); }
.server-card .app-head .chip { margin-left: 2px; }
.server-version { margin-left: auto; font-size: 12px; }
.server-problem { margin: 0 14px 8px; color: var(--crit); font-size: 13px; overflow-wrap: anywhere; }
.server-summary { margin: 0 14px 4px; font-size: 13px; }
.server-card .alert { margin: 8px 14px; }
.text-crit { color: var(--crit); }
.metrics-compact { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 8px 14px 12px; }
.metrics-compact .metric { padding: 10px 12px; }
.server-card .attention { margin: 0 14px 12px; }
.server-more { margin: -6px 14px 12px; font-size: 12px; }
.server-foot { display: flex; align-items: center; gap: 10px; }
.server-foot .h2-link { font-size: 12px; }
.banner-side-btn { margin-left: auto; flex: none; }
.remote-note { font-size: 13px; margin-top: 16px; }

/* Detalle de contenedor */
.back { display: inline-block; color: var(--muted); margin-bottom: 12px; }
.back:hover { color: var(--text); }
.details { margin-top: 16px; padding: 4px 16px; }
.details dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 24px; margin: 0; }
.details dl > div { padding: 9px 0; border-bottom: 1px solid var(--border); }
.details dt { font-size: 12px; color: var(--muted); }
.details dd { margin: 2px 0 0; }

/* Logs */
.logs { margin-top: 20px; padding: 14px 16px 16px; }
.logs-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.logs-toolbar h2 { margin: 0 8px 7px 0; }
.logs-toolbar label { width: 140px; }
.logs-toolbar label:has(#log-since) { width: 200px; }
.logs-toolbar label:has(#log-level) { width: 190px; }
.logs-toolbar label.grow { flex: 1 1 180px; }
.logs-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.logs-status { display: flex; align-items: center; gap: 14px; margin: 12px 0 8px; font-size: 12px; }
.logs-status .check { margin-left: auto; }
.log-output {
  height: 62vh; min-height: 320px; overflow: auto;
  background: var(--log-bg); color: var(--log-text);
  border-radius: 8px; padding: 10px 0;
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.log-line { padding: 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-line:hover { background: rgba(255, 255, 255, .04); }
.log-ts { color: var(--log-ts); user-select: none; margin-right: 10px; }
.log-line.lv-warn .log-msg { color: var(--log-warn); }
.log-line.lv-error { background: rgba(255, 107, 97, .08); }
.log-line.lv-error .log-msg { color: var(--log-error); }
.log-line mark { background: #f0b429; color: #111; border-radius: 2px; }
.log-empty { color: var(--log-ts); padding: 12px; }

/* Errores en logs */
.incident-list { list-style: none; margin: 0; padding: 4px 0; }
.incident-list > li + li { border-top: 1px solid var(--border); }
.incident-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 200px) 120px 100px;
  align-items: center; gap: 12px; padding: 9px 14px;
}
.incident-row:hover { background: var(--surface-2); }
.status-open .dot { background: var(--crit); }
.status-resolved .dot { background: var(--ok); }
.status-ignored .dot { background: var(--muted); }
.incident-main { display: flex; flex-direction: column; min-width: 0; }
.incident-title, .incident-context { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: normal; }
.incident-context { font-size: 12px; }
.incident-id { font-variant-numeric: tabular-nums; }
.status-ignored .incident-title { color: var(--muted); }
.incident-where { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.incident-count, .incident-when { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.incident-count strong { font-size: 14px; }
.incident-empty { padding: 10px 14px; }
.incident-legend { display: grid; grid-template-columns: minmax(0, 1fr) 120px 100px; gap: 12px; padding: 0 14px 6px 35px; font-size: 12px; }
.incident-legend span:not(:first-child) { text-align: right; }
.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tab { padding: 6px 12px; border-radius: 8px; border: 1px solid transparent; color: var(--muted); font-weight: 500; }
.tab:hover { background: var(--surface-2); }
.tab.active { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow); }
.filter-app { display: flex; gap: 8px; }
.filter-app select { width: 230px; }

.incident-head { padding: 16px 18px; border-top: 3px solid var(--crit); }
.incident-head.status-resolved { border-top-color: var(--ok); }
.incident-head.status-ignored { border-top-color: var(--muted); }
.incident-head-top { display: flex; align-items: center; gap: 10px; }
.incident-h1 { font-size: 16px; font-weight: 600; margin: 12px 0 4px; white-space: pre-wrap; word-break: normal; overflow-wrap: anywhere; }
.incident-ctx { margin: 0; word-break: normal; overflow-wrap: anywhere; }
.page-head .mono, .rule-help .mono, .rule-main .mono { word-break: normal; overflow-wrap: anywhere; }
.incident-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.incident-actions form { margin: 0; }
.incident-sample { height: auto; max-height: 62vh; min-height: 0; margin: 12px 0 0; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.hist-card { margin-top: 16px; padding: 4px 16px 12px; }
.hist-card h2 { margin: 12px 0; }
.hist { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; height: 64px; align-items: end; }
.hist-bar { height: 100%; display: flex; align-items: flex-end; }
.hist-bar > span { display: block; width: 100%; min-height: 2px; border-radius: 2px; background: var(--border); }
.hist-bar.has > span { min-height: 3px; background: var(--crit); }
.hist-axis { display: flex; justify-content: space-between; font-size: 12px; margin-top: 6px; }

.rule-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding: 14px 16px; }
.rule-form label { width: 190px; }
.rule-form label:has(select[name="scope"]) { width: 240px; }
.rule-form label.grow { flex: 1 1 220px; }
.rule-help { flex-basis: 100%; margin: 4px 0 0; font-size: 12px; }
.rule-list { list-style: none; margin: 16px 0 0; padding: 4px 0; }
.rule-item { display: flex; align-items: center; gap: 12px; padding: 8px 14px; }
.rule-item + .rule-item { border-top: 1px solid var(--border); }
.rule-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.rule-main .muted { font-size: 12px; }
.rule-item form { margin: 0; }

/* Historial */
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.charts-2 { grid-template-columns: repeat(auto-fill, minmax(480px, 1fr)); margin-bottom: 14px; }
.chart-card { margin: 0; padding: 12px 14px 10px; min-width: 0; }
.chart-title { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.chart-box { position: relative; height: 210px; }
.chart-empty { margin: 0; padding-top: 80px; text-align: center; font-size: 13px; }
.tabs-sm { margin-left: 8px; }
.tabs-sm .tab { font: inherit; font-size: 12px; padding: 2px 9px; cursor: pointer; background: transparent; }
.tabs-sm .tab.active { background: var(--surface); }
.sub-h { font-size: 13px; color: var(--muted); font-weight: 500; margin: 18px 0 8px; }
.empty-card { padding: 14px; margin: 0; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.data-table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 9px 14px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 8px 14px; border-top: 1px solid var(--border); }
.data-table tbody tr:first-child td { border-top: 0; }
.data-table .num { text-align: right; white-space: nowrap; }
.data-table td a { color: var(--accent); font-weight: 500; }
.data-table td a:hover { text-decoration: underline; }
.data-table tr.selected td { background: var(--surface-2); }
.swatch { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 8px; vertical-align: middle; background: var(--series-1); }
.swatch[data-slot="2"] { background: var(--series-2); } .swatch[data-slot="3"] { background: var(--series-3); }
.swatch[data-slot="4"] { background: var(--series-4); } .swatch[data-slot="5"] { background: var(--series-5); }
.swatch[data-slot="6"] { background: var(--series-6); } .swatch[data-slot="7"] { background: var(--series-7); }
.swatch[data-slot="8"] { background: var(--series-8); }
.event-list { list-style: none; margin: 0; padding: 4px 0; max-height: 520px; overflow-y: auto; }
.event-item { display: grid; grid-template-columns: auto 92px minmax(120px, 260px) minmax(0, 1fr); align-items: center; gap: 12px; padding: 6px 14px; }
.event-item + .event-item { border-top: 1px solid var(--border); }
.event-time { font-size: 12px; font-variant-numeric: tabular-nums; }
.event-container { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.event-container a:hover { text-decoration: underline; }
.event-list:not(:has(.event-container)) .event-item { grid-template-columns: auto 92px minmax(0, 1fr); }
.level-crit .event-text { color: var(--crit); }

/* Repositorio de la aplicación */
.repo { padding: 4px 16px; }
.repo-row { padding: 12px 0; }
.repo-row + .repo-row, .repo-sub-h + .repo-row { border-top: 1px solid var(--border); }
.repo-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.repo-name { font-size: 15px; }
.repo-path { font-size: 12px; margin-top: 2px; word-break: normal; overflow-wrap: anywhere; }
.repo-sub-h { margin: 8px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.repo-submodule { padding-left: 14px; border-left: 3px solid var(--border); margin-left: 2px; }
.repo-row .alert { margin: 10px 0 0; font-size: 13px; }
.repo-note { font-size: 12px; margin: 8px 2px 0; }
.chip-branch { color: var(--accent); border-color: var(--accent); }
.branch-at { font-size: 12px; }
.commit { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.commit-subject { font-weight: 500; overflow-wrap: anywhere; }
.commit-meta { font-size: 12px; }
.commit-hash { font-size: 12px; }

/* Acciones */
.page-title { font-size: 20px; margin-bottom: 14px; }
.nowrap { white-space: nowrap; }
.scripts { display: grid; gap: 10px; }
.script-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 14px 16px; margin: 0; }
.script-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 320px; }
.script-desc { font-size: 13px; }
.script-meta, .script-last { font-size: 12px; }
.script-meta .mono { font-size: 12px; word-break: normal; overflow-wrap: anywhere; }
.script-run { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.script-run label { width: 150px; }
.run-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.run-ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.run-crit { color: var(--crit); border-color: var(--crit); background: var(--crit-soft); }
.run-warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.run-run { color: var(--accent); border-color: var(--accent); }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.container-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.container-actions form { margin: 0; }
.run-head { padding: 16px 18px; }
.run-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.run-title h1 { font-size: 19px; }
.run-meta { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 14px 0 0; }
.run-meta dt { font-size: 12px; color: var(--muted); }
.run-meta dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.run-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.run-actions form { margin: 0; }
.run-output { margin: 0; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.logs-status .mono { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.audit-detail { font-size: 12px; overflow-wrap: anywhere; }
.alert-item.level-ok .alert-text { color: var(--ok); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-brand h1 { font-size: 22px; }
.login-card .btn { margin-top: 6px; }

@media (max-width: 640px) {
  .apps, .servers { grid-template-columns: minmax(0, 1fr); }
  .banner:has(.banner-side-btn) { flex-wrap: wrap; }
  .banner-side-btn { margin-left: 28px; }
  .metrics-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-value { font-size: 17px; }
  .service { grid-template-columns: auto minmax(60px, auto) minmax(0, 1fr) 56px; }
  .service-num:last-child { display: none; }
  .row { grid-template-columns: auto minmax(0, 1fr); }
  .row-reason, .row-when { grid-column: 2; }
  .alert-item { grid-template-columns: 22px minmax(0, 1fr); gap: 2px 8px; }
  .alert-item > :not(.alert-icon) { grid-column: 2; }
  .alert-subject { white-space: normal; }
  .banner-side { display: none; }
  .logs-toolbar label, .logs-toolbar label:has(#log-since), .logs-toolbar label:has(#log-level) { width: 100%; }
  .server-name { display: none; }
  .incident-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .incident-where, .incident-when { display: none; }
  .charts, .charts-2 { grid-template-columns: minmax(0, 1fr); }
  .event-item { grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; }
  .event-item > :not(.dot) { grid-column: 2; }
  .event-list:not(:has(.event-container)) .event-item { grid-template-columns: auto minmax(0, 1fr); }
  .incident-legend { display: none; }
  .page-head { flex-direction: column; }
  .filter-app select { width: 100%; }
  .rule-form label, .rule-form label:has(select[name="scope"]) { width: 100%; }
  .nav a { padding: 5px 7px; }
  .current-user, .brand span { display: none; }
  .nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav a:first-child, .nav-long { display: none; }  /* el logo ya lleva al panel */
  .topbar { gap: 8px; }
}
