/* Estilo: limpio, sencillo y claro. Todos los colores viven en las variables de :root. */
:root {
  --bg: #f5f8f7; --surface: #ffffff; --ink: #22313a; --muted: #66757d; --line: #e4eaec;
  --accent: #5aa5b0; --accent-strong: #2e7682; --accent-soft: #e6f2f4; --bar-ing: #cfe6ea;
  --airbnb-bg: #fde9e5; --airbnb-ink: #a2412e;
  --booking-bg: #e3ecfb; --booking-ink: #2a4f9c;
  --directa-bg: #e5f4e7; --directa-ink: #2d6c43;
  --pos: #2d7a4b; --neg: #c0453a; --warn-bg: #fff4dc; --warn-ink: #85560a;
  --radius: 16px;
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: 16px; line-height: 1.45; background: var(--bg); }
body.noscroll { overflow: hidden; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
.muted { color: var(--muted); font-size: 14px; }
.neg { color: var(--neg); }
.grow { flex: 1; }
.pad { padding: 16px 18px; }

/* ---------- Estructura ---------- */
.app { min-height: 100dvh; }
.content { width: 100%; max-width: 920px; margin: 0 auto; padding: 18px 16px calc(150px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; min-height: 40px; }
.top h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.year { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px; font-weight: 600; font-variant-numeric: tabular-nums; }
.year button { width: 34px; height: 34px; border: 0; background: none; border-radius: 50%; font-size: 20px; color: var(--accent-strong); }
.year button:hover { background: var(--accent-soft); }
.year span { min-width: 3.2em; text-align: center; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 8px; border: 0; background: none; color: var(--muted); font-size: 12px; }
.nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav button.on { color: var(--accent-strong); font-weight: 600; }

.fab { position: fixed; right: 18px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 15; width: 56px; height: 56px; border: 0; border-radius: 50%; background: var(--accent-strong); color: #fff; font-size: 30px; line-height: 1; box-shadow: 0 6px 18px rgba(46, 118, 130, .28); }
.fab:hover { background: #266570; }

@media (min-width: 900px) {
  .app { display: flex; }
  .nav { position: sticky; top: 0; height: 100dvh; width: 216px; flex-shrink: 0; flex-direction: column; gap: 4px; border-top: 0; border-right: 1px solid var(--line); padding: 24px 12px; }
  .nav button { flex: none; flex-direction: row; gap: 12px; padding: 10px 14px; border-radius: 12px; font-size: 15px; }
  .nav button:hover { background: var(--bg); }
  .nav button.on { background: var(--accent-soft); }
  .content { padding: 28px 36px 64px; }
  .fab { right: 40px; bottom: 36px; }
}

/* ---------- Bloques ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.panel > h2 { font-size: 16px; font-weight: 650; padding: 16px 18px 6px; }
.panel.pad > h2 { padding: 0 0 8px; }
.panel.pad p + p, .panel.pad p + button, .panel.pad p + .actions { margin-top: 10px; }
.note { color: var(--muted); font-size: 13px; margin: 4px 4px 16px; max-width: 70ch; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty p { max-width: 38ch; margin: 0 auto 16px; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.kpis.three { grid-template-columns: repeat(3, 1fr); }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kpi:nth-child(2n) { border-right: 0; }
.kpi:nth-last-child(-n+2) { border-bottom: 0; }
.kpis.three .kpi { border-right: 1px solid var(--line); border-bottom: 0; padding: 14px 16px; }
.kpis.three .kpi:last-child { border-right: 0; }
.k-label { color: var(--muted); font-size: 14px; }
.kpi strong { font-size: 26px; font-weight: 650; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
.k-sub { color: var(--muted); font-size: 13px; }
@media (min-width: 700px) {
  .kpis:not(.three) { grid-template-columns: repeat(4, 1fr); }
  .kpis:not(.three) .kpi { border-bottom: 0; border-right: 1px solid var(--line); }
  .kpis:not(.three) .kpi:last-child { border-right: 0; }
}

.chart { display: block; width: 100%; height: auto; padding: 6px 12px 0; }
.chart .axis { stroke: var(--line); }
.chart .ax { font-size: 17px; fill: var(--muted); }
.bar-ing { fill: var(--bar-ing); } .bar-ben { fill: var(--accent); } .bar-neg { fill: var(--neg); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 4px 18px 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.sw.ing { background: var(--bar-ing); } .sw.ben { background: var(--accent); }
.sw.airbnb { background: var(--airbnb-bg); border: 1px solid #f3c3ba; } .sw.booking { background: var(--booking-bg); border: 1px solid #bcd0f2; } .sw.directa { background: var(--directa-bg); border: 1px solid #b9dfc0; }

.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13px; }
.tbl th, .tbl td { padding: 9px 7px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
.tbl th:first-child { text-align: left; font-weight: 600; }
.tbl thead th { color: var(--muted); font-weight: 500; border-top: 0; }
.tbl tfoot th, .tbl tfoot td { font-weight: 650; background: var(--bg); }
.lines { padding: 4px 18px 14px; font-variant-numeric: tabular-nums; }
.line { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.line.total { border-bottom: 0; font-weight: 650; padding-top: 10px; }

/* ---------- Listas ---------- */
.toolbar { margin-bottom: 14px; }
.toolbar input, .toolbar select { width: 100%; max-width: 420px; }
.group { margin-bottom: 18px; }
.group h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 15px; font-weight: 650; padding: 0 4px 8px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list.panel { margin-bottom: 16px; }
.panel .row:first-of-type { border-top: 0; }
.row { display: flex; width: 100%; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 13px 18px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; }
.list .row:first-child { border-top: 0; }
.row:hover { background: #fafcfc; }
.r-main, .r-side { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.r-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-side { align-items: flex-end; flex-shrink: 0; font-variant-numeric: tabular-nums; }

.chip, .tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.chip.airbnb { background: var(--airbnb-bg); color: var(--airbnb-ink); }
.chip.booking { background: var(--booking-bg); color: var(--booking-ink); }
.chip.directa { background: var(--directa-bg); color: var(--directa-ink); }
.tag { background: var(--bg); color: var(--muted); font-weight: 500; }
.tag.ok { background: var(--directa-bg); color: var(--directa-ink); }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); font-weight: 600; }

/* ---------- Calendario ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head strong { flex: 1; text-align: center; font-size: 18px; }
.icon-btn { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: 50%; font-size: 20px; color: var(--accent-strong); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wd { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cell { position: relative; min-height: 58px; padding: 6px 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: left; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.cell.blank { border: 0; background: none; }
.cell .dn { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cell .who { font-size: 11px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell.occ.airbnb { background: var(--airbnb-bg); border-color: #f6cfc7; color: var(--airbnb-ink); }
.cell.occ.booking { background: var(--booking-bg); border-color: #c9d9f4; color: var(--booking-ink); }
.cell.occ.directa { background: var(--directa-bg); border-color: #c4e3ca; color: var(--directa-ink); }
.cell.today { outline: 2px solid var(--accent-strong); outline-offset: -2px; }
.cell.clash { outline: 2px solid var(--neg); outline-offset: -2px; }
.out { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); opacity: .55; }
.out.static { position: static; display: inline-block; }
@media (min-width: 700px) { .cell { min-height: 78px; padding: 8px; } .cell .who { font-size: 12px; } }

/* ---------- Botones y formularios ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 600; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn.primary:hover { background: #266570; }
.btn.danger-outline { color: var(--neg); border-color: #efc9c5; }
.btn.small { padding: 7px 14px; font-size: 14px; }
.btn.block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions.center { justify-content: center; }

input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #d5dde0; border-radius: 10px; background: #fff; font-size: 16px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); font-weight: 500; }
textarea { resize: vertical; }

.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: rgba(34, 49, 58, .32); }
.sheet { width: 100%; max-width: 520px; max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); animation: sube .2s ease-out; outline: 0; }
@keyframes sube { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 22px; padding-bottom: 20px; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

.form { display: flex; flex-direction: column; gap: 14px; }
.form h2 { font-size: 20px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: flex; gap: 8px; }
.pill { flex: 1; position: relative; }
.pill input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.pill span { display: block; text-align: center; padding: 9px 6px; border: 1px solid #d5dde0; border-radius: 999px; color: var(--ink); font-weight: 600; font-size: 15px; }
.pill.airbnb input:checked + span { background: var(--airbnb-bg); border-color: #f1b9ae; color: var(--airbnb-ink); }
.pill.booking input:checked + span { background: var(--booking-bg); border-color: #aac3ee; color: var(--booking-ink); }
.pill.directa input:checked + span { background: var(--directa-bg); border-color: #a5d6ae; color: var(--directa-ink); }
.pill.neutral input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.pill input:focus-visible + span { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
.check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-size: 16px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent-strong); }
.calc { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; background: var(--accent-soft); border-radius: 12px; }
.calc div { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.calc strong { color: var(--ink); font-size: 17px; font-variant-numeric: tabular-nums; }
.warn-box { background: var(--warn-bg); color: var(--warn-ink); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.form-error { color: var(--neg); font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 50; transform: translate(-50%, 12px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- Acceso ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px; }
.login-box h1 { font-size: 24px; }

/* Evita que los campos de fecha se salgan de su columna en móvil */
.row2 > label, .form label { min-width: 0; }
input[type="date"] { min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; min-height: 44px; }
@media (min-width: 700px) {
  .top h1 { font-size: 26px; }
  .tbl { font-size: 14px; } .tbl th, .tbl td { padding: 9px 14px; }
  .chart .ax { font-size: 13px; }
}
.chart { max-height: 280px; }

/* Cancelaciones */
.canc-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--bg); border-radius: 12px; }
.canc-box .muted { font-size: 13px; }

/* Lectura de capturas */
.capt { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--accent-soft); border-radius: 12px; }
.capt .btn { background: var(--surface); }
.capt .muted { font-size: 13px; }
.capt .busy { color: var(--accent-strong); }
.tb-row { display: flex; gap: 10px; align-items: center; }
.tb-row input { flex: 1; min-width: 0; }
.tb-row .btn { white-space: nowrap; }

/* Tipos de cancelación */
.seg-wrap { flex-wrap: wrap; }
.seg-wrap .pill { flex: 1 1 30%; min-width: 0; }
.seg-wrap .pill span { font-size: 14px; padding: 9px 4px; }
.tag.canc-gratuita { background: var(--directa-bg); color: var(--directa-ink); }
.tag.canc-parcial { background: var(--warn-bg); color: var(--warn-ink); }
.tag.canc-sin_reembolso { background: var(--airbnb-bg); color: var(--airbnb-ink); }

.capt-error { color: var(--neg); font-size: 13px; }

/* Limpieza */
.row.static { cursor: default; }
.row.static:hover { background: none; }
.row.static .btn { margin-top: 6px; }
.tag.lp-pendiente { background: var(--warn-bg); color: var(--warn-ink); font-weight: 600; }
.tag.lp-finalizado { background: var(--booking-bg); color: var(--booking-ink); font-weight: 600; }
.tag.lp-pagado { background: var(--directa-bg); color: var(--directa-ink); font-weight: 600; }
.form h2 .tag { vertical-align: middle; margin-left: 6px; font-size: 13px; }
.kpi strong.pend { color: var(--warn-ink); }
.filtros { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 16px; }
.fbtn { padding: 7px 11px; border: 1px solid #d5dde0; border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 600; color: var(--ink); }
.fbtn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.ticket-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--bg); border-radius: 12px; }
#ticket-img { max-width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: #fff; align-self: flex-start; }
.ticket-box .busy { color: var(--accent-strong); }
@media (max-width: 480px) {
  .kpis.three .kpi { padding: 12px 10px; }
  .kpis.three .kpi strong { font-size: 19px; }
  .kpis.three .k-label, .kpis.three .k-sub { font-size: 12px; }
}

