/* ==========================================================================
   HUB SHARED STYLES · HOSPITAL DE GUADARRAMA (SERMAS)
   Dossiers Monográficos de Contratación y Auditoría Pericial
   Diseño Profesional, Máxima Indexabilidad y Adaptabilidad Móvil
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg: #040807;
  --card-bg: rgba(8, 20, 17, 0.88);
  --card-bg-solid: #091512;
  --border: rgba(36, 229, 163, 0.18);
  --border-hover: rgba(36, 229, 163, 0.45);
  --mint: #24e5a3;
  --mint-soft: rgba(36, 229, 163, 0.08);
  --mint-glow: rgba(36, 229, 163, 0.3);
  --text: #f0f6f3;
  --text-soft: #c4d7d0;
  --text-dim: #79948a;
  --line: rgba(255, 255, 255, 0.08);
  --signal: #f87171;
  --signal-soft: rgba(248, 113, 113, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.12);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", "Consolas", "Roboto Mono", monospace;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  font-size: 14px;
  padding: 0 16px 80px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
}

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 14px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.brand-badge {
  background: linear-gradient(135deg, var(--mint) 0%, #34d399 100%);
  color: #030b08;
  font-weight: 850;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.08em;
  box-shadow: 0 0 12px var(--mint-glow);
}

.brand-title h1 {
  font-size: 15px;
  font-weight: 850;
  letter-spacing: 0.03em;
  color: #ffffff;
  line-height: 1.2;
}

.brand-title p {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.nav-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-nav {
  color: var(--mint);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s;
  background: rgba(36, 229, 163, 0.04);
}

.btn-nav:hover {
  background: rgba(36, 229, 163, 0.12);
  border-color: var(--mint);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Breadcrumbs */
.breadcrumb {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb a:hover {
  color: var(--mint);
}

.breadcrumb strong {
  color: var(--text-soft);
  font-weight: 600;
}

/* Header */
.hub-header {
  background: linear-gradient(180deg, rgba(36, 229, 163, 0.08) 0%, rgba(8, 20, 17, 0.95) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 36px 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
}

.hub-tag {
  display: inline-block;
  background: var(--mint-soft);
  color: var(--mint);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
  border: 1px solid rgba(36, 229, 163, 0.3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hub-header h2 {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 900;
  color: #ffffff;
  line-height: 1.25;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.hub-header p {
  font-size: 15px;
  color: var(--text-soft);
  max-width: 960px;
  line-height: 1.65;
  margin-bottom: 28px;
}

/* KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--card-bg-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  transition: all 0.2s ease;
}

.kpi-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.kpi-card span {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 6px;
}

.kpi-card strong {
  font-size: clamp(20px, 2.2vw, 26px);
  color: #ffffff;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

/* CTA Banner */
.cta-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(36, 229, 163, 0.12) 0%, rgba(96, 165, 250, 0.08) 100%);
  border: 1px solid var(--mint);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: 0 0 24px rgba(36, 229, 163, 0.15);
}

.cta-banner-text strong {
  display: block;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 3px;
}

.cta-banner-text span {
  font-size: 13px;
  color: var(--text-soft);
}

.btn-cta {
  background: linear-gradient(135deg, var(--mint) 0%, #10b981 100%);
  color: #030b08;
  font-weight: 850;
  font-size: 13px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(36, 229, 163, 0.35);
}

.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(36, 229, 163, 0.5);
  background: #34d399;
}

/* Analysis Box */
.analysis-card {
  background: rgba(96, 165, 250, 0.06);
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 18px 22px;
  margin-bottom: 32px;
  font-size: 14px;
  color: #d1e7ff;
  line-height: 1.6;
}

.analysis-card strong {
  color: #ffffff;
  display: block;
  margin-bottom: 6px;
  font-weight: 800;
}

/* Table */
.table-section {
  margin-bottom: 40px;
}

.table-section h3 {
  font-size: 18px;
  font-weight: 850;
  margin-bottom: 16px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-bg-solid);
  box-shadow: var(--shadow-card);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

th {
  background: rgba(36, 229, 163, 0.08);
  color: var(--mint);
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
  color: var(--text-soft);
}

tr:hover td {
  background: rgba(36, 229, 163, 0.04);
}

.td-exp strong {
  color: var(--mint);
  font-family: var(--mono);
  font-size: 12px;
}

.td-tit {
  max-width: 420px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.4;
}

.badge-proc {
  display: inline-block;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  white-space: nowrap;
}

.td-adj {
  font-weight: 600;
  color: #ffffff;
}

.td-fecha {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.td-imp {
  font-weight: 850;
  color: var(--mint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.btn-inspect-link {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(36, 229, 163, 0.1);
  border: 1px solid rgba(36, 229, 163, 0.35);
  border-radius: var(--radius-xs);
  color: var(--mint);
  text-decoration: none;
  font-size: 11px;
  font-weight: 750;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-inspect-link:hover {
  background: var(--mint);
  color: #030b08;
  box-shadow: 0 0 10px var(--mint-glow);
}

/* Other Hubs Section */
.other-hubs {
  margin-bottom: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.other-hubs h4 {
  font-size: 15px;
  font-weight: 850;
  margin-bottom: 14px;
  color: #ffffff;
}

.hubs-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.hub-chip-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card-bg-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s;
}

.hub-chip-link:hover {
  background: rgba(36, 229, 163, 0.08);
  border-color: var(--mint);
  color: #ffffff;
  transform: translateX(3px);
}

/* Footer */
footer {
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}

footer a {
  color: var(--mint);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  body {
    padding: 0 12px 60px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .nav-actions {
    justify-content: flex-start;
  }

  .hub-header {
    padding: 24px 18px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .kpi-card {
    padding: 14px;
  }

  .cta-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-cta {
    justify-content: center;
  }

  .td-proc,
  .td-fecha {
    display: none;
  }

  .hubs-nav-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .brand-title h1 {
    font-size: 13px;
  }
}

/* ==========================================================================
   MODAL DE INSPECCIÓN PERICIAL (HUB / DOSSIER IN-SITU)
   ========================================================================== */
.dossier-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

.dossier-modal.is-active,
.dossier-modal.is-open {
  display: flex;
}

.dossier-card {
  width: 100%;
  max-width: 820px;
  background: #091714;
  border: 1px solid rgba(36, 229, 163, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 30px rgba(36, 229, 163, 0.15);
  overflow: hidden;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  margin: auto;
  box-sizing: border-box;
}

.dossier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(4, 8, 7, 0.8);
  flex-shrink: 0;
}

.dossier-badge {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  color: var(--mint);
  letter-spacing: 0.06em;
}

.dossier-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text-dim);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 0;
  cursor: pointer;
}

.dossier-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.dossier-body {
  padding: 22px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-sizing: border-box;
}

.dossier-title {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.35;
}

.dossier-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
}

.dossier-meta-item span {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.dossier-meta-item strong {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 600;
  word-break: break-word;
}

.dossier-financials {
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  background: rgba(36, 229, 163, 0.04);
  border: 1px solid rgba(36, 229, 163, 0.2);
}

.dossier-fin-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--mint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.dossier-fin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.dossier-fin-item span {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.dossier-fin-item strong {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  font-family: var(--mono);
}

.dossier-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.dossier-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  border: 0;
  transition: all 0.2s ease;
}

.dossier-btn-primary {
  background: var(--mint);
  color: #040807;
  flex: 1;
}

.dossier-btn-primary:hover {
  background: #34f5b3;
  transform: translateY(-1px);
}

@media (max-width: 650px) {
  .dossier-meta-grid {
    grid-template-columns: 1fr;
  }
  .dossier-fin-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
