/* -------------------------------------------------------------------------
   GestFel CSS · 00-foundation.css
   Variables, reset, tipografía, tarjetas, botones, métricas, badges base y utilidades generales.
   Orden de carga: respetar la numeración de los ficheros para conservar
   la cascada original y evitar regresiones visuales.
   ------------------------------------------------------------------------- */

/* Orden de prioridad CSS — las capas posteriores ganan siempre. */
@layer base, layout, forms, components, modules, tables, public, theme, overrides;

@layer base {

:root {
  --teal: #0b7d6d;
  --dark: #0f2437;
  --mint: #e6f4f1;
  --soft: #f7faf9;
  --line: #dbe7e4;
  --muted: #667085;
  --orange: #f59e0b;
  --coral: #ef6f61;
  --shadow: 0 14px 40px rgba(15, 36, 55, 0.08);
  --r: 18px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  color: var(--dark);
  background: #fff;
}
a {
  color: inherit;
  text-decoration: none;
}
img {
  max-width: 100%;
}
.skip-link {
  position: absolute;
  left: -999px;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: #fff;
  padding: 0.8rem;
  z-index: 9;
}
.public-nav,
.app-top {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  font-size: 1.35rem;
  color: var(--teal);
}
.brand img {
  width: 42px;
  height: 42px;
}
.nav-links {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.nav-links a {
  padding: 0.7rem;
}
.btn,
button,
.button {
  border: 0;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}
.btn-primary,
.button.primary {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 8px 20px rgba(11, 125, 109, 0.22);
}
.btn-outline,
.button.secondary {
  border: 1px solid var(--teal);
  color: var(--teal);
  background: #fff;
}
.nav-toggle,
.sidebar-toggle {
  display: none;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 1.2rem;
}
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 64px clamp(16px, 5vw, 72px);
}
.hero h1 {
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 1.02;
  margin: 0 0 1rem;
}
.hero h1 span {
  color: var(--teal);
}
.hero p {
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1.6;
}
.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2rem 0;
}
.mini-benefits {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--muted);
}
.mini-benefits span {
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.8rem;
  border-radius: 14px;
}
.dashboard-preview,
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.dashboard-preview {
  padding: 1.2rem;
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 1rem;
}
.preview-sidebar {
  background: var(--soft);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 170px;
}
.preview-content {
  display: grid;
  gap: 1rem;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  padding: 0 clamp(16px, 5vw, 72px) 32px;
}
/* Métricas y KPIs */
.metric {
  min-height: 122px;
  padding: 1.2rem;
  display: grid;
  align-content: center;
  gap: 0.35rem;
  background: linear-gradient(180deg, #fff, #fbfdfc);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}
.metric:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 48px rgba(15, 36, 55, 0.11);
}
.metric strong {
  display: block;
  font-size: clamp(1.9rem, 3vw, 2.35rem);
  line-height: 1;
  color: var(--teal);
}
.metric span {
  display: block;
  color: var(--dark);
  font-weight: 800;
  line-height: 1.18;
}
.kpi {
  padding: 1.2rem;
}
.kpi strong {
  font-size: 1.8rem;
  color: var(--teal);
  display: block;
}
.section {
  padding: 38px clamp(16px, 5vw, 72px);
}
.section h2 {
  text-align: center;
  font-size: 2rem;
}
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.cards.six {
  grid-template-columns: repeat(6, 1fr);
}
.card {
  padding: 1.2rem;
}
.card-icon {
  font-size: 2rem;
  line-height: 1;
  color: var(--teal);
}
.app-icon,
.nav-icon,
.kpi-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.kpi-icon {
  width: 44px;
  height: 44px;
  padding: 10px;
  margin-bottom: 0.6rem;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal);
}
.chart {
  height: 160px;
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}
.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.bar {
  width: 100%;
  background: linear-gradient(180deg, #22b6a6, #0b7d6d);
  border-radius: 8px 8px 0 0;
  min-height: 20px;
}
.bar-label {
  font-size: 0.62rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
  padding-top: 4px;
  white-space: nowrap;
}
.notice {
  margin: 1rem clamp(16px, 5vw, 72px);
  padding: 1rem 1.2rem;
  border: 1px solid var(--teal);
  background: var(--mint);
  border-radius: 14px;
  color: #07594e;
  font-weight: 700;
}
.footer,
.app-footer {
  background: linear-gradient(135deg, #086c60, #0b7d6d);
  color: #fff;
  padding: 34px clamp(16px, 5vw, 72px);
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 2rem;
  align-items: center;
}
.footer img,
.app-footer img:not(.footer-cat) {
  width: 42px;
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  color: #fff;
  margin-bottom: 0.75rem;
}
.footer .footer-brand,
.app-footer .footer-brand {
  font-size: 1.2rem;
}
.footer-brand img {
  width: 72px;
  height: 72px;
  display: block;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  object-fit: contain;
}
.footer-brand strong {
  color: #fff;
  font-size: clamp(1.7rem, 2.6vw, 2.2rem);
  line-height: 1.05;
}
.footer a,
.app-footer a {
  display: block;
  color: #dff7f4;
  margin: 0.3rem 0;
}
.footer-brand,
.footer-brand:hover,
.footer-brand:focus-visible {
  text-decoration: none;
}
.app-body {
  background: #fbfdfc;
}
.app-top {
  padding: 0 24px;
}
.user-chip {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}
.user-chip small {
  display: block;
  color: var(--muted);
}
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.logout {
  color: var(--teal);
  font-weight: 700;
}
.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: calc(100vh - 74px);
  align-items: start;
}
.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 1rem;
  position: sticky;
  top: 74px;
  align-self: start;
  overflow: visible;
}
.sidebar nav a {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-height: 46px;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin: 0.25rem 0;
  color: #344054;
  font-weight: 800;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}
