/* Letra Inter, alojada en la propia app (static/fonts), sin pedirla a Google. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Aspecto moderno: se carga DESPUÉS de style.css y solo cambia el aspecto
   (colores, tipografía, bordes, sombras). No toca estructura ni lógica.
   Para volver al aspecto anterior basta quitar su <link> en base.html. */

:root {
  --azul: #0d9488;
  --azul-oscuro: #0f766e;
  --azul-suave: #f0fdfa;
  --gris-fondo: #f5f7fa;
  --gris-borde: #e6e9ef;
  --texto: #101828;
  --texto-suave: #667085;
  --sombra-suave: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.04);
  --sombra-media: 0 12px 32px -8px rgba(16, 24, 40, 0.18), 0 2px 6px rgba(16, 24, 40, 0.06);
  --radio: 16px;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(13, 148, 136, 0.08), transparent 60%),
    var(--gris-fondo);
  letter-spacing: -0.005em;
}

/* ---------- Barra superior ---------- */
nav.topbar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  color: var(--texto);
  border-bottom: 1px solid var(--gris-borde);
  box-shadow: none;
  padding: 0.7rem 1.75rem;
  min-height: 64px;
}

nav.topbar a { color: #475467; font-weight: 500; font-size: 0.92rem; }

nav.topbar .brand {
  color: var(--texto);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  gap: 0.7rem;
}

.brand-logo {
  height: 38px;
  width: 38px;
  padding: 6px;
  object-fit: contain;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  border-radius: 11px;
  box-shadow: 0 4px 10px -2px rgba(15, 118, 110, 0.45);
}

nav.topbar .links { gap: 0.25rem; }

nav.topbar .links > a,
nav.topbar .dropdown-toggle {
  padding: 0.45rem 0.8rem;
  border-radius: 10px;
  color: #475467;
  font-weight: 500;
  font-size: 0.92rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

nav.topbar .links > a:hover,
nav.topbar .dropdown:hover .dropdown-toggle {
  background: #f0f2f5;
  color: var(--texto);
}

nav.topbar .links > span {
  margin-left: 0.6rem;
  padding: 0.35rem 0.8rem;
  background: var(--azul-suave);
  color: var(--azul-oscuro);
  border: 1px solid #ccf3ee;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.dropdown-menu-inner {
  border-radius: 14px;
  border: 1px solid var(--gris-borde);
  padding: 0.4rem;
  box-shadow: var(--sombra-media);
}

.dropdown-menu a {
  border-radius: 9px;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.dropdown-menu a:hover { background: #f0f2f5; }

/* ---------- Contenido ---------- */
.container { padding: 2rem 1.75rem; }

h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; margin: 0; }
h2, h3 { font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }

.section-title { margin-bottom: 1.1rem; }

.card {
  border: 1px solid var(--gris-borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra-suave);
  padding: 1.5rem 1.6rem;
}

.muted { color: var(--texto-suave); }

/* ---------- Botones ---------- */
a.btn, button.btn {
  background: var(--azul);
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1.1rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

a.btn:hover, button.btn:hover {
  background: var(--azul-oscuro);
  transform: none;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

/* Los botones "grises" de la app (color puesto a mano en cada página)
   pasan a ser botones secundarios: fondo blanco y borde suave. */
a.btn[style*="#6b7280"], button.btn[style*="#6b7280"] {
  background: #ffffff !important;
  color: #344054 !important;
  border: 1px solid #d5d9e0;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

a.btn[style*="#6b7280"]:hover, button.btn[style*="#6b7280"]:hover {
  background: #f9fafb !important;
  border-color: #b8bfca;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1);
}

button.btn.danger, a.btn.danger {
  background: #fff1f3;
  color: #c01048;
  border: 1px solid #fecdd6;
  box-shadow: none;
}

button.btn.danger:hover, a.btn.danger:hover {
  background: #e11d48;
  color: #fff;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.3);
}

.btn-sm { border-radius: 8px !important; font-size: 0.8rem !important; }

/* ---------- Formularios ---------- */
label { font-size: 0.82rem; font-weight: 600; color: #344054; }

input, select, textarea {
  border: 1px solid #d5d9e0;
  border-radius: 10px;
  padding: 0.62rem 0.8rem;
  font-size: 0.93rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

input::placeholder, textarea::placeholder { color: #98a2b3; }

input:focus, select:focus, textarea:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.14);
}

.search-bar input {
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center;
  padding-left: 2.5rem;
}

/* ---------- Tablas ---------- */
th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #667085;
  background: #f9fafb;
  border-bottom: 1px solid var(--gris-borde);
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

th:first-child { border-top-left-radius: 10px; }
th:last-child { border-top-right-radius: 10px; }

td { border-bottom: 1px solid #eef0f4; color: #1d2939; }
tbody tr:last-child td { border-bottom: none; }
tr:hover { background: #fafbfc; }
thead tr:hover { background: transparent; }

td a { color: var(--azul-oscuro); font-weight: 600; text-decoration: none; }
td a.btn { color: #fff; }
td a.btn[style*="#6b7280"] { color: #344054; }
td a:hover { text-decoration: underline; }

.compact-table th, .compact-table td { padding: 0.5rem 0.6rem; font-size: 0.84rem; }
.compact-table td.btn-row { flex-wrap: nowrap; }
.compact-table .badge { white-space: nowrap; }
.compact-table td.muted { font-variant-numeric: tabular-nums; }

/* ---------- Etiquetas de estado ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem 0.2rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.badge[style*="#dcfce7"] { border-color: #bbf0cd; }
.badge[style*="#fef3c7"] { border-color: #fbe3a0; }
.badge[style*="#dbeafe"] { border-color: #bcd5fb; }
.badge[style*="#e5e7eb"] { border-color: #d7dbe2; }

/* ---------- Tablero (Consultas de hoy) ---------- */
.dashboard-stats-card { padding: 1.25rem; }
.dashboard-stats-card h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--texto-suave);
  margin-bottom: 0.8rem !important;
}

.dashboard-stats-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.dashboard-stats-card h3 { margin-bottom: 0.3rem !important; }

.dashboard-stat-fila {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.6rem 0.8rem !important;
  background: #f5f7fa;
}
.dashboard-stat-fila:last-child { border-bottom: 1px solid transparent; }
.dashboard-stat-fila:nth-child(2) { background: #eef2f6; }
.dashboard-stat-fila:nth-child(3) { background: #ecfbf3; }
.dashboard-stat-fila:nth-child(4) { background: #fff8e6; }
.dashboard-stat-fila:nth-child(5) { background: #eef4ff; }

.dashboard-stat-numero { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.03em; min-width: 1.6rem; text-align: center; }
.dashboard-stat-etiqueta { font-size: 0.76rem; line-height: 1.25; font-weight: 500; }

.dashboard-eventos-card h3 { margin-bottom: 0.2rem; }
.dashboard-eventos-lista { gap: 0.2rem; }
.dashboard-eventos-lista li {
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
}
.dashboard-eventos-lista li:hover { background: #f5f7fa; }
.dashboard-evento-titulo { font-size: 0.85rem; }

.dashboard-main-card { padding: 1.3rem 1.4rem; }

/* ---------- Avisos ---------- */
.flash { border-radius: 12px; font-weight: 500; font-size: 0.92rem; }

.app-version-tag { font-size: 0.66rem; letter-spacing: 0.04em; }

/* ---------- Detalle del paciente: tarjetas más aireadas ---------- */
.card h2 { font-size: 1.05rem; }

td a { white-space: nowrap; }
table td:last-child { white-space: nowrap; }

/* Menú en pantallas medianas/pequeñas: que cada opción no se parta en dos líneas */
nav.topbar .dropdown-toggle,
nav.topbar .links > a,
nav.topbar .links > span { white-space: nowrap; }

@media (max-width: 900px) {
  nav.topbar { padding: 0.6rem 1rem; }
  nav.topbar .links { flex-wrap: wrap; row-gap: 0.15rem; gap: 0.1rem; }
  nav.topbar .links > a,
  nav.topbar .dropdown-toggle { padding: 0.4rem 0.6rem; }
  nav.topbar .links > span { margin-left: 0.2rem; }
  .container { padding: 1.2rem 1rem; }
  h1 { font-size: 1.5rem; }
}
