/* Villa Corazón de Jesús
   Idea: el calendario es el protagonista. Verde palma para la marca, mango solo para lo que se toca. */
:root {
  --bg: #f2f5ee;
  --surface: #ffffff;
  --surface-2: #e6ece1;
  --ink: #14241c;
  --muted: #56675d;
  --line: #d2dacd;
  --brand: #1d4d3a;
  --brand-ink: #ffffff;
  --accent: #e2971f;
  --accent-ink: #201402;
  --ok: #1c7a4c;
  --warn: #a35f00;
  --bad: #b3261e;
  --busy: #cfd6cb;
  --shadow: 0 1px 2px rgba(20, 36, 28, .06), 0 8px 24px rgba(20, 36, 28, .06);
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1612; --surface: #16211b; --surface-2: #1e2c24; --ink: #e7eee8; --muted: #9aaba0; --line: #2b3a31;
    --brand: #86cfa9; --brand-ink: #0e1612; --accent: #f0b04f; --accent-ink: #201402;
    --ok: #6fd3a0; --warn: #f0b04f; --bad: #ff8a80; --busy: #2b3a31;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1612; --surface: #16211b; --surface-2: #1e2c24; --ink: #e7eee8; --muted: #9aaba0; --line: #2b3a31;
  --brand: #86cfa9; --brand-ink: #0e1612; --accent: #f0b04f; --accent-ink: #201402;
  --ok: #6fd3a0; --warn: #f0b04f; --bad: #ff8a80; --busy: #2b3a31;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.has-modal { overflow: hidden; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
p { margin: 0; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bad { color: var(--bad); }
.due { color: var(--bad); font-weight: 600; }
.eyebrow { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sub, .hint { color: var(--muted); font-size: .875rem; }
.hint { margin-top: 6px; }

.boot { min-height: 60vh; display: grid; place-content: center; text-align: center; gap: 8px; padding: 24px; }
.boot-name { font-family: var(--display); font-size: 1.75rem; font-weight: 600; }
.boot-note { color: var(--muted); }

/* botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; text-decoration: none; white-space: nowrap; transition: transform .12s ease, background .12s ease; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-cta { background: var(--accent); color: var(--accent-ink); width: 100%; font-size: 1.05rem; min-height: 52px; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .875rem; border-radius: 8px; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; text-decoration: underline; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; padding: 10px 18px; border-radius: 9px; font-weight: 600; color: var(--muted); min-height: 40px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.sm button { padding: 6px 12px; min-height: 32px; font-size: .875rem; }

/* campos */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; grid-column: 1 / -1; min-width: 0; }
.field.half { grid-column: auto; }
.field[hidden] { display: none; }
.field label { font-size: .875rem; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.field textarea { resize: vertical; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; grid-column: auto; }
.field.inline input, .field.inline select { min-height: 36px; padding: 6px 10px; width: auto; }
.form-error { color: var(--bad); font-weight: 600; margin-top: 12px; }
.notice { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; color: var(--muted); }

/* ===== página pública ===== */
.pub { max-width: 1120px; margin: 0 auto; padding: 0 20px 56px; display: flex; flex-direction: column; gap: 40px; }
.hero { padding-top: 44px; display: flex; flex-direction: column; gap: 14px; }
.hero h1 { font-size: clamp(2.6rem, 9vw, 5.6rem); font-weight: 700; letter-spacing: -.035em; line-height: .95; color: var(--brand); }
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: 1.15rem; max-width: 58ch; color: var(--muted); }
.chips { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .9rem; font-weight: 500; background: var(--surface); }

.gallery { display: grid; gap: 8px; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 150px; }
.gallery .ph { border: 0; padding: 0; background: var(--surface-2); border-radius: 14px; overflow: hidden; }
.gallery .ph img { width: 100%; height: 100%; object-fit: cover; }
.gallery .ph:first-child { grid-column: span 2; grid-row: span 2; }
.gallery.n1 { grid-template-columns: 1fr; grid-auto-rows: min(60vw, 440px); }
.gallery.n1 .ph:first-child { grid-column: auto; grid-row: auto; }
.gallery.n2 { grid-template-columns: 1fr 1fr; grid-auto-rows: 300px; }
.gallery.n2 .ph:first-child { grid-column: auto; grid-row: auto; }

.book { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.book-cal, .req, .rules { background: var(--surface); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
.book-cal { display: flex; flex-direction: column; gap: 16px; }
.book-cal h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.book-cal .seg { align-self: flex-start; }
#cal-area { position: relative; display: flex; flex-direction: column; gap: 14px; }
.cal-nav { display: flex; gap: 8px; align-items: center; }
#cal-area > .cal-nav { position: absolute; right: 0; top: -4px; }
.nav-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 1.1rem; }
.nav-btn[disabled] { opacity: .35; cursor: not-allowed; }
.months { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.month h3 { font-size: 1.05rem; margin-bottom: 10px; min-height: 32px; display: flex; align-items: center; }
.dow, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dow span { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: center; padding-bottom: 6px; font-weight: 600; }
.day { aspect-ratio: 1; border: 0; border-radius: 10px; background: transparent; display: grid; place-items: center; position: relative; padding: 0; }
.day b { font-family: var(--display); font-weight: 600; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.day.free { background: var(--surface-2); }
.day.free:hover { box-shadow: inset 0 0 0 2px var(--brand); }
.day.past { color: var(--muted); opacity: .45; cursor: default; }
.day.busy { background: var(--busy); color: var(--muted); }
.day.busy::after { content: ""; position: absolute; left: 18%; right: 18%; top: 50%; height: 2px; background: currentColor; transform: rotate(-32deg); opacity: .8; }
.day.today b { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.day.in { background: color-mix(in srgb, var(--accent) 28%, var(--surface)); }
.day.sel { background: var(--accent); color: var(--accent-ink); }
.day.sel::after { display: none; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 16px; font-size: .875rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 8px; }
.k { width: 16px; height: 16px; border-radius: 5px; display: inline-block; }
.k-free { background: var(--surface-2); } .k-busy { background: var(--busy); } .k-sel { background: var(--accent); }
.updated { font-size: .8rem; color: var(--muted); }

.req { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.req h2 { font-size: 1.4rem; }
.facts { margin: 0; display: grid; gap: 10px; }
.facts div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.facts.three { grid-template-columns: repeat(3, 1fr); margin: 16px 0; }
.facts.three div { flex-direction: column; border: 0; background: var(--surface-2); border-radius: 12px; padding: 12px; gap: 2px; }
.facts.three dd { text-align: left; font-family: var(--display); font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.rq-summary { font-weight: 600; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.rq-summary.warn { color: var(--bad); }
.rules h2 { font-size: 1.4rem; margin-bottom: 12px; }
.rules ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; max-width: 70ch; }
.foot { color: var(--muted); font-size: .875rem; border-top: 1px solid var(--line); padding-top: 20px; }

/* ===== panel ===== */
.adminbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; background: var(--brand); color: var(--brand-ink); position: sticky; top: 0; z-index: 5; }
.adminbar .brand { font-family: var(--display); font-weight: 600; }
.adminbar .seg { background: color-mix(in srgb, var(--brand-ink) 16%, transparent); }
.adminbar .seg button { color: var(--brand-ink); opacity: .8; }
.adminbar .seg button.on { color: var(--ink); opacity: 1; }
.panel { max-width: 1180px; margin: 0 auto; padding: 28px 20px 64px; display: flex; flex-direction: column; gap: 20px; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.panel-head h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin-top: 6px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tabs { display: flex; gap: 4px; overflow-x: auto; background: var(--surface-2); padding: 4px; border-radius: 14px; scrollbar-width: thin; }
.tabs button { border: 0; background: transparent; padding: 10px 16px; border-radius: 10px; font-weight: 600; color: var(--muted); white-space: nowrap; min-height: 42px; }
.tabs button.on { background: var(--brand); color: var(--brand-ink); }
.tab-body { display: flex; flex-direction: column; gap: 20px; }
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-radius: 14px; padding: 12px 16px; font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.tile { background: var(--surface); border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow); border-left: 4px solid transparent; display: flex; flex-direction: column; gap: 4px; }
.tile-warn { border-left-color: var(--accent); } .tile-bad { border-left-color: var(--bad); }
.tile-l { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.tile-v { font-family: var(--display); font-size: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; overflow-wrap: anywhere; }
.tile-s { color: var(--muted); font-size: .875rem; }
.card { background: var(--surface); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card h2 { font-size: 1.35rem; } .card h3 { font-size: 1.1rem; }
.fund-v { font-family: var(--display); font-size: clamp(2.2rem, 7vw, 3.4rem); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--brand); }
.panel-nav h3 { min-width: 11ch; text-align: center; }
.admin-grid { gap: 6px; }
.acell { min-height: 92px; background: var(--surface-2); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.acell.blank { background: transparent; }
.acell.past { opacity: .7; }
.acell.today { box-shadow: inset 0 0 0 2px var(--brand); }
.aday { align-self: flex-start; border: 0; background: transparent; font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; padding: 2px 6px; border-radius: 6px; }
.aday:hover { background: var(--surface); }
.chip { border: 0; border-radius: 6px; padding: 3px 6px; font-size: .75rem; font-weight: 600; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.chip-pendiente { background: color-mix(in srgb, var(--accent) 35%, var(--surface)); color: var(--ink); }
.chip-confirmada { background: var(--brand); color: var(--brand-ink); }
.chip-finalizada { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.pill { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pill-pendiente { background: color-mix(in srgb, var(--accent) 30%, var(--surface)); color: var(--ink); }
.pill-confirmada { background: color-mix(in srgb, var(--ok) 20%, var(--surface)); color: var(--ink); }
.pill-finalizada { background: var(--surface-2); color: var(--muted); }
.pill-cancelada { background: color-mix(in srgb, var(--bad) 16%, var(--surface)); color: var(--bad); }
.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl small { display: block; color: var(--muted); font-size: .8rem; }
.tbl small.bad { color: var(--bad); font-weight: 600; }
.tbl .r { text-align: right; }
.tbl .acts { white-space: nowrap; }
.tbl .acts > * { margin-left: 6px; }
.rowlink { cursor: pointer; } .rowlink:hover { background: var(--surface-2); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.list-row { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px; }
.list-row small { display: block; color: var(--muted); }
.list.tight li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding: 8px 0; }
.empty { color: var(--muted); padding: 18px; text-align: center; background: var(--surface-2); border-radius: 12px; }
.status-line { color: var(--muted); }
.todo { margin: 0; padding: 12px 16px 12px 34px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-radius: 12px; display: grid; gap: 4px; }
.photos { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; }
.thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.thumbs li { display: flex; flex-direction: column; gap: 6px; }
.thumbs img { aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; width: 100%; }
.thumb-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .8rem; color: var(--muted); }

/* diálogos y avisos */
.backdrop { position: fixed; inset: 0; background: rgba(8, 16, 12, .55); display: grid; place-items: center; padding: 16px; z-index: 20; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 20px; padding: 24px; width: min(640px, 100%); max-height: calc(100% - 16px); overflow-y: auto; position: relative; box-shadow: 0 24px 64px rgba(0, 0, 0, .3); }
.modal h2 { font-size: 1.5rem; padding-right: 40px; }
.modal h3 { font-size: 1.05rem; margin: 18px 0 8px; }
.modal-intro { color: var(--muted); margin: 6px 0 18px; }
.modal .x { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 1.4rem; line-height: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-actions.wrap { flex-wrap: wrap; }
.modal .field { margin-top: 14px; }
.modal .fields .field { margin-top: 0; }
.lightbox { border-radius: 12px; width: 100%; }
.dump { width: 100%; font-family: ui-monospace, monospace; font-size: .8rem; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--surface-2); }
#toast-root { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 30; width: min(92vw, 520px); pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); transition: opacity .4s ease, transform .4s ease; }
.toast-warn { background: var(--accent); color: var(--accent-ink); }
.toast.out { opacity: 0; transform: translateY(8px); }

@media (max-width: 860px) {
  .book { grid-template-columns: 1fr; }
  .req { position: static; }
  .gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 130px; }
}
@media (max-width: 620px) {
  .months { grid-template-columns: 1fr; }
  .months .month:nth-child(2) { display: none; }
  .fields { grid-template-columns: 1fr; }
  .field.half { grid-column: 1 / -1; }
  .book-cal, .req, .rules, .card, .modal { padding: 18px; border-radius: 16px; }
  .acell { min-height: 64px; padding: 4px; }
  .chip { font-size: .68rem; padding: 2px 4px; }
  .facts.three { grid-template-columns: 1fr; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ===== versión web propia ===== */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: min(420px, 100%); gap: 18px; padding: 28px; }
.login h1 { font-size: 1.7rem; color: var(--brand); }
.login .link { text-align: center; font-size: .9rem; }
.adminbar .tools { gap: 18px; }
.bar-link { background: none; border: 0; padding: 6px 0; color: var(--brand-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; font-size: .92rem; }
