/* NOVA by Amstro — sistema visual.
   Paleta del Brandbook 2026: Verde Lima #BFE870 · Verde Hoja #96D14D · Gris Metálico #E8E8E8
   · Negro Bosque #1B281B · Blanco. Los tonos de fondo son Negro Bosque con transparencia
   (el brandbook permite 20–80 % en digital). Rojo y ámbar solo para estados de error. */

:root {
  --lima: #bfe870;
  --hoja: #96d14d;
  --metal: #e8e8e8;
  --bosque: #1b281b;
  --white: #ffffff;

  --bg: #0b130c;
  --bg-2: #101b11;
  --surface: rgba(27, 40, 27, 0.55);
  --surface-2: rgba(27, 40, 27, 0.85);
  --surface-hover: rgba(191, 232, 112, 0.06);
  --line: rgba(191, 232, 112, 0.12);
  --line-strong: rgba(191, 232, 112, 0.28);
  --text: #eef3e6;
  --text-2: rgba(232, 232, 232, 0.62);
  --text-3: rgba(232, 232, 232, 0.38);
  --lima-glow: rgba(191, 232, 112, 0.35);
  --danger: #ff7a6b;
  --business: #ff9f4a;   /* Business Exception: naranja */
  --warning: #f2c14e;    /* Abandoned, paradas, avisos: ámbar */

  --radius: 16px;
  --radius-sm: 10px;
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Fondo: grafeno (red hexagonal) + halos lima */
.backdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 600px at 100% -10%, rgba(150, 209, 77, 0.16), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(191, 232, 112, 0.08), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}
.backdrop::after {
  content: ""; position: absolute; inset: 0; opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cg fill='none' stroke='%23BFE870' stroke-opacity='.10' stroke-width='1'%3E%3Cpath d='M28 0v16.2L0 32.4v32.3l28 16.2 28-16.2V32.4L28 16.2M28 80.9V97'/%3E%3C/g%3E%3Cg fill='%23BFE870' fill-opacity='.16'%3E%3Ccircle cx='28' cy='16.2' r='1.4'/%3E%3Ccircle cx='0' cy='32.4' r='1.4'/%3E%3Ccircle cx='56' cy='32.4' r='1.4'/%3E%3Ccircle cx='0' cy='64.7' r='1.4'/%3E%3Ccircle cx='56' cy='64.7' r='1.4'/%3E%3Ccircle cx='28' cy='80.9' r='1.4'/%3E%3C/g%3E%3C/svg%3E");
  mask-image: radial-gradient(ellipse at 70% 20%, #000 10%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 20%, #000 10%, transparent 75%);
}

/* ── Estructura ─────────────────────────────────────────────────────────── */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 248px 1fr; height: 100vh; }
.sidebar {
  display: flex; flex-direction: column; gap: 6px; padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(27, 40, 27, 0.75), rgba(11, 19, 12, 0.6));
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand-mark { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 0 12px var(--lima-glow)); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-weight: 800; font-size: 21px; letter-spacing: 0.18em; color: var(--white); }
.wordmark { white-space: nowrap; }
.wordmark .wm-a { position: relative; color: var(--lima); text-shadow: 0 0 18px rgba(191, 232, 112, 0.35); }
.wordmark .sparkles { position: absolute; top: -0.3em; right: -0.5em; width: 0.62em; height: 0.57em; overflow: visible; pointer-events: none; filter: drop-shadow(0 0 0.05em rgba(191, 232, 112, 0.85)); }
.wordmark .sparkles .spark { transform-box: fill-box; transform-origin: center; animation: twinkle 2.8s ease-in-out infinite; }
.wordmark .sparkles .s2 { animation-delay: 0.9s; }
.wordmark .sparkles .s3 { animation-delay: 1.8s; }
.brand-by { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 10px; color: var(--text-3); letter-spacing: 0.08em; text-transform: uppercase; }
.brand-by img { height: 9px; opacity: 0.9; }

.nav-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0;
  border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; font-weight: 600;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
  position: relative;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--surface-hover); color: var(--text); }
