/* ============================================================================
   gov.css v1.9 — SPIRA Cloud Governance & FinOps Command Center
   Alineado 100 % al Manual de Identidad Corporativa SPIRA:
   - Colores primarios: Spira Rojo Web #DC1C24 | Spira Rojo #ED1C24 |
     Spira Gris #56575A (Pantone 425c) | Spira Negro #1D1D1B
   - Colores complementarios: Mostaza #E6B23A | Lima #E6F0CB |
     Teal #5E868A | Verde Bosque #1A2A1F
   - Tipografía: Montserrat (digital) / Lato (impresión y SIG PDF)
   ============================================================================ */
:root {
  --spira-red: #DC1C24;
  --spira-red-bright: #ED1C24;
  --spira-red-dark: #B0151B;
  --spira-red-soft: rgba(220, 28, 36, 0.10);
  --spira-ink: #1D1D1B;
  --spira-gray: #56575A;
  --spira-mustard: #E6B23A;
  --spira-lime: #E6F0CB;
  --spira-teal: #5E868A;
  --spira-forest: #1A2A1F;
  --surface: #F5F5F5;
  --card-bg: #FFFFFF;
  --border-subtle: #E2E3E5;
  --text-muted: #56575A;
  --radius-xl: 1rem;
  --radius-lg: 0.75rem;
  --shadow-sm: 0 2px 10px rgba(29, 29, 27, 0.05);
  --shadow-md: 0 10px 28px rgba(29, 29, 27, 0.09);
}

body.gov-body {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--surface);
  color: var(--spira-ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 0.88rem;
  -webkit-font-smoothing: antialiased;
}

/* --- Topbar Corporativo SPIRA (Spira Negro #1D1D1B + línea Spira Rojo #DC1C24) --- */
.gov-topbar {
  background: var(--spira-ink);
  border-bottom: 3px solid var(--spira-red);
  z-index: 1030;
}

.gov-search-pill {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  overflow: hidden;
  flex-wrap: nowrap !important;
  min-width: 240px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.gov-search-pill:focus-within {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--spira-red-bright);
}
.gov-search-pill input {
  background: transparent !important;
  color: #fff !important;
  border: 0 !important;
  box-shadow: none !important;
}
.gov-search-pill input::placeholder { color: rgba(255, 255, 255, 0.60); }

