@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Caveat:wght@600;700&family=Inter:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; }
:root {
  --navy: #16233F; --navy-2: #1D3159; --navy-3: #24406f;
  --burgundy: #A5283A; --burgundy-2: #862033;
  --cream: #FBF2E7; --cream-2: #F4E4D0; --paper: #FFFDFB;
  --ink: #221C14; --muted: #8A7C68; --line: #E7D7BF;
  --success: #2E7D5B; --success-bg: #E4F2EA;
  --warn: #B9761F; --warn-bg: #FBEDD8; --danger-bg: #FBE4E2;
}
html, body { margin:0; padding:0; }
body { font-family:'Inter', sans-serif; color:var(--ink); background:var(--cream); }
.disp { font-family:'Baloo 2', sans-serif; }
.script { font-family:'Caveat', cursive; }

#app { min-height:100vh; display:flex; }

/* Sidebar */
.sidebar { width:220px; min-width:220px; background:var(--navy); color:#EFE7DA; padding:22px 16px; display:flex; flex-direction:column; gap:22px; position:sticky; top:0; height:100vh; }
.brand { display:flex; align-items:center; gap:10px; padding:0 4px; }
.brand-mark { width:34px; height:34px; border-radius:9px; background:linear-gradient(150deg,var(--burgundy),var(--burgundy-2)); display:flex; align-items:center; justify-content:center; font-family:'Baloo 2'; font-weight:800; color:#fff; font-size:15px; flex-shrink:0; }
.brand-text { line-height:1.15; }
.brand-text b { font-family:'Baloo 2'; font-size:15px; display:block; }
.brand-text span { font-size:10.5px; color:#B9AF9E; letter-spacing:.03em; }
.nav-label { font-size:10.5px; letter-spacing:.12em; color:#8B93AA; text-transform:uppercase; padding:0 4px; margin-top:4px; }
.nav-list { display:flex; flex-direction:column; gap:5px; }
.nav-item { display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:10px; font-size:13px; font-weight:600; color:#CBD2E3; border:1px solid transparent; }
.nav-item .dot { width:7px; height:7px; border-radius:50%; background:#5A6480; flex-shrink:0; }
.nav-item.active { background:var(--navy-2); color:#fff; border-color:rgba(255,255,255,.08); }
.nav-item.active .dot { background:var(--burgundy); box-shadow:0 0 0 3px rgba(165,40,58,.35); }
.nav-item.disabled { color:#828AA0; opacity:.6; cursor:not-allowed; }
.nav-item .tag { margin-left:auto; font-size:9px; background:rgba(255,255,255,.08); padding:2px 6px; border-radius:20px; }
.sidebar-foot { margin-top:auto; font-size:11px; color:#7E87A0; line-height:1.6; padding:10px 4px 0; border-top:1px solid rgba(255,255,255,.08); }
.sidebar-foot b { color:#C7CEE0; }

/* Main / topbar */
.main { flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar { padding:16px 26px; border-bottom:1px solid var(--line); background:var(--paper); position:sticky; top:0; z-index:5; }
.breadcrumb { font-size:11px; color:var(--muted); font-weight:600; margin-bottom:8px; }
.topbar-row { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
h1.page-title { font-family:'Baloo 2'; font-size:23px; color:var(--navy); margin:0; font-weight:800; }
.mode-tabs { display:flex; gap:4px; background:var(--cream-2); padding:4px; border-radius:11px; }
.mode-tab { padding:8px 14px; border-radius:8px; font-size:12px; font-weight:700; cursor:pointer; color:var(--muted); }
.mode-tab.active { background:var(--paper); color:var(--navy); box-shadow:0 1px 3px rgba(0,0,0,.1); }
.content { padding:22px 26px 40px; display:flex; flex-direction:column; gap:20px; max-width:1100px; }

.btn { font-family:'Inter'; font-weight:600; font-size:12.5px; border-radius:9px; border:none; padding:10px 15px; cursor:pointer; display:inline-flex; align-items:center; gap:7px; }
.btn:active { transform:scale(.97); }
.btn-primary { background:var(--burgundy); color:#fff; box-shadow:0 3px 0 var(--burgundy-2); }
.btn-ghost { background:var(--cream-2); color:var(--navy); border:1px solid var(--line); }
.btn-block { width:100%; justify-content:center; }
.btn[disabled] { opacity:.6; cursor:wait; }

.stats { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; }
.stat-card { background:var(--paper); border:1px solid var(--line); border-radius:13px; padding:15px 16px; }
.stat-card .label { font-size:10.5px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); font-weight:700; }
.stat-card .value { font-family:'Baloo 2'; font-size:23px; color:var(--navy); margin-top:4px; font-weight:700; }
.stat-card .sub { font-size:11px; color:var(--muted); margin-top:2px; }
.bar-track { height:5px; background:var(--cream-2); border-radius:6px; margin-top:9px; overflow:hidden; }
.bar-fill { height:100%; background:linear-gradient(90deg,var(--burgundy),var(--navy-3)); border-radius:6px; }

.panel { background:var(--paper); border:1px solid var(--line); border-radius:13px; padding:16px 18px; }
.panel h3 { font-family:'Baloo 2'; font-size:14.5px; color:var(--navy); margin:0 0 10px; }
.pay-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px 18px; font-size:12.5px; }
.pay-grid div b { display:block; color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.05em; font-weight:700; margin-bottom:2px; }
.pay-note { margin-top:11px; background:var(--cream-2); border:1px dashed var(--burgundy); border-radius:9px; padding:9px 11px; font-size:12px; color:var(--navy); line-height:1.45; }
.pay-note b { color:var(--burgundy); }

.toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.search { flex:1; max-width:260px; position:relative; }
.search input { width:100%; padding:9px 12px 9px 30px; border-radius:9px; border:1px solid var(--line); background:var(--paper); font-size:12.5px; }
.search::before { content:"⌕"; position:absolute; left:11px; top:50%; transform:translateY(-50%); color:var(--muted); }
.filters { display:flex; gap:6px; flex-wrap:wrap; }
.chip-filter { font-size:11px; font-weight:600; padding:7px 11px; border-radius:20px; cursor:pointer; border:1px solid var(--line); background:var(--paper); color:var(--muted); }
.chip-filter.active { background:var(--navy); color:#fff; border-color:var(--navy); }

.table-wrap { overflow-x:auto; border-radius:13px; border:1px solid var(--line); }
table.parejas { width:100%; border-collapse:separate; border-spacing:0; background:var(--paper); min-width:700px; }
table.parejas thead th { text-align:left; font-size:10px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); padding:11px 12px; background:var(--cream-2); font-weight:700; border-bottom:1px solid var(--line); white-space:nowrap; }
table.parejas tbody td { padding:10px 12px; border-bottom:1px solid var(--line); font-size:12.5px; vertical-align:middle; }
table.parejas tbody tr:last-child td { border-bottom:none; }
table.parejas tbody tr:hover { background:#FFF9F1; }
.person-name { font-weight:700; color:var(--navy); }
.person-sub { font-size:10.5px; color:var(--muted); }
.td-thumb { width:38px; height:38px; border-radius:8px; object-fit:cover; display:block; }
.td-thumb-ph { width:38px; height:38px; border-radius:8px; background:var(--cream-2); display:flex; align-items:center; justify-content:center; color:var(--burgundy); font-size:15px; }

.status-pill { font-size:10px; font-weight:700; padding:4px 9px; border-radius:20px; display:inline-block; white-space:nowrap; }
.status-completo { background:var(--success-bg); color:var(--success); }
.status-vence { background:var(--warn-bg); color:var(--warn); }
.status-atrasada { background:var(--danger-bg); color:var(--burgundy); }
.status-pendiente { background:#EEF0F4; color:#5A6480; }

.cuotas-row { display:flex; gap:5px; flex-wrap:wrap; }
.cuota-chip { width:44px; border-radius:6px; overflow:hidden; border:1px solid var(--line); cursor:pointer; background:#fff; position:relative; }
.cuota-chip .top { background:var(--burgundy); color:#fff; font-size:7.5px; font-weight:700; text-align:center; padding:2px 0; }
.cuota-chip.paid .top { background:var(--success); }
.cuota-chip .mid { text-align:center; font-size:7.5px; font-weight:700; color:var(--navy); padding:2px 0 0; text-transform:uppercase; }
.cuota-chip .amt { text-align:center; font-size:8px; color:var(--muted); padding-bottom:3px; font-weight:600; }
.cuota-chip.paid .amt { color:var(--success); }
.cuota-chip .check { position:absolute; top:1px; right:2px; font-size:8px; color:#fff; display:none; }
.cuota-chip.paid .check { display:block; }
.row-actions { display:flex; gap:5px; }
.icon-btn { width:27px; height:27px; border-radius:7px; border:1px solid var(--line); background:var(--paper); cursor:pointer; font-size:11px; display:flex; align-items:center; justify-content:center; color:var(--muted); }
.icon-btn:hover { background:var(--cream-2); color:var(--navy); }
.empty { text-align:center; padding:44px 20px; color:var(--muted); }
.empty .disp { font-size:16px; color:var(--navy); margin-bottom:4px; }

.admin-gate { max-width:340px; margin:30px auto; text-align:center; background:var(--paper); border:1px solid var(--line); border-radius:14px; padding:28px; }
.admin-gate .icon { font-size:26px; margin-bottom:8px; }
.admin-gate h3 { font-family:'Baloo 2'; color:var(--navy); margin:0 0 4px; }
.admin-gate p { font-size:12px; color:var(--muted); margin:0 0 16px; }
.admin-gate input { width:100%; padding:10px 12px; border-radius:9px; border:1px solid var(--line); margin-bottom:10px; }
.gate-error { color:var(--burgundy); font-size:11.5px; margin-bottom:8px; display:none; }

.hero { background:linear-gradient(160deg,var(--navy),var(--navy-2)); border-radius:16px; padding:30px 28px; color:#fff; position:relative; overflow:hidden; }
.hero::after { content:"♡"; position:absolute; right:18px; top:10px; font-size:90px; color:rgba(255,255,255,.05); }
.hero-title { font-family:'Baloo 2'; font-size:28px; font-weight:800; margin:0; }
.hero-script { font-family:'Caveat'; font-size:24px; color:#E8AEB6; font-weight:700; margin-top:-2px; }
.hero-desc { font-size:12.5px; color:#C7CEE0; max-width:440px; margin-top:10px; line-height:1.55; }
.hero-total { display:inline-flex; align-items:center; gap:8px; background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.18); padding:9px 16px; border-radius:30px; font-size:13px; font-weight:700; margin-top:16px; }
.hero-actions { margin-top:18px; display:flex; gap:10px; flex-wrap:wrap; }
.plan-mini-row { display:flex; gap:10px; margin-top:20px; flex-wrap:wrap; }
.plan-mini { background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.16); border-radius:11px; padding:10px 14px; min-width:120px; }
.plan-mini b { display:block; font-family:'Baloo 2'; font-size:15px; }
.plan-mini span { font-size:10.5px; color:#C7CEE0; }

.section-head { display:flex; align-items:baseline; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.section-head h2 { font-family:'Baloo 2'; font-size:17px; color:var(--navy); margin:0; }
.section-head .count { font-family:'Caveat'; font-size:17px; color:var(--burgundy); }

.gallery-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:13px; }
.gallery-card { background:var(--paper); border:1px solid var(--line); border-radius:13px; overflow:hidden; }
.gallery-photo { width:100%; aspect-ratio:1/1; object-fit:cover; display:block; background:var(--cream-2); }
.gallery-placeholder { width:100%; aspect-ratio:1/1; display:flex; align-items:center; justify-content:center; background:linear-gradient(160deg,var(--cream-2),#EAD4B3); font-size:26px; color:var(--burgundy); }
.gallery-name { padding:9px 8px 11px; font-weight:700; font-size:11.5px; color:var(--navy); line-height:1.35; text-align:center; }

.overlay { position:fixed; inset:0; background:rgba(22,35,63,.55); display:flex; align-items:center; justify-content:center; z-index:50; padding:20px; }
.modal { background:var(--paper); border-radius:16px; width:100%; max-width:460px; padding:24px; max-height:88vh; overflow-y:auto; position:relative; }
.modal h3 { font-family:'Baloo 2'; color:var(--navy); font-size:18px; margin:0 0 4px; }
.modal .modal-sub { font-size:12px; color:var(--muted); margin-bottom:14px; }
.field { margin-bottom:11px; }
.field label { font-size:10.5px; font-weight:700; color:var(--navy); text-transform:uppercase; letter-spacing:.04em; display:block; margin-bottom:4px; }
.field input, .field select { width:100%; padding:8px 10px; border-radius:8px; border:1px solid var(--line); font-size:13px; font-family:'Inter'; background:#fff; }
.person-cols { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:6px; }
.person-col { background:var(--cream); border:1px solid var(--line); border-radius:11px; padding:11px; }
.person-col h4 { font-family:'Baloo 2'; font-size:11.5px; margin:0 0 8px; color:var(--burgundy); text-transform:uppercase; letter-spacing:.04em; }
.plan-options { display:flex; gap:8px; }
.plan-opt { flex:1; border:1.5px solid var(--line); border-radius:9px; padding:9px 6px; text-align:center; cursor:pointer; background:#fff; }
.plan-opt b { display:block; font-family:'Baloo 2'; color:var(--navy); font-size:15px; }
.plan-opt span { font-size:10px; color:var(--muted); }
.plan-opt.sel { border-color:var(--burgundy); background:var(--danger-bg); }
.photo-row { display:flex; align-items:center; gap:12px; }
.photo-preview, .photo-placeholder-sm { width:60px; height:60px; border-radius:10px; object-fit:cover; background:var(--cream-2); border:1px dashed var(--line); display:flex; align-items:center; justify-content:center; color:var(--muted); font-size:20px; flex-shrink:0; }
.modal-actions { display:flex; gap:8px; margin-top:16px; }
.modal-actions .btn { flex:1; justify-content:center; }
.modal-close { position:absolute; top:16px; right:16px; }
.save-note { font-size:10px; color:var(--muted); text-align:center; padding-top:6px; }
.form-error { color:var(--burgundy); font-size:11.5px; margin-top:6px; display:none; }

@media (max-width:760px) {
  #app { flex-direction:column; }
  .sidebar { width:100%; height:auto; position:static; flex-direction:row; align-items:center; overflow-x:auto; }
  .nav-list { flex-direction:row; }
  .sidebar-foot, .nav-label { display:none; }
  .stats, .person-cols { grid-template-columns:1fr; }
}
