:root {
  --bg: #F2F3EE;
  --surface: #FFFFFF;
  --ink: #1B231F;
  --muted: #5B675F;
  --line: #D8DDD2;
  --accent: #2E5B45;
  --accent-ink: #FFFFFF;
  --taken: #7E2738;
  --taken-bg: #F6E6EA;
  --mine-bg: #E1EEE6;
  --block: #666B64;
  --block-bg: #E9EAE5;
  --warn: #6E5200;
  --warn-bg: #FFF2CC;
  --font-display: "Young Serif", Georgia, "Times New Roman", serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131815; --surface: #1B221E; --ink: #E6ECE8; --muted: #9AA79F; --line: #2D3731;
    --accent: #84C3A0; --accent-ink: #0D1410; --taken: #E697A6; --taken-bg: #3A2028;
    --mine-bg: #1E3A2B; --block: #A3A9A2; --block-bg: #262C28; --warn: #EBCB70; --warn-bg: #383012;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131815; --surface: #1B221E; --ink: #E6ECE8; --muted: #9AA79F; --line: #2D3731;
  --accent: #84C3A0; --accent-ink: #0D1410; --taken: #E697A6; --taken-bg: #3A2028;
  --mine-bg: #1E3A2B; --block: #A3A9A2; --block-bg: #262C28; --warn: #EBCB70; --warn-bg: #383012;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 15px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 28px 48px;
}
.wrap { max-width: 1120px; margin: 0 auto; display: grid; gap: 24px; }

