/* =========================================================
   SiPeK — components.css
   Componentes compartidos por todos los módulos.
   ========================================================= */

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line-soft);
  padding: 18px 14px;
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 22px;
}
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-name {
  font-family: var(--font-display); font-weight: 500;
  font-size: 22px; letter-spacing: .02em; line-height: 1;
}
.brand-name b { font-weight: 500; color: var(--muted); }

.nav-group { padding: 6px 0 14px; }
.nav-group + .nav-group { border-top: 1px solid var(--line-soft); padding-top: 14px; }
.nav-title {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 6px;
  font-size: var(--fs-xs); color: var(--muted);
}
.nav-title svg { width: 15px; height: 15px; color: var(--faint); }
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px 7px 31px;
  border-radius: var(--r-sm);
  color: var(--muted); font-size: var(--fs-md);
}
.nav-link.top { padding-left: 10px; }
.nav-link.top svg { width: 16px; height: 16px; color: var(--faint); }
.nav-link:hover { color: var(--text); background: var(--raised); }
.nav-link.active { color: var(--text); background: var(--raised); }
.nav-link.active::before {
  content: ""; position: absolute; left: 0; top: 7px; bottom: 7px;
  width: 2px; border-radius: 2px; background: var(--signal);
}
.nav-soon {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px; color: var(--faint); font-size: var(--fs-sm);
  border-radius: var(--r-sm);
}
.nav-soon:hover { color: var(--muted); }
.nav-soon svg { width: 15px; height: 15px; margin-right: 8px; vertical-align: -3px; }
.soon-chip {
  font-size: 11px; padding: 1px 7px; border-radius: 99px;
  border: 1px dashed var(--line); color: var(--faint);
}
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-soft); }

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--ink);
  position: sticky; top: 0; z-index: 5;
}
.topbar-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: var(--fs-xl); letter-spacing: .01em;
}
.crumbs { color: var(--muted); font-size: var(--fs-sm); }
.crumbs a:hover { color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.running-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 99px;
  font-size: var(--fs-sm); color: var(--text);
}
.running-pill:hover { border-color: var(--muted); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--raised); border: 1px solid var(--line);
  font-size: var(--fs-xs); font-weight: 700; color: var(--muted);
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: transparent; color: var(--text);
  font-size: var(--fs-sm); font-weight: 700; cursor: pointer;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.btn-primary:hover { background: #fff; border-color: #fff; }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: transparent; background: var(--raised); }

/* ---------- Paneles ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}
.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px 0;
}
.panel-title { font-size: var(--fs-lg); font-weight: 700; }
.panel-sub { color: var(--muted); font-size: var(--fs-sm); }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px 20px 20px; }

/* ---------- Puntos de estado / pulso ---------- */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-live { background: var(--signal); box-shadow: 0 0 0 0 rgba(220, 231, 244, .6); animation: pulse 1.8s infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(220, 231, 244, .5); }
  70%  { box-shadow: 0 0 0 7px rgba(220, 231, 244, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 231, 244, 0); }
}

/* ---------- Chip de estado ---------- */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); white-space: nowrap; }
.status .dot { width: 7px; height: 7px; }
.status-running   .dot { background: var(--signal); animation: pulse 1.8s infinite; }
.status-queued    { color: var(--muted); }
.status-queued    .dot { background: transparent; border: 1.5px solid var(--muted); }
.status-completed .dot { background: var(--ok); }
.status-failed    { color: var(--fail); }
.status-failed    .dot { background: var(--fail); }
.status-cancelled { color: var(--faint); }
.status-cancelled .dot { background: var(--faint); }
.status small { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; }

/* ---------- Severidad ---------- */
.sev { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.sev::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: currentColor; }
.sev-critical { color: var(--sev-critical); }
.sev-high     { color: var(--sev-high); }
.sev-medium   { color: var(--sev-medium); }
.sev-low      { color: var(--sev-low); }
.sev-info     { color: var(--sev-info); }