.nav a.active { color: var(--bosque); background: linear-gradient(135deg, var(--lima), var(--hoja)); box-shadow: 0 6px 24px rgba(191, 232, 112, 0.25); }
.nav a .count { margin-left: auto; font-family: var(--mono); font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(191, 232, 112, 0.14); color: var(--lima); }
.nav a.active .count { background: rgba(27, 40, 27, 0.2); color: var(--bosque); }
.sidebar-foot { margin-top: auto; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.sidebar-foot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lima); box-shadow: 0 0 10px var(--lima); animation: pulse 2s infinite; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 19, 12, 0.55); backdrop-filter: blur(12px);
}
.crumbs { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-3); }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--lima); }
.crumbs .sep { opacity: 0.5; }
.crumbs .here { color: var(--text); font-weight: 700; }
.topbar .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.user-chip .name { font-size: 12px; font-weight: 600; }
.user-chip .avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--bosque); background: linear-gradient(135deg, var(--lima), var(--hoja)); }
.dev-badge { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; color: var(--warning); border: 1px dashed rgba(242, 193, 78, 0.5); padding: 3px 8px; border-radius: 999px; }
.icon-btn { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.icon-btn:hover { color: var(--danger); background: rgba(255, 122, 107, 0.08); }
.icon-btn svg { width: 16px; height: 16px; }

.content { flex: 1; overflow-y: auto; padding: 28px 32px 48px; }
.content > * { animation: rise 0.35s var(--ease) both; }

/* ── Cabeceras de página ────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.page-head .sub { color: var(--text-2); margin-top: 6px; font-size: 13px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--lima); margin-bottom: 8px; }

/* ── Tarjetas ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(10px); box-shadow: inset 0 1px 0 rgba(191, 232, 112, 0.05);
}
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 14px; font-weight: 700; }
.card-head .meta { color: var(--text-3); font-size: 12px; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px 20px; }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-5 { grid-template-columns: repeat(3, 1fr); } .grid-3-1, .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 800px) { .grid-5 { grid-template-columns: repeat(2, 1fr); } .grid-5 > :last-child:nth-child(odd) { grid-column: 1 / -1; } }

.kpi {
  position: relative; overflow: hidden; padding: 20px 22px; cursor: pointer; text-decoration: none; color: inherit;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
.kpi:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.kpi::before { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, var(--kpi-glow, rgba(191, 232, 112, 0.18)), transparent 70%); }
.kpi .label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; font-weight: 600; }
.kpi .label svg { width: 16px; height: 16px; color: var(--kpi-color, var(--lima)); }
.kpi .value { font-family: var(--mono); font-size: 40px; font-weight: 700; margin-top: 12px; letter-spacing: -0.03em; color: var(--kpi-color, var(--white)); }
.kpi .hint { color: var(--text-3); font-size: 11px; margin-top: 4px; }
.kpi.danger { --kpi-color: var(--danger); --kpi-glow: rgba(255, 122, 107, 0.16); }
.kpi.warn { --kpi-color: var(--warning); --kpi-glow: rgba(242, 193, 78, 0.14); }
.kpi.calm { --kpi-color: var(--metal); --kpi-glow: rgba(232, 232, 232, 0.08); }

/* ── Tablas ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); padding: 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 10px; border-bottom: 1px solid rgba(191, 232, 112, 0.06); vertical-align: middle; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
tbody tr { transition: background 0.15s; }
tbody tr.link { cursor: pointer; }
tbody tr:hover { background: var(--surface-hover); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--mono); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.strong { font-weight: 700; }
.ellipsis { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.id { font-family: var(--mono); color: var(--lima); font-size: 12px; }
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty svg { width: 36px; height: 36px; color: var(--line-strong); margin-bottom: 10px; }

/* ── Estados ────────────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--lima); background: rgba(191, 232, 112, 0.1); border-color: rgba(191, 232, 112, 0.25); }
.pill.run { color: var(--hoja); background: rgba(150, 209, 77, 0.1); border-color: rgba(150, 209, 77, 0.3); }
.pill.run::before { animation: pulse 1.4s infinite; box-shadow: 0 0 8px currentColor; }
.pill.idle { color: var(--metal); background: rgba(232, 232, 232, 0.06); border-color: rgba(232, 232, 232, 0.14); }
.pill.bad { color: var(--danger); background: rgba(255, 122, 107, 0.1); border-color: rgba(255, 122, 107, 0.28); }
.pill.term { color: var(--danger); background: rgba(255, 122, 107, 0.12); border-color: rgba(255, 122, 107, 0.4); }
.pill.term::before { animation: pulse 0.9s infinite; box-shadow: 0 0 8px currentColor; }
.pill.biz { color: var(--business); background: rgba(255, 159, 74, 0.1); border-color: rgba(255, 159, 74, 0.3); }
.stuck { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: var(--warning); }
.stuck::before { content: "⚠"; }
.pill.warn { color: var(--warning); background: rgba(242, 193, 78, 0.1); border-color: rgba(242, 193, 78, 0.28); }
.pill.off { color: var(--text-3); background: transparent; border-color: rgba(232, 232, 232, 0.1); }
.tag { display: inline-block; font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--lima); }
.tag.dispatcher { color: var(--hoja); border-color: rgba(150, 209, 77, 0.35); }
.tag.reporter { color: var(--metal); border-color: rgba(232, 232, 232, 0.25); }
.counts { display: inline-flex; gap: 10px; font-family: var(--mono); font-size: 12px; }
a.plain { color: var(--text); text-decoration: none; } a.plain:hover { color: var(--lima); }
.log-ref { margin-right: 8px; padding: 1px 6px; border-radius: 5px; background: rgba(191, 232, 112, 0.1); color: var(--lima); font-size: 11px; }
.counts .c-new { color: var(--text); } .counts .c-ok { color: var(--lima); } .counts .c-be { color: var(--business); } .counts .c-ae { color: var(--danger); } .counts .c-ab { color: var(--warning); }

/* ── Controles ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px;
  font-family: var(--font); font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn:hover { border-color: var(--lima); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { color: var(--bosque); border-color: transparent; background: linear-gradient(135deg, var(--lima), var(--hoja)); box-shadow: 0 6px 22px rgba(191, 232, 112, 0.22); }
.btn.primary:hover { box-shadow: 0 8px 30px rgba(191, 232, 112, 0.38); }
.btn.danger { color: var(--danger); border-color: rgba(255, 122, 107, 0.35); background: rgba(255, 122, 107, 0.06); }
.btn.danger:hover { border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--surface-hover); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--text-3); }
.search input { padding-left: 38px; }
input, select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; font-family: var(--font); font-size: 13px;
  background: rgba(11, 19, 12, 0.7); color: var(--text); border: 1px solid var(--line);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
select { width: auto; min-width: 150px; cursor: pointer; }
textarea { height: auto; min-height: 150px; padding: 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--lima); box-shadow: 0 0 0 3px rgba(191, 232, 112, 0.14); }
/* Checkbox propio (el nativo desentona con el tema oscuro). */
input[type="checkbox"] { appearance: none; -webkit-appearance: none; flex: none; display: inline-grid; place-content: center; box-sizing: border-box; width: 16px; min-width: 16px; height: 16px; padding: 0; margin: 0; vertical-align: middle; border-radius: 5px; border: 1.5px solid rgba(232, 232, 232, 0.26); background: rgba(232, 232, 232, 0.04); cursor: pointer; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s; }
input[type="checkbox"]::before { content: ""; width: 9px; height: 9px; background: #1b281b; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); transform: scale(0); transition: transform 0.12s var(--ease); }
input[type="checkbox"]:hover { border-color: var(--lima); }
input[type="checkbox"]:checked { background: var(--lima); border-color: var(--lima); box-shadow: 0 0 8px var(--lima-glow); }
input[type="checkbox"]:focus { box-shadow: none; }
input[type="checkbox"]:checked:focus { box-shadow: 0 0 8px var(--lima-glow); }
input[type="checkbox"]:checked::before { transform: scale(1); }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--lima); outline-offset: 2px; }
.field.check { flex-direction: row; align-items: center; gap: 10px; }
input[type="file"] { padding: 7px 10px; height: auto; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-2); }
/* La ayuda va debajo del campo (order): así dos campos de la misma fila quedan alineados
   aunque solo uno tenga ayuda. */
