/* Comunidapp · Panel administrativo
   Paleta aprobada: principal #213F9A · acento #E75B5A · secundario #42448C · bordes #D6DBE0 */
:root {
  --primary: #213F9A;
  --primary-hover: #1A3380;
  --accent: #E75B5A;
  --accent-ink: #B33A39;
  --accent-tint: #FDECEC;
  --secondary: #42448C;
  --bg: #F3F6FA;
  --surface: #FFFFFF;
  --well: #EEF2F7;
  --border: #D6DBE0;
  --ink: #0F1733;
  --ink-2: #33405C;
  --muted: #5B6478;
  --on-dark-muted: #C9D2F0;
  --ok: #1F7A50;
  --ok-tint: #E3F4EC;
  --warn: #7A4B00;
  --warn-tint: #FFF1D1;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 'Geist', system-ui, sans-serif; font-variant-numeric: tabular-nums; }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Estructura */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.sidebar { flex: 1 1 260px; max-width: 100%; background: var(--primary); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; }
.main { flex: 999 1 560px; min-width: 0; padding: 24px 36px 48px; display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 720px) { .main { padding: 20px 16px 40px; } }

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; color: #fff; text-decoration: none; }
.brand img { width: 36px; height: 34px; object-fit: contain; }
.brand span { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.brand b { color: #FFB3B2; font-weight: 700; }
.church { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--secondary); }
.church .tile { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--ink); font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.church small { display: block; color: var(--on-dark-muted); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--on-dark-muted); padding: 0 12px 8px; }
.nav a, .nav span.soon { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--on-dark-muted); text-decoration: none; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav span.soon { opacity: .6; cursor: default; }
.nav .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: var(--ink); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; }
.req { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding: 16px 20px; border-top: 1px solid var(--well); }
.req:first-child { border-top: none; }
.req form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tile a.stretch { color: inherit; text-decoration: none; }
.tile a.stretch:hover { color: var(--primary); }
.radio-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .radio-cards { grid-template-columns: minmax(0, 1fr); } }
.radio-cards label { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; cursor: pointer; font-weight: 500; color: var(--ink); }
.radio-cards input { margin-top: 3px; accent-color: var(--primary); }
.radio-cards small { display: block; color: var(--muted); font-weight: 400; }
.nav .tag { margin-left: auto; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, .16); color: #fff; }

.me { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--secondary); }
.me .avatar { background: #fff; color: var(--ink); }
.me small { display: block; color: var(--on-dark-muted); font-size: 12px; }
.me form { margin-left: auto; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: none; background: transparent; color: var(--on-dark-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.topbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.crumb { font-size: 13px; color: var(--muted); }
.topbar h1 { font-size: 30px; font-weight: 700; letter-spacing: -.03em; }

/* Superficies */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.hero { background: var(--primary); color: #fff; border-radius: 24px; padding: 26px 28px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.hero .muted { color: var(--on-dark-muted); }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g4, .g3, .g2 { grid-template-columns: minmax(0, 1fr); } .span2 { grid-column: auto; } }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.grow { flex: 999 1 520px; min-width: 0; }
.side { flex: 1 1 300px; min-width: 0; }

.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.hero .kpi-value { font-size: 56px; letter-spacing: -.04em; line-height: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Controles */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent; font: 600 14px 'Geist', system-ui, sans-serif; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { background: var(--well); color: var(--ink); }
.btn-danger { background: #fff; border-color: #F5C6C5; color: var(--accent-ink); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }

.seg { display: inline-flex; gap: 4px; background: var(--well); padding: 4px; border-radius: 14px; flex-wrap: wrap; }
.seg a { min-height: 38px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 13px; }
.seg a.on { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, select.input { height: 48px; border: 1px solid var(--border); border-radius: 14px; padding: 0 14px; font: 500 15px 'Geist', system-ui, sans-serif; background: #fff; color: var(--ink); width: 100%; }
.input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.search input { border: none; outline: none; font: 14px 'Geist', system-ui, sans-serif; min-width: 180px; background: transparent; }

/* Datos */
.avatar { width: 36px; height: 36px; border-radius: 999px; background: var(--well); color: var(--ink); font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--well); color: var(--ink-2); white-space: nowrap; }
.chip.role { background: var(--accent-tint); color: var(--accent-ink); font-weight: 700; }
.chip.ok { background: var(--ok-tint); color: var(--ok); }
.chip.warn { background: var(--warn-tint); color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 999px; background: currentColor; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); background: #F7F9FC; padding: 12px; }
.table td { padding: 12px; border-top: 1px solid var(--well); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.person { display: flex; align-items: center; gap: 12px; }
.person a { font-weight: 600; color: var(--ink); text-decoration: none; }
.person a:hover { color: var(--primary); }

.alert { padding: 12px 16px; border-radius: 14px; font-weight: 600; }
.alert.ok { background: var(--ok-tint); color: var(--ok); }
.alert.err { background: var(--accent-tint); color: var(--accent-ink); }
.empty { padding: 24px; text-align: center; color: var(--muted); }
.stepper { list-style: none; margin: 0; padding: 0; }
.stepper li { display: flex; gap: 14px; }
.stepper .rail { display: flex; flex-direction: column; align-items: center; }
.stepper .num { width: 28px; height: 28px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.stepper li:first-child .num { background: var(--accent); color: var(--ink); }
.stepper .line { width: 2px; flex: 1; min-height: 14px; background: var(--well); }
.stepper li:last-child .line { display: none; }
.stepper .body { padding: 4px 0 16px; }
.tile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tile-grid { grid-template-columns: minmax(0, 1fr); } }
.tile { border: 1px solid var(--border); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #FCFDFE; }
.mono-tile { width: 36px; height: 36px; border-radius: 11px; background: var(--primary); color: #fff; font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.timeline { display: flex; flex-direction: column; }
.timeline .item { display: flex; gap: 12px; }
.timeline .rail { display: flex; flex-direction: column; align-items: center; width: 10px; }
.timeline .rail i { width: 10px; height: 10px; border-radius: 999px; background: var(--primary); margin-top: 4px; }
.timeline .rail b { width: 2px; flex: 1; min-height: 22px; background: var(--well); }
.timeline .item > div:last-child { padding-bottom: 12px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 120px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar span.fill { width: 100%; border-radius: 8px 8px 4px 4px; background: rgba(255, 255, 255, .22); min-height: 4px; }
.bars .bar:last-child span.fill { background: var(--accent); }
.bars small { color: var(--on-dark-muted); font-size: 11px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-top: 1px solid var(--well); }

/* Autenticación */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--primary); }
.auth .panel { width: 100%; max-width: 420px; background: #fff; border-radius: 28px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.auth .panel img { width: 56px; height: 52px; object-fit: contain; }
.auth h1 { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.error { color: var(--accent-ink); font-size: 13px; font-weight: 600; }
