/* Voluntariado Fellowship — área privada */
:root {
  --bg: #f3eee4;
  --bg-2: #e7dfd0;
  --paper: #fffaf2;
  --ink: #1c2a24;
  --muted: #5b6a63;
  --brand: #1d5a4b;
  --brand-2: #163f35;
  --accent: #c46a32;
  --line: #d9d0c0;
  --ok: #1f7a4d;
  --warn: #a15c12;
  --danger: #9b2c2c;
  --alta: #9b2c2c;
  --media: #a15c12;
  --baja: #2b5f8a;
  --shadow: 0 10px 30px rgba(28, 42, 36, 0.08);
  --radius: 16px;
  --sans: "Source Sans 3", "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Literata", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #dfe8d8 0%, transparent 50%),
    var(--bg);
  padding-bottom: 72px;
}
a { color: var(--brand); }
img { max-width: 100%; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px 12px; z-index: 9; }
.topbar {
  background: var(--brand);
  color: #f7f3ea;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 22px; position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.brand strong { font-family: var(--serif); font-size: 1.12rem; letter-spacing: .01em; }
.brand span { font-size: .78rem; opacity: .85; }
.who { display: flex; align-items: center; gap: 10px; font-size: .86rem; }
.who button, button, .btn {
  font: inherit; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 9px 16px; text-decoration: none; display: inline-block;
  min-height: 44px;
}
.btn.secondary { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn.ghost { background: transparent; color: inherit; border: 1px solid rgba(255,255,255,.35); }
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 62px); }
aside { background: var(--paper); border-right: 1px solid var(--line); padding: 22px 16px; }
aside p { color: var(--muted); font-size: .86rem; line-height: 1.45; }
aside a {
  display: flex; align-items: center; text-decoration: none; color: var(--ink);
  padding: 8px 10px; border-radius: 10px; margin-bottom: 4px; min-height: 44px;
}
aside a[aria-current="page"], aside a:hover { background: var(--bg-2); }
main { padding: 28px 28px 64px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 620; line-height: 1.25; }
h1 { font-size: 1.85rem; margin: 0 0 10px; }
.lede { color: var(--muted); max-width: 70ch; margin: 0 0 22px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.card .n { font-family: var(--serif); font-size: 2rem; margin: 8px 0 0; }
.table-wrap { overflow: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.badge { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: .78rem; font-weight: 650; }
.badge.alta, .badge.urgente { background: #f8d7d4; color: var(--alta); }
.badge.media, .badge.mereceatencion { background: #f7e3c4; color: var(--warn); }
.badge.baja, .badge.tranquila, .badge.presente, .badge.recibido, .badge.bueno { background: #d8f0e2; color: var(--ok); }
.badge.salio, .badge.salió, .badge.comprado { background: #ece7de; color: var(--muted); }
.badge.pendiente, .badge.propuestoadonante { background: #f7e3c4; color: var(--warn); }
.badge.comprometido, .badge.entransito { background: #e4e8d4; color: var(--brand); }
.badge.ejemplo { background: #efe6fb; color: #5b3d91; }
.badge.pocostock, .badge.regular { background: #f7e3c4; color: var(--warn); }
.badge.sinverificar { background: #fbe9c8; color: var(--warn); border: 1px solid #e0b46a; }
.badge.danado, .badge.dañado, .badge.porreponer { background: #f8d7d4; color: var(--danger); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; align-items: end; }
.filters label { margin: 0; min-width: 140px; flex: 1 1 140px; }
label { display: block; font-size: .88rem; margin: 0 0 12px; }
input, select, textarea {
  width: 100%; font: inherit; padding: 9px 11px; border-radius: 10px;
  border: 1px solid #cfc6b6; background: #fff; font-size: 16px;
}
textarea { min-height: 90px; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px 18px;
}
@media (min-width: 720px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.full, .form-grid .full { grid-column: 1 / -1; }

.notice { background: #fff4d6; border: 1px solid #e6d08a; color: #5c4710; padding: 12px 14px; border-radius: 12px; margin: 0 0 18px; }
.warnbox { background: #fbe6e4; border: 1px solid #e8b3ad; color: #6d221c; padding: 12px 14px; border-radius: 12px; margin: 0 0 18px; }
.okbox { background: #e5f5ea; border: 1px solid #b7dfc4; color: #1c5a35; padding: 12px 14px; border-radius: 12px; margin: 0 0 18px; }
.gate, .public {
  max-width: 640px; margin: 8vh auto; background: var(--paper);
  border: 1px solid var(--line); border-radius: 22px; padding: 36px 32px; box-shadow: var(--shadow);
}
.public h1, .gate h1 { font-size: 2rem; }
footer {
  grid-column: 1 / -1; padding: 18px 22px; color: var(--muted); font-size: .82rem;
  border-top: 1px solid var(--line);
}
.empty { color: var(--muted); padding: 28px; text-align: center; }
.nav-toggle {
  display: none; flex-shrink: 0; background: transparent; color: inherit;
  border: 1px solid rgba(255,255,255,.35); min-width: 44px; min-height: 44px;
  padding: 8px 14px; border-radius: 999px;
}
.record-cards { display: none; }
.record-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.record-card .k {
  display: block; font-size: .75rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); margin: 10px 0 2px;
}
.record-card .k:first-child { margin-top: 0; }
.check-row {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fff4d6; border: 1px solid #e6d08a; color: #5c4710;
  padding: 12px 14px; border-radius: 12px; margin: 0 0 14px;
}
.check-row input { width: auto; min-width: 22px; min-height: 22px; margin-top: 3px; }

.visitor-picker { grid-column: 1 / -1; margin: 0 0 12px; border: 0; padding: 0; min-width: 0; }
.visitor-picker legend { font-weight: 650; margin: 0 0 6px; }
.visitor-picker .hint { color: var(--muted); font-size: .88rem; margin: 0 0 10px; }
.visitor-dropdown { margin: 0 0 12px; }
.visitor-toggle {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fff; font: inherit; color: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  text-align: left;
}
.visitor-toggle[aria-expanded="true"] { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.visitor-toggle-caret { color: var(--muted); font-size: 1.1rem; line-height: 1; }
.visitor-panel {
  border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 12px 12px; background: #fff; padding: 10px 12px 12px;
}
.visitor-search-label { display: block; margin: 0 0 8px; font-size: .9rem; }
.visitor-options {
  max-height: 240px; overflow-y: auto; display: grid; gap: 6px;
  -webkit-overflow-scrolling: touch;
}
.visitor-options .is-hidden { display: none; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 14px; margin: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; cursor: pointer; font-size: .95rem;
}
.visitor-options .chip { border-radius: 12px; width: 100%; }
.chip input { width: auto; min-width: 22px; min-height: 22px; margin: 0; flex: 0 0 auto; }
.chip.is-on, .chip:has(input:checked) {
  background: #d8f0e2; border-color: var(--ok);
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .btn, .actions button { margin: 0; }
.hero-status {
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.hero-status.tranquila { background: #d8f0e2; color: #145534; }
.hero-status.mereceatencion { background: #f7e3c4; color: #6a3d08; }
.hero-status.urgente { background: #f8d7d4; color: #6d221c; }
.hero-status .n { font-family: var(--serif); font-size: 2rem; margin: 6px 0 4px; }
.diary-feed { display: grid; gap: 14px; }
.diary-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); border-left: 8px solid var(--brand);
}
.diary-card.tranquila { border-left-color: var(--ok); }
.diary-card.mereceatencion { border-left-color: #d4a017; }
.diary-card.urgente { border-left-color: var(--danger); }
.diary-meta { color: var(--muted); font-size: .9rem; margin: 0 0 8px; }
.share-box textarea { min-height: 180px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  aside { display: none; border-right: 0; border-bottom: 1px solid var(--line); }
  aside.is-open { display: block; }
  .desktop-table { display: none; }
  .record-cards { display: grid; gap: 12px; }
  main { padding: 20px 16px 48px; }
  .topbar { flex-wrap: wrap; padding: 10px 12px; gap: 10px; }
  .brand span { display: none; }
  .who span { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gate, .public { margin: 4vh 12px; padding: 24px 18px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .who span { display: none; }
}
@media print {
  .topbar, aside, footer, .nav-toggle, form, .no-print, .filters { display: none !important; }
  .layout { display: block; }
  main { padding: 0; }
  body { background: #fff; padding-bottom: 0; }
  .card, .diary-card, .table-wrap { box-shadow: none; }
  .desktop-table { display: block !important; }
  .record-cards { display: none !important; }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.project-switcher select {
  min-height: 40px; max-width: min(48vw, 240px);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 10px; font: inherit; background: #fff;
}
.who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.project-grid { display: grid; gap: 14px; }
@media (min-width: 720px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.project-card {
  border-top: 6px solid var(--project-color, var(--brand));
  box-shadow: inset 6px 0 0 var(--project-color, var(--brand)), var(--shadow);
}
.project-accent-bar {
  height: 6px;
  background: var(--project-color, var(--brand));
}
.topbar.project-themed {
  box-shadow: inset 0 -4px 0 var(--project-color, var(--brand));
}
.project-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--project-color, var(--brand));
  color: var(--project-ink, #fffaf2);
  font-size: .86rem;
  font-weight: 600;
  line-height: 1.25;
}
.project-chip-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.field-hint { display: block; color: var(--muted); font-size: .82rem; margin: 4px 0 0; font-weight: 400; }
.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type="color"] {
  width: 48px; min-width: 48px; height: 40px; padding: 2px;
  border-radius: 10px; border: 1px solid #cfc6b6; background: #fff;
}
.membership-editor { display: grid; gap: 12px; margin-top: 12px; }
.membership-editor .move-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: end;
}
.membership-editor .move-row label { margin: 0; min-width: min(100%, 160px); flex: 1 1 160px; }

.assignment-row, .visit-row {
  display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line);
}
.inline-move { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .95rem; }
.inline-move select { min-height: 40px; font: inherit; max-width: 100%; }
.muted-inline { color: var(--muted); margin-left: 8px; }
.calendar-list { display: grid; gap: 12px; }
.badge.pocactivo, .badge.pocoactivo { background: #f7e3c4; color: #6a3d08; }

.nav-back { display: inline-block; margin-bottom: 8px; font-weight: 600; }
.nav-project-name {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 12px;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--serif);
  font-size: 1.02rem;
  background: var(--project-color, var(--brand));
  color: var(--project-ink, #fffaf2);
}
.guide-body h2, .guide-body h3 { margin-top: 1.1em; }
.guide-body p { margin: 0.6em 0; }
.guide-body ul { margin: 0.4em 0 0.8em 1.2em; }

.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 8px 12px;
  padding: 0 0 0 10px;
  border-left: 2px solid var(--line);
}
.nav-sub a { font-size: .95rem; }
a.hub-card { display: block; text-decoration: none; color: inherit; }
a.hub-card:hover { border-color: var(--brand); }
.filters .checkbox-dropdown {
  min-width: min(100%, 220px);
  flex: 1 1 220px;
  margin: 0;
}
.filters .filter-heading { display: block; font-size: .88rem; margin: 0 0 6px; }
.filters .visitor-panel { z-index: 4; }

.checkbox-dropdown-clear {
  display: flex;
  width: 100%;
  margin: 0 0 8px;
  border-radius: 12px;
}

.volunteer-admin-card h2 { margin-top: 0; }

.admin-wrap { max-width: 920px; width: 100%; }
.crumbs { color: var(--muted); margin: 0 0 10px; font-size: .95rem; }
.crumbs a { color: var(--brand); }
.editor-section { margin: 0 0 20px; scroll-margin-top: 80px; }
.editor-section h2 { margin: 0 0 12px; font-size: 1.2rem; }
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.module-grid .chip { width: 100%; margin: 0; }
.guide-editor {
  display: grid;
  gap: 14px;
}
@media (min-width: 860px) {
  .guide-editor { grid-template-columns: 1fr 1fr; align-items: stretch; }
}
.guide-editor textarea {
  min-height: 380px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.45;
}
.guide-preview {
  min-height: 380px;
  max-height: 70vh;
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.editor-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 8px 0 0;
  padding: 12px 10px 16px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 18px rgba(28, 42, 36, 0.06);
}
.readonly-field {
  display: block;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px dashed #cfc6b6;
  background: var(--bg-2);
  color: var(--muted);
}
main .btn.ghost {
  color: var(--brand);
  border-color: var(--line);
  background: transparent;
}

.admin-wrap.finance-wrap { max-width: 1040px; }
.finance-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 8px;
  box-shadow: 0 0 0 1px rgba(28, 42, 36, 0.12);
}
.finance-table .finance-project-row { cursor: pointer; }
.finance-table .finance-project-row:focus,
.finance-table .finance-project-row:hover,
.finance-table .finance-project-row.is-open { background: var(--bg-2); }
.finance-table .finance-detail td { background: #fffaf2; padding-top: 12px; padding-bottom: 14px; }
.finance-allocs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.finance-allocs li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.finance-allocs li:last-child { border-bottom: 0; }
.finance-alloc-meta { color: var(--muted); font-size: .9rem; margin: 4px 0 0; }
.finance-assign-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 140px auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}
.finance-pending, .finance-donation { margin: 0 0 12px; }
.finance-more { margin-top: 18px; padding: 14px 16px; }
.finance-more > summary {
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.finance-card-toggle {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  min-height: 44px;
}
.finance-totals-card { background: var(--bg-2); }
@media (max-width: 860px) {
  .finance-assign-form { grid-template-columns: 1fr; }
}

.checkbox-dropdown-search { width: 100%; margin: 0 0 8px; }
.role-flags { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.invite-card .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.assignment-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

/* --- Tour de administración: mejoras de presentación --- */
.visitor-options .chip[hidden], .chip[hidden] { display: none !important; }
.badge.example-badge { background: #efe6fb; color: #5b3d91; border: 1px dashed #8a6cc0; text-transform: uppercase; letter-spacing: .03em; }
tr.is-example td { background: #f6f2fb; color: var(--muted); }
.record-card.is-example, .diary-card.is-example, .card.is-example, .contact-card.is-example {
  background: #f6f2fb; border-style: dashed; border-color: #b9a5dc; opacity: .88;
}
.example-banner { border-left: 6px solid #8a6cc0; }
.example-toggle { margin: 6px 0 14px; }
tr.is-low-stock td { background: #fdf0db; }
.record-card.is-low-stock { background: #fdf0db; border-color: #d4a017; }
.entry-panel { margin: 0 0 18px; }
.entry-panel > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin: 0 0 12px; }
.entry-panel > summary::-webkit-details-marker { display: none; }
.entry-panel[open] > summary { background: var(--bg-2, #ece7de); color: inherit; }
.entry-panel[open] > summary .entry-plus { transform: rotate(45deg); }
.entry-plus { display: inline-block; transition: transform .15s; }
.section-index { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 0 0 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: .95rem; }
.section-index a { color: var(--brand); padding: 4px 0; }
.section-index-title { color: var(--muted); font-weight: 650; }
.guide-index ol { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; }
.guide-index-title { font-size: 1.05rem; margin: 0 0 8px; }
.guide-anchor { scroll-margin-top: 80px; }
.guide-revision { color: var(--muted); font-size: .92rem; margin: 0 0 12px; }
[id] { scroll-margin-top: 72px; }
.role-legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.role-legend strong { display: inline-block; min-width: 11em; }
.state-flow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.contact-verify { font-size: .92rem; }
.contact-verify.stale { color: var(--warn); font-weight: 650; }
.add-modes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.add-count { font-weight: 650; margin: 0 0 8px; }
button[disabled], .btn[disabled] { opacity: .55; cursor: not-allowed; }
.editor-index { position: sticky; top: 0; z-index: 3; }
.checkbox-dropdown-clear, .checkbox-dropdown-clear.is-on { color: inherit; }

/* --- Responsive: sin desbordamiento horizontal de página --- */
.layout { grid-template-columns: 240px minmax(0, 1fr); }
.layout > *, main, aside, footer, .admin-wrap, .card, .record-card, .notice, .warnbox, .okbox, label, form { min-width: 0; }
main, footer, .card, .record-card, .notice, .warnbox, .okbox, .lede, h1, h2, h3, p, li, .crumbs, .kicker { overflow-wrap: anywhere; }
.table-wrap { max-width: 100%; }
.table-wrap td, .table-wrap th { overflow-wrap: normal; }
.card .n { font-size: clamp(1.35rem, 6vw, 2rem); }
.grid { grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); }
.who { min-width: 0; }
.project-switcher select { max-width: 46vw; }
.finance-allocs li { flex-wrap: wrap; }
.finance-allocs li > * { min-width: 0; }
.role-legend strong { min-width: 0; margin-right: 6px; }
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .finance-assign-form { grid-template-columns: minmax(0, 1fr); }
  /* Tablas que siguen siendo tabla en móvil: desplazamiento dentro del recuadro y primera columna fija. */
  .table-wrap table:not(.stack-table) th:first-child:not([colspan]), .table-wrap table:not(.stack-table) td:first-child:not([colspan]) { position: sticky; left: 0; z-index: 1; background: var(--paper); box-shadow: 1px 0 0 var(--line); }
  .table-wrap tr.is-example td:first-child { background: #f6f2fb; }
  .table-wrap tr.is-low-stock td:first-child { background: #fdf0db; }
  /* Tablas pequeñas de resumen: se apilan como tarjetas. */
  .table-wrap:has(> .stack-table) { overflow: visible; border: 0; background: transparent; }
  .stack-table thead { display: none; }
  .stack-table, .stack-table tbody, .stack-table tr { display: block; width: 100%; }
  .stack-table tr { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 8px 0; }
  .stack-table tr.stack-strong { font-weight: 700; }
  .stack-table th, .stack-table td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); position: static; box-shadow: none; background: transparent; text-transform: none; letter-spacing: 0; font-size: .95rem; color: inherit; }
  .stack-table tr > :last-child { border-bottom: 0; }
  .stack-table td::before { content: attr(data-label); color: var(--muted); font-weight: 400; }
}

/* --- Carga: esqueleto visible antes de que llegue la sesión y los datos --- */
.boot-main { padding: 28px 28px 64px; max-width: 920px; }
@media (max-width: 860px) { .boot-main { padding: 20px 16px 48px; } }
.skeleton-page { display: grid; gap: 14px; }
.skeleton {
  border-radius: 12px; background: linear-gradient(90deg, #ebe4d6 0%, #f5f0e6 50%, #ebe4d6 100%);
  background-size: 200% 100%; animation: sk-shimmer 1.2s ease-in-out infinite;
}
.sk-title { height: 34px; width: min(60%, 360px); }
.sk-line { height: 14px; width: min(90%, 620px); }
.sk-line.short { width: min(55%, 380px); }
.sk-block { height: 120px; width: 100%; }
@keyframes sk-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* --- Paso de verificación de correo --- */
.verify-step h2 { margin-top: 0; }
.verify-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
#verify-code { font-size: 1.3rem; letter-spacing: .25em; max-width: 14em; }

/* --- Menú siempre alcanzable: barra superior fija, cajón fijo en móvil, lateral fija en escritorio --- */
.topbar { position: sticky; top: 0; z-index: 40; }
.nav-drawer-head { display: none; }
.nav-backdrop[hidden] { display: none; }
.editor-index { top: var(--topbar-h, 62px); }
@media (min-width: 861px) {
  .layout { background: linear-gradient(to right, var(--paper) 0 239px, var(--line) 239px 240px, transparent 240px); }
  #sidenav {
    position: sticky; top: var(--topbar-h, 62px); align-self: start;
    max-height: calc(100vh - var(--topbar-h, 62px)); max-height: calc(100dvh - var(--topbar-h, 62px));
    overflow-y: auto; overscroll-behavior: contain; border-right: 0; background: transparent;
  }
}
@media (max-width: 860px) {
  #sidenav {
    display: block; position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: min(86vw, 340px); height: 100vh; height: 100dvh;
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 0 16px calc(24px + env(safe-area-inset-bottom, 0px));
    border: 0; border-right: 1px solid var(--line); background: var(--paper);
    transform: translateX(-105%); visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
  }
  #sidenav.is-open { transform: none; visibility: visible; transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .28); }
  .nav-drawer-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 1; background: var(--paper);
    margin: 0 -16px 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; border-bottom: 1px solid var(--line);
  }
  .nav-drawer-head strong { font-family: var(--serif); font-size: 1.1rem; }
  .nav-close { background: transparent; color: var(--brand); border: 1px solid var(--line); }
  .nav-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(20, 24, 22, .45); }
  body.nav-open { overflow: hidden; }
  html:has(body.nav-open) { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  #sidenav, #sidenav.is-open { transition: none; }
}
/* Mismo ancho con «Menú» y «Cerrar»: abrir el menú no cambia la altura de la barra ni mueve la página. */
.nav-toggle { min-width: 6em; justify-content: center; }
@media (min-width: 861px) {
  /* El pie va en la columna del contenido para que la lateral fija nunca lo tape. */
  .layout > footer { grid-column: 2; }
  #sidenav { background: var(--paper); }
}

/* ---------- Panel del proyecto (móvil primero) ---------- */
.form-grid[hidden], .panel-card[hidden] { display: none !important; }
.panel-stack { display: grid; gap: 14px; }
.panel-stack .skeleton.sk-block { min-height: 120px; }
.panel-hero { margin: 0; }
.panel-hero .panel-kicker { font-family: var(--sans); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; margin: 0; color: inherit; }
.panel-hero p { margin: 4px 0; }
.hero-status.sin-datos { background: var(--paper); color: var(--ink); }
.panel-flag { display: inline-block; margin-top: 8px !important; padding: 2px 10px; border-radius: 999px; background: rgba(0,0,0,.08); font-weight: 650; }
.panel-cards { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .panel-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.panel-card { margin: 0; padding: 16px 18px; min-width: 0; }
.panel-card h2 { font-size: 1.12rem; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-card h2 small { font-weight: 400; color: var(--muted); font-size: .85rem; }
.panel-card p { margin: 6px 0; }
.panel-card > p:last-child { margin-bottom: 0; }
.panel-card a:not(.btn) { font-weight: 600; }
.panel-card.diary-accent { border-left: 8px solid var(--brand); }
.panel-card.diary-accent.tranquila { border-left-color: var(--ok); }
.panel-card.diary-accent.mereceatencion { border-left-color: #d4a017; }
.panel-card.diary-accent.urgente { border-left-color: var(--danger); }
.panel-count { display: inline-flex; min-width: 1.9em; justify-content: center; padding: 1px 8px; border-radius: 999px; background: #e4e8d4; color: var(--brand); font-weight: 700; font-size: .95rem; }
.panel-count.warn { background: #f7e3c4; color: var(--warn); }
.panel-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-quote { background: rgba(0,0,0,.03); border-radius: 10px; padding: 8px 10px; }
.panel-list { margin: 6px 0; padding-left: 1.1em; }
.panel-list li { margin: 4px 0; }
.panel-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 8px; margin: 8px 0; }
.panel-figures div { background: rgba(0,0,0,.03); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.panel-figures dt { font-size: .82rem; color: var(--muted); }
.panel-figures dd { margin: 2px 0 0; font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.panel-actions .btn { margin: 0; flex: 1 1 auto; text-align: center; }

/* ---------- Diario: lista y página de nueva visita ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.page-head h1 { margin-bottom: 0; }
.btn-primary-cta { font-size: 1.05rem; padding: 12px 18px; }
@media (max-width: 520px) { .page-head .btn-primary-cta { width: 100%; text-align: center; } }
.filters-panel { margin: 0 0 14px; }
.filters-panel > summary { cursor: pointer; font-weight: 650; padding: 8px 0; }
.diary-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 6px; }
.diary-date { font-weight: 650; }
.diary-summary { margin: 6px 0; }
.diary-follow { margin: 6px 0; }
.diary-more > summary { cursor: pointer; color: var(--brand); font-weight: 600; margin: 6px 0; }
.diary-card.is-just-saved { outline: 3px solid var(--accent); outline-offset: 2px; }
.empty-cta { text-align: center; padding: 12px 0; }
.back-link { margin: 0 0 6px; }
.indicator-picker { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.indicator-picker legend { font-weight: 650; margin-bottom: 6px; padding: 0; }
.indicator-option { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); cursor: pointer; font-weight: 600; }
.indicator-option input { margin: 0; }
.indicator-option.tranquila:has(input:checked) { background: #d8f0e2; border-color: var(--ok); }
.indicator-option.mereceatencion:has(input:checked) { background: #f7e3c4; border-color: #d4a017; }
.indicator-option.urgente:has(input:checked) { background: #f8d7d4; border-color: var(--danger); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.form-actions > * { margin: 0; }
.indicator-picker .indicator-option { display: inline-flex; width: auto; margin: 0; font-size: 1rem; }
.indicator-picker .indicator-option input { width: auto; min-width: 0; padding: 0; flex: none; }
.indicator-picker .indicator-option span { white-space: nowrap; }

/* ---------- Rol en el proyecto ---------- */
.badge.rol-voluntario { background: #e4e8d4; color: var(--brand); }
.badge.rol-admin { background: #1d5a4b; color: #fff; }
.role-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.role-hint { margin: 6px 0 0; }
.role-change { margin: 0; }

/* ---------- Gastos del proyecto ---------- */
.span-all { grid-column: 1 / -1; }
.saldo-card { border-left: 6px solid #1d5a4b; }
.saldo-card.saldo-neg { border-left-color: var(--danger); }
.saldo-card.saldo-zero { border-left-color: var(--warn, #9a5b00); }
.saldo-card h2 { margin: 0 0 4px; font-size: 1.05rem; }
.saldo-n { font-size: 1.9rem; font-weight: 700; margin: 0; color: #1d5a4b; overflow-wrap: anywhere; }
.saldo-neg .saldo-n { color: var(--danger); }
.gastos-total { margin: 12px 0 4px; }
.gasto-month { margin-top: 14px; }
.gasto-month-h { font-size: 1rem; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin: 0 0 6px; }
.gasto-month-h small { color: var(--muted); font-weight: 600; }
.gasto-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gasto-item { background: #fff; border: 1px solid rgba(0,0,0,.08); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.gasto-item.is-new { outline: 3px solid var(--accent); outline-offset: 2px; }
.gasto-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.gasto-desc { min-width: 0; overflow-wrap: anywhere; }
.gasto-amount { font-weight: 700; white-space: nowrap; }
.gasto-item .diary-meta, .gasto-tags, .gasto-notes { margin: 4px 0 0; }
.gasto-item .actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.gasto-item .btn.ghost, .buy-dialog .btn.ghost { color: var(--ink, #1f2a26); border-color: rgba(0,0,0,.2); }
.btn.ghost.danger { color: var(--danger); border-color: rgba(155,44,44,.4); }
.buy-dialog { border: 0; border-radius: 14px; padding: 0; width: min(420px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.buy-dialog::backdrop { background: rgba(0,0,0,.45); }
.buy-dialog form { padding: 16px; display: grid; gap: 10px; }
.buy-dialog h2 { margin: 0; font-size: 1.1rem; }
.buy-dialog label { display: grid; gap: 4px; }
.buy-dialog .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ---------- Listas tipo elenco (módulos del proyecto) ---------- */
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
.filter-chip {
  min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-size: .95rem; cursor: pointer; width: auto;
}
.filter-chip.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.filter-count { display: inline-block; min-width: 1.4em; padding: 0 6px; margin-left: 2px; border-radius: 999px; background: rgba(0,0,0,.08); font-size: .8rem; font-weight: 700; }
.filter-chip.is-on .filter-count { background: rgba(255,255,255,.25); }
.list-summary { margin: 0 0 10px; color: var(--muted); font-size: .92rem; }
.elenco { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.elenco-row + .elenco-row { border-top: 1px solid var(--line); }
.elenco-link { display: flex; align-items: center; gap: 10px; padding: 11px 12px; min-height: 56px; color: inherit; text-decoration: none; }
.elenco-link:hover, .elenco-link:focus-visible { background: rgba(29,90,75,.06); }
.elenco-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.elenco-title { font-weight: 650; overflow-wrap: anywhere; }
.elenco-meta { color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.elenco-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.elenco-right { flex: 0 0 auto; font-weight: 700; white-space: nowrap; text-align: right; }
.elenco-chevron { flex: 0 0 auto; color: var(--muted); font-size: 1.4rem; line-height: 1; }
.elenco-row.is-example { background: repeating-linear-gradient(135deg, #fff, #fff 10px, #fbf7ee 10px, #fbf7ee 20px); }
.elenco-row.is-low-stock .elenco-right { color: var(--danger); }
.elenco-row.is-just-saved { outline: 3px solid var(--accent); outline-offset: -3px; }
.elenco-group { margin: 14px 0 6px; font-size: .95rem; display: flex; justify-content: space-between; gap: 8px; }
.elenco-group small { color: var(--muted); }
.back-link { margin: 0 0 6px; }
.back-link a { text-decoration: none; font-weight: 600; }
.detail-card h1 { margin-top: 0; overflow-wrap: anywhere; }
.detail-list { display: grid; gap: 0; margin: 10px 0; }
.detail-list div { display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.detail-list dt { color: var(--muted); font-size: .9rem; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.detail-actions .btn, .detail-actions button { margin: 0; }
.btn.danger-outline { background: transparent; color: var(--danger); border: 1px solid rgba(155,44,44,.45); }
.more-panel { margin-top: 16px; }
.more-panel > summary { cursor: pointer; font-weight: 650; padding: 10px 0; }
.form-page-actions { display: flex; flex-wrap: wrap; gap: 8px; grid-column: 1 / -1; }

/* Idioma ES / EN */
html[data-i18n-pending] body { visibility: hidden; }
.lang-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; border: 1px solid currentColor; flex: none; }
.lang-switch .lang-btn { min-width: 34px; min-height: 30px; padding: 2px 8px; border: 0; border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: .82rem; font-weight: 700; line-height: 1; cursor: pointer; box-shadow: none; }
.topbar .lang-switch .lang-btn.is-on { background: #fff; color: var(--project-color, #1d5a4b); }
.lang-in-drawer { margin: 0 0 12px; color: #1d5a4b; }
.lang-in-drawer .lang-btn.is-on, .lang-floating .lang-btn.is-on { background: #1d5a4b; color: #fff; }
.lang-floating { position: absolute; top: 12px; right: 12px; z-index: 5; background: #fff; color: #1d5a4b; }

/* Proyectos abiertos y ficha del proyecto */
.open-projects { margin-top: 26px; }
.open-project-card h3 { margin: 0 0 6px; overflow-wrap: anywhere; }
.open-project-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .92rem; }
.open-project-meta span { overflow-wrap: anywhere; }
.ficha-card .detail-actions { align-items: center; }

/* Portada = acceso */
.gate-request { margin-top: 18px; }
.gate-request a { font-weight: 600; color: var(--brand); }

/* Bitácora del proyecto */
.bitacora-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin: 8px 0 12px; }
.bitacora-filters label { display: flex; flex-direction: column; gap: 2px; font-weight: 600; font-size: .95rem; flex: 1 1 130px; min-width: 0; }
.bitacora-filters select, .bitacora-filters input { width: 100%; min-width: 0; }
.bitacora-filters .btn { flex: 0 0 auto; }
.badge.tipo-actividad { background: #dde9f7; color: #1d4a7a; }
.badge.tipo-novedad { background: #e6e0f5; color: #4b2f86; }
.badge.tipo-problema { background: #f8d7d4; color: #8a1f17; }
.badge.tipo-nota { background: #ece9e2; color: #4a4639; }
.bitacora-author { font-size: .9rem; color: var(--muted, #5b5b5b); }
.bitacora-body { margin: 8px 0 12px; }
.bitacora-text { margin: 0 0 10px; white-space: normal; overflow-wrap: anywhere; }
.bitacora-privacy { margin-bottom: 12px; }
.tipo-option:has(input:checked) { background: #dde9f7; border-color: #1d4a7a; }
.indicator-option.sin-estado:has(input:checked) { background: #ece9e2; border-color: #8a8678; }
.bitacora-row .elenco-meta { overflow-wrap: anywhere; }