.field .help { order: 1; font-weight: 500; color: var(--text-3); font-size: 11px; line-height: 1.4; }
.form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; cursor: pointer; border: 1px solid var(--line); background: transparent; color: var(--text-2); font-family: var(--font); }
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.on { background: rgba(191, 232, 112, 0.14); border-color: var(--lima); color: var(--lima); }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12px; }
.bulkbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: rgba(191, 232, 112, 0.08); border-bottom: 1px solid var(--line-strong); font-size: 13px; }

/* ── Detalles ───────────────────────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 13px; }
.kv dt { color: var(--text-3); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv .full { grid-column: 1 / -1; }
.kv dd.full { margin-top: -4px; }
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(255, 122, 107, 0.35); background: rgba(255, 122, 107, 0.07); color: var(--text); margin-bottom: 18px; }
.alert svg { width: 20px; height: 20px; color: var(--danger); flex: none; margin-top: 1px; }
.alert .title { font-weight: 800; color: var(--danger); }
.alert.warn { border-color: rgba(242, 193, 78, 0.35); background: rgba(242, 193, 78, 0.07); }
.alert.warn svg, .alert.warn .title { color: var(--warning); }
details.trace summary { cursor: pointer; color: var(--text-2); font-size: 12px; margin-top: 8px; }
pre { margin: 0; }
.code {
  font-family: var(--mono); font-size: 12px; line-height: 1.6; padding: 14px 16px; border-radius: 12px;
  background: rgba(5, 10, 6, 0.75); border: 1px solid var(--line); overflow: auto; max-height: 420px; white-space: pre-wrap; word-break: break-word;
}
/* Argumentos como tabla (web/js/args.js) */
.args { display: grid; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text); }
.args-head, .arg-row { display: grid; grid-template-columns: minmax(120px, 1fr) 118px minmax(160px, 1.5fr) 30px; gap: 8px; align-items: center; }
.args-head { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.args-rows { display: grid; gap: 6px; }
.arg-row select { min-width: 0; width: 100%; }
.arg-name { min-width: 0; }
.arg-name > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--lima); }
.arg-row.changed .arg-name > span::after { content: " ●"; color: var(--warning); font-size: 10px; }
.arg-value { display: flex; align-items: center; gap: 10px; min-width: 0; }
.args-empty { font-size: 12px; padding: 4px 0; }
.args-foot { display: flex; gap: 8px; align-items: center; }
.args-foot [data-mode] { margin-left: auto; }
.args textarea { min-height: 120px; }
.icon-btn.neutral:hover { color: var(--lima); background: var(--surface-hover); }
.args [hidden] { display: none; }
/* Versión publicada más nueva que la activa */
.update-arrow { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--warning); white-space: nowrap; }
.update-arrow svg { width: 13px; height: 13px; }
.alert.warn .btn { align-self: center; }
.args-view { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-family: var(--mono); font-size: 12.5px; }
.args-view > span { min-width: 0; overflow-wrap: break-word; }
.json .k { color: var(--lima); } .json .s { color: #d9f2b0; } .json .n { color: var(--hoja); } .json .b { color: var(--warning); } .json .z { color: var(--text-3); }

.terminal { font-family: var(--mono); font-size: 12px; line-height: 1.65; background: rgba(5, 10, 6, 0.85); border-radius: 0 0 var(--radius) var(--radius); max-height: 520px; overflow: auto; padding: 12px 0; }
.log-line { display: grid; grid-template-columns: 96px 70px 1fr; gap: 12px; padding: 1px 18px; }
.log-line:hover { background: rgba(191, 232, 112, 0.04); }
.log-line .ts { color: var(--text-3); }
.log-line .lv { font-weight: 700; text-transform: uppercase; font-size: 10.5px; padding-top: 1px; }
.log-line .msg { white-space: pre-wrap; word-break: break-word; color: var(--metal); }
.log-line .msg a { color: var(--lima); text-decoration: none; margin-right: 6px; font-size: 11px; }
.lv-debug { color: var(--text-3); } .lv-info { color: var(--hoja); } .lv-warning { color: var(--warning); } .lv-error, .lv-critical { color: var(--danger); }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--line-strong), transparent); }
.step { position: relative; padding: 0 0 20px; }
.step::before { content: ""; position: absolute; left: -23px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--step-color, var(--metal)); box-shadow: 0 0 10px var(--step-color, transparent); }
.step.ok { --step-color: var(--lima); } .step.bad { --step-color: var(--danger); } .step.warn { --step-color: var(--warning); } .step.run { --step-color: var(--hoja); } .step.biz { --step-color: var(--business); }
.step .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step .body { margin-top: 8px; font-size: 12.5px; color: var(--text-2); }

