:root {
    --bg: #f7f5f0; --surface: #ffffff; --text: #24211c; --muted: #6f685d; --border: #e2ddd2;
    --accent: #7a1f1a; --accent-soft: #f3e4e2; --match: #fff4cc; --match-border: #d9a400;
    --martyr: #b3261e; --marian: #2f6fb5; --euch: #b38600;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #17150f; --surface: #221f18; --text: #ece7dc; --muted: #a59d8f; --border: #3a352b;
        --accent: #e0857d; --accent-soft: #3a2422; --match: #3d3315; --match-border: #d9a400;
        --martyr: #ef7b72; --marian: #7fb0ea; --euch: #e2bb45;
    }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
.topbar { display: flex; gap: 24px; align-items: center; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.topbar nav a { margin-right: 16px; text-decoration: none; color: var(--muted); }
.topbar nav a.active { color: var(--accent); font-weight: 600; }
.container { max-width: 1280px; margin: 0 auto; padding: 16px; }
.footer { color: var(--muted); font-size: 13px; padding: 24px 16px; text-align: center; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
h1 { margin: 0; font-size: 24px; }
h2 { font-size: 17px; margin: 0 0 8px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.warning { background: var(--accent-soft); padding: 8px 12px; border-radius: 6px; }
.summary { font-weight: 600; }
.cal-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-head .nav { font-size: 28px; text-decoration: none; padding: 0 8px; }
.jump { margin-left: auto; display: flex; gap: 6px; }
.jump input { width: 80px; }
input, select, button { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; }
button { background: var(--accent); color: #fff; border: none; cursor: pointer; padding: 6px 14px; }
.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.wd { text-align: center; font-weight: 600; color: var(--muted); font-size: 13px; padding: 4px 0; }
.cell { position: relative; min-height: 104px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cell:hover { border-color: var(--accent); }
.cell.outside { opacity: .45; }
.cell.today .num { background: var(--accent); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.cell.match { background: var(--match); border: 2px solid var(--match-border); }
.cell.dim { opacity: .5; }
.num { font-weight: 700; }
.principal { font-size: 12px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.badges { margin-top: auto; display: flex; gap: 4px; align-items: center; }
.count { margin-left: auto; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot.martyr { background: var(--martyr); } .dot.marian { background: var(--marian); } .dot.euch { background: var(--euch); }
.lc { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--border); }
.lc-white { background: #fff; } .lc-red { background: #c62828; } .lc-green { background: #2e7d32; } .lc-purple { background: #6a1b9a; } .lc-rose { background: #e891b5; } .lc-gold { background: #d4a017; } .lc-black { background: #000; }
.legend { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 640px) { .cell { min-height: 64px; padding: 4px; } .principal { display: none; } .jump { margin-left: 0; } }
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.filter { border: 1px solid var(--border); border-radius: 8px; margin: 0 0 10px; padding: 8px 10px; }
.filter.on { border-color: var(--accent); }
.filter legend { font-weight: 600; padding: 0 4px; }
.param { margin: 6px 0; } .param.row { display: flex; gap: 8px; } .param.row input { width: 90px; }
.plabel { display: block; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 13px; border: 1px solid var(--border); border-radius: 12px; padding: 2px 8px; }
.actions { display: flex; gap: 12px; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin: 16px 0; }
.celebration { border-top: 1px solid var(--border); padding: 10px 0; } .celebration:first-of-type { border-top: none; }
.celebration h3 { margin: 0; font-size: 16px; }
.meta { margin: 2px 0 6px; color: var(--muted); font-size: 13px; }
.saint { margin: 6px 0 6px 12px; } .saint p { margin: 2px 0; }
.badge { font-size: 11px; font-weight: 600; border-radius: 10px; padding: 1px 7px; margin-left: 4px; vertical-align: middle; color: #fff; }
.badge.martyr { background: var(--martyr); } .badge.marian { background: var(--marian); } .badge.euch { background: var(--euch); color: #000; }
.eval { list-style: none; padding: 0; margin: 0; } .eval .ok { color: #2e7d32; } .eval .ko { color: var(--martyr); }
.results { width: 100%; border-collapse: collapse; background: var(--surface); }
.results th, .results td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
/* Filtros con casilla y fuentes */
.group { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; }
.filters .filter { padding: 8px 10px; }
.filter-head { display: flex; align-items: center; gap: 6px; }
.filter-check { display: flex; align-items: center; gap: 8px; font-weight: 600; flex: 1; cursor: pointer; }
.filter-check input { width: 17px; height: 17px; accent-color: var(--accent); }
.desc { margin: 2px 0 0 25px; }
.filters .param { margin: 6px 0 0 25px; }
.filters .param input[type=text] { width: 100%; margin-top: 2px; }
.info, .info-dot { width: 22px; height: 22px; border-radius: 50%; padding: 0; font: italic 700 13px/22px Georgia, serif; text-align: center; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); display: inline-block; }
.info-dot { width: 18px; height: 18px; line-height: 18px; font-size: 11px; }
.info:hover { background: var(--accent); color: #fff; }
.sol { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.sol-alta { background: #2e7d32; } .sol-media { background: #f0a500; } .sol-baja { background: #c62828; } .sol-sin_fuente { background: #9e9e9e; } .sol-tecnico { background: #2f6fb5; }
.sol-badge { display: inline-block; font-size: 12px; font-weight: 700; color: #fff; border-radius: 10px; padding: 1px 8px; width: auto; height: auto; }
.popup { max-width: min(560px, calc(100vw - 32px)); max-height: 80vh; overflow: auto; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.popup::backdrop { background: rgba(0,0,0,.25); }
.popup-head { display: flex; justify-content: space-between; align-items: center; font-size: 17px; }
.popup .close { background: none; color: var(--muted); font-size: 22px; padding: 0 4px; }
.popup h4 { margin: 12px 0 4px; font-size: 14px; }
.sources { padding-left: 18px; margin: 0; font-size: 14px; } .sources li { margin-bottom: 8px; }
.kind { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 8px; padding: 0 6px; margin-left: 4px; }
.candidates li { margin-bottom: 4px; }
.calsel { margin-bottom: 12px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; max-height: 60vh; overflow: auto; }
.calsel summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.calopt { display: grid; grid-template-columns: 18px 1fr; column-gap: 6px; font-size: 13px; margin: 4px 0; }
.calopt small { grid-column: 2; }
.civil { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.civil dt { font-weight: 600; } .civil dd { margin: 0; }

/* Santo agrupado y ficha con todas las fuentes */
.celebration.saint-group h3 a { color: inherit; }
.sources-count { font-weight: 600; }
.badge.wd { background: transparent; border: 1px solid var(--border); color: var(--muted); font-weight: 400; }
.sources-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.sources-table th, .sources-table td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.sources-table tr.unselected { opacity: .55; }
@media (max-width: 640px) { .sources-table { display: block; overflow-x: auto; } }

/* Ayuda */
.help { max-width: 900px; }
.help .lead { font-size: 1.05rem; }
.help h3 { margin: 18px 0 6px; font-size: 1rem; }
.toc ol { margin: 6px 0; padding-left: 20px; }
.sol-legend { list-style: none; padding: 0; }
.sol-legend li { margin: 4px 0; }
.filter-help dt { font-weight: 600; margin-top: 8px; }
.filter-help dd { margin: 2px 0 0 18px; color: var(--muted); }
.table-wrap { overflow-x: auto; }

/* Administración */
.admin-login { max-width: 360px; }
.admin-login label { display: block; margin: 10px 0; }
.admin-login input { display: block; width: 100%; padding: 6px 8px; margin-top: 4px; box-sizing: border-box; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.admin-head .link, button.link { background: none; border: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font: inherit; }
.admin-row { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.admin-row input { margin-top: 3px; }
.admin-source { border: 1px solid var(--border); border-radius: 8px; margin: 10px 0; padding: 6px 12px; }
.ok-msg { background: var(--match); border: 1px solid var(--match-border); padding: 8px 12px; border-radius: 8px; }

/* Administración del callejero */
.admin-tabs { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 8px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.admin-tabs a { text-decoration: none; color: var(--muted); } .admin-tabs a.active { color: var(--accent); font-weight: 600; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }
.field { display: block; margin: 0 0 12px; font-weight: 600; font-size: 14px; }
.field input, .field select, .field textarea { display: block; width: 100%; margin-top: 4px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font: 400 14px/1.4 system-ui, sans-serif; }
.field input[type=color] { height: 38px; padding: 2px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: block; margin: 6px 0; }
.admin-map { height: 360px; border-radius: 8px; border: 1px solid var(--border); margin: 8px 0 16px; background: #dfe6dc; }
.admin-map.tall { height: 460px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table input { width: 100%; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); }
.admin-table input.num { width: 70px; } .admin-table input.coord { width: 110px; } .admin-table input[type=checkbox] { width: auto; }
.panos { overflow-x: auto; display: block; }
.pano-thumb { width: 120px; height: 60px; object-fit: cover; border-radius: 4px; }
.pano-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #1a73e8; color: #fff; font: 700 12px system-ui; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.pano-num.nogps { background: #d9a400; }
.tag-ok, .tag-off, .tag-warn { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.tag-ok { background: #e3f3e5; color: #2e7d32; } .tag-off { background: var(--accent-soft); color: var(--muted); } .tag-warn { background: var(--match); color: #8a6a00; }
.admin-upload { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0 16px; }
.admin-danger { margin: 24px 0; } button.link.danger { color: var(--martyr); }
button.link { padding: 0; }
.admin-panos { margin-top: 24px; }

/* Fichas y vidas de santos (Ordo FSSPX) */
.ficha { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .8rem; margin: .5rem 0; }
.ficha dt { font-weight: 600; color: var(--muted, #666); }
.ficha dd { margin: 0; }
details.vida { margin: .6rem 0; border: 1px solid rgba(0,0,0,.12); border-radius: 6px; padding: .5rem .8rem; background: rgba(0,0,0,.02); }
details.vida summary { cursor: pointer; font-weight: 600; }
details.vida p { line-height: 1.6; max-width: 70ch; }
@media (max-width: 600px) { .ficha { grid-template-columns: 1fr; } .ficha dt { margin-top: .3rem; } }

/* Marcas en fotos 360° (administración) */
.admin-pano { height: 62vh; min-height: 360px; border-radius: 8px; overflow: hidden; background: #111; }
.markers-grid { grid-template-columns: minmax(0, 2.2fr) minmax(240px, 1fr); }
.marker-row { display: flex; gap: .6rem; align-items: center; padding: .3rem 0; border-bottom: 1px solid rgba(0,0,0,.08); }
.marker-row .danger { margin-left: auto; }
.poi-photo-admin { display: block; max-width: 100%; max-height: 180px; border-radius: 6px; margin: .3rem 0; }
@media (max-width: 800px) { .markers-grid { grid-template-columns: 1fr; } }