.nav-icon {
  width: 24px;
  height: 24px;
  padding: 4px;
  border-radius: 9px;
  background: var(--soft);
  color: var(--muted);
}
.sidebar nav a:hover,
.sidebar nav a:focus-visible {
  background: #f4fbfa;
  color: var(--teal);
}
.sidebar nav a.active {
  background: var(--mint);
  color: var(--teal);
}
.sidebar nav a:hover .nav-icon,
.sidebar nav a:focus-visible .nav-icon,
.sidebar nav a.active .nav-icon {
  background: #fff;
  color: var(--teal);
}
.help-card {
  margin-top: 2rem;
  background: var(--mint);
  border-radius: 18px;
  padding: 1.1rem;
  text-align: center;
}
.help-card img {
  width: min(170px, 100%);
  height: auto;
  display: block;
  margin: 0 auto 0.85rem;
}
.help-card strong {
  display: block;
  margin-bottom: 0.45rem;
}
.help-card p {
  margin: 0;
}
.app-main {
  min-width: 0;
  padding: 28px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-head h1 {
  margin: 0.2rem 0;
  font-size: 2.2rem;
}
.grid {
  display: grid;
  gap: 1rem;
}
.grid.two {
  grid-template-columns: 2fr 1fr;
}
.grid.three {
  grid-template-columns: repeat(3, 1fr);
}
.grid.four {
  grid-template-columns: repeat(4, 1fr);
}
.kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  margin: 1rem 0 1.4rem;
}
.table-wrap {
  overflow: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
.table th,
.table td {
  padding: 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.table th {
  font-size: 0.85rem;
  color: var(--muted);
  background: #fafafa;
}
/* Badges de estado */
.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: fit-content;
  min-width: 0;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}
.badge-buena,
.badge-completado,
.badge-completada,
.badge-esterilizado,
.badge-correcto,
.badge-estable {
  background: #ddf7ed;
  color: #08705f;
}
.badge-observacion,
.badge-pendiente,
.badge-necesita_revision,
.badge-atencion {
  background: #fff4d6;
  color: #9a6200;
}
.badge-tratamiento,
.badge-en_tratamiento {
  background: #ffe8d6;
  color: #9a4b00;
}
.badge-urgente,
.badge-rechazada {
  background: #fef2f2;
  color: #991b1b;
}
.badge-seguimiento {
  background: #eef4ff;
  color: #175cd3;
}
.badge-cronico,
.badge-crónico,
.badge-cronica,
.badge-crónica,
.badge-cronic,
.badge-chronic {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}
.badge-aprobada,
.badge-comprada {
  background: #ecfeff;
  color: #155e75;
}
.badge-entregada {
  background: #ecfdf5;
  color: #065f46;
}
.form {
  display: grid;
  gap: 1rem;
}
.form label {
  display: grid;
  gap: 0.35rem;
  font-weight: 700;
}
.form input,
.form select,
.form textarea {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
}

.form input[type="checkbox"],
.form input[type="radio"] {
  width: auto;
  padding: 0;
}
.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.flash {
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}
.flash.ok {
  background: #ddf7ed;
  color: #07594e;
}
.flash.err {
  background: #ffe1df;
  color: #9d241b;
}
.flash.warn {
  background: #fff7ed;
  color: #9a3412;
}
.cat-photo {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
}
.thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.timeline {
  display: grid;
  gap: 1rem;
}
.timeline-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1rem;
  border-left: 3px solid var(--mint);
  padding-left: 1rem;
}
.app-footer {
  margin-top: 2rem;
  position: relative;
}
.footer-cat {
  height: 120px;
  justify-self: end;
}
@media (max-width: 1100px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .metric-grid,
  .cards.six,
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }
  .dashboard-preview {
    grid-template-columns: 1fr;
  }
  .preview-sidebar {
    display: none;
  }
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: -280px;
    top: 74px;
    width: 260px;
    z-index: 20;
    transition: left 0.2s;
    box-shadow: var(--shadow);
    overflow: auto;
  }
  .sidebar.open {
    left: 0;
  }
  .sidebar-toggle {
    display: inline-flex;
  }
  .app-main {
    padding: 18px;
  }
  .footer,
  .app-footer {
    grid-template-columns: 1fr;
  }
  .footer-cat {
    display: none;
  }
}
@media (max-width: 720px) {
  .public-nav {
    padding: 0 16px;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .nav-links {
    position: fixed;
    top: 74px;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    box-shadow: var(--shadow);
  }
  .nav-links.open {
    display: flex;
  }
  .hero {
    padding: 38px 16px;
  }
  .metric-grid,
  .cards,
  .cards.six,
  .kpis {
    grid-template-columns: 1fr;
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .user-chip span:not(.avatar),
  .logout {
    display: none;
  }
  .app-top {
    padding: 0 12px;
  }
  .app-main {
    padding: 14px;
  }
  .timeline-item {
    grid-template-columns: 1fr;
  }
  .cat-photo {
    width: 100%;
    height: auto;
  }
  .table {
    font-size: 0.9rem;
  }
  .section {
    padding: 28px 16px;
  }
  .notice {
    margin: 1rem 16px;
  }
  .brand strong {
    font-size: 1rem;
  }
  .footer-brand {
    gap: 0.85rem;
  }
  .footer-brand img {
    width: 60px;
    height: 60px;
  }
  .footer-brand strong {
    font-size: 1.8rem;
  }
}
/* --------------------------------------------------------------------------
   Utilidades comunes
   -------------------------------------------------------------------------- */
.mt-1 { margin-top: 1rem !important; }
.mt-sm { margin-top: .65rem !important; }
.separator { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.login-logo { width: 64px; max-height: 64px; object-fit: contain; }
.legend-dot--teal { background: #22b6a6 !important; }
.legend-dot--amber { background: #f59e0b !important; }

/* --------------------------------------------------------------------------
   Iconos SVG de salud · contenedor base del evento clínico
   Los tamaños, tipos y estilos por icono viven en 99-instance-theme.css
   -------------------------------------------------------------------------- */
.clinical-event-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}

} /* end @layer base */