.progress { height: 6px; border-radius: 999px; background: rgba(232, 232, 232, 0.08); overflow: hidden; display: flex; }
.progress span { height: 100%; }

/* ── Modal y avisos ─────────────────────────────────────────────────────── */
.modal-back { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(4, 8, 5, 0.7); backdrop-filter: blur(6px); animation: fade 0.2s both; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 48px); overflow: auto; background: linear-gradient(180deg, rgba(27, 40, 27, 0.96), rgba(16, 27, 17, 0.98)); border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow), 0 0 0 1px rgba(191, 232, 112, 0.04) inset; animation: pop 0.25s var(--ease) both; }
.modal.wide { max-width: 760px; }
.modal-head { padding: 20px 24px 0; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 800; }
.modal-head p { margin: 6px 0 0; color: var(--text-2); font-size: 13px; }
.modal-body { padding: 20px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; }
.modal .error { color: var(--danger); font-size: 12px; min-height: 16px; }
/* Screencast */
/* Ancho limitado por la altura de la ventana: la imagen (16:10) cabe entera sin scroll. */
.modal.screen { max-width: min(1120px, 100%, calc((100vh - 190px) * 1.6 + 48px)); }
.screen-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 16px; }
.screen-head h3 { display: flex; align-items: center; gap: 10px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lima); box-shadow: 0 0 10px var(--lima); animation: pulse 1.6s infinite; flex: none; }
.screen-box { position: relative; margin: 0 24px 24px; aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden; background: #070c08; border: 1px solid var(--line); }
.screen-box img { display: block; width: 100%; height: 100%; object-fit: contain; }
.screen-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; color: var(--text-2); font-size: 13px; text-align: center; }
.screen-empty svg { width: 28px; height: 28px; opacity: 0.6; }
.screen-empty[hidden], .screen-box img[hidden] { display: none; }
.modal.screen.ended .live-dot { background: var(--text-3); box-shadow: none; animation: none; }
@media (max-width: 640px) { .screen-box { margin: 0 12px 12px; aspect-ratio: 4 / 3; } }
.secret { display: flex; gap: 10px; align-items: center; padding: 14px; border-radius: 12px; border: 1px dashed var(--lima); background: rgba(191, 232, 112, 0.06); font-family: var(--mono); font-size: 12.5px; word-break: break-all; }

