/* Cedars - Portal del paciente */
:root {
  /* Marca CEDARS (naranja). Igual en ambos temas salvo ajuste de contraste. */
  --cedars-50: #fff6ed;
  --cedars-100: #fdebd8;
  --cedars-200: #f5d4b6;
  --cedars-600: #f26f21;
  --cedars-700: #d95d17;

  /* Semánticos — TEMA CLARO (valores originales del portal). */
  --accent:        var(--cedars-600);
  --accent-strong: var(--cedars-700);
  --accent-weak:   var(--cedars-50);
  --accent-weak-2: var(--cedars-100);
  --accent-ring:   rgba(242, 111, 33, .12);
  --accent-shadow: rgba(242, 111, 33, .9);
  --on-accent:     #ffffff;

  --ink:          #14213d;
  --muted:        #6b7488;
  --line:         #eadfd4;
  --bg:           #fbf8f4;
  --surface:      #ffffff;
  --surface-soft: var(--cedars-50);
  --glass:        rgba(255, 255, 255, .72);   /* botones/badges translúcidos sobre bg */
  --glass-strong: rgba(255, 255, 255, .96);   /* píldora de horarios del hero */
  --nav-bg:       rgba(251, 248, 244, .96);

  --shadow-card:  0 1px 3px rgba(0, 0, 0, .04);
  --shadow-soft:  0 14px 34px -24px rgba(20, 33, 61, .55);
  --shadow-hover: 0 14px 34px -24px rgba(132, 66, 18, .45);

  /* Footer: oscuro por diseño también en claro. */
  --footer-bg:     #0f172a;
  --footer-fg:     #cbd5e1;
  --footer-head:   #ffffff;
  --footer-muted:  #94a3b8;
  --footer-line:   #1e293b;
  --footer-bottom: #64748b;

  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

/* TEMA OSCURO — mismos valores base que el sistema (tokens.css) para que combine
   con la app. El naranja de marca se aclara para conservar contraste sobre fondo oscuro. */
:root[data-theme="dark"] {
  --accent:        color-mix(in oklab, var(--cedars-600) 82%, #fff);
  --accent-strong: color-mix(in oklab, var(--cedars-600) 92%, #fff);
  --accent-weak:   color-mix(in srgb, var(--cedars-600) 20%, #13212e);
  --accent-weak-2: color-mix(in srgb, var(--cedars-600) 26%, #13212e);
  --accent-ring:   color-mix(in srgb, var(--cedars-600) 32%, transparent);
  --accent-shadow: rgba(0, 0, 0, .55);
  --on-accent:     #1a0e05;

  --ink:          #e8eef3;
  --muted:        #93a6b8;
  --line:         #26384a;
  --bg:           #0c1620;
  --surface:      #13212e;
  --surface-soft: #182838;
  --glass:        rgba(255, 255, 255, .06);
  --glass-strong: rgba(19, 33, 46, .96);
  --nav-bg:       rgba(12, 22, 32, .92);

  --shadow-card:  0 1px 3px rgba(0, 0, 0, .4);
  --shadow-soft:  0 16px 36px -24px rgba(0, 0, 0, .7);
  --shadow-hover: 0 16px 36px -24px rgba(0, 0, 0, .8);

  --footer-bg:     #0a121b;
  --footer-fg:     #93a6b8;
  --footer-head:   #e8eef3;
  --footer-muted:  #6b8096;
  --footer-line:   #1e2f3f;
  --footer-bottom: #5b7186;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { min-height: 100vh; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.container { width: 100%; max-width: 1110px; margin: 0 auto; padding: 0 24px; }

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.navbar .inner { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 20px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); }
.brand-logo { width: 34px; height: 42px; object-fit: contain; flex: 0 0 auto; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.06; min-width: 0; }
.brand-copy strong { font-family: var(--serif); font-size: 20px; font-weight: 700; letter-spacing: 0; white-space: nowrap; }
.brand-copy small { margin-top: 5px; color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mark { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 900; }

.nav-links { display: flex; align-items: center; justify-content: center; gap: 30px; }
.nav-links a { color: var(--muted); font-size: 14px; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: #b86d36; background: #fdeade; padding: 8px 20px; border-radius: 9999px; font-weight: 500; transition: background-color .2s ease; }
.nav-links a.active:hover { color: #b86d36; background: #fbe0cd; }
.nav-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-cta,
.login-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  transition: .2s;
}
.nav-cta {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 8px 20px -12px var(--accent-shadow);
}
.login-link {
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink);
}
.nav-cta:hover { background: var(--accent-strong); }
.login-link:hover { background: var(--accent-strong); border-color: var(--cedars-200); color: var(--on-accent); }
.nav-toggle { display: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 22px; color: var(--ink); }

/* Selector de tema (claro · sistema · oscuro) — mismo patrón segmentado del sistema. */
.theme-switch { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.theme-switch__opt {
  display: grid;
  place-items: center;
  width: 30px;
  height: 26px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 7px;
  cursor: pointer;
  transition: .2s;
}
.theme-switch__opt svg { width: 15px; height: 15px; display: block; }
.theme-switch__opt:hover { color: var(--ink); }
.theme-switch__opt.is-active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-card); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 30px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: .2s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 10px 20px -14px var(--accent-shadow); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-outline { padding: 12px 28px; background: #ffffff; color: #1e293b; font-size: 15px; font-weight: 500; border: 1px solid #d1d5db; border-radius: 9999px; transition: background-color .2s ease, border-color .2s ease; }
.btn-outline:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-block { width: 100%; }

.hero {
  padding: clamp(40px, 4.5vw, 60px) 0 48px;
  background-color: #fefbf9;
  background-image: radial-gradient(circle at 30% 40%, #fefbf9 0%, #f7f1ec 100%);
  overflow: hidden;
}
/* En oscuro se mantiene el fondo del tema (el degradado crema es solo para claro). */
:root[data-theme="dark"] .hero { background-color: var(--bg); background-image: none; }
.hero .grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.07fr); gap: clamp(32px, 4.5vw, 58px); align-items: start; }
.hero-copy { padding-top: 2px; min-width: 0; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.hero-badge::before {
  content: "";
  width: 15px;
  height: 15px;
  border: 1.5px solid #8d97aa;
  border-radius: 50%;
  background: radial-gradient(circle at center, transparent 45%, #8d97aa 47%, #8d97aa 53%, transparent 55%);
  flex: 0 0 auto;
}
.hero h1 { max-width: 500px; margin-bottom: 22px; font-family: var(--serif); font-size: clamp(34px, 4.6vw, 48px); font-weight: 700; line-height: 1.08; letter-spacing: 0; }
.hero h1 span { display: block; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { max-width: 462px; margin-bottom: 28px; color: var(--muted); font-size: 16px; line-height: 1.48; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(18px, 3vw, 34px);
  max-width: 448px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.hero-stats strong { display: block; color: var(--ink); font-family: var(--serif); font-size: 27px; line-height: 1; }
.hero-stats span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.hero-card { position: relative; width: 100%; overflow: visible; }
.hero-card > img:first-child {
  width: 100%;
  height: clamp(300px, 34vw, 402px);
  object-fit: cover;
  border-radius: 22px;
  box-shadow: 0 30px 58px -32px rgba(132, 66, 18, .26);
}
.hero-logo { display: none; }
/* Ficha de horarios: DEBAJO de la imagen, centrada, separada ~12px (no tapa la foto ni compite con los dots). */
.hero-hours {
  position: static;
  margin: 9px auto 0;
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--ink);
  font-size: 13.5px;
  box-shadow: 0 2px 8px -6px rgba(20, 33, 61, .22);
  backdrop-filter: blur(6px);
}
.hero-hours span { display: grid; place-items: center; width: 18px; height: 18px; border: 2px solid var(--accent); border-radius: 50%; color: var(--accent); font-size: 11px; flex: 0 0 auto; }
.hero-hours strong { color: var(--ink); }
.hero-hours-copy { display: flex; flex-direction: row; align-items: center; flex-wrap: nowrap; line-height: 1.25; }
.hero-hours-copy div { white-space: nowrap; }
.hero-hours-copy div + div { margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line); }

/* Carrusel del hero */
.hero-carousel {
  position: relative;
  width: 100%;
  max-width: 640px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 4px solid #ffffff;
}
.hero-carousel__track { position: relative; width: 100%; height: 400px; }
.hero-carousel__slide { position: absolute; inset: 0; opacity: 0; transition: opacity 0.7s ease-in-out; }
.hero-carousel__slide.active { opacity: 1; }
.hero-carousel__slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-carousel__dots {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 10;
}
.hero-carousel__dot {
  width: 8px; height: 8px; border-radius: 9999px; background: rgba(255, 255, 255, 0.7);
  border: none; cursor: pointer; padding: 0; transition: all 0.3s ease;
}
.hero-carousel__dot:hover { background: #ffffff; }
.hero-carousel__dot.active { width: 24px; background: #E67E22; }
@media (max-width: 900px) { .hero-carousel__track { height: 300px; } }

.search-band { padding: 16px 0 0; background: var(--surface); }
.portal-search {
  display: grid;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}
.portal-search label {
  font-family: var(--serif);
  color: var(--ink);
  font-size: clamp(20px, 3vw, 25px);
  font-weight: 700;
  line-height: 1.2;
}
.portal-search input {
  width: 100%;
  height: 52px;
  padding: 0 22px 0 52px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  box-shadow: 0 14px 34px -28px rgba(20, 33, 61, .55);
}
.portal-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring), 0 14px 34px -28px rgba(20, 33, 61, .55);
}
.portal-search-field { position: relative; }
.portal-search-field::before {
  content: "";
  position: absolute;
  left: 24px;
  top: 50%;
  width: 13px;
  height: 13px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-58%);
  z-index: 1;
}
.portal-search-field::after {
  content: "";
  position: absolute;
  left: 37px;
  top: 50%;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: var(--muted);
  transform: translateY(5px) rotate(45deg);
  z-index: 1;
}
.search-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 42px -28px rgba(20, 33, 61, .45);
  text-align: left;
}
.suggestion-group p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.suggestion-item {
  display: grid;
  width: 100%;
  gap: 2px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.suggestion-item:hover { background: var(--accent-weak); }
.suggestion-item span { color: var(--accent); font-size: 11px; font-weight: 800; }
.suggestion-item strong { font-size: 14px; line-height: 1.25; }
.suggestion-item small { color: var(--muted); font-size: 12px; }

.section { padding: 34px 0; background: var(--surface); }
.section.soft { background: var(--surface-soft); }
.section-title { text-align: center; margin-bottom: 24px; }
.section-title h2 { margin-bottom: 10px; font-size: clamp(28px, 4vw, 34px); letter-spacing: 0; }
.section-title p { color: var(--muted); }
.section-title .accent { color: var(--accent); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.section-actions { display: flex; justify-content: center; margin-top: 22px; }
.card,
.doctor-card,
.panel,
.appt-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.card { position: relative; min-height: 124px; padding: 24px 28px; overflow: hidden; transition: .2s; }
.card::before { content: ""; position: absolute; left: 0; top: 22px; bottom: 22px; width: 4px; border-radius: 0 999px 999px 0; background: var(--accent); opacity: .9; }
.card:hover,
.doctor-card:hover,
.appt-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--cedars-200); }
.card .icon { width: 48px; height: 48px; border-radius: 8px; background: var(--accent-weak-2); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; margin-bottom: 18px; }
.card-kicker { display: inline-flex; margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.card h3 { max-width: calc(100% - 70px); font-size: 18px; margin-bottom: 8px; }
.card p { color: var(--accent); font-size: 15px; }
.card .price { color: var(--accent); font-weight: 800; margin-top: 12px; }
.card-link { position: absolute; right: 22px; bottom: 20px; display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: 13px; font-weight: 700; background: var(--surface); transition: .2s; }
.card-link:hover { border-color: var(--cedars-200); color: var(--accent-strong); background: var(--accent-weak); }
.specialties-section .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.specialty-card { min-height: 112px; padding: 18px 24px; }
.specialty-card::before { top: 18px; bottom: 18px; }
.specialty-card .card-kicker { margin-bottom: 7px; font-size: 10px; }
.specialty-card h3 { max-width: none; margin-bottom: 3px; font-size: 17px; line-height: 1.3; }
.specialty-card p { color: var(--muted); font-size: 13px; }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; margin-top: 12px; }
.card-actions .card-link { position: static; }
.card-actions .card-link { white-space: nowrap; }
.card-text-link {
  flex: 1;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.card-text-link span { color: var(--accent); }
.card-text-link:hover { color: var(--accent-strong); }
.card-link-soft { flex: 1; color: var(--ink); background: var(--glass); }
.specialty-card .card-actions .card-link:not(.card-link-soft) {
  color: var(--accent-strong);
  background: var(--accent-weak);
}
.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: var(--glass);
}

.doctor-card {
  display: flex;
  align-items: stretch;
  gap: 15px;
  min-height: 148px;
  padding: 12px;
  overflow: hidden;
  transition: .2s;
}
#doctors.cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.doctor-media,
.doctor-photo,
.doctor-avatar { width: 112px; height: 124px; }
.doctor-media {
  flex: 0 0 112px;
  display: grid;
  place-items: center;
  background: transparent;
}
.doctor-photo {
  border: 1px solid var(--line);
  border-radius: 10px;
  object-fit: cover;
  object-position: center top;
  background: var(--surface);
}
.doctor-avatar {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.doctor-avatar span {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
}
.doctor-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding: 3px 0 2px;
}
.doctor-body h3 { font-size: 15px; line-height: 1.28; margin-bottom: 5px; }
.doctor-body .specialty { color: var(--accent); font-weight: 700; font-size: 12px; line-height: 1.35; margin-bottom: 0; }
.doctor-body .bio { display: none; }
.doctor-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 10px; padding-top: 4px; }
.doctor-footer .btn { width: auto; min-height: 30px; }
.doctor-fee { display: none; font-weight: 800; color: var(--accent-strong); }

.toolbar { display: flex; gap: 12px; margin-bottom: 32px; flex-wrap: wrap; }
.toolbar input,
.toolbar select,
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
}
.toolbar input,
.toolbar select { flex: 1; min-width: 180px; }
.toolbar input:focus,
.toolbar select:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.split { display: grid; grid-template-columns: 320px 1fr; gap: 32px; align-items: start; }
.panel { padding: 24px; position: sticky; top: 88px; }
.panel h3 { margin-bottom: 16px; font-size: 16px; }
.doctor-pick { display: flex; gap: 12px; padding: 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; transition: .2s; }
.doctor-pick:hover,
.doctor-pick.active { background: var(--accent-weak); border-color: var(--cedars-200); }
.doctor-pick img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.doctor-pick .nm { font-weight: 700; font-size: 14px; }
.doctor-pick .sp { font-size: 12px; color: var(--muted); }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.time-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
.time-slot { padding: 8px; text-align: center; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 14px; transition: .2s; }
.time-slot:hover { border-color: var(--cedars-200); }
.time-slot.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.appt-card { padding: 22px; display: flex; gap: 18px; align-items: center; justify-content: space-between; margin-bottom: 16px; transition: .2s; }
.appt-left { display: flex; gap: 18px; align-items: center; min-width: 0; }
.appt-date { min-width: 64px; padding: 10px 14px; border-radius: 8px; background: var(--accent-weak); text-align: center; }
.appt-date .d { font-size: 22px; font-weight: 900; color: var(--accent-strong); }
.appt-date .m { font-size: 11px; text-transform: uppercase; color: var(--accent); font-weight: 800; }
.appt-info { min-width: 0; }
.appt-info h4 { font-size: 16px; margin-bottom: 2px; }
.appt-info .meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.badge { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.badge-pendiente { background: #fef3c7; color: #92400e; }
.badge-confirmada { background: #d1fae5; color: #065f46; }
.badge-cancelada { background: #fee2e2; color: #991b1b; }
.badge-completada { background: #dbeafe; color: #1e40af; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.spinner { width: 36px; height: 36px; border: 4px solid var(--accent-weak-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.contact-strip {
  padding: 28px 0 34px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.final-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.final-cta h2 {
  margin-bottom: 6px;
  font-family: var(--serif);
  font-size: clamp(24px, 3.4vw, 28px);
  line-height: 1.2;
}
.final-cta p { color: var(--muted); font-size: 15px; }
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 22px;
  align-items: center;
}
.contact-grid div {
  min-height: 62px;
  padding: 4px 0;
}
.contact-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.contact-grid strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.footer { background: var(--footer-bg); color: var(--footer-fg); padding: 46px 0 22px; margin-top: 0; }
.footer .grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.footer h4 { color: var(--footer-head); margin-bottom: 14px; font-size: 15px; }
.footer p,
.footer a { font-size: 14px; color: var(--footer-muted); margin-bottom: 8px; display: block; }
.footer a:hover { color: var(--cedars-200); }
.footer .brand { color: var(--footer-head); margin-bottom: 12px; }
.footer .brand strong { color: var(--footer-head); }
.footer .brand small { color: var(--footer-muted); }
.footer-bottom { border-top: 1px solid var(--footer-line); padding-top: 20px; text-align: center; font-size: 13px; color: var(--footer-bottom); }
.toast { position: fixed; bottom: 24px; right: 24px; max-width: min(360px, calc(100vw - 32px)); background: #0f172a; color: #fff; padding: 14px 20px; border-radius: 8px; box-shadow: 0 14px 34px -24px rgba(0, 0, 0, .8); z-index: 100; opacity: 0; transform: translateY(20px); pointer-events: none; transition: .3s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #991b1b; }
.toast.success { background: #065f46; }

/* Badges: suavizar sobre fondo oscuro para no encandilar. */
:root[data-theme="dark"] .badge-pendiente { background: color-mix(in srgb, #fef3c7 22%, var(--surface)); color: #fcd77a; }
:root[data-theme="dark"] .badge-confirmada { background: color-mix(in srgb, #d1fae5 22%, var(--surface)); color: #6ee7b7; }
:root[data-theme="dark"] .badge-cancelada { background: color-mix(in srgb, #fee2e2 22%, var(--surface)); color: #fca5a5; }
:root[data-theme="dark"] .badge-completada { background: color-mix(in srgb, #dbeafe 22%, var(--surface)); color: #93c5fd; }

@media (max-width: 1180px) {
  .hero h1 { font-size: clamp(38px, 4.4vw, 46px); }
}

@media (max-width: 900px) {
  .navbar .inner { grid-template-columns: 1fr auto auto; gap: 12px; padding: 10px 24px; }
  .nav-toggle { display: block; grid-column: 3; grid-row: 1; }
  .nav-actions { display: none; grid-column: 1 / -1; width: 100%; }
  .nav-actions.open { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 8px; }
  .nav-actions.open .nav-cta,
  .nav-actions.open .login-link { flex: 1; min-width: 140px; min-height: 40px; }
  .nav-links { display: none; grid-column: 1 / -1; width: 100%; flex-direction: column; align-items: stretch; gap: 0; padding: 8px 0 4px; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 0; }
  .nav-links a.active { align-self: flex-start; }
  .nav-theme { grid-column: 2; grid-row: 1; justify-self: end; }
  .hero { padding: 44px 0 44px; }
  .hero .grid,
  .split { grid-template-columns: 1fr; }
  .hero-card { width: 100%; max-width: 560px; margin: 0 auto; }
  .hero-card > img:first-child { height: 300px; }
  .panel { position: static; }
  .specialties-section .cards,
  #doctors.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .container { padding: 0 18px; }
  /* Barra móvil: la marca comparte fila con el selector de tema y el menú; se compacta para no recortarse. */
  .navbar .inner { gap: 10px; }
  .brand-logo { width: 30px; height: 38px; }
  .brand-copy strong { font-size: 16px; }
  .brand-copy small { display: none; }
  .theme-switch { padding: 2px; gap: 1px; }
  .theme-switch__opt { width: 26px; height: 24px; }
  .theme-switch__opt svg { width: 14px; height: 14px; }
  .hero h1 { font-size: clamp(30px, 8vw, 36px); }
  .hero h1 span { white-space: normal; }
  .hero .actions { flex-direction: column; }
  .hero .actions .btn { width: 100%; }
  .hero-stats { gap: 18px; }
  /* En celular la ficha va en UNA sola fila (no apilada): se achica la tipografía para que entre. */
  .hero-hours { transform: none; font-size: 12px; padding: 7px 14px; gap: 8px; }
  .hero-hours-copy div + div { margin-left: 8px; padding-left: 8px; }
  .search-band { padding-top: 24px; }
  .specialties-section .cards,
  #doctors.cards { grid-template-columns: 1fr; }
  .doctor-card { min-height: 146px; }
  .doctor-footer .btn { width: auto; }
  .final-cta { flex-direction: column; align-items: flex-start; }
  .final-cta .btn { width: 100%; }
  .contact-grid { grid-template-columns: 1fr; gap: 10px; }
  .footer .grid { grid-template-columns: 1fr; }
  .appt-card,
  .appt-left { align-items: flex-start; }
  .appt-card { flex-direction: column; }
}

@media (max-width: 420px) {
  .doctor-card { gap: 12px; padding: 12px; }
  .doctor-media { flex-basis: 96px; }
  .doctor-media,
  .doctor-photo,
  .doctor-avatar { width: 96px; height: 118px; }
  .doctor-avatar span { width: 58px; height: 58px; font-size: 23px; }
  .doctor-body h3 { font-size: 14px; }
  /* Ficha de horarios en pantallas mínimas: una sola fila, aún más compacta. */
  .hero-hours { font-size: 11px; padding: 6px 12px; gap: 6px; }
  .hero-hours-copy div + div { margin-left: 6px; padding-left: 6px; }
}

@media (max-width: 340px) {
  /* Pantallas mínimas: el nombre de marca manda; el isotipo cede espacio para que no se recorte. */
  .brand-logo { display: none; }
}