/* Contadores compactos por severidad (en tablas) */
.sev-counts { display: inline-flex; gap: 3px; }
.sev-counts span {
  min-width: 26px; height: 22px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: 3px;
  font-size: 12px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  background: var(--raised); color: var(--faint);
}
.sev-counts span.has.c-critical { background: rgba(255, 79, 109, .16); color: var(--sev-critical); }
.sev-counts span.has.c-high     { background: rgba(255, 139, 61, .15); color: var(--sev-high); }
.sev-counts span.has.c-medium   { background: rgba(235, 192, 63, .14); color: var(--sev-medium); }
.sev-counts span.has.c-low      { background: rgba(76, 168, 240, .14); color: var(--sev-low); }
.sev-counts span.has.c-info     { background: rgba(125, 136, 153, .16); color: #a4adbb; }

/* ---------- Tags ---------- */
.tags { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.tag {
  --c: var(--tag-slate);
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px 0 7px;
  border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  color: color-mix(in srgb, var(--c) 75%, white);
  font-size: var(--fs-xs); white-space: nowrap; cursor: pointer;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.tag:hover { border-color: var(--c); }
.tag.is-active { background: color-mix(in srgb, var(--c) 28%, transparent); border-color: var(--c); color: #fff; }
.tag-green  { --c: var(--tag-green); }
.tag-blue   { --c: var(--tag-blue); }
.tag-violet { --c: var(--tag-violet); }
.tag-pink   { --c: var(--tag-pink); }
.tag-amber  { --c: var(--tag-amber); }
.tag-teal   { --c: var(--tag-teal); }
.tag-red    { --c: var(--tag-red); }
.tag-slate  { --c: var(--tag-slate); }

/* ---------- Badges simples ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; border-radius: var(--r-sm);
  background: var(--raised); color: var(--muted);
  font-size: var(--fs-xs); white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; }

/* ---------- Tabla ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.table th {
  text-align: left; font-weight: 400; color: var(--muted);
  font-size: var(--fs-xs);
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 12px 12px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .025); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-icon {
  width: 30px; height: 30px; flex: none; border-radius: var(--r-sm);
  display: grid; place-items: center; background: var(--raised); color: var(--muted);
}
.cell-icon svg { width: 16px; height: 16px; }
.cell-name { font-weight: 700; white-space: nowrap; }
.cell-target {
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px;
}
.cell-muted { color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
.cell-sub { color: var(--faint); font-size: var(--fs-xs); white-space: nowrap; }
.table .tags { flex-wrap: nowrap; }

/* ---------- Filtros / segment ---------- */
.segment { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-sm); background: var(--ink); border: 1px solid var(--line-soft); }
.segment button {
  height: 26px; padding: 0 12px; border: 0; border-radius: 3px;
  background: transparent; color: var(--muted); font-size: var(--fs-sm); cursor: pointer;
}
.segment button:hover { color: var(--text); }
.segment button.is-active { background: var(--raised); color: var(--text); }

/* ---------- Estado vacío ---------- */
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: var(--fs-lg); margin-bottom: 4px; }

/* =========================================================
   Overview
   ========================================================= */
.ov-top { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); gap: 20px; }
@media (max-width: 1100px) { .ov-top { grid-template-columns: 1fr; } }

/* Running now: la pieza característica del Overview */
.run-list { display: flex; flex-direction: column; }
.run {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 20px; padding: 16px 20px;
  border-top: 1px solid var(--line-soft);
}
.run:first-child { border-top: 0; }
.run:hover { background: rgba(255, 255, 255, .02); }
.run-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.run-meta { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
.run-pct { font-family: var(--font-display); font-size: var(--fs-xl); color: var(--text); min-width: 52px; text-align: right; }
.run-pct small { font-family: var(--font-ui); font-size: var(--fs-sm); color: var(--muted); margin-left: 2px; }

/* Pista de herramientas: un segmento por herramienta del pipeline */
.track { grid-column: 1 / -1; display: flex; gap: 3px; }
.track-seg { flex: 1; min-width: 0; }
.track-bar { height: 4px; border-radius: 2px; background: var(--line); }
.track-seg.done .track-bar { background: var(--muted); }
.track-seg.running .track-bar { background: linear-gradient(90deg, var(--signal) var(--p, 40%), var(--line) var(--p, 40%)); }
.track-label {
  margin-top: 6px; font-family: var(--font-mono); font-size: 11px; color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track-seg.done .track-label { color: var(--muted); }
.track-seg.running .track-label { color: var(--text); }

/* Cola de log en vivo */
.tail {
  grid-column: 1 / -1;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.65;
  background: var(--ink); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: 8px 12px; height: calc(12px * 1.65 * 3 + 16px); overflow: hidden;
}
.tail-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.tail-line .t { color: var(--faint); margin-right: 10px; }
.tail-line .tool { color: var(--text); margin-right: 8px; }
.tail-line.finding { color: var(--sev-high); }
.tail-line.warn { color: var(--sev-medium); }
.tail-line.new { animation: lineIn .35s ease-out; }
@keyframes lineIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Open findings */
.risk-total { display: flex; align-items: baseline; gap: 12px; }
.risk-total .n { font-family: var(--font-display); font-size: var(--fs-4xl); line-height: 1; }
.risk-total .l { color: var(--muted); font-size: var(--fs-sm); }
.sevbar { display: flex; height: 10px; gap: 2px; margin: 18px 0 6px; }
.sevbar i { display: block; height: 100%; border-radius: 2px; }
.sevbar .critical { background: var(--sev-critical); }
.sevbar .high     { background: var(--sev-high); }
.sevbar .medium   { background: var(--sev-medium); }
.sevbar .low      { background: var(--sev-low); }
.sevbar .info     { background: var(--sev-info); }
.sev-rows { margin-top: 10px; }
.sev-row {
  display: grid; grid-template-columns: 1fr auto 44px; align-items: center; gap: 12px;
  padding: 8px 0; border-top: 1px solid var(--line-soft);
}
.sev-row:first-child { border-top: 0; }
.sev-row .n { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.sev-row .pct { color: var(--faint); font-size: var(--fs-xs); text-align: right; font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.facts div { display: flex; flex-direction: column; }
.facts dt { color: var(--muted); font-size: var(--fs-xs); }
.facts dd { margin: 0; font-family: var(--font-display); font-size: var(--fs-xl); }

/* Filtro por tag */
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 20px 6px; }
.filter-row .label { color: var(--muted); font-size: var(--fs-sm); margin-right: 2px; }
.filter-row .clear { color: var(--muted); font-size: var(--fs-sm); background: none; border: 0; cursor: pointer; padding: 0 4px; }
.filter-row .clear:hover { color: var(--text); }

/* Módulos */
.modules { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.module {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px; border-radius: var(--r-md);
  background: var(--panel); border: 1px solid var(--line-soft);
}
.module:hover { border-color: var(--line); }
.module-head { display: flex; align-items: center; gap: 10px; }
.module-head svg { width: 18px; height: 18px; color: var(--muted); }
.module-name { font-weight: 700; }
.module-desc { color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.module-stats { margin-top: auto; display: flex; gap: 18px; font-size: var(--fs-sm); color: var(--muted); }
.module-stats b { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-lg); color: var(--text); margin-right: 4px; }
.module.reserved { background: transparent; border-style: dashed; border-color: var(--line); }
.module.reserved .module-name, .module.reserved svg { color: var(--faint); }

.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.section-title { font-size: var(--fs-lg); font-weight: 700; }

/* =========================================================
   Coming soon
   ========================================================= */
.reserved-page {
  max-width: 620px; margin: 8vh auto 0; padding: 40px;
  border: 1px dashed var(--line); border-radius: var(--r-md);
}
.reserved-page h1 { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-3xl); margin-bottom: 12px; }
.reserved-page p { color: var(--muted); max-width: 52ch; }
.flow { display: flex; gap: 6px; margin: 26px 0 30px; flex-wrap: wrap; }
.flow span {
  padding: 6px 12px; border-radius: var(--r-sm); background: var(--panel);
  border: 1px solid var(--line-soft); font-size: var(--fs-sm); color: var(--muted);
}
.flow span + span::before { content: none; }

/* Acciones de página (layout.js las mueve a la topbar) */
.page-actions { display: flex; gap: 8px; }

/* Últimos hallazgos graves (Overview) */
.latest { margin-top: 22px; }
.latest h3 { font-size: var(--fs-sm); font-weight: 700; margin-bottom: 4px; }
.latest a {
  display: grid; grid-template-columns: 9px 1fr; gap: 2px 10px; align-items: baseline;
  padding: 9px 0; border-top: 1px solid var(--line-soft);
}
.latest a:first-of-type { border-top: 0; }
.latest a:hover .latest-title { text-decoration: underline; text-underline-offset: 3px; }
.latest .sq { width: 9px; height: 9px; border-radius: 2px; align-self: center; }
.latest .sq.critical { background: var(--sev-critical); }
.latest .sq.high { background: var(--sev-high); }
.latest-title { font-size: var(--fs-sm); }
.latest-where { grid-column: 2; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Pantallas angostas ---------- */
@media (max-width: 900px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 12px 16px; position: static; }
  .topbar-right { flex-wrap: wrap; margin-left: 0; width: 100%; }
  .sidebar { position: static; height: auto; }
  .sidebar-foot { margin-top: 0; }
  .run { grid-template-columns: minmax(0, 1fr); }
  .ov-top { grid-template-columns: minmax(0, 1fr); }
  .run-meta { flex-wrap: wrap; }
  .modules { grid-template-columns: 1fr; }
  .panel-head { flex-wrap: wrap; }
}

/* Estados extra de la pista de herramientas */
.track-seg.failed .track-bar { background: var(--fail); }
.track-seg.stopped .track-bar { background: var(--faint); }

/* =========================================================
   Formularios
   ========================================================= */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; max-width: 1180px; }
.form-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.form-section { padding: 22px 24px 24px; }
.form-section > h2 { font-size: var(--fs-lg); font-weight: 700; }
.form-section > .help { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; margin-bottom: 18px; max-width: 64ch; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: var(--fs-sm); color: var(--muted); }
.field-row { display: grid; gap: 12px; }
.input, .select {
  height: 38px; width: 100%; padding: 0 12px;
  background: var(--ink); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--text); font-size: var(--fs-md); outline: none;
}
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus { border-color: var(--focus); }
.input.mono { font-family: var(--font-mono); font-size: 13px; }
.input.is-invalid { border-color: var(--sev-critical); }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.input-lg { height: 46px; font-size: 15px; }
.input-icon .input-lg + svg, .input-icon.lg svg { top: 15px; }
.field-error { color: var(--sev-critical); font-size: var(--fs-xs); min-height: 16px; }
.field-hint { color: var(--faint); font-size: var(--fs-xs); }
.select { appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c98a8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }

/* Tarjetas de opción (radio) */
.options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.option { position: relative; cursor: pointer; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option-card {
  height: 100%; display: flex; flex-direction: column; gap: 8px;
  padding: 16px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--ink);
}
.option:hover .option-card { border-color: var(--muted); }
.option input:checked + .option-card { border-color: var(--signal); background: var(--raised); box-shadow: inset 0 0 0 1px var(--signal); }
.option input:focus-visible + .option-card { outline: 2px solid var(--focus); outline-offset: 2px; }
.option-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.option-title { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-xl); }
.option-time { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.option-time svg { width: 13px; height: 13px; }
.option-desc { color: var(--muted); font-size: var(--fs-sm); }
.option-tools { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-soft); font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); line-height: 1.7; }
.option-tools b { font-weight: 400; color: var(--text); }
.option-warn { color: var(--sev-medium); font-size: var(--fs-xs); }

