/* Roma, guía de viaje. Pensado para una mano, al sol y de noche.
   Paleta: travertino frío, basalto de adoquín y el rojo oscuro del escudo de Roma. */

@font-face { font-family: "Atkinson"; src: url("../fuentes/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("../fuentes/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --fondo: #ECEEEA;
  --sup: #FFFFFF;
  --sup2: #F4F5F2;
  --tinta: #14191C;
  --tinta2: #465055;
  --linea: #C6CDC8;
  --acento: #7A1626;
  --sobre-acento: #FFFFFF;
  --lacteo: #1D5FA6;  --lacteo-f: #E3EEFA;
  --carne: #9B1C1C;   --carne-f: #FBE6E4;
  --oro: #7A5600;     --oro-f: #FBF0D2;
  --alerta: #A14A00;  --alerta-f: #FFEDD9;
  --ok: #1B6B45;
  --dia: var(--acento);
  --nav-alto: 64px;
  --sombra: 0 2px 10px rgba(20, 25, 28, .16);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    color-scheme: dark;
    --fondo: #0F1315; --sup: #191F23; --sup2: #212A2F; --tinta: #EEF1EC; --tinta2: #A9B4B1; --linea: #323D42;
    --acento: #F2A6B0; --sobre-acento: #2B0A11;
    --lacteo: #9CC7F5; --lacteo-f: #14304D; --carne: #F5A8A0; --carne-f: #4A1714;
    --oro: #F0CD7A; --oro-f: #3D3110; --alerta: #FFC08A; --alerta-f: #48290C; --ok: #8FD6AE;
    --sombra: 0 2px 12px rgba(0, 0, 0, .5);
  }
}
:root[data-tema="oscuro"] {
  color-scheme: dark;
  --fondo: #0F1315; --sup: #191F23; --sup2: #212A2F; --tinta: #EEF1EC; --tinta2: #A9B4B1; --linea: #323D42;
  --acento: #F2A6B0; --sobre-acento: #2B0A11;
  --lacteo: #9CC7F5; --lacteo-f: #14304D; --carne: #F5A8A0; --carne-f: #4A1714;
  --oro: #F0CD7A; --oro-f: #3D3110; --alerta: #FFC08A; --alerta-f: #48290C; --ok: #8FD6AE;
  --sombra: 0 2px 12px rgba(0, 0, 0, .5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--tinta);
  font: 400 17px/1.5 "Atkinson", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top, 0px) 0 calc(var(--nav-alto) + env(safe-area-inset-bottom, 0px));
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: anywhere;
}
body.en-mapa { overflow: hidden; }
h1, h2, h3, p, ul, ol, dl, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--acento); }
:focus-visible { outline: 3px solid var(--lacteo); outline-offset: 2px; }
[hidden] { display: none !important; }

.pantalla { max-width: 640px; margin: 0 auto; padding: 0 16px 28px; }

/* ---------- Cabecera ---------- */
.cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 18px 0 12px; }
.cab-titulo { font-size: 34px; line-height: 1.05; font-weight: 700; letter-spacing: -.01em; }
.cab-sub { color: var(--tinta2); font-size: 15px; margin-top: 2px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 2px solid var(--acento);
  background: var(--acento); color: var(--sobre-acento);
  font: 700 16px/1.2 "Atkinson", system-ui, sans-serif; text-decoration: none; cursor: pointer; text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; }
