:root {
  --ink: #0e1a2b;
  --ink-2: #16263d;
  --ink-3: #213650;
  --gold: #c8a45c;
  --gold-d: #a98536;
  --cream: #f6f3ed;
  --line: #e6e1d6;
  --text: #1f2a37;
  --muted: #6b7686;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(14,26,43,.05), 0 8px 24px rgba(14,26,43,.06);
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-color: var(--text);
  --bs-primary: var(--ink);
  --bs-primary-rgb: 14,26,43;
}
body { background: var(--cream); font-size: .95rem; }
h1, h2, h3, h4, .serif { font-family: 'Playfair Display', Georgia, serif; letter-spacing: .1px; }
.min-w-0 { min-width: 0; }

/* Botones */
.btn-gold { background: var(--gold); border-color: var(--gold); color: #1b1405; font-weight: 600; }
.btn-gold:hover, .btn-gold:focus { background: var(--gold-d); border-color: var(--gold-d); color: #fff; }
.btn-ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--ink-3); border-color: var(--ink-3); color: #fff; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(200,164,92,.25); }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
.form-label { font-weight: 500; font-size: .85rem; color: #3b4757; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 264px; flex: 0 0 264px; background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #cdd6e3; display: flex; flex-direction: column; padding: 1.4rem 1rem; position: sticky; top: 0; height: 100vh; z-index: 1040;
}
.brand { display: block; padding: .3rem .5rem 1.4rem; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 1rem; }
.brand img { width: 100%; max-height: 48px; object-fit: contain; object-position: left center; }
.sidebar .nav { flex: 1; overflow-y: auto; gap: .15rem; }
.sidebar .nav-link {
  color: #b9c4d4; border-radius: 10px; padding: .6rem .8rem; display: flex; align-items: center; gap: .7rem; font-weight: 500;
}
.sidebar .nav-link i { font-size: 1.1rem; width: 1.3rem; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: rgba(200,164,92,.16); color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
.nav-sep { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #7f8ca0; padding: 1rem .8rem .3rem; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: 1rem; }
.user-chip { display: flex; align-items: center; gap: .7rem; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--gold); color: #1b1405; display: grid; place-items: center; font-weight: 700; flex: 0 0 40px; }
.u-name { color: #fff; font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-role { font-size: .75rem; color: #93a1b6; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.6rem 0; }
.topbar-title { font-family: 'Playfair Display', serif; font-size: 1.7rem; font-weight: 700; color: var(--ink); }
.content { padding: 1rem 1.6rem 2.5rem; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: none; }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(8,14,24,.5); z-index: 1030; }
  .topbar, .content { padding-left: 1rem; padding-right: 1rem; }
}

/* Tarjetas */
.card-x { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.page-sub { color: var(--muted); margin: -.2rem 0 1.2rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1.1rem; }
.toolbar .grow { flex: 1 1 240px; }
.search-box { position: relative; }
.search-box i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 2.3rem; }

/* Estadísticas */
.stat { padding: 1.2rem 1.3rem; display: flex; gap: 1rem; align-items: center; }
.stat-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; background: rgba(200,164,92,.16); color: var(--gold-d); }
.stat-num { font-family: 'Playfair Display', serif; font-size: 2rem; line-height: 1; font-weight: 700; color: var(--ink); }
.stat-lbl { color: var(--muted); font-size: .82rem; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 42%) 1fr 34px; gap: .7rem; align-items: center; padding: .35rem 0; font-size: .88rem; }
.bar-track { background: #efe9dc; border-radius: 99px; height: 9px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--gold-d)); }

/* Ministerios */
.min-card { padding: 1.2rem; display: flex; flex-direction: column; gap: .8rem; height: 100%; transition: transform .15s ease, box-shadow .15s ease; }
.min-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(14,26,43,.06), 0 14px 32px rgba(14,26,43,.1); }
.min-head { display: flex; gap: .9rem; align-items: center; }
.min-logo { width: 56px; height: 56px; border-radius: 14px; object-fit: contain; background: #faf8f3; border: 1px solid var(--line); flex: 0 0 56px; }
.min-logo.ph { display: grid; place-items: center; background: linear-gradient(135deg, var(--ink), var(--ink-3)); color: var(--gold); font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1.2rem; border: 0; }
.min-name { font-weight: 600; line-height: 1.25; color: var(--ink); }
.min-meta { color: var(--muted); font-size: .82rem; }
.badge-soft { background: rgba(14,26,43,.07); color: var(--ink); font-weight: 500; border-radius: 99px; padding: .35em .75em; }
.badge-gold { background: rgba(200,164,92,.2); color: #7a5d1c; font-weight: 600; border-radius: 99px; padding: .35em .75em; }
.badge-lider { background: var(--ink); color: var(--gold); font-weight: 600; border-radius: 99px; padding: .35em .75em; }
.min-actions { margin-top: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: .3rem .85rem; font-size: .83rem; cursor: pointer; color: var(--text); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Tablas */
.table-x { margin: 0; }
.table-x thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); background: #fcfbf8; white-space: nowrap; }
.table-x td { vertical-align: middle; border-color: #f0ece3; }
.table-x tbody tr:hover { background: #fcfaf5; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: 9px; }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.empty i { font-size: 2.4rem; color: #c9c1ad; display: block; margin-bottom: .5rem; }

/* Detalle de ministerio */
.hero-min { padding: 1.4rem; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.2rem; background: linear-gradient(120deg, #fff 60%, #fbf6ea); }
.hero-min .min-logo { width: 84px; height: 84px; flex-basis: 84px; }

/* Modal */
.modal-content { border: 0; border-radius: 18px; overflow: hidden; }
.modal-header { background: var(--ink); color: #fff; border: 0; }
.modal-header .modal-title { font-family: 'Playfair Display', serif; }
.modal-header .btn-close { filter: invert(1) grayscale(1); }
.check-list { max-height: 210px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: .4rem .8rem; background: #fcfbf8; }
.perm-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: .7rem 0 .2rem; font-weight: 600; }
.logo-prev { width: 84px; height: 84px; border-radius: 14px; border: 1px dashed #cfc6af; object-fit: contain; background: #faf8f3; }
.dup-box { border-left: 4px solid var(--gold); background: #fbf6ea; border-radius: 8px; padding: .6rem .8rem; font-size: .85rem; }

/* Login */
.login-body { background: radial-gradient(1200px 600px at 10% -10%, #24406a 0%, transparent 60%), linear-gradient(160deg, var(--ink), #09111d); min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 2rem; max-width: 1080px; margin: 0 auto; padding: 2rem 1.2rem; }
.login-hero { color: #fff; }
.login-logo { width: min(380px, 80%); margin-bottom: 2rem; }
.login-hero h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; }
.login-hero h1 em { color: var(--gold); font-style: italic; }
.login-hero p { color: #aab6c8; font-size: 1.05rem; max-width: 30ch; }
.login-card { background: #fff; border-radius: 22px; padding: 2.2rem; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.login-card h2 { font-weight: 700; color: var(--ink); }
.login-card .input-group-text { background: #faf8f3; color: var(--muted); }
@media (max-width: 800px) { .login-wrap { grid-template-columns: 1fr; text-align: center; } .login-hero p { margin: 0 auto 1rem; } }

.fade-in { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Pasos del registro de líder */
.stepper { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.step { display: flex; align-items: center; gap: .55rem; padding: .4rem .9rem .4rem .45rem; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-weight: 500; font-size: .86rem; }
.step span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #efe9dc; font-size: .8rem; font-weight: 700; }
.step.active { color: var(--ink); border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200,164,92,.18); }
.step.active span { background: var(--gold); color: #1b1405; }
.step.done span { background: var(--ink); color: var(--gold); }
.min-card.mine { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(200,164,92,.25), var(--shadow); }

/* Página pública de registro */
.pub-head { background: linear-gradient(180deg, var(--ink), var(--ink-2)); padding: 1rem 0; }
.pub-head img { height: 38px; max-width: 60%; object-fit: contain; }
.pub-tag { color: var(--gold); font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 600; }
.pub-wrap { max-width: 1080px; margin: 0 auto; padding-left: 1rem; padding-right: 1rem; }

/* Barra de selección múltiple (administrador) */
.bulk-bar { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 1050; display: flex; align-items: center; gap: .8rem; background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.bulk-bar b { color: var(--gold); }

/* Lista compacta y ventana de detalle de persona */
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:hover { background: #fbf6ea; }
#modalDetail .modal-content { background: #fff; }
.dt-head { background: linear-gradient(135deg, var(--ink) 0%, var(--ink-3) 100%); color: #fff; padding: 1.4rem 1.5rem; display: flex; align-items: flex-start; gap: 1rem; position: relative; }
.dt-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--gold), transparent); }
.dt-head h4 { font-family: 'Playfair Display', serif; margin: 0; }
.dt-head .badge-soft { background: rgba(255,255,255,.14); color: #fff; }
.dt-avatar { width: 62px; height: 62px; flex: 0 0 62px; border-radius: 18px; background: var(--gold); color: #1b1405; display: grid; place-items: center; font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1.5rem; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.dt-body { padding: 1.3rem 1.5rem; overflow-y: auto; }
.dt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.dt-item { display: flex; gap: .8rem; align-items: flex-start; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 14px; background: #fcfbf8; min-width: 0; }
.dt-item > i { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(200,164,92,.18); color: var(--gold-d); font-size: 1.05rem; }
.dt-lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.dt-val { font-weight: 500; overflow-wrap: anywhere; }
.dt-val a { color: var(--ink); }
.dt-sec { font-family: 'Playfair Display', serif; font-size: 1.05rem; color: var(--ink); margin: 1.3rem 0 .6rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line); }
.dt-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.btn-wa { background: #1faa59; border-color: #1faa59; color: #fff; font-weight: 600; }
.btn-wa:hover { background: #168a47; border-color: #168a47; color: #fff; }
.dt-foot { display: flex; flex-wrap: wrap; gap: .5rem; padding: .9rem 1.5rem; border-top: 1px solid var(--line); background: #fcfbf8; }
@media (max-width: 576px) { .dt-grid { grid-template-columns: 1fr; } .dt-head, .dt-body, .dt-foot { padding-left: 1rem; padding-right: 1rem; } }

/* Registro de líderes: formulario único, fácil y claro */
.reg-hero { background: linear-gradient(135deg, var(--ink) 0%, var(--ink-3) 100%); color: #fff; border-radius: 20px; padding: 1.8rem 1.6rem; margin-bottom: 1.2rem; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.reg-hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(200,164,92,.35), transparent 70%); }
.reg-hero h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 700; margin: .2rem 0 .4rem; }
.reg-hero h2 { color: #fff; }
.reg-hero p { color: #cdd6e3; margin: 0; max-width: 56ch; }
.reg-hero .text-muted { color: #aab6c8 !important; }
.reg-hero.compact { padding: 1.2rem 1.4rem; }
.reg-kicker { color: var(--gold); font-size: .75rem; text-transform: uppercase; letter-spacing: .16em; font-weight: 600; }
.reg-card { padding: 1.4rem; margin-bottom: 1.1rem; }
.reg-title { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.1rem; }
.reg-num { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; background: var(--gold); color: #1b1405; display: grid; place-items: center; font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1.1rem; }
.pick { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; position: relative; height: 100%; transition: border-color .15s, background .15s, box-shadow .15s; }
.pick:hover { border-color: var(--gold); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick .min-logo { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 11px; font-size: .95rem; }
.pick-name { font-weight: 500; line-height: 1.2; font-size: .9rem; flex: 1; }
.pick-ok { color: var(--gold-d); font-size: 1.25rem; opacity: 0; transform: scale(.6); transition: all .15s; }
.pick.on { border-color: var(--gold); background: #fbf6ea; box-shadow: 0 0 0 3px rgba(200,164,92,.2); }
.pick.on .pick-ok { opacity: 1; transform: none; }
.reg-count { margin-top: 1rem; color: var(--muted); font-size: .9rem; }
.reg-count.ok { color: #2f6b3f; }
.reg-submit { position: sticky; bottom: 0; padding: .8rem 0 1rem; background: linear-gradient(180deg, transparent, var(--cream) 35%); text-align: center; z-index: 5; }
.reg-submit .btn { min-width: min(100%, 360px); box-shadow: 0 10px 28px rgba(169,133,54,.35); }
.min-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.min-tab { border: 1.5px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; border-radius: 99px; padding: .4rem 1rem; font-size: .88rem; font-weight: 500; cursor: pointer; transition: all .15s; }
.min-tab:hover { background: rgba(255,255,255,.16); }
.min-tab.on { background: var(--gold); border-color: var(--gold); color: #1b1405; font-weight: 600; }

/* Tarjetas del panel clicables */
.stat-link { text-decoration: none; color: inherit; position: relative; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.stat-link:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 2px 4px rgba(14,26,43,.06), 0 14px 32px rgba(14,26,43,.12); color: inherit; }
.stat-link .stat-go { margin-left: auto; font-size: 1.6rem; color: var(--gold-d); opacity: .55; transition: transform .15s, opacity .15s; }
.stat-link:hover .stat-go { opacity: 1; transform: translateX(3px); }

/* Selector "primera vez / ya me registré" */
.mode-switch { display: flex; gap: .4rem; background: #efe9dc; padding: .3rem; border-radius: 99px; margin-bottom: 1.1rem; max-width: 460px; }
.mode-switch button { flex: 1; border: 0; background: transparent; border-radius: 99px; padding: .6rem .8rem; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer; transition: all .15s; }
.mode-switch button.on { background: var(--ink); color: #fff; box-shadow: 0 4px 12px rgba(14,26,43,.25); }
.mode-switch button.on i { color: var(--gold); }
.tipo-grid { display: grid; gap: .7rem; }
.tipo-op { display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left; border: 2px solid #e6dfcf; background: #fff; border-radius: 16px; padding: 1rem 1.1rem; cursor: pointer; transition: all .15s; color: var(--ink); }
.tipo-op > i:first-child { font-size: 1.6rem; color: var(--gold); flex: 0 0 auto; width: 2.6rem; height: 2.6rem; border-radius: 12px; background: #f6f1e6; display: grid; place-items: center; }
.tipo-op b { display: block; font-size: 1.05rem; }
.tipo-op small { display: block; color: var(--muted); line-height: 1.35; margin-top: .15rem; }
.tipo-op .bi-chevron-right { color: var(--muted); }
.tipo-op:hover, .tipo-op:focus-visible { border-color: var(--gold); box-shadow: 0 6px 18px rgba(14,26,43,.1); transform: translateY(-1px); }
.tipo-op.tipo-sec { border-style: dashed; background: #fbf9f4; }

/* Ventana "la persona ya existe" */
.match-list { display: flex; flex-direction: column; gap: .7rem; }
.match { display: flex; align-items: center; gap: .9rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: #fcfbf8; flex-wrap: wrap; }
.match-ava { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; background: var(--ink); color: var(--gold); display: grid; place-items: center; font-family: 'Playfair Display', serif; font-weight: 700; }
.match-info { flex: 1; min-width: 160px; }
.match-act { margin-left: auto; }
.match-info .badge-gold, .match-info .badge-soft { font-size: .7rem; vertical-align: middle; }

/* Ventana de aviso: solo el espacio que necesita (sin pantalla completa, ni en el celular) */
#modalDetail .modal-dialog.modal-dialog-sm-compact { max-width: 520px; margin-left: auto; margin-right: auto; }
@media (max-width: 575.98px) { #modalDetail .modal-dialog.modal-dialog-sm-compact { margin: .75rem; max-width: none; } }
#modalDetail .modal-dialog.modal-dialog-sm-compact .modal-content { max-height: calc(100vh - 1.5rem); }

/* Aviso "ya existe" dibujado con SweetAlert (para usarlo encima de otro formulario abierto) */
.swal2-popup.dup-swal { padding: 0 !important; border-radius: 18px; overflow: hidden; text-align: left; max-width: calc(100vw - 1.5rem); }
.dup-swal .swal2-html-container { margin: 0 !important; padding: 0 !important; text-align: left; overflow: visible; }
.dup-swal .swal2-close { color: #fff; z-index: 3; }
.dup-swal .swal2-close:hover { color: var(--gold); background: transparent; }

/* Botones siempre visibles + indicación clara de cuándo hay que bajar */
.sticky-actions { position: sticky; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -10px 24px rgba(14,26,43,.12);
  padding-top: .75rem !important; padding-bottom: calc(.75rem + env(safe-area-inset-bottom)) !important; margin-top: 1rem !important; border-radius: 14px 14px 0 0; }
.sticky-actions .btn { min-width: 130px; }
.reg-submit { background: #fff !important; border-top: 1px solid var(--line); box-shadow: 0 -10px 24px rgba(14,26,43,.12); padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom)) !important; border-radius: 14px 14px 0 0; z-index: 20; }
.scroll-note { display: flex; gap: .5rem; align-items: center; background: #fbf6ea; border: 1px solid #ecdcb4; border-radius: 12px; padding: .55rem .8rem; margin-bottom: .8rem; font-size: .86rem; color: #6b5420; }
.scroll-note i { font-size: 1.1rem; color: var(--gold-d); }
.list-end { text-align: center; color: var(--muted); font-size: .86rem; padding: .9rem .5rem; border: 1px dashed #d8cfb8; border-radius: 12px; background: #fcfbf8; }
.list-end i { color: #2f6b3f; }
.scroll-hint { position: fixed; left: 50%; bottom: calc(5.4rem + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(10px); z-index: 1030; opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; border: 0; border-radius: 99px; padding: .55rem 1.1rem; font-weight: 600; font-size: .85rem; box-shadow: 0 10px 26px rgba(14,26,43,.4); transition: opacity .2s, transform .2s; white-space: nowrap; }
.scroll-hint i { color: var(--gold); margin-right: .25rem; display: inline-block; animation: bajar 1.2s ease-in-out infinite; }
.scroll-hint.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
@keyframes bajar { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }

/* Personas extranjeras: documento en lugar de DUI */
.ext-box { background: #fbf6ea; border: 1px solid #ecdcb4; border-radius: 14px; padding: 1rem; }
.form-check-input:checked[id$="Ext"] { background-color: var(--gold-d); border-color: var(--gold-d); }
.tel-cc { font-size: .88rem; }

/* Exportar integrantes */
.exp-op { display: flex; align-items: center; gap: .5rem; padding: .6rem 1.1rem; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 500; background: #fff; }
.exp-op input { display: none; }
.exp-op i { font-size: 1.3rem; color: var(--gold-d); }
.exp-op.on { border-color: var(--gold); background: #fbf6ea; box-shadow: 0 0 0 3px rgba(200,164,92,.2); }

/* Foto de carnet */
.fc-block { background: #fbf6ea; border: 1px solid #ecdcb4; border-radius: 14px; padding: .85rem 1rem; }
.fc-row { display: flex; gap: 1rem; align-items: center; }
.fc-thumb { width: 72px; height: 96px; flex: 0 0 72px; border-radius: 8px; background: #fff; border: 2px dashed #d9c48f; display: grid; place-items: center; color: #b9a46b; font-size: 2rem; overflow: hidden; }
.fc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fc-btns { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; }
.fc-popup { padding: 1.2rem .8rem !important; }
.fc-wrap { display: flex; flex-direction: column; align-items: center; gap: .7rem; }
.fc-stage { position: relative; overflow: hidden; background: #222; border-radius: 6px; touch-action: none; cursor: grab; user-select: none; }
.fc-stage img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; pointer-events: none; }
.fc-guides { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fc-zoom { display: flex; align-items: center; gap: .5rem; width: 100%; max-width: 300px; color: #6b7686; }
.fc-zoom input { flex: 1; }
.fc-hint { font-size: .8rem; color: #4a5568; text-align: left; margin: 0; max-width: 320px; }
.fc-consent { display: flex; gap: .5rem; align-items: flex-start; font-size: .82rem; text-align: left; max-width: 320px; }
.dt-avatar.dt-photo { padding: 0; overflow: hidden; width: 66px; height: 88px; flex: 0 0 66px; border-radius: 10px; }
.dt-avatar.dt-photo img { width: 100%; height: 100%; object-fit: cover; }
.fc-stage video, .fc-stage #fcSnap { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fc-stage video { transform: scaleX(-1); }
.fc-popup .swal2-html-container { overflow-x: hidden; margin: 1em .5em .3em; }
.fc-consent, .fc-hint { box-sizing: border-box; width: 100%; }

/* Diseño móvil: etiquetas que se ajustan al ancho y tablas en forma de tarjetas */
.badge-soft, .badge-gold, .badge-lider { display: inline-block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.3; text-align: left; vertical-align: middle; }
.badge-soft, .badge-gold, .badge-lider { border-radius: 14px; }
#view, .card-x, .hero-min { overflow-wrap: break-word; }
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tbody tr { border: 1px solid var(--line); border-radius: 14px; margin: .6rem 0; padding: .45rem .85rem; background: #fff; }
  .table-stack td { border: 0; padding: .3rem 0; text-align: left !important; }
  .table-stack td::before { content: attr(data-label); display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: .1rem; }
  .table-stack td[data-label=""]::before { display: none; }
  .table-stack td.text-nowrap { white-space: normal !important; }
  .table-stack td .btn-icon, .table-stack td .btn { margin: 0 .25rem .25rem 0; }
  .table-stack tbody tr:hover { background: #fff; }
  .table-responsive:has(.table-stack) { overflow: visible; padding: 0 .75rem .5rem; }
  .hero-min { flex-direction: column; align-items: flex-start; }
  .toolbar { flex-wrap: wrap; }
  .toolbar > * { max-width: 100%; }
  .modal-dialog .table-responsive { overflow-x: auto; }
}
@media (max-width: 575.98px) {
  .stat { flex-direction: column; align-items: flex-start; gap: .4rem; padding: .85rem; }
  .stat .stat-lbl { font-size: .74rem; line-height: 1.25; hyphens: none; overflow-wrap: normal; word-break: normal; }
  .stat-go { display: none; }
}

/* Celular: el menú ocupa solo la pantalla visible (sin quedar debajo de la barra del navegador) y "Clave / Salir" siempre se ven */
.sidebar .nav { min-height: 0; }
.sidebar-foot { flex: 0 0 auto; }
@supports (height: 100dvh) { .sidebar { height: 100dvh; } }
@media (max-width: 991.98px) {
  .sidebar { top: 0; bottom: 0; height: auto; max-height: 100dvh; padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); overflow: hidden; }
  @supports (height: 100dvh) { .sidebar { height: 100dvh; } }
}

/* Buscador de persona vinculada (usuarios) */
.per-list { display: grid; gap: .35rem; margin-top: .4rem; max-height: 260px; overflow-y: auto; }
.per-op { display: block; width: 100%; text-align: left; border: 1px solid #e6dfcf; background: #fff; border-radius: 10px; padding: .5rem .75rem; cursor: pointer; }
.per-op:hover:not(:disabled) { border-color: var(--gold); background: #fbf8f1; }
.per-op:disabled { opacity: .55; cursor: not-allowed; }
.per-op b, .per-chip b { display: block; overflow-wrap: break-word; }
.per-op small, .per-chip small { color: var(--muted); }
.per-none { color: var(--muted); font-size: .9rem; padding: .4rem .2rem; }
.per-chip { display: flex; align-items: center; gap: .6rem; border: 1px solid var(--gold); background: #fbf8f1; border-radius: 12px; padding: .5rem .75rem; }
.per-chip > i { color: var(--gold); font-size: 1.3rem; }