/* Opciones avanzadas (details nativo) */
details.adv { border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
details.adv > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px;
  padding: 18px 24px;
}
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary .chev { width: 18px; height: 18px; color: var(--muted); transition: transform .15s; }
details.adv[open] > summary .chev { transform: rotate(90deg); }
details.adv > summary h2 { font-size: var(--fs-lg); font-weight: 700; }
details.adv > summary .panel-sub { margin-left: auto; }
.adv-body { padding: 0 24px 24px; display: flex; flex-direction: column; gap: 22px; }
.adv-block { border-top: 1px solid var(--line-soft); padding-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.adv-block h3 { font-size: var(--fs-md); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.adv-block h3 svg { width: 16px; height: 16px; color: var(--muted); }
.proxy-grid { grid-template-columns: 130px minmax(0, 1fr) 110px; }
.cred-grid { grid-template-columns: 1fr 1fr; }
.is-hidden { display: none !important; }

/* Interruptor */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-md); }
.switch input { position: absolute; opacity: 0; }
.switch .knob { width: 34px; height: 20px; border-radius: 99px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + .knob { background: var(--signal); }
.switch input:checked + .knob::after { transform: translateX(14px); background: var(--signal-ink); }
.switch input:focus-visible + .knob { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Segmento con radios (tipo de auth) */
.seg-radio { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-sm); background: var(--ink); border: 1px solid var(--line); align-self: flex-start; }
.seg-radio label { position: relative; cursor: pointer; }
.seg-radio input { position: absolute; opacity: 0; }
.seg-radio span { display: block; height: 30px; line-height: 30px; padding: 0 14px; border-radius: 3px; color: var(--muted); font-size: var(--fs-sm); }
.seg-radio input:checked + span { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.seg-radio input:focus-visible + span { outline: 2px solid var(--focus); }

/* Tags en formulario */
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.new-tag { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.new-tag .input { width: 200px; height: 32px; }
.swatches { display: inline-flex; gap: 6px; }
.swatches label { position: relative; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--c); border: 2px solid transparent; }
.swatches input:checked + span { border-color: var(--text); }
.swatches input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Resumen lateral */
.summary { position: sticky; top: calc(var(--topbar-h) + 28px); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.summary h2 { font-size: var(--fs-lg); font-weight: 700; }
.summary dl { margin: 0; display: flex; flex-direction: column; }
.summary dl div { display: grid; grid-template-columns: 76px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: var(--fs-sm); }
.summary dl div:first-child { border-top: 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.summary dd.empty-val { color: var(--faint); }
.summary .btn { justify-content: center; height: 42px; font-size: var(--fs-md); }
.summary .btn[disabled] { opacity: .4; cursor: not-allowed; }
.summary .note { color: var(--faint); font-size: var(--fs-xs); }

@media (max-width: 1000px) {
  .form-layout { grid-template-columns: minmax(0, 1fr); }
  .options { grid-template-columns: 1fr; }
  .proxy-grid, .cred-grid { grid-template-columns: 1fr; }
  .summary { position: static; }
}

/* =========================================================
   Detalle de escaneo
   ========================================================= */
.scan-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 32px; align-items: end; }
.scan-id { display: flex; gap: 16px; align-items: center; min-width: 0; }
.scan-id .cell-icon { width: 44px; height: 44px; }
.scan-id .cell-icon svg { width: 22px; height: 22px; }
.scan-name { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-2xl); line-height: 1.15; }
.scan-url { font-family: var(--font-mono); font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.scan-meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scan-meta .sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }
.scan-progress { text-align: right; }
.scan-progress .big { font-family: var(--font-display); font-size: var(--fs-4xl); line-height: 1; }
.scan-progress .big small { font-family: var(--font-ui); font-size: var(--fs-lg); color: var(--muted); margin-left: 2px; }
.scan-progress .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 6px; }
.progress { grid-column: 1 / -1; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--signal); transition: width .6s; }
.progress.is-done i { background: var(--ok); }
.progress.is-failed i { background: var(--fail); }
.progress.is-cancelled i { background: var(--faint); }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-sm); font-size: var(--fs-sm); border: 1px solid; }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner-error { border-color: color-mix(in srgb, var(--fail) 45%, transparent); background: color-mix(in srgb, var(--fail) 9%, transparent); color: #ffc2cc; }
.banner-muted { border-color: var(--line); color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  height: 42px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--muted); font-size: var(--fs-md); cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--signal); }
.tab .count { font-size: var(--fs-xs); padding: 1px 7px; border-radius: 99px; background: var(--raised); color: var(--muted); font-variant-numeric: tabular-nums; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* Pipeline grande */
.pipe { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 18px 20px 16px; }
.pipe-step { min-width: 0; }
.pipe-step .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.pipe-step .bar i { display: block; height: 100%; width: 0; background: var(--signal); transition: width .6s; }
.pipe-step.done .bar i { width: 100%; background: var(--muted); }
.pipe-step.failed .bar i { width: 100%; background: var(--fail); }
.pipe-step.stopped .bar i { background: var(--faint); }
.pipe-step .name { margin-top: 10px; font-family: var(--font-mono); font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe-step.done .name, .pipe-step.running .name { color: var(--text); }
.pipe-step.failed .name { color: var(--fail); }
.pipe-step .time { font-size: var(--fs-xs); color: var(--faint); font-variant-numeric: tabular-nums; }
.pipe-step.running .time { color: var(--signal); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; margin-top: 20px; align-items: start; }
@media (max-width: 1200px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } }

/* Event log */
.log-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.log-toolbar .select { width: auto; height: 32px; font-size: var(--fs-sm); }
.log-toolbar .spacer { flex: 1; }
.log-toolbar .switch { font-size: var(--fs-sm); color: var(--muted); }
.eventlog { height: 520px; overflow-y: auto; padding: 8px 0; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; }
.ev { display: grid; grid-template-columns: 70px 78px minmax(0, 1fr); gap: 12px; padding: 2px 16px; }
.ev:hover { background: rgba(255, 255, 255, .025); }
.ev .t { color: var(--faint); }
.ev .tool { color: var(--muted); }
.ev .msg { color: var(--text); overflow-wrap: anywhere; }
.ev.start .msg, .ev.done .msg { color: var(--muted); }
.ev.done .msg::before { content: "✓ "; color: var(--ok); }
.ev.warn .msg { color: var(--sev-medium); }
.ev.error .msg { color: var(--fail); }
.ev.finding .msg { color: var(--text); }
.ev .sevtag { font-weight: 700; margin-right: 6px; }
.ev.new { animation: lineIn .35s ease-out; }

/* Widgets */
.widgets { display: flex; flex-direction: column; gap: 14px; }
.widget { padding: 16px 18px; }
.widget h3 { font-size: var(--fs-sm); font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.widget h3 a, .widget h3 button { font-weight: 400; color: var(--muted); font-size: var(--fs-xs); background: none; border: 0; cursor: pointer; }
.widget h3 a:hover, .widget h3 button:hover { color: var(--text); }
.pair { display: grid; grid-template-columns: 1fr 1fr; }
.pair div + div { border-left: 1px solid var(--line-soft); padding-left: 16px; }
.pair .n { font-family: var(--font-display); font-size: var(--fs-3xl); line-height: 1.1; }
.pair .l { color: var(--muted); font-size: var(--fs-xs); }
.minirows .sev-row { padding: 6px 0; }
.httpbars { display: flex; flex-direction: column; gap: 8px; }
.httpbar { display: grid; grid-template-columns: 34px 1fr 30px; gap: 10px; align-items: center; font-size: var(--fs-xs); }
.httpbar .k { color: var(--muted); font-family: var(--font-mono); }
.httpbar .b { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.httpbar .b i { display: block; height: 100%; background: var(--muted); border-radius: 3px; }
.httpbar .v { text-align: right; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ports { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.ports td { padding: 6px 0; border-top: 1px solid var(--line-soft); }
.ports tr:first-child td { border-top: 0; }
.ports td:first-child { font-family: var(--font-mono); width: 70px; }
.ports td:last-child { color: var(--muted); text-align: right; }
.widget .none { color: var(--faint); font-size: var(--fs-sm); }

/* Raw output */
.console-wrap { background: #0d1117; border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; }
.console-wrap .log-toolbar { background: var(--panel); }
.console {
  margin: 0; height: 620px; overflow: auto; padding: 14px 18px;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65; color: #b9c4d2;
  white-space: pre;
}
.console.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.console .cmd { color: var(--signal); font-weight: 700; display: inline-block; margin-top: 10px; }
.console .cmd:first-child { margin-top: 0; }
.console .cursor { display: inline-block; width: 8px; height: 15px; background: var(--signal); vertical-align: -3px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Barra de herramientas de listas */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 20px; }
.toolbar .input-icon { width: 280px; }
.toolbar .input, .toolbar .select { height: 34px; font-size: var(--fs-sm); }
.toolbar .select { width: auto; }
.toolbar .spacer { flex: 1; }
.table-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: var(--fs-sm); }

.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.row-actions { display: inline-flex; gap: 2px; opacity: .55; }
.table tr:hover .row-actions { opacity: 1; }
.flags { display: inline-flex; gap: 4px; }
.flags .badge { padding: 0 6px; }

/* Configuración */
.config { margin: 0; display: grid; grid-template-columns: 180px minmax(0, 1fr); }
.config dt, .config dd { padding: 12px 0; border-top: 1px solid var(--line-soft); margin: 0; font-size: var(--fs-md); }
.config dt { color: var(--muted); }
.config dd.mono { font-family: var(--font-mono); font-size: 13px; }
.config dt:first-of-type, .config dt:first-of-type + dd { border-top: 0; }

/* Drawer de hallazgo */
.overlay { position: fixed; inset: 0; background: rgba(6, 9, 13, .6); z-index: 20; opacity: 0; pointer-events: none; transition: opacity .2s; }
.overlay.is-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 21;
  background: var(--panel); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .22s ease-out;
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: none; }
.drawer-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; }
.drawer-head .top { display: flex; align-items: center; gap: 10px; }
.drawer-head .top .icon-btn { margin-left: auto; }
.drawer-title { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-xl); line-height: 1.25; }
.drawer-body { padding: 20px 24px 32px; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; }
.drawer-body h4 { font-size: var(--fs-sm); font-weight: 700; margin-bottom: 6px; }
.drawer-body p { color: #c3ccd8; max-width: 62ch; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; font-size: var(--fs-sm); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv .mono { font-family: var(--font-mono); font-size: 12.5px; }
.codebox { background: var(--ink); border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 12px 14px; font-family: var(--font-mono); font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: #b9c4d2; }
.codebox .note { color: var(--faint); font-style: italic; }

.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }

/* Tabla densa: los tags pueden pasar a dos líneas */
.table-dense .tags { flex-wrap: wrap; max-width: 200px; }
.table-dense .cell-target { max-width: 260px; }

/* =========================================================
   Módulo 1 (estático)
   ========================================================= */
.options-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.source-card { flex-direction: row; align-items: center; gap: 14px; }
.source-card svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.option input:checked + .source-card svg { color: var(--text); }
.source-card .option-title { font-family: var(--font-ui); font-weight: 700; font-size: var(--fs-md); }

.dropzone {
  margin-top: 16px; padding: 30px 20px; text-align: center;
  border: 1.5px dashed var(--line); border-radius: var(--r-md); background: var(--ink);
  color: var(--muted); transition: border-color .15s, background .15s;
}
.dropzone.is-over { border-color: var(--signal); background: var(--raised); }
.dropzone svg { width: 30px; height: 30px; color: var(--faint); }
.dropzone p { margin: 8px 0 14px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.picked { margin-top: 16px; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--ink); }
.picked .cell-icon { width: 38px; height: 38px; }
.picked .meta { color: var(--muted); font-size: var(--fs-sm); }
.picked .btn { margin-left: auto; }
.gh-grid { margin-top: 16px; grid-template-columns: minmax(0, 1fr) 200px; }

.lang-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 1000px) { .lang-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lang .option-card { padding: 12px 14px; gap: 2px; }
.lang .lang-name { font-size: var(--fs-md); font-weight: 700; }
.lang .lang-tool { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }

/* Franja de métricas (una sola superficie con divisiones) */
.stats-strip { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; }
.stats-strip > div { padding: 18px 20px; border-left: 1px solid var(--line-soft); }
.stats-strip > div:first-child { border-left: 0; }
.stats-strip .l { color: var(--muted); font-size: var(--fs-sm); }
.stats-strip .n { font-family: var(--font-display); font-size: var(--fs-3xl); line-height: 1.2; }
.stats-strip .n small { font-family: var(--font-ui); font-size: var(--fs-md); color: var(--muted); margin-left: 4px; }
.stats-strip .sevbar { margin: 10px 0 0; height: 6px; }
@media (max-width: 1000px) { .stats-strip { grid-template-columns: 1fr 1fr; } .stats-strip > div:nth-child(3) { border-left: 0; } }

/* Visor de código en el panel lateral */
.code { background: var(--ink); border: 1px solid var(--line-soft); border-radius: var(--r-sm); overflow-x: auto; font-family: var(--font-mono); font-size: 12px; line-height: 1.7; }
.code-head { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 11.5px; }
.code-line { display: grid; grid-template-columns: 52px 1fr; white-space: pre; }
.code-line .ln { text-align: right; padding-right: 14px; color: var(--faint); user-select: none; }
.code-line .tx { padding-right: 14px; color: #b9c4d2; }
.code-line.hl { background: color-mix(in srgb, var(--sev-high) 12%, transparent); box-shadow: inset 2px 0 0 var(--sev-high); }
.code-line.hl .tx { color: var(--text); }
.code-empty { padding: 14px; color: var(--faint); }

/* =========================================================
   Settings
   ========================================================= */
.settings { display: flex; flex-direction: column; gap: 20px; max-width: 900px; }
.settings .form-section > .help { margin-bottom: 14px; }
.tag-row { display: grid; grid-template-columns: 34px minmax(0, 260px) 1fr auto auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.tag-row:first-child { border-top: 0; }
.tag-row .dot { width: 14px; height: 14px; margin-left: 10px; }
.tag-row .input { height: 34px; }
.tag-row .usage { color: var(--muted); font-size: var(--fs-sm); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.demo-row { display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.btn-danger { border-color: color-mix(in srgb, var(--fail) 50%, transparent); color: #ffb3c0; }
.btn-danger:hover { border-color: var(--fail); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

/* =========================================================
   Sprint 1 — login, menú de usuario, admin, estados nuevos
   ========================================================= */

/* ---------- Estado "stopping" ---------- */
.status-stopping { color: var(--muted); }
.status-stopping .dot { background: var(--sev-medium); animation: pulse 1.2s infinite; }
.progress.is-stopping i { background: var(--sev-medium); }
.pipe-step.skipped .name, .pipe-step.skipped .time { color: var(--faint); }

/* ---------- Opción deshabilitada (tipos de escaneo del próximo sprint) ---------- */
.option.is-disabled { cursor: not-allowed; }
.option.is-disabled .option-card { opacity: .5; }
.option.is-disabled:hover .option-card { border-color: var(--line); }
.next-chip { font-family: var(--font-ui); font-size: var(--fs-xs); color: var(--faint); border: 1px dashed var(--line); border-radius: 99px; padding: 1px 8px; white-space: nowrap; }

/* ---------- Casilla de autorización y avisos de formulario ---------- */
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: var(--fs-sm); color: var(--text); }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--signal); flex: none; }
.check small { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
.form-error { color: #ffc2cc; font-size: var(--fs-sm); }
.form-error:empty { display: none; }
.inline-warn { color: var(--sev-medium); font-size: var(--fs-xs); }
.inline-warn:empty { display: none; }

/* ---------- Menú de usuario ---------- */
.user-menu { position: relative; }
.avatar { cursor: pointer; }
button.avatar { padding: 0; font-family: var(--font-ui); }
.user-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 210px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 6px; box-shadow: 0 12px 32px rgba(0, 0, 0, .35); display: none;
}
.user-menu.is-open .user-pop { display: block; }
.user-pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.user-pop .who b { display: block; font-size: var(--fs-md); }
.user-pop .who span { color: var(--muted); font-size: var(--fs-xs); }
.user-pop a, .user-pop button.item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none;
  border-radius: var(--r-sm); color: var(--muted); font-size: var(--fs-sm); text-align: left; cursor: pointer;
}
.user-pop a:hover, .user-pop button.item:hover { background: var(--raised); color: var(--text); }
.user-pop svg { width: 15px; height: 15px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; padding: 28px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-brand .brand-mark { width: 30px; height: 30px; }
.login-brand span { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-2xl); }
.login-card .help { color: var(--muted); font-size: var(--fs-sm); }
.login-card .btn { justify-content: center; height: 40px; }

/* ---------- Admin ---------- */
.role-chip { font-size: var(--fs-xs); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; color: var(--muted); }
.role-chip.admin { border-color: var(--signal); color: var(--signal); }
.drawer-form { display: flex; flex-direction: column; gap: 16px; }
.drawer-form .actions { display: flex; gap: 10px; align-items: center; padding-top: 6px; }
.danger-zone { border-top: 1px solid var(--line-soft); padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.danger-zone p { color: var(--muted); font-size: var(--fs-sm); }

@media (max-width: 700px) {
  .tag-row { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .tag-row .usage, .tag-row .swatches { display: none; }
}