/* --- Sidebar ocultable (Desktop) + Offcanvas hamburguesa (Móvil) --- */
.gov-sidebar {
  width: 246px;
  min-height: calc(100vh - 58px);
  background: #ffffff;
  border-right: 1px solid var(--border-subtle);
  flex-shrink: 0;
  transition: width 0.2s ease, padding 0.2s ease, opacity 0.16s ease, border-color 0.2s ease;
  overflow: hidden;
}
body.sidebar-collapsed .gov-sidebar {
  width: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  border-right-color: transparent !important;
  opacity: 0;
  pointer-events: none;
}
.gov-menu-btn {
  width: 34px;
  height: 34px;
  border-radius: 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transition: background 0.14s ease;
}
.gov-menu-btn:hover {
  background: rgba(232, 26, 26, 0.35);
  color: #ffffff;
}
.gov-mobile-nav .section-title {
  font-size: 0.67rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 700;
  padding: 0.85rem 0.65rem 0.25rem;
}
.gov-mobile-nav .nav-link {
  color: #334155;
  border-radius: 0.6rem;
  padding: 0.55rem 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.gov-mobile-nav .nav-link.active {
  background: rgba(232, 26, 26, 0.10);
  color: var(--spira-red-dark);
  font-weight: 700;
}
.gov-sidebar .section-title {
  font-size: 0.67rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 700;
  padding: 0.9rem 0.9rem 0.3rem;
}
.gov-sidebar .nav-link {
  color: #334155;
  border-radius: 0.6rem;
  padding: 0.52rem 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.14s ease;
}
.gov-sidebar .nav-link:hover {
  background: #f1f5f9;
  color: var(--spira-ink);
  transform: translateX(2px);
}
.gov-sidebar .nav-link.active {
  background: linear-gradient(90deg, rgba(232, 26, 26, 0.12), rgba(232, 26, 26, 0.03));
  color: var(--spira-red-dark);
  font-weight: 700;
  border-left: 3px solid var(--spira-red);
}

/* --- Hero Full-Bleed Command Header (Manual SPIRA: Negro #1D1D1B + Corte Diagonal Rojo #DC1C24) --- */
.gov-hero {
  background:
    linear-gradient(128deg, var(--spira-ink) 0%, #262624 68%, var(--spira-red) 68.3%, var(--spira-red-dark) 100%);
  color: #ffffff;
  border-radius: var(--radius-xl);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.gov-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(29, 29, 27, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(230, 240, 203, 0.35);
}
.pulse-dot.ok { background: #84cc16; }
.pulse-dot.warn { background: var(--spira-mustard); box-shadow: 0 0 0 3px rgba(230, 178, 58, 0.32); }
.pulse-dot.crit { background: var(--spira-red-bright); box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.38); }

/* --- Bento Grid Asimétrico --- */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
}
.bento-span-12 { grid-column: span 12; }
.bento-span-8  { grid-column: span 8; }
.bento-span-7  { grid-column: span 7; }
.bento-span-6  { grid-column: span 6; }
.bento-span-5  { grid-column: span 5; }
.bento-span-4  { grid-column: span 4; }
.bento-span-3  { grid-column: span 3; }

.bento-tile {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.2rem 1.3rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  display: flex;
  flex-direction: column;
}
.bento-tile:hover {
  box-shadow: var(--shadow-md);
}
.bento-tile-dark {
  background: linear-gradient(135deg, var(--spira-ink) 0%, #2a2a28 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-top: 3px solid var(--spira-red);
}
.bento-tile-finops {
  background: linear-gradient(145deg, #ffffff 0%, var(--spira-lime) 100%);
  border: 1px solid #cddda6;
}
.bento-eyebrow {
  font-size: 0.69rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--spira-gray);
}
.bento-tile-dark .bento-eyebrow { color: rgba(255, 255, 255, 0.72); }

/* --- Estilos SIG Corporativo (ISO 9001/27001 + Manual SPIRA) --- */
.sig-doc-header {
  border: 1px solid var(--border-subtle);
  border-top: 4px solid var(--spira-red);
  border-radius: 0.75rem;
  background: #ffffff;
  overflow: hidden;
}
.sig-tri-list {
  list-style: none;
  padding-left: 0;
}
.sig-tri-list li {
  position: relative;
  padding-left: 1.15rem;
  margin-bottom: 0.45rem;
}
.sig-tri-list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--spira-red);
  font-weight: 700;
}
@media print {
  body.gov-body {
    font-family: "Lato", Arial, sans-serif !important;
    background: #ffffff !important;
  }
  .gov-topbar, .gov-sidebar, .no-print { display: none !important; }
  main { padding: 0 !important; }
}

.bento-metric-lg {
  font-size: 2.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

/* --- Ring Gauge SVG --- */
.gauge-wrap {
  position: relative;
  width: 78px;
  height: 78px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gauge-wrap svg { transform: rotate(-90deg); }
.gauge-label {
  position: absolute;
  font-size: 0.85rem;
  font-weight: 800;
}

/* --- Org Split Chips --- */
.org-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  background: #f8fafc;
  transition: border-color 0.15s ease;
}
.org-card:hover { border-color: #94a3b8; }

/* --- SSL Radar Bar --- */
.ssl-row {
  border-bottom: 1px dashed var(--border-subtle);
  padding: 0.55rem 0;
}
.ssl-row:last-child { border-bottom: 0; }

/* --- Cards & Tables --- */
.gov-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.gov-table th {
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  background: #f8fafc;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-subtle);
}
.gov-table td {
  vertical-align: middle;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gov-table td.cell-wrap {
  white-space: normal;
  max-width: 420px;
  word-break: break-word;
}
.gov-table td.cell-actions {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}
.explorer-row { cursor: pointer; }
.explorer-row:hover { background-color: rgba(232, 26, 26, 0.05) !important; }

.collapse-btn {
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0.15rem 0.35rem;
  border-radius: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.collapse-btn:hover { background: rgba(100, 116, 139, 0.12); }
.collapse-btn .chev { transition: transform 0.18s ease; display: inline-block; }
.collapse-btn.collapsed .chev { transform: rotate(-90deg); }

.tag-chip {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.16rem 0.5rem;
  margin: 0.12rem 0.2rem 0.12rem 0;
  border-radius: 999px;
  background: #e2e8f0;
  color: #1e293b;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* --- Kanban Board (Hallazgos) --- */
.kanban-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.kanban-col {
  background: #e8eef6;
  border-radius: var(--radius-xl);
  padding: 0.9rem;
  min-height: 240px;
}
.kanban-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 6px rgba(11, 19, 36, 0.04);
  border-left: 4px solid #64748b;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kanban-card.sev-crit { border-left-color: #dc2626; }
.kanban-card.sev-high { border-left-color: #f59e0b; }
.kanban-card.sev-med  { border-left-color: #0284c7; }
.kanban-card.sev-low  { border-left-color: #64748b; }

/* --- Vertical Timeline (Bitácora) --- */
.gov-timeline {
  position: relative;
  padding-left: 1.5rem;
}
.gov-timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--spira-red), #cbd5e1);
}
.timeline-item {
  position: relative;
  padding-bottom: 1rem;
}
.timeline-dot {
  position: absolute;
  left: -1.5rem;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--spira-red);
}

/* --- Split-Screen Login 50/50 --- */
.login-split {
  min-height: calc(100vh - 58px);
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #ffffff;
}
.login-brand-pane {
  background:
    radial-gradient(circle at 80% 20%, rgba(232, 26, 26, 0.34), transparent 46%),
    linear-gradient(140deg, var(--spira-ink) 0%, var(--spira-navy) 60%, #1c2e52 100%);
  color: #ffffff;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-form-pane {
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #ffffff;
}

/* --- Diff highlights --- */
.diff-added { background-color: #ecfdf3 !important; border-left: 3px solid #12b76a; }
.diff-removed { background-color: #fef3f2 !important; border-left: 3px solid #f04438; }

/* --- Buttons --- */
.btn-spira {
  background: var(--spira-red);
  border-color: var(--spira-red);
  color: #fff;
  font-weight: 600;
}
.btn-spira:hover {
  background: var(--spira-red-dark);
  border-color: var(--spira-red-dark);
  color: #fff;
}

/* --- Responsive --- */
@media (max-width: 1199.98px) {
  .bento-span-8, .bento-span-7, .bento-span-6, .bento-span-5, .bento-span-4, .bento-span-3 {
    grid-column: span 6;
  }
  .kanban-grid { grid-template-columns: 1fr; }
}
@media (max-width: 991.98px) {
  .gov-sidebar { width: 100%; min-height: auto; border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .login-split { grid-template-columns: 1fr; }
  .login-brand-pane { padding: 2rem; }
  .login-form-pane { padding: 2rem; }
  .bento-span-8, .bento-span-7, .bento-span-6, .bento-span-5, .bento-span-4, .bento-span-3 {
    grid-column: span 12;
  }
}