.row.static .r-main strong { white-space: normal; }

/* Calendario: nombre y personas que entran */
.cell .ident { display: flex; flex-direction: column; min-width: 0; gap: 0; }
.cell .pax { font-size: 10px; line-height: 1.15; font-weight: 600; opacity: .9; white-space: nowrap; }
@media (min-width: 700px) { .cell .pax { font-size: 12px; } }
/* Limpieza: quién entra después */
.next-box { background: var(--accent-soft); color: var(--accent-strong); padding: 10px 12px; border-radius: 12px; }

/* Panel: mes elegido */
.chart g.dim { opacity: .3; }
.tbl tbody tr.sel th, .tbl tbody tr.sel td { background: var(--accent-soft); font-weight: 650; }

/* Calendario de limpieza */
.cell.lc { cursor: default; align-items: stretch; }
.cell.lc.work { background: #ffc000; border-color: #e0a800; color: #1f1a00; }
.cell.lc .pax { font-size: 10px; line-height: 1.15; font-weight: 600; }
.sw.trabajo { background: #ffc000; }
@media (min-width: 700px) { .cell.lc .pax { font-size: 12px; } }

/* Calendarios iCal: novedades y marca en el menú */
.nav button { position: relative; }
.nav button[data-n]::after { content: attr(data-n); position: absolute; top: 4px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--neg); color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; }
@media (min-width: 900px) { .nav button[data-n]::after { position: static; margin-left: auto; } }
.inbox { margin-bottom: 14px; border-color: #f0d9a8; }
.inbox h2 { color: var(--ink); }
.inbox .row.static { flex-wrap: wrap; align-items: flex-start; }
.inbox .r-side.acc { width: 100%; flex-direction: row; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }

/* Bebés, cuna, compartir y Panel */
.cell .pax.extra { font-weight: 500; }
.cuna { display: inline-block; align-self: flex-start; margin-top: 2px; padding: 1px 6px; border-radius: 6px; background: #a4262c; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .04em; line-height: 1.35; }
.cell.lc { gap: 1px; justify-content: flex-start; }
.cell.lc .pax { display: block; }
.legend .cuna { margin: 0 6px 0 0; }
.actions.share { margin: 14px 0 6px; flex-wrap: wrap; }
.actions.share .btn { flex: 1 1 140px; }
label.check { display: flex; flex-direction: row; align-items: center; gap: 10px; align-self: end; min-height: 44px; font-weight: 500; }
label.check input { width: 22px; height: 22px; flex: none; margin: 0; }
label.check.inline { margin: 10px 0 4px; min-height: 0; align-items: flex-start; }
.pend-panel { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.pend-panel > span { display: flex; flex-direction: column; gap: 2px; }
.pend-panel > strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.tag.nr { background: var(--warn-bg); color: var(--warn-ink); font-weight: 600; }
