:root {
  --texto: #111827;
  --texto-2: #374151;
  --fondo: #eef1f5;
  --tarjeta: #ffffff;
  --borde: #b8c2cf;
  --primario: #0b3d6e;
  --primario-2: #0a3259;
  --primario-suave: #e3edf8;
  --exito: #136c35;
  --peligro: #b42318;
  --foco: #f59e0b;
  --radio: 14px;
  --sombra: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(15,35,60,.08);
  font-size: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--texto);
  background: var(--fondo);
  line-height: 1.45;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
body.sin-sesion { padding-bottom: 0; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
p { margin: .3rem 0; }
a { color: var(--primario); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 100; }
.saltar:focus { left: .5rem; }

.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* ---------- Estructura ---------- */
.banner:empty, .cabecera:empty, .nav:empty { display: none; }
.banner {
  display: flex; gap: .6rem; align-items: flex-start; flex-wrap: wrap;
  background: #fff4cc; color: #4a3600; border-bottom: 2px solid #d9a400;
  padding: .55rem 1rem; font-size: .85rem;
}
.banner > span { flex: 1 1 220px; }
.cabecera {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  background: var(--primario); color: #fff; padding: .6rem 1rem;
}
.marca { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.1rem; }
.marca.grande { font-size: 1.5rem; color: var(--primario); justify-content: center; }
.chip-usuario {
  display: flex; align-items: center; gap: .4rem; min-height: 44px;
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px; padding: .3rem .8rem; cursor: pointer; font-weight: 600;
}
.principal { max-width: 760px; margin: 0 auto; padding: 1rem 16px 2rem; outline: none; }

.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: #fff; border-top: 1px solid var(--borde);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 14px rgba(0,0,0,.06);
}
.nav-op {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  min-height: 68px; text-decoration: none; color: var(--texto-2); font-weight: 600; font-size: .9rem;
  border-top: 4px solid transparent;
}
.nav-op .ico { width: 1.6rem; height: 1.6rem; }
.nav-op.activo { color: var(--primario); border-top-color: var(--primario); background: var(--primario-suave); }
.contador {
  position: absolute; top: 6px; left: calc(50% + 8px);
  background: var(--peligro); color: #fff; border-radius: 999px; font-size: .75rem; min-width: 1.4rem; padding: 0 .35rem; text-align: center;
}

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .nav {
    position: sticky; top: 58px; bottom: auto; z-index: 9;
    max-width: 760px; margin: 0 auto; border: 1px solid var(--borde); border-top: 0; border-radius: 0 0 var(--radio) var(--radio);
    box-shadow: var(--sombra);
  }
  .nav-op { flex-direction: row; min-height: 56px; font-size: 1rem; gap: .5rem; border-top: 0; border-bottom: 4px solid transparent; }
  .nav-op.activo { border-bottom-color: var(--primario); }
  .nav-op .ico { width: 1.3rem; height: 1.3rem; }
  .contador { position: static; }
  .principal:has(.semana), .principal:has(.mes) { max-width: 1180px; }
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 52px; padding: .55rem 1.1rem; border-radius: 12px; border: 2px solid transparent;
  font-weight: 700; text-decoration: none; cursor: pointer; text-align: center; line-height: 1.2;
}
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primario { background: var(--primario); color: #fff; }
.btn-primario:hover { background: var(--primario-2); }
.btn-exito { background: var(--exito); color: #fff; }
.btn-peligro { background: #fff; color: var(--peligro); border-color: var(--peligro); }
.btn-sec { background: #fff; color: var(--primario); border-color: var(--primario); }
.btn-chico { min-height: 44px; padding: .35rem .8rem; font-size: .9rem; }
.btn-grande { min-height: 64px; font-size: 1.15rem; width: 100%; }
.btn-icono { width: 52px; padding: 0; }
.enlace { background: none; border: 0; color: inherit; text-decoration: underline; font-weight: 700; cursor: pointer; padding: .2rem; min-height: 32px; }

/* ---------- Insignias de estado (color + icono + texto) ---------- */
.insignia {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .55rem; border-radius: 999px; font-size: .82rem; font-weight: 700;
  border: 1.5px solid currentColor; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.st-amarillo { background: #fff4cc; color: #6b4e00; }
.st-verde { background: #dcf5e3; color: #14532d; }
.st-azul { background: #dbeafe; color: #1e3a8a; }
.st-gris { background: #eceef1; color: #3f4651; }
.st-naranja { background: #ffedd5; color: #8a3b0b; }
.st-rojo { background: #fde4e1; color: #8f1d14; }
.st-neutro { background: #f3f4f6; color: #374151; }
.txt-rojo { color: #a31d12; font-weight: 700; }
.txt-naranja { color: #8a3b0b; font-weight: 700; }
.marca-importante { display: inline-flex; align-items: center; gap: .25rem; font-size: .8rem; font-weight: 700; color: #7a4b00; background: #fff1c2; border-radius: 999px; padding: .1rem .5rem; vertical-align: middle; }
.ico-importante { color: #b07800; }

/* ---------- Encabezados ---------- */
.titulo-pantalla { margin: .3rem 0 1rem; }
.titulo-pantalla h1 { font-size: 1.75rem; }
.sobretitulo { text-transform: uppercase; letter-spacing: .06em; font-weight: 800; color: var(--primario); font-size: .85rem; margin: 0; }
.resumen { color: var(--texto-2); font-size: 1.02rem; }
.fila-titulo { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.seccion { margin: 1.5rem 0; }
.seccion > h2, .seccion > summary h2 { font-size: 1.2rem; margin-bottom: .6rem; display: flex; gap: .4rem; align-items: center; }
details.seccion > summary { cursor: pointer; list-style: none; min-height: 44px; display: flex; align-items: center; }
details > summary::-webkit-details-marker { display: none; }
details > summary h2::after, details > summary h3::after { content: " ▾"; color: var(--texto-2); font-size: .9em; }
.vacio { color: var(--texto-2); display: flex; gap: .4rem; align-items: center; }
.nota { color: var(--texto-2); font-size: .92rem; display: flex; gap: .5rem; margin-top: 1rem; }

/* ---------- Cajas ---------- */
.caja { display: flex; gap: .65rem; align-items: flex-start; border-radius: 12px; padding: .75rem .9rem; margin: .7rem 0; border: 2px solid; }
.caja > .ico { margin-top: .15rem; width: 1.3rem; height: 1.3rem; }
.caja p { margin: .2rem 0; }
.caja ul { margin: .3rem 0; padding-left: 1.1rem; }
.caja-aviso { background: #fff8e1; border-color: #d9a400; color: #4a3600; }
.caja-error { background: #fdecea; border-color: #c2382b; color: #6e1710; }
.caja-ok { background: #e8f7ee; border-color: #2f8f55; color: #133f24; }
.caja-vacia { background: #fff; border-color: var(--borde); color: var(--texto-2); }

/* ---------- Avisos ---------- */
.avisos ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.aviso {
  display: grid; grid-template-columns: auto 1fr; gap: .2rem .7rem; align-items: start;
  background: #fff; border: 2px solid var(--primario); border-left-width: 8px; border-radius: 12px; padding: .75rem .9rem;
}
.aviso > .ico { width: 1.5rem; height: 1.5rem; color: var(--primario); }
.aviso-salida { border-color: #b45309; }
.aviso-salida > .ico { color: #b45309; }
.aviso-txt { display: flex; flex-direction: column; }
.aviso-txt small { color: var(--texto-2); }
.aviso-btns { grid-column: 1 / -1; display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }

/* ---------- Próxima cita ---------- */
.tarjeta-proxima {
  background: var(--tarjeta); border-radius: 18px; padding: 1.1rem; box-shadow: var(--sombra);
  border: 2px solid var(--primario); border-top-width: 8px;
}
.tarjeta-proxima.importante { border-color: #b07800; }
.tp-cab { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.tp-etiqueta { font-weight: 800; color: var(--primario); text-transform: uppercase; font-size: .85rem; letter-spacing: .04em; }
.tp-hora { font-size: 2rem; font-weight: 800; margin: .4rem 0 .2rem; line-height: 1.1; }
.tp-hora span { font-size: 1rem; font-weight: 600; color: var(--texto-2); }
.tp-persona { font-size: 1.4rem; }
.tp-org { color: var(--texto-2); font-weight: 600; }
.tp-motivo { font-size: 1.05rem; margin: .5rem 0; }
.tp-lugar { display: flex; gap: .45rem; align-items: flex-start; }
.tp-lugar .ico { margin-top: .2rem; }
.tp-proyecto { color: var(--texto-2); }
.salida { display: flex; gap: .7rem; align-items: center; background: var(--primario-suave); border-radius: 12px; padding: .75rem .9rem; margin: .8rem 0; }
.salida .ico { width: 1.8rem; height: 1.8rem; color: var(--primario); }
.salida div { display: flex; flex-direction: column; }
.salida strong { font-size: 1.25rem; }
.salida-ya { background: #fdecea; color: #6e1710; border: 2px solid #c2382b; }
.salida-ya .ico { color: #c2382b; }
.tp-acciones, .acciones-detalle { display: grid; grid-template-columns: 1fr; gap: .55rem; margin-top: .9rem; }
@media (min-width: 520px) { .tp-acciones, .acciones-detalle { grid-template-columns: 1fr 1fr; } }

/* ---------- Listas ---------- */
.lista-citas, .lista-resolver, .lista-pend, .mini-lista { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.fila-cita {
  width: 100%; display: flex; gap: .8rem; text-align: left; cursor: pointer;
  background: #fff; border: 1.5px solid var(--borde); border-radius: 12px; padding: .75rem; min-height: 64px;
}
.fila-cita:hover { border-color: var(--primario); }
.fila-cita.confirmado { border-left: 6px solid #2f8f55; }
.fila-cita.por_confirmar { border-left: 6px solid #d9a400; }
.fila-cita.realizado { border-left: 6px solid #3b6fd6; opacity: .9; }
.fila-cita.cancelado { border-left: 6px solid #8a929c; background: #f6f7f8; }
.fila-cita.cancelado .fc-persona, .fila-cita.cancelado .fc-motivo { text-decoration: line-through; color: var(--texto-2); }
.fc-hora { font-weight: 800; min-width: 5.3rem; display: flex; flex-direction: column; }
.fc-hora small { font-weight: 600; color: var(--texto-2); font-size: .8rem; }
.fc-cuerpo { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.fc-persona { font-size: 1.05rem; }
.fc-motivo, .fc-lugar { color: var(--texto-2); font-size: .92rem; }
.fc-insignias { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .25rem; }
.compacta .fila-cita { padding: .55rem; }

.fila-resolver, .fila-resolver-pend {
  width: 100%; display: flex; align-items: center; gap: .7rem; text-align: left;
  background: #fff; border: 1.5px solid var(--borde); border-radius: 12px; padding: .7rem .8rem; min-height: 56px; cursor: pointer;
}
.fila-resolver-pend { cursor: default; flex-wrap: wrap; }
.fila-resolver span, .fila-resolver-pend span { flex: 1; display: flex; flex-direction: column; min-width: 180px; }
.fila-resolver small, .fila-resolver-pend small { color: var(--texto-2); }

/* ---------- Agenda ---------- */
.controles-agenda { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem; margin-bottom: .6rem; }
.segmentado { display: inline-flex; border: 2px solid var(--primario); border-radius: 12px; overflow: hidden; }
.segmentado button { min-height: 48px; min-width: 80px; border: 0; background: #fff; color: var(--primario); font-weight: 700; cursor: pointer; }
.segmentado button[aria-pressed="true"] { background: var(--primario); color: #fff; }
.navegar-fecha { display: flex; gap: .4rem; }
.etiqueta-periodo { font-size: 1.15rem; margin: .7rem 0; }
.semana { display: grid; gap: .8rem; }
@media (min-width: 900px) { .semana { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); } }
.dia-semana { background: #fff; border-radius: 14px; border: 1.5px solid var(--borde); padding: .5rem; }
.dia-semana.es-hoy { border: 2.5px solid var(--primario); }
.ds-cab { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: .5rem; background: none; border: 0; padding: .45rem .3rem; min-height: 44px; font-weight: 800; cursor: pointer; text-align: left; }
.ds-n { font-weight: 600; color: var(--texto-2); font-size: .9rem; }
.dia-semana .lista-citas { margin-top: .3rem; }

/* ---------- Pendientes ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: .3rem; }
.filtro { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: .3rem .85rem; border-radius: 999px; border: 2px solid var(--primario); background: #fff; color: var(--primario); font-weight: 700; cursor: pointer; }
.filtro[aria-pressed="true"] { background: var(--primario); color: #fff; }
.interruptor { display: inline-flex; gap: .45rem; align-items: center; min-height: 44px; font-weight: 600; padding: 0 .4rem; }
.interruptor input, .casilla input { width: 1.4rem; height: 1.4rem; accent-color: var(--primario); flex: none; }
.tarjeta-pend { background: #fff; border: 1.5px solid var(--borde); border-radius: 14px; padding: .85rem; }
.tarjeta-pend.terminado { background: #f6f7f8; }
.tarjeta-pend.terminado h3 { text-decoration: line-through; color: var(--texto-2); }
.tpend-cab { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; align-items: center; }
.tpend-tipo { display: inline-flex; gap: .35rem; align-items: center; font-weight: 700; color: var(--texto-2); font-size: .9rem; }
.tarjeta-pend h3 { font-size: 1.1rem; margin: .45rem 0 .2rem; }
.tpend-detalle { color: var(--texto-2); }
.tpend-meta { display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: center; font-size: .92rem; }
.tpend-meta > span { display: inline-flex; gap: .3rem; align-items: center; }
.enlace-cita { display: inline-flex; align-items: center; gap: .35rem; background: none; border: 0; color: var(--primario); text-decoration: underline; font-weight: 600; cursor: pointer; padding: .3rem 0; min-height: 44px; text-align: left; }
.tpend-acciones { display: flex; gap: .5rem; margin-top: .6rem; }
.tpend-acciones .btn:not(.btn-icono) { flex: 1; }

/* ---------- Entrada ---------- */
.entrada { max-width: 460px; margin: 10vh auto 0; text-align: center; display: grid; gap: 1.2rem; }
.entrada h1 { font-size: 1.6rem; }
.entrada-ops { display: grid; gap: .8rem; }
.entrada .caja { text-align: left; }

/* ---------- Diálogo ---------- */
dialog {
  padding: 0; border: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0;
  background: var(--fondo); color: var(--texto);
}
dialog::backdrop { background: rgba(10, 20, 35, .55); }
@media (min-width: 700px) {
  dialog { max-width: 680px; height: auto; max-height: 92vh; margin: auto; border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
}
.dlg { display: flex; flex-direction: column; height: 100%; max-height: inherit; }
@media (min-width: 700px) { .dlg { max-height: 92vh; } }
.dlg-cab { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .7rem 16px; background: #fff; border-bottom: 1px solid var(--borde); }
.dlg-cab h2 { font-size: 1.25rem; }
.dlg-cuerpo { overflow-y: auto; padding: 1rem 16px 1.5rem; flex: 1; }
.dlg-pie { display: flex; gap: .6rem; padding: .7rem 16px calc(.7rem + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--borde); }
.dlg-pie .btn { flex: 1; }
.detalle-cab { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.detalle-hora { font-size: 1.1rem; margin: .6rem 0; }
.datos { display: grid; gap: .1rem; margin: .8rem 0; background: #fff; border-radius: 12px; padding: .3rem .9rem; border: 1px solid var(--borde); }
.dato { display: grid; grid-template-columns: 7.5rem 1fr; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid #e3e7ec; }
.dato:last-child { border-bottom: 0; }
.dato dt { font-weight: 700; color: var(--texto-2); }
.dato dd { margin: 0; overflow-wrap: anywhere; }
.sub { margin: 1.3rem 0 .4rem; }
.sub > h3, .sub > summary h3 { font-size: 1.08rem; margin-bottom: .5rem; }
.sub > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; list-style: none; }
.historial ol { padding-left: 1.2rem; margin: .3rem 0; display: grid; gap: .45rem; font-size: .92rem; }
.historial ol span { color: var(--texto-2); }
.mini-lista li { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.lista-falta { padding-left: 1.2rem; }

/* ---------- Formularios ---------- */
fieldset { border: 0; background: #fff; border-radius: 14px; padding: .9rem; margin: 0 0 .9rem; box-shadow: var(--sombra); }
legend { float: left; width: 100%; font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
legend + * { clear: both; }
.paso { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--primario); color: #fff; font-size: .95rem; }
.campo { margin-bottom: .85rem; display: flex; flex-direction: column; gap: .3rem; }
.campo > label, .etiqueta { font-weight: 700; }
.obligatorio { font-weight: 500; color: var(--texto-2); font-size: .85rem; }
.ayuda { color: var(--texto-2); font-size: .88rem; margin: 0; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; min-height: 52px; padding: .6rem .75rem; border: 2px solid var(--borde); border-radius: 10px; background: #fff;
}
input[type=file] { padding: .5rem; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primario); }
[aria-invalid="true"] { border-color: var(--peligro) !important; background: #fff7f6 !important; }
.msg-error { color: #a31d12; font-weight: 700; font-size: .9rem; margin: 0; display: flex; gap: .35rem; align-items: center; }
.errores { display: flex; gap: .6rem; background: #fdecea; border: 2px solid #c2382b; color: #6e1710; border-radius: 12px; padding: .75rem .9rem; margin-bottom: .9rem; }
.errores[hidden] { display: none; }
.errores ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.dos-col { display: grid; gap: 0 .8rem; }
@media (min-width: 560px) { .dos-col { grid-template-columns: 1fr 1fr; } }
.con-unidad { display: flex; align-items: center; gap: .5rem; }
.con-unidad input { max-width: 8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { min-height: 44px; padding: .3rem .85rem; border-radius: 999px; border: 2px solid var(--borde); background: #fff; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--primario); border-color: var(--primario); color: #fff; }
.opciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .45rem; }
.opcion { display: flex; align-items: center; gap: .5rem; min-height: 52px; padding: .45rem .7rem; border: 2px solid var(--borde); border-radius: 10px; background: #fff; cursor: pointer; font-weight: 600; }
.opcion input { width: 1.25rem; height: 1.25rem; accent-color: var(--primario); flex: none; }
.opcion:has(input:checked) { border-color: var(--primario); background: var(--primario-suave); box-shadow: inset 0 0 0 1px var(--primario); }
.opcion:has(input:focus-visible) { outline: 3px solid var(--foco); outline-offset: 2px; }
.casilla { display: flex; align-items: flex-start; gap: .55rem; min-height: 44px; padding: .4rem 0; cursor: pointer; }
.casilla small { color: var(--texto-2); }
.hora-pref { max-width: 10rem; margin: 0 0 .5rem 2rem; }
.grupo-pref { box-shadow: none; border: 1.5px solid var(--borde); padding: .6rem .8rem; margin: .4rem 0; }
.grupo-pref legend { font-size: 1rem; margin-bottom: .2rem; }

/* ---------- Estado de la agenda compartida ---------- */
.banner-ok { background: #e8f7ee; color: #133f24; border-bottom-color: #2f8f55; }
.banner-guardando { background: #e3edf8; color: #0a3259; border-bottom-color: var(--primario); }
.banner-error, .banner-sin-conexion { background: #fdecea; color: #6e1710; border-bottom-color: #c2382b; }
.tarjeta-login { background: #fff; border-radius: 16px; padding: 1.1rem; box-shadow: var(--sombra); text-align: left; }

/* ---------- Horario por confirmar, notas y ejemplos ---------- */
.st-ejemplo { background: #f3e8ff; color: #5b2a86; border-style: dashed; }
.sin-hora { display: inline-flex; flex-direction: column; gap: .15rem; font-size: .85rem; line-height: 1.15; color: #6b4e00; }
.sin-hora .ico { width: 1.1rem; height: 1.1rem; }
.fc-nota { display: flex; gap: .35rem; align-items: flex-start; font-size: .9rem; color: #4a3600; background: #fff8e1; border-radius: 8px; padding: .25rem .5rem; }
.fc-nota .ico { margin-top: .15rem; }
.caja-nota { background: #fff8e1; border-color: #d9a400; color: #4a3600; border-width: 1.5px; }
.por-confirmar { color: #6b4e00; font-style: italic; }
.aclaracion { font-weight: 500; font-size: .85rem; color: var(--texto-2); }
.separado { margin-top: 1.2rem; }

/* ---------- Vista mensual ---------- */
.mes { background: #fff; border: 1.5px solid var(--borde); border-radius: 14px; padding: .35rem; }
.mes-cab, .mes-rejilla { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.mes-cab span { text-align: center; font-weight: 800; font-size: .78rem; color: var(--texto-2); padding: .3rem 0; }
.mes-dia {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .15rem;
  min-height: 58px; padding: .3rem .15rem; border: 1.5px solid #dde3ea; border-radius: 10px; background: #fff; cursor: pointer; min-width: 0;
}
.mes-dia:hover { border-color: var(--primario); }
.mes-dia.otro-mes { background: #f4f6f8; color: #7a838f; }
.mes-dia.con-citas { background: #f2f7fd; }
.mes-dia.es-hoy .md-num { background: var(--primario); color: #fff; }
.mes-dia.seleccionado { border: 3px solid var(--foco); }
.md-num { font-weight: 800; font-size: .95rem; min-width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border-radius: 50%; }
.md-marcas { display: flex; align-items: center; gap: .15rem; }
.md-n { background: var(--primario); color: #fff; border-radius: 999px; font-size: .75rem; font-weight: 800; min-width: 1.3rem; padding: 0 .3rem; text-align: center; }
.md-pend { width: .95rem; height: .95rem; color: #8a6500; }
.md-items { display: none; }
.leyenda { font-size: .88rem; color: var(--texto-2); display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: .5rem 0 0; }
.dia-elegido { scroll-margin-top: 80px; }
@media (min-width: 900px) {
  .mes-dia { align-items: stretch; min-height: 104px; padding: .35rem; }
  .md-num { align-self: flex-start; }
  .md-marcas { display: none; }
  .md-items { display: flex; flex-direction: column; gap: 2px; width: 100%; }
  .md-item { font-size: .72rem; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; padding: 1px 4px; border-left: 3px solid; }
  .md-item.confirmado { background: #dcf5e3; border-color: #2f8f55; }
  .md-item.por_confirmar { background: #fff4cc; border-color: #d9a400; }
  .md-item.realizado { background: #dbeafe; border-color: #3b6fd6; }
  .md-mas { font-size: .72rem; color: var(--texto-2); text-align: left; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 1000;
  max-width: 560px; margin: 0 auto; display: flex; gap: .6rem; align-items: center;
  padding: .85rem 1rem; border-radius: 12px; font-weight: 700; color: #fff; background: #1f2937;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s;
}
.toast.visible { opacity: 1; transform: none; pointer-events: auto; }
.toast-ok { background: #14532d; }
.toast-error { background: #8f1d14; }
@media (min-width: 900px) { .toast { bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