.btn-suave { background: transparent; color: var(--acento); }
.btn-chico { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.btn-peligro { border-color: var(--carne); color: var(--carne); }

/* ---------- Pestañas de día ---------- */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--fondo); padding: 6px 0 10px; }
.tab {
  min-height: 52px; border-radius: 12px; border: 2px solid var(--linea); background: var(--sup); color: var(--tinta);
  font: 700 16px/1.15 "Atkinson", system-ui, sans-serif; cursor: pointer; padding: 6px 4px;
}
.tab[aria-selected="true"] { background: var(--dia); border-color: var(--dia); color: #fff; }
.dia-titulo { font-size: 22px; font-weight: 700; margin: 4px 0 14px; padding-left: 12px; border-left: 6px solid var(--dia); line-height: 1.2; }

.barra-edicion { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; padding: 12px; background: var(--sup2); border: 2px dashed var(--linea); border-radius: 14px; }

/* ---------- Línea de tiempo ---------- */
.linea { position: relative; }
.parada { display: grid; grid-template-columns: 60px 1fr; column-gap: 10px; position: relative; padding-bottom: 14px; }
.parada::before { content: ""; position: absolute; left: 29px; top: 30px; bottom: -4px; width: 2px; background: var(--linea); }
.parada:last-child::before { display: none; }
.p-lado { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 12px; position: relative; }
.p-hora { font-weight: 700; font-size: 17px; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; background: var(--fondo); padding: 2px 0; }
.p-num {
  width: 30px; height: 30px; border-radius: 50%; background: var(--dia); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; border: 2px solid var(--fondo);
}
.p-num-vacio { width: 12px; height: 12px; background: var(--linea); margin-top: 4px; }
.p-cuerpo { background: var(--sup); border: 1px solid var(--linea); border-radius: 14px; padding: 12px 14px; position: relative; min-width: 0; }
.p-titulo { font-size: 19px; line-height: 1.25; font-weight: 700; }
.p-dir { color: var(--tinta2); font-size: 15px; margin-top: 2px; }
.p-notas { margin-top: 8px; font-size: 16px; }
.p-acciones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.p-apie { grid-column: 2; color: var(--tinta2); font-size: 14.5px; padding: 8px 2px 0 14px; }
.p-apie::before { content: "↓ "; font-weight: 700; }
.p-marca { display: inline-block; font-weight: 700; font-size: 14px; padding: 2px 10px; border-radius: 999px; margin-bottom: 6px; background: var(--dia); color: #fff; }
.es-ahora .p-cuerpo { border: 3px solid var(--dia); box-shadow: var(--sombra); }
.es-sigue .p-cuerpo { border: 2px dashed var(--dia); }
.es-sigue .p-marca { background: transparent; color: var(--tinta); border: 2px solid var(--dia); }
.es-hecha .p-cuerpo { opacity: .55; }
.es-hecha .p-titulo { text-decoration: line-through; }
.hecha-chk { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 8px; font-weight: 700; font-size: 15px; cursor: pointer; margin-left: auto; }
.hecha-chk input, .checks input { width: 24px; height: 24px; accent-color: var(--acento); flex: none; }
.asa { position: absolute; top: 6px; right: 6px; width: 48px; height: 48px; border: 0; background: var(--sup2); border-radius: 10px; font-size: 24px; color: var(--tinta2); cursor: grab; touch-action: none; }
.editando .p-titulo { padding-right: 52px; }
.arrastrando { opacity: .4; }
.vacio { padding: 24px 8px; color: var(--tinta2); text-align: center; }

/* ---------- Etiquetas ---------- */
.etqs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.etq { display: inline-block; font-size: 13.5px; font-weight: 700; line-height: 1; padding: 6px 10px; border-radius: 8px; background: var(--sup2); color: var(--tinta2); border: 1px solid var(--linea); white-space: nowrap; }
.etq-lacteo { background: var(--lacteo-f); color: var(--lacteo); border-color: var(--lacteo); }
.etq-carne { background: var(--carne-f); color: var(--carne); border-color: var(--carne); }
.etq-reserva { background: var(--oro-f); color: var(--oro); border-color: var(--oro); }
.etq-confirmar { background: var(--alerta-f); color: var(--alerta); border-color: var(--alerta); border-style: dashed; }

/* ---------- Ficha ---------- */
.volver { margin: 14px 0 10px; }
.f-nombre { font-size: 30px; line-height: 1.12; font-weight: 700; letter-spacing: -.01em; }
.f-dir { color: var(--tinta2); margin-top: 8px; }
.galeria { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 16px -16px 0; padding: 0 16px 6px; -webkit-overflow-scrolling: touch; }
.foto { flex: 0 0 86%; scroll-snap-align: center; }
.foto img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; background: var(--sup2); display: block; }
.foto figcaption { font-size: 12.5px; color: var(--tinta2); margin-top: 4px; line-height: 1.3; }
.audio { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.vel { min-height: 48px; border-radius: 12px; border: 2px solid var(--linea); background: var(--sup); color: var(--tinta); font: 400 16px "Atkinson", system-ui, sans-serif; padding: 0 10px; }
.f-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.f-sec { margin-top: 22px; }
.f-sec h2, .bloque h2 { font-size: 20px; line-height: 1.2; margin-bottom: 6px; }
.f-sec ul, .bloque > ul:not(.checks):not(.telefonos), .reserva ul { padding-left: 20px; list-style: disc; }
.f-sec li, .bloque li { margin-top: 6px; }
.f-sec p + p { margin-top: 8px; }
.nota { color: var(--tinta2); font-size: 14.5px; }
.aviso { background: var(--alerta-f); color: var(--alerta); border-left: 4px solid var(--alerta); padding: 8px 10px; border-radius: 6px; font-size: 15px; margin-top: 8px; }

/* ---------- Mapa ---------- */
.pantalla-mapa { max-width: none; padding: 0; position: fixed; inset: 0 0 calc(var(--nav-alto) + env(safe-area-inset-bottom, 0px)) 0; }
.mapa { position: absolute; inset: 0; background: var(--sup2); }
.mapa-error { position: absolute; inset: 30% 20px auto; }
.mapa-filtros { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 0; right: 0; display: grid; gap: 6px; pointer-events: none; }
.fila-chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 10px; scrollbar-width: none; }
.fila-chips::-webkit-scrollbar { display: none; }
.chip {
  pointer-events: auto; flex: none; min-height: 42px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--linea);
  background: var(--sup); color: var(--tinta); font: 700 15px "Atkinson", system-ui, sans-serif; box-shadow: var(--sombra); cursor: pointer;
}
.chip.activo { background: var(--dia, var(--tinta)); border-color: var(--dia, var(--tinta)); color: #fff; }
.fila-chips + .fila-chips .chip.activo { background: var(--tinta); border-color: var(--tinta); color: var(--fondo); }
.mapa-botones { position: absolute; right: 10px; top: calc(env(safe-area-inset-top, 0px) + 112px); display: grid; gap: 8px; justify-items: end; }
.btn-redondo {
  min-height: 46px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--linea); background: var(--sup); color: var(--tinta);
  font: 700 14.5px "Atkinson", system-ui, sans-serif; box-shadow: var(--sombra); cursor: pointer; max-width: 46vw;
}
.proxima {
  position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 10px; align-items: center; justify-content: space-between;
  background: var(--sup); border: 1px solid var(--linea); border-radius: 16px; padding: 10px 12px; box-shadow: var(--sombra);
}
.proxima .btn { flex: none; }
.btn { overflow-wrap: normal; }
.prox-texto { display: grid; min-width: 0; line-height: 1.25; }
.prox-etq { font-size: 13px; color: var(--tinta2); }
.prox-dist { font-size: 15px; font-weight: 700; color: var(--acento); }
.hoja {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--sup); border-radius: 18px 18px 0 0; box-shadow: 0 -4px 18px rgba(0, 0, 0, .28);
  padding: 12px 14px 14px; display: grid; grid-template-columns: auto 1fr; gap: 12px; z-index: 3;
}
.hoja-foto img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; display: block; }
.hoja-texto { min-width: 0; }
.hoja-texto h2 { font-size: 19px; line-height: 1.2; }
.hoja-botones { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.hoja-botones .btn { flex: 1 1 auto; }
.pantalla-mapa .maplibregl-ctrl-bottom-left { bottom: 104px; }
.maplibregl-ctrl-attrib { font-size: 11px; }

/* Pines: la raíz no lleva transform porque el mapa la usa para ubicarlos */
.pin { border: 0; background: none; padding: 0; cursor: pointer; width: 38px; height: 46px; display: grid; justify-items: center; }
.pin-forma {
  width: 36px; height: 36px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--pin, var(--acento));
  border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .45); display: grid; place-items: center; margin-top: 2px;
}
.pin-forma b { transform: rotate(45deg); color: #fff; font: 700 15px/1 "Atkinson", system-ui, sans-serif; }
.pin-doble .pin-forma b { font-size: 11.5px; letter-spacing: -.02em; }
.pin-extra { width: 34px; height: 34px; }
.pin-extra .pin-forma { width: 32px; height: 32px; border-radius: 50%; transform: none; background: #fff; border: 2px solid #14191C; margin-top: 0; }
.pin-extra .pin-forma b { transform: none; font-size: 16px; }
.yo { width: 60px; height: 60px; position: relative; pointer-events: none; }
.yo-punto { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: #1A73E8; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(26, 115, 232, .35), 0 2px 6px rgba(0, 0, 0, .4); }
.yo-flecha { position: absolute; inset: 0; }
.yo-flecha::before { content: ""; position: absolute; left: 50%; top: 2px; margin-left: -9px; border: 9px solid transparent; border-bottom: 16px solid #1A73E8; border-top: 0; }

/* ---------- Comer ---------- */
.regla { background: var(--oro-f); color: var(--oro); border: 1px solid var(--oro); border-radius: 12px; padding: 10px 12px; font-weight: 700; font-size: 15.5px; }
.mapa-chico { position: relative; inset: auto; height: 38vh; min-height: 230px; border-radius: 14px; overflow: hidden; margin-top: 12px; border: 1px solid var(--linea); }
#comer-estado { margin: 10px 2px; }
.comer { background: var(--sup); border: 1px solid var(--linea); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.comer.resaltado { border: 3px solid var(--acento); }
.comer-cab { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.comer-icono { font-size: 26px; line-height: 1.1; }
.comer h3 { font-size: 19px; line-height: 1.2; }
.comer h3 a { color: var(--tinta); }
.comer-tipo { font-size: 14.5px; color: var(--tinta2); }
.comer-dist { font-weight: 700; color: var(--acento); margin-top: 4px; }
.comer-reserva { margin-top: 6px; font-size: 15px; padding-left: 16px; position: relative; }
.comer-reserva::before { content: ""; position: absolute; left: 0; top: .5em; width: 10px; height: 10px; border-radius: 50%; background: var(--alerta); }
.comer-reserva.r-ok::before { background: var(--ok); }

/* ---------- Datos ---------- */
.bloque { margin-top: 26px; }
.reserva { background: var(--sup); border: 1px solid var(--linea); border-radius: 14px; padding: 12px 14px; margin-top: 10px; }
.reserva header { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.reserva h3 { font-size: 18px; line-height: 1.25; }
.checks li, .telefonos li { background: var(--sup); border: 1px solid var(--linea); border-radius: 12px; margin-top: 8px; }
.checks label { display: flex; gap: 12px; align-items: flex-start; padding: 12px; cursor: pointer; }
.checks input:checked + span { text-decoration: line-through; color: var(--tinta2); }
.confirmar { padding-left: 20px; list-style: disc; }
.telefonos li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; }
.frases { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.frases dt, .frases dd { margin: 0; padding: 9px 0; border-top: 1px solid var(--linea); }
.frases dd { font-weight: 700; }
.segmentos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg { min-height: 48px; border-radius: 12px; border: 2px solid var(--linea); background: var(--sup); color: var(--tinta); font: 700 15px "Atkinson", system-ui, sans-serif; cursor: pointer; }
.seg.activo { background: var(--tinta); color: var(--fondo); border-color: var(--tinta); }

/* ---------- Navegación inferior ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--nav-alto) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px); display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--sup); border-top: 1px solid var(--linea);
}
.nav a { display: grid; place-items: center; align-content: center; gap: 2px; text-decoration: none; color: var(--tinta2); font-weight: 700; font-size: 13.5px; }
.nav svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav a.activo { color: var(--acento); }
.nav a.activo span { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 3px; }

/* ---------- Avisos ---------- */
.aviso-red { position: fixed; top: 0; left: 0; right: 0; z-index: 30; background: #14191C; color: #fff; text-align: center; font-weight: 700; font-size: 14px; padding: calc(env(safe-area-inset-top, 0px) + 5px) 10px 5px; }
body.sin-red { padding-top: calc(env(safe-area-inset-top, 0px) + 30px); }
body.sin-red .mapa-filtros { top: calc(env(safe-area-inset-top, 0px) + 38px); }
body.sin-red .mapa-botones { top: calc(env(safe-area-inset-top, 0px) + 142px); }
body.sin-red .tabs { top: calc(env(safe-area-inset-top, 0px) + 30px); }
.tostada { position: fixed; left: 14px; right: 14px; bottom: calc(var(--nav-alto) + env(safe-area-inset-bottom, 0px) + 14px); z-index: 40; background: #14191C; color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 700; font-size: 15px; box-shadow: var(--sombra); max-width: 600px; margin: 0 auto; }
.error-carga { padding: 40px 20px; text-align: center; }

/* ---------- Diálogo de edición ---------- */
.dlg { border: 0; border-radius: 18px; padding: 18px; width: min(560px, 94vw); background: var(--sup); color: var(--tinta); max-height: 92vh; }
.dlg::backdrop { background: rgba(0, 0, 0, .55); }
.dlg h2 { font-size: 22px; margin-bottom: 10px; }
.dlg label { display: grid; gap: 4px; font-weight: 700; font-size: 15px; margin-top: 10px; }
.dlg input:not([type="checkbox"]), .dlg textarea, .dlg select {
  min-height: 48px; border-radius: 10px; border: 2px solid var(--linea); background: var(--fondo); color: var(--tinta);
  font: 400 17px "Atkinson", system-ui, sans-serif; padding: 8px 10px; width: 100%;
}
.dlg fieldset { border: 1px solid var(--linea); border-radius: 10px; margin: 14px 0 0; padding: 6px 10px 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.dlg legend { font-weight: 700; font-size: 15px; padding: 0 4px; }
.dlg .chk { display: inline-flex; grid-template-columns: none; align-items: center; gap: 8px; font-weight: 400; min-height: 40px; margin-top: 0; }
.dlg .chk input { width: 22px; height: 22px; accent-color: var(--acento); }
.dlg-botones { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* En modo edición las tarjetas se achican para reordenar más fácil */
.editando .p-notas, .editando .etqs, .editando .p-apie, .editando .p-dir { display: none; }