header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(28px, 5vw, 40px); line-height: 1.1; margin: 4px 0 0; text-wrap: balance; }
.summary { color: var(--muted); font-size: 14px; }
.summary b { color: var(--ink); font-family: var(--font-mono); font-weight: 500; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { font: inherit; font-weight: 600; font-size: 14px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 12px; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab .badge { font-family: var(--font-mono); font-weight: 500; font-size: 11px; background: var(--block-bg); color: var(--muted); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.tab .badge.hot { background: var(--warn-bg); color: var(--warn); }

.banner { border-radius: 8px; padding: 10px 14px; font-size: 14px; background: var(--warn-bg); color: var(--warn); }

.main { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .main { grid-template-columns: minmax(0, 1fr); } }
.view { display: grid; gap: 24px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; min-width: 0; }
h2.ph { font-family: var(--font-display); font-weight: 400; font-size: 22px; margin: 0; }

.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.cal-head h2 { text-transform: capitalize; }
.nav { display: flex; gap: 6px; }
.iconbtn { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 8px; height: 34px; min-width: 34px; padding: 0 10px; font: inherit; font-size: 14px; cursor: pointer; }
.iconbtn:hover { border-color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: center; padding-bottom: 4px; font-weight: 600; }
.day {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 64px; padding: 6px 7px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; min-width: 0;
}
.day:hover { border-color: var(--accent); }
.day .n { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.day .who { font-size: 11px; line-height: 1.25; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day.empty { visibility: hidden; }
.day.past { color: var(--muted); background: transparent; }
.day.taken { background: var(--taken-bg); border-color: transparent; }
.day.taken .who { color: var(--taken); font-weight: 600; }
.day.mine { background: var(--mine-bg); border-color: transparent; }
.day.mine .who { color: var(--accent); font-weight: 600; }
.day.blocked { background: var(--block-bg); border-color: transparent; }
.day.blocked .who { color: var(--block); }
.day.today .n { background: var(--ink); color: var(--bg); border-radius: 4px; padding: 0 4px; }
.day.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.day:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 480px) { .day { min-height: 48px; padding: 4px 5px; } .day .who { display: none; } .day.taken::after, .day.mine::after, .day.blocked::after { content: ""; position: absolute; left: 6px; bottom: 6px; width: 6px; height: 6px; border-radius: 50%; } .day.taken::after { background: var(--taken); } .day.mine::after { background: var(--accent); } .day.blocked::after { background: var(--block); } }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); display: inline-block; }

.detail h3 { font-family: var(--font-display); font-weight: 400; font-size: 22px; margin: 0; text-wrap: balance; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .03em; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.free, .pill.ok { background: var(--mine-bg); color: var(--accent); }
.pill.taken { background: var(--taken-bg); color: var(--taken); }
.pill.blocked, .pill.past { background: var(--block-bg); color: var(--block); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }

/* Secciones de la ficha de reserva */
.sec { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 16px; display: grid; gap: 10px; }
.sec h4 { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
dl.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.lines { display: grid; gap: 6px; font-size: 14px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; }
.line .q { font-family: var(--font-mono); color: var(--muted); font-size: 13px; }
.line .a { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; min-width: 5.5em; }
.line input { width: 4.5em; text-align: right; padding: 6px 8px; font-family: var(--font-mono); }
.line .pu { font-size: 12px; color: var(--muted); display: block; }
.total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px dashed var(--line); padding-top: 10px; font-weight: 600; }
.total .a { font-family: var(--font-mono); font-size: 18px; font-weight: 500; }

form { display: grid; gap: 12px; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 420px) { .row2 { grid-template-columns: minmax(0, 1fr); } }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
label .hint { font-weight: 400; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; }
label.check input { width: 18px; height: 18px; flex: none; }
label.check .a { margin-left: auto; font-family: var(--font-mono); }
input, select, textarea { font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 64px; }
.btn { font: inherit; font-weight: 600; font-size: 15px; border-radius: 8px; padding: 10px 16px; cursor: pointer; border: 1px solid transparent; text-decoration: none; display: inline-block; }
.btn.sm { font-size: 13px; padding: 6px 12px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--taken); border-color: var(--taken); }
.btn.danger.confirm { background: var(--taken); color: var(--surface); }
.btn:disabled { opacity: .55; cursor: wait; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.note { font-size: 13px; color: var(--muted); margin: 0; }
.err { font-size: 14px; color: var(--taken); background: var(--taken-bg); padding: 8px 12px; border-radius: 8px; }
.ok-msg { font-size: 14px; color: var(--accent); background: var(--mine-bg); padding: 8px 12px; border-radius: 8px; }
.instr { font-size: 14px; background: var(--bg); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

.list { display: grid; }
.item { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 10px 0; border: 0; border-top: 1px solid var(--line); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
.item:hover .i-who { text-decoration: underline; }
.i-date { font-family: var(--font-mono); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.i-who { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.i-who small { font-weight: 400; color: var(--muted); }
.i-pax { display: flex; gap: 8px; align-items: baseline; font-family: var(--font-mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.emptymsg { color: var(--muted); font-size: 14px; margin: 0; }

/* Socios */
.s-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; color: var(--muted); margin-top: 4px; }
.stats b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
.s-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.s-tools input { flex: 1 1 220px; }
.s-tools select { flex: 0 1 170px; width: auto; }
.tablewrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
tr.baja td { color: var(--muted); }
td .sub { display: block; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.editor { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; display: grid; gap: 12px; }
.editor h3 { font-family: var(--font-display); font-weight: 400; font-size: 19px; margin: 0; }
.junta { display: grid; gap: 10px; margin-top: 12px; }
.junta-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.junta-item:last-child { border-bottom: 0; padding-bottom: 0; }
.junta-item b { font-weight: 600; }
.junta-item span { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }

/* Avisos */
.aviso { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; display: grid; gap: 10px; }
.aviso:first-of-type { border-top: 0; margin-top: 8px; padding-top: 0; }
.aviso-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.aviso-head b { font-size: 16px; }
.mail { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 14px; display: grid; gap: 6px; }
.mail .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.mail textarea { background: var(--surface); font-size: 14px; min-height: 180px; font-family: var(--font-body); }

/* Ajustes */
.aj-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .aj-grid { grid-template-columns: minmax(0, 1fr); } }
.beb-row { display: grid; grid-template-columns: minmax(0, 1fr) 7em auto auto; gap: 8px; align-items: center; }
.beb-row input[type="checkbox"] { width: 18px; height: 18px; }
.beb-head { display: grid; grid-template-columns: minmax(0, 1fr) 7em auto auto; gap: 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.xbtn { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 16px; }
.xbtn:hover { color: var(--taken); border-color: var(--taken); }
footer { font-size: 13px; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) { .day, .btn { transition: border-color .12s, background-color .12s, filter .12s; } }

/* ---------- Añadido para la aplicación propia ---------- */
[hidden]:not([hidden=until-found i]) { display: none !important; }
img { max-width: 100%; }
.cuenta { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.cuenta b { color: var(--ink); font-weight: 600; }
.acceso { max-width: 420px; width: 100%; margin: 24px auto 0; display: grid; gap: 14px; }
.acceso h2 { font-family: var(--font-display); font-weight: 400; font-size: 24px; margin: 0; }
.enlace { display: grid; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.enlace input { font-family: var(--font-mono); font-size: 13px; background: var(--surface); }
body { margin: 0; }
.tabs { overflow-y: hidden; scrollbar-width: none; }
.cal-head h2 { text-transform: none; }

/* Comunicados */
.comunicados { display: grid; gap: 14px; }
.comunicado { border-bottom: 1px solid var(--line); padding-bottom: 14px; display: grid; gap: 6px; }
.comunicado:last-child { border-bottom: 0; padding-bottom: 0; }
.c-cab { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; }
.c-texto { margin: 0; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.modal-fondo { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-fondo[hidden] { display: none; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; display: grid; gap: 10px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.modal h2 { font-family: var(--font-display); font-weight: 400; font-size: 22px; margin: 0; }

/* Apartado de la junta */
.subtabs { display: flex; flex-wrap: wrap; gap: 6px; }
.subtab { font: inherit; font-size: 14px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.subtab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.anio { align-self: center; padding: 0 4px; font-size: 15px; }
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 16px; }
.cifra { background: var(--bg); border-radius: 10px; padding: 12px 14px; display: grid; gap: 2px; }
.cifra span { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.cifra b { font-family: var(--font-mono); font-weight: 500; font-size: 22px; font-variant-numeric: tabular-nums; }
.cifra small { color: var(--muted); font-size: 12px; }
.neg { color: var(--taken); }
.pos { color: var(--accent); }
td.importe { text-align: right; white-space: nowrap; }
.cat { display: grid; grid-template-columns: minmax(0, 9em) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; padding: 4px 0; }
.barra { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.cuotas { display: grid; margin-top: 12px; }
.cuota-socio { border-top: 1px solid var(--line); padding: 12px 0; display: grid; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips-meses { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; flex: 1 1 480px; min-width: 0; }
@media (max-width: 620px) { .chips-meses { grid-template-columns: repeat(6, minmax(0, 1fr)); flex-basis: 100%; } }
.chip { font: inherit; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 6px 2px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-align: center; white-space: nowrap; min-width: 0; }
.chip[data-jcuota="entrada"] { padding: 6px 12px; }
.chip.pagada { background: var(--mine-bg); color: var(--accent); border-color: transparent; }
.chip.debe { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.nada { color: var(--muted); background: transparent; border-style: dashed; }
.chip.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.barra-cobro { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.reuniones { display: grid; gap: 16px; margin-top: 16px; }
.reunion { border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 8px; }
.reunion .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