.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 260px; max-width: 420px; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-size: 13px; animation: pop 0.25s var(--ease) both; display: flex; gap: 10px; align-items: flex-start; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--lima); box-shadow: 0 0 10px var(--lima); }
.toast.bad { border-color: rgba(255, 122, 107, 0.4); } .toast.bad::before { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bosque); }
.login-art { position: relative; background: url("/static/img/fondo-amstro.png") left center / cover no-repeat; overflow: hidden; }
.login-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 55%, var(--bosque)); }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 64px; position: relative; }
.login-panel .brand-mark { width: 54px; height: 54px; }
.login-title { font-size: 64px; font-weight: 800; letter-spacing: 0.16em; margin: 22px 0 0; line-height: 1; }
.login-by { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--text-3); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; }
.login-by img { height: 14px; }
.login-lead { color: var(--text-2); font-size: 15px; line-height: 1.6; max-width: 380px; margin: 34px 0 30px; }
.ms-btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; height: 48px; padding: 0 22px; max-width: 340px; border-radius: 12px; border: 0; cursor: pointer; background: var(--white); color: #1b1b1b; font-family: var(--font); font-weight: 700; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); transition: transform 0.2s var(--ease); }
.ms-btn:hover { transform: translateY(-2px); }
.ms-btn:disabled { opacity: 0.6; cursor: wait; }
.login .error { color: var(--danger); font-size: 12px; margin-top: 14px; min-height: 16px; }
.login-foot { position: absolute; bottom: 28px; left: 64px; color: var(--text-3); font-size: 11px; font-family: var(--mono); }
@media (max-width: 900px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } }

.splash { position: fixed; inset: 0; display: grid; place-items: center; z-index: 90; background: var(--bg); }
.splash .brand-mark { width: 64px; height: 64px; animation: spin 2.4s linear infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes twinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.7; transform: scale(0.8); } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(191, 232, 112, 0.14); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(191, 232, 112, 0.28); background-clip: padding-box; }

/* ── Triggers y Assets ─────────────────────────────────────────────────── */
tr.dim td { opacity: 0.5; }
tr.dim td:first-child { opacity: 1; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(232, 232, 232, 0.14); border: 1px solid var(--line); transition: background 0.2s; }
.switch span::before { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--metal); transition: transform 0.2s var(--ease), background 0.2s; }
.switch input:checked + span { background: rgba(191, 232, 112, 0.25); border-color: var(--lima); }
.switch input:checked + span::before { transform: translateX(16px); background: var(--lima); box-shadow: 0 0 10px var(--lima-glow); }
.preview { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line-strong); background: rgba(191, 232, 112, 0.04); font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.preview > div { width: 100%; }
.chip:disabled { opacity: 0.5; cursor: not-allowed; }
td.wrap { white-space: normal; min-width: 150px; max-width: 320px; }
.ellipsis.narrow { max-width: 170px; }
/* Lista de colas: la descripción, en una línea con «…» (entera al pasar el ratón y en la cola);
   los reintentos siempre se ven. */
/* La celda «grow» se queda con el espacio que dejan las demás columnas (los números siempre
   se ven) y su texto se corta con «…» según el ancho de la pantalla. */
td.grow { width: 100%; max-width: 0; }
td.grow .ellipsis { max-width: none; }
.queue-sub { display: flex; min-width: 0; }
.queue-sub .ellipsis { min-width: 0; }
.queue-sub > span:not(.ellipsis) { flex: none; }

/* Roles: lo que tu rol no puede hacer no se muestra (el servidor lo impide igualmente). */
body[data-role="viewer"] [data-need="developer"],
body[data-role="viewer"] [data-need="owner"],
body[data-role="developer"] [data-need="owner"] { display: none !important; }
body[data-role="viewer"] .switch { pointer-events: none; opacity: 0.6; }
.role-badge { margin-left: 8px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-strong); color: var(--lima); font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; vertical-align: 1px; }
.roles { display: grid; gap: 14px; }
.roles .muted { margin-top: 6px; font-size: 12px; }
.denied-title { margin: 22px 0 0; font-size: 20px; font-weight: 800; color: var(--danger); }

/* Menú ⋮ de las filas de jobs */
.btn.kebab { padding: 4px 6px; }
.btn.kebab svg { width: 16px; height: 16px; }
.row-menu { position: fixed; z-index: 60; min-width: 200px; padding: 6px; border-radius: 12px; border: 1px solid var(--line-strong); background: linear-gradient(180deg, rgba(27, 40, 27, 0.98), rgba(16, 27, 17, 0.99)); box-shadow: var(--shadow); animation: pop 0.15s var(--ease) both; }
.row-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.row-menu button svg { width: 15px; height: 15px; opacity: 0.8; }
.row-menu button:hover { background: rgba(191, 232, 112, 0.09); }
.row-menu button.danger { color: var(--danger); }
.row-menu hr { margin: 5px 4px; border: 0; border-top: 1px solid var(--line); }

/* Ordenar tablas: clic en la cabecera (ui.js) */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable::after { content: "↕"; margin-left: 6px; opacity: 0.25; font-size: 11px; }
th.sort-asc::after { content: "▲"; opacity: 0.9; color: var(--lima); font-size: 9px; }
th.sort-desc::after { content: "▼"; opacity: 0.9; color: var(--lima); font-size: 9px; }
