:root {
  --navy: #1239b8;
  --navy-deep: #081d6b;
  --ink: #183474;
  --muted: #7e8ca8;
  --line: #e4e9f5;
  --surface: #ffffff;
  --canvas: #f7f8fd;
  --teal: #1647d8;
  --teal-dark: #1035a5;
  --coral: #f2b000;
  --gold: #ffc229;
  --green: #48a868;
  --yellow: #e9b949;
  --red: #d94f4f;
  --shadow: 0 12px 38px rgba(16, 42, 67, .08);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
* { scrollbar-width: thin; scrollbar-color: rgba(126, 140, 168, .55) transparent; }
*::-webkit-scrollbar { width: 4px; height: 4px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(126, 140, 168, .55); }
*::-webkit-scrollbar-thumb:hover { background: rgba(18, 57, 184, .72); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--navy); font-size: 21px; font-weight: 800; letter-spacing: -.04em; }
.brand-light { color: white; }
.brand-mark { color: var(--coral); font-size: 28px; line-height: 1; }
.eyebrow { margin: 0; color: var(--teal-dark); font-size: 10px; letter-spacing: .18em; font-weight: 800; }
.button { border: 0; border-radius: 9px; min-height: 40px; padding: 0 16px; font-weight: 750; transition: .2s ease; }
.button:hover { transform: translateY(-1px); filter: brightness(.98); }
.button-primary { background: var(--teal); color: white; box-shadow: 0 8px 18px rgba(22, 71, 216, .22); }
.button-secondary { background: #eef2ff; color: var(--teal-dark); }
.button-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.button-danger { background: #fff0ee; color: var(--red); }
.button-large { width: 100%; height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; }
.link-button { border: 0; background: none; color: var(--teal-dark); font-weight: 700; padding: 0; }
.icon-button { border: 0; background: transparent; color: var(--muted); display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; }
.icon-button:hover { background: #eff5f8; color: var(--navy); }
.modal-head > .icon-button { width: 38px; height: 38px; flex: 0 0 38px; border: 0; border-radius: 0; background: transparent; color: var(--navy); font-size: 29px; font-weight: 800; line-height: 1; }
.modal-head > .icon-button:hover { background: transparent; color: var(--teal-dark); }
.avatar { border-radius: 50%; display: inline-grid; place-items: center; color: white; font-size: 12px; font-weight: 800; flex: 0 0 auto; }
.avatar img { width: 100%; height: 100%; display: block; border-radius: inherit; object-fit: cover; }
.avatar-photo { background-repeat: no-repeat; background-size: 400% 400%; }
.avatar-small { width: 32px; height: 32px; }
.avatar-large { width: 74px; height: 74px; font-size: 22px; }
.avatar-pastor { background: linear-gradient(145deg, #e3a678, #8f5d59); }
.avatar-blue { background: linear-gradient(145deg, #61a9b7, #285e7e); }
.avatar-purple { background: linear-gradient(145deg, #a594d5, #635189); }
.avatar-orange { background: linear-gradient(145deg, #e99e66, #a95d31); }
.avatar-green { background: linear-gradient(145deg, #73b79c, #31725e); }
.badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; border-radius: 10px; padding: 0 5px; background: #e7785e; color: white; font-size: 10px; }

/* Login */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(390px, .95fr); background: var(--surface); }
.login-art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 46px 9%; color: white; background: radial-gradient(circle at 85% 22%, rgba(255, 194, 41, .28), transparent 30%), linear-gradient(135deg, #081d6b 0%, #1239b8 48%, #315df5 130%); }
.login-art::after { content: ""; position: absolute; width: 600px; height: 600px; right: -240px; bottom: -220px; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; box-shadow: 0 0 0 62px rgba(255,255,255,.035), 0 0 0 124px rgba(255,255,255,.03); }
.login-message { max-width: 540px; position: relative; z-index: 1; margin: auto 0; }
.login-message .eyebrow { color: #8fe1d8; }
.login-message h1 { margin: 19px 0 20px; font-size: clamp(36px, 4.4vw, 63px); line-height: 1.04; letter-spacing: -.055em; font-weight: 760; }
.login-message p:not(.eyebrow) { max-width: 410px; color: rgba(255,255,255,.67); line-height: 1.7; font-size: 15px; }
.art-stats { display: flex; gap: 38px; color: rgba(255,255,255,.58); font-size: 12px; position: relative; z-index: 1; }
.art-stats strong { color: #fff; font-size: 20px; display: block; margin-bottom: 3px; }
.login-panel { align-self: center; width: min(410px, 80%); margin: auto; padding: 40px 0; }
.login-brand-lockup { display: grid; justify-items: start; gap: 12px; }
.church-logo { display: block; width: min(260px, 78%); height: auto; border-radius: 4px; }
.login-copy { margin: 67px 0 34px; }
.login-copy h2 { margin: 10px 0 10px; font-size: 32px; letter-spacing: -.04em; }
.login-copy p:last-child { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.form-stack { display: grid; gap: 18px; }
label { color: var(--ink); font-size: 12px; font-weight: 750; }
input, textarea, select { width: 100%; border: 1px solid #d9e2ea; color: var(--ink); background: white; border-radius: 8px; padding: 12px 13px; outline: none; margin-top: 8px; transition: .2s; }
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(22,71,216,.12); }
textarea { min-height: 94px; resize: vertical; }
.password-field { position: relative; }
.password-field input { padding-right: 40px; }
.password-field .icon-button { position: absolute; right: 3px; bottom: 3px; }
.passkey-login { margin-top: 20px; text-align: center; }
.login-divider { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; color: var(--muted); font-size: 11px; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.button-passkey { justify-content: center; gap: 10px; border: 1px solid #ccd7ee; background: #fff; color: var(--navy); box-shadow: 0 7px 18px rgba(18, 57, 184, .08); }
.button-passkey:disabled { cursor: wait; opacity: .65; transform: none; }
.passkey-symbol { display: grid; place-items: center; width: 22px; }
.passkey-symbol svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.passkey-login small { display: block; margin-top: 9px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.login-options { display: flex; justify-content: space-between; gap: 16px; margin-top: 25px; font-size: 12px; }
.login-options .link-button:last-child { color: var(--muted); font-weight: 600; }
.demo-hint { margin: 68px 0 0; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; text-align: center; }

/* Shell */
.app-screen { min-height: 100vh; display: flex; }
.sidebar { width: 253px; flex: 0 0 253px; padding: 25px 17px 16px; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 10px 27px; }
.mobile-close { display: none; }
.church-switcher { display: flex; gap: 10px; align-items: center; margin: 0 2px 25px; padding: 11px 10px; border: 1px solid var(--line); border-radius: 11px; }
.church-avatar { width: 31px; height: 31px; display: grid; place-items: center; background: #eef2ff; color: var(--teal-dark); border-radius: 9px; font-size: 10px; font-weight: 800; }
.church-switcher strong, .church-switcher span, .user-mini strong, .user-mini span { display: block; }
.church-switcher strong { font-size: 11px; white-space: nowrap; }
.church-switcher div:nth-child(2) span { color: var(--muted); font-size: 9px; margin-top: 3px; }
.church-switcher .caret { margin-left: auto; color: var(--muted); }
.nav-label { margin: 0 10px 8px; color: #a0aeba; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.nav-label-space { margin-top: 28px; }
.main-nav { flex: 1; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 11px; margin: 3px 0; border: 0; border-radius: 9px; color: #6b7f92; background: transparent; text-align: left; font-size: 12px; font-weight: 700; }
.nav-item span { width: 18px; text-align: center; font-size: 17px; font-weight: 400; }
.nav-item:hover, .nav-item.active { color: var(--navy); background: #eef2ff; }
.nav-item.active { box-shadow: inset 3px 0 0 var(--teal); }
.nav-item em { font-style: normal; margin-left: auto; min-width: 20px; height: 20px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--teal); font-size: 9px; }
.nav-item em.soft { background: #e9f0f3; color: #7f92a3; }
.sidebar-bottom { border-top: 1px solid var(--line); padding-top: 15px; }
.help-card { display: flex; align-items: center; gap: 8px; padding: 12px 10px; margin-bottom: 18px; border-radius: 10px; background: #fff8ea; color: #7d6130; }
.help-card > span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #f6d78a; font-weight: 800; font-size: 11px; }
.help-card strong { display: block; font-size: 10px; }
.help-card small { font-size: 9px; color: #aa8951; }
.help-card b { margin-left: auto; font-size: 14px; }
.user-mini { display: flex; align-items: center; gap: 9px; padding: 0 5px; }
.user-mini strong { font-size: 11px; }
.user-mini span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.user-mini .icon-button { margin-left: auto; }
.main-content { flex: 1; min-width: 0; position: relative; }
.topbar { height: 79px; display: flex; align-items: center; justify-content: space-between; padding: 0 4.1%; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.75); }
.menu-toggle { display: none; }
.breadcrumbs { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; }
.breadcrumbs strong { color: var(--navy); }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.notification-button { position: relative; font-size: 22px; }
.notification-button b { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--coral); border: 1px solid white; }
.profile-trigger { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0; color: var(--navy); font-size: 11px; font-weight: 700; }
.profile-trigger .avatar { transition: box-shadow .2s ease; }
.profile-trigger .avatar.has-unread { box-shadow: 0 0 0 3px #dc3d4b; }
.profile-trigger .caret { color: var(--muted); font-size: 15px; }
.profile-trigger-name { display: block; max-width: 88px; overflow: hidden; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.popover { position: absolute; z-index: 20; min-width: 225px; right: 4%; top: 67px; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); }
.popover button { width: 100%; border: 0; background: transparent; padding: 11px 10px; display: flex; align-items: center; gap: 10px; border-radius: 7px; text-align: left; color: var(--ink); font-size: 12px; }
.popover button:hover { background: #f5f8fa; }
.popover button span { color: var(--muted); width: 15px; }
.popover button .menu-icon { display: grid; place-items: center; width: 18px; min-width: 18px; color: var(--muted); }
.popover button .menu-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.popover .badge { margin-left: auto; }
.popover-divider { height: 1px; margin: 6px 4px; background: var(--line); }
.danger-text { color: var(--red) !important; }
.view-container { padding: 38px 4.1% 60px; max-width: 1500px; margin: 0 auto; }
.view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 29px; }
.view-header h1 { margin: 5px 0 7px; color: var(--navy); font-size: 29px; letter-spacing: -.05em; }
.view-header p { margin: 0; color: var(--muted); font-size: 13px; }
.header-actions { display: flex; gap: 9px; align-items: center; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 4px 18px rgba(16,42,67,.025); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title h3 { margin: 0; color: var(--navy); font-size: 14px; }
.card-title a { color: var(--teal-dark); font-size: 11px; font-weight: 800; border: 0; background: none; }
.muted { color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr); gap: 20px; }
.welcome-card { min-height: 168px; padding: 25px 28px; position: relative; overflow: hidden; color: white; background: linear-gradient(110deg, #143750, #1e6f72); }
.welcome-card::after { content: "✦"; position: absolute; right: 46px; top: 20px; color: rgba(255,255,255,.12); font-size: 120px; }
.welcome-card .eyebrow { color: #9ee4dc; }
.welcome-card h2 { margin: 11px 0 8px; font-size: 23px; letter-spacing: -.04em; position: relative; z-index: 1; }
.welcome-card p { color: rgba(255,255,255,.69); max-width: 440px; font-size: 12px; position: relative; z-index: 1; }
.quick-actions { display: flex; gap: 8px; margin-top: 20px; position: relative; z-index: 1; }
.quick-actions .button { min-height: 33px; padding: 0 12px; font-size: 10px; }
.quick-actions .button-primary { background: white; color: var(--navy); box-shadow: none; }
.quick-actions .button-secondary { background: rgba(255,255,255,.13); color: white; }
.metric-card { padding: 20px; display: grid; gap: 18px; }
.metric-card p { margin: 0; color: var(--muted); font-size: 11px; }
.metric-value { display: flex; align-items: end; justify-content: space-between; }
.metric-value strong { color: var(--navy); font-size: 31px; letter-spacing: -.06em; }
.metric-trend { color: var(--green); font-size: 10px; font-weight: 800; }
.metric-bar { height: 6px; overflow: hidden; border-radius: 5px; background: #eaf1f2; }
.metric-bar span { display: block; width: 72%; height: 100%; border-radius: 5px; background: var(--teal); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, .46fr); gap: 20px; margin-top: 20px; }
.dashboard-calendar-grid { grid-template-columns: minmax(0, 1fr); }
.calendar-card, .activity-card, .tree-card, .members-card { padding: 22px; }
.calendar-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 14px; }
.calendar-head strong { color: var(--navy); font-size: 13px; }
.calendar-nav { display: flex; gap: 3px; }
.calendar-nav button { border: 0; width: 26px; height: 26px; background: #f4f7f9; color: var(--muted); border-radius: 6px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day { width: 100%; min-height: 62px; padding: 7px; border: 1px solid #eff3f5; border-radius: 7px; background: white; text-align: left; cursor: pointer; }
.day:hover { border-color: var(--teal); }
.day.selected { border-color: var(--teal-dark); box-shadow: inset 0 0 0 1px var(--teal-dark); }
.day.past { opacity: .62; }
.day small { display: block; color: var(--muted); font-size: 9px; }
.day strong { display: block; color: var(--navy); font-size: 14px; margin-top: 6px; }
.day.today { border-color: var(--teal); background: #eef2ff; }
.day.today strong { color: var(--teal-dark); }
.event { margin-top: 6px; padding: 3px 4px; border-radius: 4px; background: #eef2ff; color: var(--teal-dark); font-size: 8px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-selected-day { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.calendar-selected-day strong { color: var(--navy); font-size: 11px; text-transform: capitalize; }
.calendar-selected-day span { color: var(--muted); font-size: 10px; }
.calendar-empty { margin: 20px 0 0; text-align: center; font-size: 11px; }
.activity-list { margin-top: 20px; }
.activity-item { display: flex; align-items: flex-start; gap: 10px; padding: 13px 0; border-bottom: 1px solid #f0f3f5; }
.activity-item:last-child { border-bottom: 0; padding-bottom: 0; }
.activity-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--teal-dark); background: #eef2ff; font-size: 14px; }
.activity-item p { margin: 0; color: var(--ink); font-size: 11px; line-height: 1.35; }
.activity-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }

/* Generic views */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.search { position: relative; width: 250px; }
.search span { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.search input { margin: 0; padding-left: 34px; font-size: 11px; }
.filter { width: auto; margin: 0; padding: 10px 12px; font-size: 11px; }
.people-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(250px, .65fr); gap: 20px; }
.disciples-layout { grid-template-columns: minmax(0, 1fr); }
.disciples-layout .tree-card { min-height: 0; }
.tree-card { min-height: 550px; }
.people-tree-card { padding: 0; overflow: hidden; }
.people-tree-tabs { display: flex; align-items: stretch; gap: 0; padding: 0 22px; border-bottom: 1px solid var(--line); }
.people-tree-tab { flex: 1 1 0; min-height: 50px; display: flex; align-items: center; justify-content: center; padding: 0 6px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 15px; font-weight: 800; text-align: center; cursor: pointer; }
.people-tree-tab.active { border-bottom-color: var(--teal); color: var(--teal-dark); }
.people-tree-tab:hover { color: var(--navy); }
.people-tree-panel { padding: 0 22px 22px; }
.people-tree-panel > .card-title { padding-top: 18px; }
.people-tree-panel .tree-root { margin-top: 16px; }
.people-tree-panel .structure-tree-branch { padding-bottom: 0; }
.people-structure-people { margin: 20px -22px -22px; border-top: 1px solid var(--line); }
.people-structure-people .structure-people-title { padding: 16px 22px; }
.people-structure-people .data-table { margin: 0; }
.structure-inline-people { margin-top: 20px; }
.tree-root { display: flex; align-items: center; gap: 9px; margin: 23px 0 4px; padding: 12px; border-radius: 9px; background: #eef2ff; }
.tree-root strong { display: block; font-size: 12px; }
.tree-root small { color: var(--muted); font-size: 9px; }
.tree-branch { position: relative; margin-left: 18px; padding-left: 17px; border-left: 1px solid #dbe7eb; }
.tree-branch .tree-branch { margin-left: 11px; padding-left: 15px; border-left-color: #c8d8ec; }
.tree-branch .tree-branch .tree-branch { margin-left: 7px; padding-left: 13px; }
.tree-branch .tree-branch .tree-branch .tree-branch { margin-left: 5px; padding-left: 11px; }
.tree-node { position: relative; display: flex; align-items: center; gap: 8px; padding: 9px 6px; border-radius: 8px; cursor: pointer; }
.tree-node::before { content: ""; position: absolute; left: -17px; top: 23px; width: 16px; border-top: 1px solid #dbe7eb; }
.tree-branch .tree-branch .tree-node::before { border-top-color: #c8d8ec; }
.tree-node:hover { background: #f7fafb; }
.tree-node .toggle { width: 19px; height: 19px; padding: 0; border: 1px solid #d8e4e8; border-radius: 50%; background: white; color: var(--teal-dark); font-size: 12px; }
.tree-node-info { flex: 1; min-width: 0; }
.tree-node-info strong { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.tree-node-info small { color: var(--muted); font-size: 9px; }
.last-visit { max-width: 54px; overflow: hidden; color: var(--green); font-size: 9px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.last-visit.recent { color: var(--green); }
.last-visit.attention { color: var(--yellow); }
.last-visit.late { color: var(--red); }
.last-visit.unknown { color: #8996a3; }
.member-card { padding: 21px; }
.member-card-head { display: flex; align-items: center; gap: 11px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.member-card-head strong { display: block; color: var(--navy); font-size: 14px; }
.member-card-head span { display: block; color: var(--muted); font-size: 10px; margin-top: 4px; }
.info-row { display: flex; justify-content: space-between; gap: 10px; padding: 13px 0; border-bottom: 1px solid #f0f3f5; font-size: 10px; }
.info-row b { color: var(--muted); font-weight: 600; }
.info-row strong { text-align: right; }
.appointment-detail-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 15px; }
.appointment-detail-pair .info-row { min-width: 0; display: block; }
.appointment-detail-pair .info-row strong { display: block; margin-top: 5px; overflow-wrap: anywhere; text-align: left; }
.modal .appointment-detail-pair .info-row { font-size: 12px; padding: 13px 0; }
.modal .appointment-detail-pair .info-row b { font-size: 11px; }
.modal .appointment-detail-pair .info-row strong { font-size: 13px; }
.appointment-detail-notes { margin-top: 11px; padding-top: 12px; border-top: 1px solid var(--line); }
.appointment-detail-notes-copy { margin: 6px 0 0; color: var(--ink); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.appointment-detail-private { margin: 13px 0 0; font-size: 12px; line-height: 1.5; }
.status-pill { display: inline-block; padding: 4px 7px; color: #257b55; background: #eaf7ee; border-radius: 5px; font-size: 9px; font-weight: 800; }
.table-card { overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.data-table th { padding: 13px 17px; background: #fafcfd; color: var(--muted); font-size: 9px; text-align: left; text-transform: uppercase; letter-spacing: .08em; }
.data-table td { padding: 14px 17px; border-top: 1px solid #eff3f5; vertical-align: middle; }
.person-cell { display: flex; align-items: center; gap: 9px; }
.person-cell strong { display: block; font-size: 11px; }
.person-cell small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.table-action { border: 0; background: #eef2ff; color: var(--teal-dark); border-radius: 6px; padding: 7px 9px; font-size: 10px; font-weight: 750; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; background: var(--green); }
.status-dot.yellow { background: var(--yellow); }
.status-dot.red { background: var(--red); }
.schedule-list { display: grid; gap: 10px; }
.schedule-item { display: grid; grid-template-columns: 62px 1fr auto; align-items: center; gap: 14px; padding: 15px 17px; border-left: 3px solid #3f6fda; }
.schedule-item.appointment-task-pending { border-left-color: var(--yellow); }
.schedule-item.appointment-task-done { border-left-color: var(--green); }
.schedule-date { text-align: center; padding-right: 14px; border-right: 1px solid var(--line); }
.schedule-date strong { display: block; color: var(--navy); font-size: 18px; }
.schedule-date small { color: var(--muted); text-transform: uppercase; font-size: 8px; letter-spacing: .08em; }
.schedule-info strong { display: block; color: var(--navy); font-size: 12px; }
.schedule-info small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.schedule-actions { display: flex; gap: 7px; align-items: center; }
.schedule-actions { flex-wrap: wrap; justify-content: flex-end; }
.schedule-actions button { border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: white; color: var(--muted); font-size: 10px; }
.schedule-actions button:first-child { color: var(--teal-dark); background: #eef2ff; border-color: #dbe3ff; }
.appointment-task-action { border: 1px solid #f0c94f !important; color: #92701a !important; background: #fff8dc !important; white-space: nowrap; }
.appointment-task-action.is-done { border-color: #a6d6bb !important; color: #28744e !important; background: #effaf3 !important; }
.task-grid, .book-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.task-card, .book-card { padding: 18px; }
.task-card { border-left: 3px solid var(--gold); }
.task-card.done { border-left-color: var(--green); opacity: .78; }
.task-top, .book-top { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.task-actions { position: relative; flex: 0 0 auto; margin: -7px -7px 0 0; }
.task-actions-trigger { width: 28px; height: 28px; font-size: 15px; letter-spacing: 1px; }
.task-actions-menu { position: absolute; z-index: 15; top: 30px; right: 0; min-width: 158px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: var(--shadow); }
.task-actions-menu button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); text-align: left; font-size: 10px; }
.task-actions-menu button:hover { background: #f5f8fa; }
.task-top strong, .book-top strong { font-size: 12px; color: var(--navy); line-height: 1.35; }
.check { width: 20px; height: 20px; border: 1px solid #dbe5e9; border-radius: 6px; background: white; color: var(--teal); }
.check.checked { border-color: var(--green); background: var(--green); color: white; }
.book-task-card { padding: 15px; }
.book-task-card p { min-height: auto; margin: 5px 0 3px; }
.book-task-card .book-meta { align-items: center; padding-top: 10px; }
.book-task-card .book-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; margin: 0; }
.book-task-card .book-actions .button { padding: 6px 8px; font-size: 9px; }
.book-task-card .book-actions .link-button { font-size: 9px; }
.task-card p, .book-card p { color: var(--muted); line-height: 1.5; font-size: 10px; min-height: 31px; }
.task-meta { display: flex; justify-content: space-between; gap: 10px; padding-top: 13px; border-top: 1px solid #f0f3f5; color: var(--muted); font-size: 9px; }
.book-cover { display: grid; place-items: center; width: 42px; height: 51px; border-radius: 4px; color: white; background: linear-gradient(145deg, #1f7780, #153c57); font-size: 20px; }
.book-card { display: flex; gap: 13px; }
.book-card > div:last-child { flex: 1; }
.book-card p { min-height: auto; margin-bottom: 11px; }
.book-status { color: var(--teal-dark); font-size: 9px; font-weight: 800; }
.book-status.read { color: var(--green); }
.book-status.progress { color: var(--yellow); }
.structure-grid { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); gap: 20px; }
.structure-list, .supervision-list { padding: 20px; }
.structure-node { padding: 14px 0; border-bottom: 1px solid #eff3f5; }
.structure-node:last-child { border-bottom: 0; }
.structure-node strong { display: block; font-size: 12px; }
.structure-node small { display: block; color: var(--muted); font-size: 10px; margin-top: 4px; }
.structure-node .structure-children { margin: 10px 0 0 15px; padding-left: 15px; border-left: 1px solid #dbe7eb; }
.structure-children span { display: block; padding: 5px 0; color: var(--muted); font-size: 10px; }
.supervision-row { display: grid; grid-template-columns: 1fr 110px 100px; gap: 14px; align-items: center; padding: 15px 0; border-bottom: 1px solid #eff3f5; }
.supervision-row:last-child { border-bottom: 0; }
.supervision-row strong { display: block; font-size: 11px; }
.supervision-row small { color: var(--muted); font-size: 9px; }
.rating { color: var(--green); font-size: 10px; font-weight: 800; }
.structure-layout { display: grid; gap: 16px; }
.structure-tree-card { min-height: 0; }
.structure-tree-branch { padding-bottom: 4px; }
.structure-tree-node { cursor: pointer; }
.structure-tree-node.structure-sector { cursor: default; }
.structure-tree-node.structure-selected { background: #eef2ff; }
.structure-tree-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 38px; border: 1px solid #d8e2f4; border-radius: 50%; color: #1546c5; background: #f0f3ff; }
.structure-tree-icon svg { display: block; width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.structure-tree-icon circle:not(.icon-dashed) { fill: currentColor; stroke: currentColor; }
.structure-tree-icon > svg > circle:first-child { fill: none; }
.structure-tree-icon .icon-dashed { fill: none; stroke-dasharray: 3 3; }
.structure-icon-church { color: #274d6b; background: #f4f7ff; }
.structure-icon-church svg { width: 32px; height: 32px; }
.structure-icon-zone { color: #1648c8; }
.structure-icon-sector { color: #1648c8; }
.structure-icon-house_group { color: #1648c8; }
.structure-tree-count { min-width: 22px; height: 22px; display: grid; place-items: center; padding: 0 6px; border-radius: 11px; color: var(--teal-dark); background: #eef2ff; font-size: 10px; font-weight: 800; }
.tree-root .structure-tree-count { width: 22px; min-width: 22px; margin-left: auto; padding: 0; border: 1px solid #dbe7eb; border-radius: 50%; color: var(--navy); background: #fff; }
.structure-people-card { overflow: hidden; }
.structure-person-row { cursor: pointer; }
.structure-person-row:hover { background: #f7f9fc; }
.structure-people-title { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.structure-people-title h3 { margin-bottom: 3px; }
.structure-group-label { display: block; margin-top: 6px; color: var(--yellow); font-size: 14px; line-height: 1.2; }
.structure-role-button { flex: 0 0 auto; }
.structure-people-card .data-table { margin: 0; }
.structure-empty { display: grid; gap: 5px; padding: 26px 20px; color: var(--muted); font-size: 11px; }
.structure-empty strong { color: var(--navy); font-size: 12px; }
.personal-profile-hero { display: flex; align-items: center; gap: 18px; padding: 20px; margin-bottom: 16px; }
.personal-profile-hero h2 { margin: 0 0 5px; color: var(--navy); font-size: 20px; }
.personal-profile-hero p { margin: 0 0 10px; color: var(--muted); font-size: 11px; }
.personal-profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.personal-profile-grid .detail-card { min-width: 0; }
.personal-resource-list { display: grid; gap: 10px; margin-top: 12px; }
.personal-task-card { padding: 14px; }
.personal-task-card .task-top { align-items: center; }
.personal-task-card p { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.personal-task-card .task-meta { margin-top: 12px; padding-top: 10px; }
.personal-status { color: var(--yellow); font-size: 9px; font-weight: 800; }
.personal-status.done { color: var(--green); }
.personal-book-card { margin: 0; }
@media (max-width: 760px) {
  .personal-profile-grid { grid-template-columns: 1fr; }
  .personal-profile-hero { padding: 17px; }
}
@media (max-width: 760px) {
  .structure-people-title { padding: 16px; }
  .structure-people-card .data-table th, .structure-people-card .data-table td { padding-left: 13px; padding-right: 13px; }
}

/* Member profile */
.profile-hero { position: relative; display: flex; align-items: center; gap: 19px; padding: 23px; margin-bottom: 18px; }
.profile-hero-info { flex: 1; min-width: 0; padding-right: 36px; }
.profile-hero h2 { overflow: hidden; margin: 0 0 6px; color: var(--navy); font-size: 21px; letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.profile-hero p { margin: 0; color: var(--muted); font-size: 11px; }
.member-last-visit { display: block; font-size: 10px; font-weight: 800; }
.member-last-visit.recent { color: var(--green); }
.member-last-visit.attention { color: var(--yellow); }
.member-last-visit.late { color: var(--red); }
.member-last-visit.unknown { color: #8996a3; }
.member-actions { position: absolute; top: 12px; right: 12px; }
.member-actions-menu { position: absolute; z-index: 10; top: 38px; right: 0; min-width: 132px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: var(--shadow); }
.member-actions-menu button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); text-align: left; font-size: 11px; }
.member-actions-menu button:hover { background: #f5f8fa; }
.tabs { display: flex; gap: 23px; margin-bottom: 17px; border-bottom: 1px solid var(--line); }
.tab { border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); padding: 0 0 11px; font-size: 11px; font-weight: 750; }
.tab.active { border-bottom-color: var(--teal); color: var(--teal-dark); }
.member-tab-content { min-width: 0; }
.member-resource-list { display: grid; gap: 12px; margin-top: 9px; }
.member-book-row { display: block; padding: 13px 0 13px 10px; border: 0; border-left: 3px solid var(--yellow); border-radius: 0; box-shadow: none; }
.member-book-row.is-read { border-left-color: var(--green); }
.member-book-body { min-width: 0; }
.member-book-row .book-top { align-items: center; }
.member-book-row .book-top strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-book-row p { margin: 6px 0 8px; color: var(--muted); font-size: 10px; }
.member-book-row .book-actions { margin-top: 11px; }
.profile-columns { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 18px; }
.detail-card { padding: 21px; }
.detail-card h3 { margin: 0 0 15px; color: var(--navy); font-size: 13px; }
.contact-actions { display: flex; gap: 8px; margin-top: 17px; }
.contact-actions .button { min-height: 32px; font-size: 10px; }
.appointment-row { display: flex; align-items: center; gap: 8px; padding: 13px 0 13px 8px; border-left: 3px solid #3f6fda; border-bottom: 1px solid #eff3f5; }
.appointment-row.appointment-task-pending { border-left-color: var(--yellow); }
.appointment-row.appointment-task-done { border-left-color: var(--green); }
.appointment-row:last-child { border-bottom: 0; }
.member-appointments-list { margin-top: 14px; }
.appointment-row strong { display: block; font-size: 11px; }
.appointment-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.appointment-task-section { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); }
.appointment-task-add { font-size: 10px; }
.appointment-task-fields { margin-top: 12px; padding: 12px; border: 1px solid #e8edf0; border-radius: 10px; background: #fbfdfd; }
.appointment-task-fields .form-grid { gap: 11px; }
.appointment-task-detail { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 12px; border-left: 3px solid var(--yellow); border-radius: 8px; background: #fffaf0; }
.appointment-task-detail.is-done { border-left-color: var(--green); background: #f3fbf5; }
.appointment-task-detail b, .appointment-task-detail strong, .appointment-task-detail small { display: block; }
.appointment-task-detail b { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .05em; }
.appointment-task-detail strong { margin-top: 4px; color: var(--navy); font-size: 11px; }
.appointment-task-detail small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.modal .appointment-task-detail strong { font-size: 13px; }
.modal .appointment-task-detail small { font-size: 10px; }

/* Modal / popover */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 6px; box-sizing: border-box; background: rgba(12,34,56,.48); }
.modal { width: 100%; min-width: 0; max-width: 100%; max-height: 90vh; overflow: auto hidden; box-sizing: border-box; border-radius: 16px; background: white; box-shadow: 0 28px 80px rgba(12,34,56,.28); }
.modal, .modal * { box-sizing: border-box; }
.modal-head, .modal-body, .modal-footer, .modal form, .modal form label, .modal .form-grid { width: 100%; min-width: 0; max-width: 100%; }
.modal input, .modal select, .modal textarea { display: block; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.modal input[type="file"] { width: 100%; min-width: 0; }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 16px 17px 13px; border-bottom: 1px solid var(--line); }
.modal-head > div { min-width: 0; }
.modal-head h2, .modal-head p { overflow-wrap: anywhere; }
.modal-head h2 { margin: 0; color: var(--navy); font-size: 19px; letter-spacing: -.04em; }
.modal-head p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.modal-body { padding: 15px 17px 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.member-editor-tabs { display: flex; gap: 18px; margin: -4px 0 19px; border-bottom: 1px solid var(--line); }
.member-editor-tab { padding: 0 0 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; }
.member-editor-tab.active { border-bottom-color: var(--teal); color: var(--teal-dark); }
.member-form-panel { min-height: 170px; }
.member-form-panel .form-help { margin: 0 0 14px; }
.form-grid > * { min-width: 0; }
.form-grid .full { grid-column: 1 / -1; }
.form-help { grid-column: 1 / -1; margin: -4px 0 0; font-size: 10px; line-height: 1.5; }
.modal-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 21px; }
.modal-footer .button { min-width: 0; max-width: 100%; }
.task-detail-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.task-detail-actions .button { width: 100%; min-width: 0; padding: 0 7px; font-size: 12px; font-weight: 800; }
.modal .task-detail-actions .button { min-height: 42px; padding: 0 8px; font-size: 13px; }
.onboarding-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.onboarding-choice { display: flex; flex-direction: column; align-items: flex-start; min-height: 155px; padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: #fbfdfd; color: var(--ink); text-align: left; }
.onboarding-choice:hover { border-color: var(--teal); background: #eef2ff; }
.onboarding-choice .choice-icon { display: grid; place-items: center; width: 35px; height: 35px; margin-bottom: 18px; border-radius: 9px; color: var(--teal-dark); background: #eef2ff; font-size: 18px; }
.onboarding-choice strong { color: var(--navy); font-size: 12px; }
.onboarding-choice span:last-child { margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.code-callout { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 14px; border-radius: 9px; background: #eef2ff; }
.code-callout small { display: block; color: var(--teal-dark); font-size: 9px; }
.code-callout strong { display: block; margin-top: 4px; color: var(--navy); font-size: 19px; letter-spacing: .08em; }
.code-callout button { border: 0; color: var(--teal-dark); background: white; border-radius: 6px; padding: 7px 9px; font-size: 10px; font-weight: 800; }
.radio-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.radio-option { min-width: 0; }
.radio-option input { display: none; }
.radio-option span { display: block; min-width: 0; padding: 11px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); text-align: center; font-size: 10px; font-weight: 700; cursor: pointer; overflow-wrap: anywhere; }
.radio-option input:checked + span { border-color: var(--teal); background: #eef2ff; color: var(--teal-dark); }
.notification-list { display: grid; gap: 11px; }
.notification-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 9px; background: #f8fafb; }
.notification-item.unread { background: #eef2ff; }
.notification-icon { width: 44px; height: 44px; display: grid; flex: 0 0 44px; place-items: center; color: var(--teal-dark); }
.notification-icon svg { width: 38px; height: 38px; display: block; }
.notification-icon-report, .notification-icon-automatic { color: #1552d6; }
.notification-item p { margin: 0; font-size: 11px; line-height: 1.45; }
.notification-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.supervision-form .criterion { padding: 13px 0; border-bottom: 1px solid #eff3f5; }
.criterion-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.criterion-head strong { font-size: 11px; }
.rating-options { display: flex; gap: 5px; }
.rating-options button { border: 1px solid var(--line); background: white; border-radius: 6px; padding: 5px 7px; font-size: 12px; }
.rating-options button.selected { background: #eef2ff; border-color: var(--teal); }
.toast-region { position: fixed; z-index: 80; right: 22px; bottom: 22px; display: grid; gap: 8px; max-width: min(360px, calc(100vw - 44px)); }
.toast { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border: 1px solid #d8eeea; border-radius: 9px; color: var(--ink); background: white; box-shadow: var(--shadow); font-size: 11px; animation: toast-in .25s ease both; }
.toast > span { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: #eef2ff; color: var(--teal-dark); font-weight: 800; }
.toast.info { border-color: #f2e3bb; }
.toast.info > span { background: #fff3d6; color: #9b732a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 761px) {
  .modal-backdrop { left: 50%; right: auto; width: 440px; transform: translateX(-50%); }
  .modal { width: 100%; }
}

@media (max-width: 380px) {
  .modal-backdrop { padding: 8px; }
  .modal-head, .modal-body { padding-left: 14px; padding-right: 14px; }
  .modal-footer { justify-content: stretch; }
  .modal-footer .button { flex: 1 1 0; }
  .radio-row { grid-template-columns: 1fr; }
}

@media (max-width: 1000px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-art { min-height: 390px; }
  .login-panel { width: min(460px, 86%); }
  .login-copy { margin-top: 50px; }
  .dashboard-grid, .content-grid, .people-layout, .structure-grid, .profile-columns { grid-template-columns: 1fr; }
  .task-grid, .book-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: .25s ease; box-shadow: 12px 0 35px rgba(16,42,67,.12); }
  .sidebar.open { transform: translateX(0); }
  .mobile-close, .menu-toggle { display: inline-grid; }
  .topbar { height: 66px; padding: 0 18px; gap: 10px; }
  .breadcrumbs { flex: 1; }
  .profile-trigger .caret { display: none; }
  .view-container { padding: 26px 18px 45px; }
  .view-header { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; }
  .header-actions .button { flex: 1; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  .data-table { min-width: 620px; }
  .table-card { overflow-x: auto; }
  .task-grid, .book-grid { grid-template-columns: 1fr; }
  .tabs { gap: 16px; overflow-x: auto; }
  .tab { flex: 0 0 auto; }
  .people-tree-tabs { gap: 0; padding: 0 15px; }
  .people-tree-tab { min-height: 46px; padding: 0 4px; font-size: 13px; }
  .people-tree-panel { padding: 0 15px 15px; }
  .people-structure-people { margin: 20px -15px -15px; }
  .people-structure-people .structure-people-title { padding: 14px 15px; }
  .week { gap: 3px; }
  .day { min-height: 49px; padding: 5px; }
  .day strong { margin-top: 4px; font-size: 12px; }
  .day .event { display: none; }
  .profile-hero { align-items: flex-start; flex-wrap: wrap; }
  .view-container.view-member, .view-container.view-profile { min-height: calc(100dvh - 76px); height: calc(100dvh - 76px); padding: 14px 18px 76px; }
  .view-member .profile-hero, .view-profile .profile-hero { padding: 13px; margin-bottom: 10px; gap: 11px; }
  .view-member .profile-hero .avatar-large, .view-profile .profile-hero .avatar-large { width: 56px; height: 56px; font-size: 16px; }
  .view-member .profile-hero h2, .view-profile .profile-hero h2 { font-size: 18px; }
  .view-member .tabs, .view-profile .tabs { gap: 13px; margin-bottom: 10px; }
  .view-member .tab, .view-profile .tab { padding-bottom: 8px; font-size: 10px; }
  .view-member .detail-card, .view-profile .detail-card { padding: 13px; }
  .followup { margin-left: 93px; border-left: 0; padding-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .onboarding-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .schedule-item { grid-template-columns: 52px 1fr; }
  .schedule-actions { grid-column: 2; }
  .login-art { min-height: 330px; padding: 30px 9%; }
  .login-message { margin: 40px 0 0; }
  .login-message h1 { font-size: 38px; }
  .art-stats { display: none; }
}

/* Conecta-2 access screen: one focused surface, without church-specific content. */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; background: radial-gradient(circle at 12% 18%, rgba(255,194,41,.2), transparent 28%), radial-gradient(circle at 88% 85%, rgba(49,93,245,.18), transparent 30%), #f8faff; }
.login-card { width: min(470px, 100%); padding: 42px 46px 34px; border: 1px solid rgba(18,57,184,.1); border-radius: 24px; background: rgba(255,255,255,.96); box-shadow: 0 22px 70px rgba(8,29,107,.14); text-align: center; }
.app-logo { display: block; width: min(300px, 90%); height: auto; margin: 0 auto 22px; border-radius: 10px; }
.login-kicker { margin: 0; color: var(--teal-dark); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.login-card h1 { margin: 15px auto 10px; max-width: 360px; color: var(--navy-deep); font-size: 28px; line-height: 1.12; letter-spacing: -.045em; }
.login-lead { margin: 0 auto 28px; max-width: 330px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-verse { margin: 0 auto 28px; color: var(--navy-deep); font-size: 15px; line-height: 1.4; font-weight: 750; letter-spacing: .04em; text-align: center; }
.login-card .form-stack { text-align: left; }
.login-card .button-large { margin-top: 4px; }
.login-card .login-options { margin-top: 21px; }
.login-card .demo-hint { margin-top: 24px; padding-top: 17px; font-size: 10px; line-height: 1.45; }
.login-card .remember-option { display: flex; align-items: center; gap: 8px; margin-top: -5px; color: var(--muted); font-size: 12px; font-weight: 650; cursor: pointer; }
.login-card .remember-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--navy); }
.login-screen { width: min(100%, 440px); min-height: 100dvh; margin: 0 auto; box-sizing: border-box; }
.login-card { width: 100%; box-sizing: border-box; }
.church-avatar img { display: block; width: 100%; height: 100%; padding: 5px; border-radius: 9px; background: white; object-fit: contain; }
.church-home-banner { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.church-home-banner img { width: 132px; height: 42px; padding: 5px 8px; border-right: 1px solid var(--line); object-fit: contain; }
.church-home-banner strong { display: block; color: var(--navy); font-size: 13px; }
.church-home-banner small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.view-container.view-dashboard:has(> .unlinked-header) { height: auto; max-height: none; min-height: 0; padding: 18px 18px calc(84px + env(safe-area-inset-bottom, 0px)); overflow: visible; }
.unlinked-header { display: grid; gap: 18px; margin-top: 0; }
.unlinked-header > .eyebrow { font-size: .875rem; letter-spacing: .08em; }
.unlinked-actions { display: grid; gap: 16px; min-width: 0; }
.unlinked-option { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 16px; min-width: 0; padding: 20px; border-radius: 18px; background: rgba(255,255,255,.98); box-shadow: 0 8px 22px rgba(8,29,107,.06); }
.unlinked-option-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 13px; color: var(--teal); background: #eef2ff; }
.unlinked-option-icon svg { width: 32px; height: 32px; }
.unlinked-option h1, .unlinked-option h2 { min-width: 0; margin: 0; color: var(--navy); font-size: clamp(1.25rem, 5.8vw, 1.5rem); line-height: 1.2; letter-spacing: -.035em; overflow-wrap: break-word; }
.unlinked-option .button { grid-column: 1 / -1; width: 100%; min-width: 0; min-height: 48px; height: auto; padding: 10px 12px; border-radius: 12px; font-size: 1rem; line-height: 1.25; white-space: normal; }
@media (max-width: 560px) {
  .login-card { padding: 32px 22px 27px; border-radius: 18px; }
  .login-card h1 { font-size: 25px; }
  .login-kicker { font-size: 10px; letter-spacing: .04em; }
  .church-home-banner img { width: 100px; }
  .unlinked-option { padding: 18px; gap: 14px; }
}
@media (max-height: 620px) {
  .view-container.view-dashboard:has(> .unlinked-header) { padding-top: 12px; }
  .unlinked-header, .unlinked-actions { gap: 12px; }
  .unlinked-option { grid-template-columns: 40px minmax(0, 1fr); padding: 12px; gap: 12px; }
  .unlinked-option-icon { width: 40px; height: 40px; border-radius: 11px; }
  .unlinked-option-icon svg { width: 28px; height: 28px; }
  .unlinked-option h1, .unlinked-option h2 { font-size: 1.25rem; }
  .unlinked-option .button { min-height: 44px; }
}

/* El acceso usa exactamente el mismo marco móvil que la aplicación. */
@media (min-width: 761px) {
  body:has(.login-screen) { background: #e9eef7; }
  .login-screen { padding: 28px 18px; }
}

/* Authenticated shell: personal workspace with the church identity in the header and fixed bottom navigation. */
.app-screen { display: block; min-height: 100vh; }
.app-screen .sidebar { display: none !important; }
.main-content { width: 100%; min-height: 100vh; padding-top: 92px; }
.topbar { position: fixed; z-index: 25; top: 0; right: 0; left: 0; height: 92px; padding: 0 10px; background: rgba(255,255,255,.97); box-shadow: 0 5px 24px rgba(8,29,107,.06); }
.church-top-lockup { position: absolute; left: 10px; top: 50%; display: flex; align-items: center; width: 170px; min-width: 0; transform: translateY(-50%); }
.church-logo-trigger { flex: 0 0 auto; display: block; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; line-height: 1; cursor: pointer; }
#church-top-logo-trigger { position: absolute; top: 50%; left: 10px; transform: translateY(-50%); }
.church-logo-trigger:focus-visible { outline: 2px solid var(--teal-dark); outline-offset: 3px; border-radius: 10px; }
.church-top-logo { width: 166px; height: 62px; object-fit: contain; }
.church-top-logo-placeholder { display: grid; place-items: center; width: 166px; height: 62px; border: 1px dashed #b9c7ea; border-radius: 10px; color: var(--teal-dark); background: #f4f6ff; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.church-top-lockup > div { flex: 1 1 auto; min-width: 0; }
.church-top-lockup strong { display: block; overflow: hidden; color: var(--navy); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.church-top-lockup small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.church-logo-edit { flex: 0 0 auto; color: var(--teal-dark); background: #eef2ff; }
.entity-responsible-autocomplete { position: relative; }
.entity-responsible-menu { position: absolute; z-index: 12; top: calc(100% + 4px); right: 0; left: 0; display: grid; max-height: 190px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 12px 26px rgba(12,34,56,.14); }
.entity-responsible-menu button { display: grid; gap: 2px; width: 100%; padding: 8px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.entity-responsible-menu button:hover, .entity-responsible-menu button:focus-visible { background: #eef3ff; outline: 0; }
.entity-responsible-menu strong { color: var(--navy); font-size: 11px; }
.entity-responsible-menu small { color: var(--muted); font-size: 9px; }
.topbar-actions { width: 88px; margin-left: auto; display: flex; align-items: center; justify-content: center; }
.profile-popover { position: fixed; top: 101px; right: 4%; }
.view-container { max-width: 1500px; padding-bottom: 122px; }
.dashboard-followup-grid { grid-template-columns: minmax(0, 1fr); }
.dashboard-home-stack { display: grid; gap: 14px; margin-top: 14px; }
.birthday-card { height: auto; padding: 18px; }
.birthday-list { display: grid; gap: 5px; margin-top: 10px; }
.birthday-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eff3f5; }
.birthday-row:last-child { border-bottom: 0; }
.birthday-person { min-width: 0; flex: 1; }
.birthday-person strong, .birthday-person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.birthday-person strong { color: var(--navy); font-size: 11px; }
.birthday-person small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.birthday-age { color: var(--teal-dark); font-size: 10px; font-weight: 800; white-space: nowrap; }
.followup-card { gap: 10px; }
.followup-card .card-title { margin-bottom: 0; }
.followup-status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.followup-status { display: grid; justify-items: center; gap: 5px; min-width: 0; padding: 0 1px; border: 0; color: var(--ink); background: transparent; text-align: center; }
.followup-status strong { display: grid; place-items: center; width: 48px; height: 48px; border: 4px solid currentColor; border-radius: 50%; font-size: 17px; line-height: 1; }
.followup-status span { overflow: hidden; max-width: 100%; color: var(--ink); font-size: 9px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.followup-status small { overflow: hidden; max-width: 100%; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.followup-status.recent { color: var(--green); }
.followup-status.attention { color: var(--yellow); }
.followup-status.late { color: var(--red); }
.followup-status.unknown { color: #8996a3; }
.followup-status:hover strong, .followup-status:focus-visible strong { box-shadow: 0 0 0 4px rgba(22, 71, 216, .1); }
.followup-results-card .card-title { align-items: center; }
.followup-results-card .card-title h3 { margin-bottom: 3px; }
.followup-results-count { display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 7px; border-radius: 999px; color: var(--navy); background: #eef2ff; font-size: 11px; font-weight: 800; }
.followup-person-row { cursor: pointer; }
.followup-person-row:hover, .followup-person-row:focus-visible { background: #f7f8fd; border-radius: 10px; outline: none; }
.followup-person-row .last-visit { max-width: 72px; }
.followup-results-card .birthday-list { max-height: 265px; overflow-y: auto; padding-right: 4px; }
.view-container.view-member, .view-container.view-profile { display: flex; flex-direction: column; min-height: calc(100dvh - 92px); height: calc(100dvh - 92px); padding-top: 20px; padding-bottom: 82px; overflow: hidden; }
.view-member .profile-hero, .view-profile .profile-hero { flex: 0 0 auto; padding: 16px; margin-bottom: 12px; gap: 13px; }
.view-member .profile-hero .avatar-large, .view-profile .profile-hero .avatar-large { width: 62px; height: 62px; font-size: 18px; }
.view-member .tabs, .view-profile .tabs { flex: 0 0 auto; margin-bottom: 12px; }
.view-member .member-tab-content, .view-profile .member-tab-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-bottom: 4px; }
.view-member .detail-card, .view-profile .detail-card { padding: 15px; }
@media (max-width: 760px) {
  .view-container.view-member, .view-container.view-profile { min-height: calc(100dvh - 76px); height: calc(100dvh - 76px); padding: 14px 18px 76px; }
  .view-member .profile-hero, .view-profile .profile-hero { padding: 13px; margin-bottom: 10px; gap: 11px; }
  .view-member .profile-hero .avatar-large, .view-profile .profile-hero .avatar-large { width: 56px; height: 56px; font-size: 16px; }
  .view-member .profile-hero h2, .view-profile .profile-hero h2 { font-size: 18px; }
  .view-member .tabs, .view-profile .tabs { gap: 13px; margin-bottom: 10px; }
  .view-member .tab, .view-profile .tab { padding-bottom: 8px; font-size: 10px; }
  .view-member .detail-card, .view-profile .detail-card { padding: 13px; }
}
.bottom-nav { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); height: 74px; padding: 8px 10px 9px; gap: 4px; border-top: 1px solid var(--line); background: rgba(255,255,255,.97); box-shadow: 0 -10px 30px rgba(8,29,107,.07); }
.bottom-nav .nav-item { width: 100%; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; margin: 0; padding: 5px 2px; border-radius: 10px; color: var(--muted); background: transparent; text-align: center; font-size: 10px; font-weight: 750; }
.bottom-nav .nav-item span { display: grid; place-items: center; width: 24px; height: 24px; font-size: 20px; line-height: 1; }
.bottom-nav .nav-item span svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav .nav-item[data-view="dashboard"] span { width: 30px; height: 30px; border-radius: 50%; background: #eef2ff; }
.bottom-nav .nav-item[data-view="dashboard"].active span { color: #fff; background: var(--navy); }
.bottom-nav .nav-item small { font-size: 9px; white-space: nowrap; }
.bottom-nav .nav-item:hover, .bottom-nav .nav-item.active { color: var(--navy); background: #eef2ff; box-shadow: none; }
.bottom-nav .nav-item.active span { color: var(--coral); }
.bottom-nav .nav-item em { display: none !important; }
.member-permissions-list { display: grid; gap: 10px; }
.member-permission-row { display: grid; grid-template-columns: minmax(190px, 1.4fr) 150px 115px auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcff; }
.member-permission-row.is-current-user { background: #f1f5fa; border-color: #d9e2ec; }
.permission-explanation { margin-bottom: 16px; padding: 13px 15px; border: 1px solid #dce8f1; border-radius: 10px; background: #f7fbfd; color: var(--muted); font-size: 10px; line-height: 1.5; }
.permission-explanation strong { display: block; margin-bottom: 6px; color: var(--navy); font-size: 11px; }
.permission-explanation p { margin: 5px 0 0; }
.permission-explanation b { color: var(--ink); }
.entity-node-actions { position: relative; margin-left: auto; }
.entity-node-actions .icon-button { padding: 2px 4px; }
.entity-actions-menu { position: absolute; right: 0; top: 25px; z-index: 8; min-width: 125px; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 12px 24px rgba(12,34,56,.14); }
.entity-actions-menu button { display: block; width: 100%; padding: 8px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; font-size: 10px; }
.entity-actions-menu button:hover { background: #f2f7fa; }
.member-permission-row .person-cell { min-width: 0; }
.permission-field, .permission-check { color: var(--muted); font-size: 10px; }
.permission-field select { display: block; width: 100%; margin-top: 5px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; font-size: 10px; }
.permission-check { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.permission-check input { accent-color: var(--teal-dark); }
.book-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 14px; }
.book-actions .button { padding: 8px 10px; font-size: 10px; }
.book-actions .link-button { font-size: 10px; }
@media (min-width: 761px) {
  body { background: #e9eef7; }
  .app-screen { width: min(100%, 440px); margin: 0 auto; overflow: hidden; background: #f8faff; box-shadow: 0 0 38px rgba(8,29,107,.14); }
  .app-screen .topbar { left: 50%; right: auto; width: min(100%, 440px); transform: translateX(-50%); }
  .app-screen .bottom-nav { right: auto; left: 50%; width: min(100%, 440px); transform: translateX(-50%); }
  .app-screen .profile-popover { right: calc(50% - 220px + 16px); }
}
@media (max-width: 760px) {
  .member-permission-row { grid-template-columns: 1fr 1fr; }
  .member-permission-row .person-cell { grid-column: 1 / -1; }
  .member-permission-row .button { width: 100%; }
}
@media (max-width: 760px) {
  .main-content { padding-top: 76px; }
  .topbar { height: 76px; padding: 0 10px; }
  .topbar-actions { width: 76px; }
  #church-top-logo-trigger { left: 10px; }
  .church-top-logo { width: 132px; height: 48px; }
  .church-top-logo-placeholder { width: 132px; height: 48px; font-size: 9px; }
  .church-top-lockup strong { font-size: 10px; }
  .church-top-lockup small { display: block; margin-top: 2px; font-size: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .church-logo-edit { width: 28px; height: 28px; }
  .profile-popover { top: 84px; right: 10px; }
  .view-container { padding: 26px 18px 108px; }
  .bottom-nav { height: 68px; padding-right: 6px; padding-left: 6px; gap: 2px; }
}

/* La pantalla de inicio cabe en la ventana móvil sin desplazamiento. */
@media (max-width: 760px) {
  .view-container.view-dashboard {
    height: calc(100dvh - 76px);
    min-height: 0;
    padding: 14px 18px 76px;
    overflow: hidden;
  }
  .dashboard-home {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .dashboard-home .view-header { flex: 0 0 auto; margin-bottom: 10px; }
  .dashboard-home .view-header h1 { margin: 3px 0 0; font-size: 24px; }
  .dashboard-home .dashboard-followup-grid { flex: 0 0 auto; }
  .dashboard-home .metric-card { gap: 10px; padding: 14px; }
  .dashboard-home .metric-value strong { font-size: 27px; }
  .dashboard-home-stack { min-height: 0; flex: 0 0 auto; margin-top: 10px; }
  .dashboard-home .birthday-card { min-height: 0; height: auto; padding: 14px; overflow: visible; }
  .dashboard-home .birthday-list { min-height: 0; margin-top: 5px; gap: 0; }
  .dashboard-home .birthday-row { padding: 6px 0; }
}

/* En escritorio la app sigue usando su marco móvil de 440 px. */
@media (min-width: 761px) {
  .view-container.view-dashboard {
    height: calc(100dvh - 92px);
    min-height: 0;
    padding: 22px 22px 82px;
    overflow: hidden;
  }
  .dashboard-home {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .dashboard-home .view-header { flex: 0 0 auto; margin-bottom: 14px; }
  .dashboard-home .dashboard-followup-grid { flex: 0 0 auto; }
  .dashboard-home .metric-card { gap: 12px; padding: 16px; }
  .dashboard-home-stack { min-height: 0; flex: 0 0 auto; margin-top: 12px; }
  .dashboard-home .birthday-card { min-height: 0; height: auto; padding: 16px; overflow: visible; }
  .dashboard-home .birthday-list { min-height: 0; margin-top: 6px; gap: 0; }
  .dashboard-home .birthday-row { padding: 7px 0; }
}

/* Inicio móvil: aprovecha la altura disponible y evita el desplazamiento vertical. */
@media (max-width: 760px) {
  .view-container.view-dashboard {
    height: calc(100dvh - 76px);
    max-height: calc(100dvh - 76px);
    min-height: 0;
    padding: 10px 16px 68px;
    overflow: hidden;
  }
  .view-container.view-dashboard .dashboard-home {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .view-container.view-dashboard .dashboard-home .view-header { margin-bottom: 7px; }
  .view-container.view-dashboard .dashboard-home .view-header h1 { margin: 2px 0 0; font-size: 22px; }
  .view-container.view-dashboard .dashboard-home .metric-card { gap: 7px; padding: 11px; }
  .view-container.view-dashboard .dashboard-home .card-title h3 { font-size: 13px; }
  .view-container.view-dashboard .followup-status-grid { gap: 2px; }
  .view-container.view-dashboard .followup-status { gap: 3px; }
  .view-container.view-dashboard .followup-status strong { width: 42px; height: 42px; border-width: 3px; font-size: 15px; }
  .view-container.view-dashboard .followup-status span { font-size: 8px; }
  .view-container.view-dashboard .followup-status small { font-size: 7px; }
  .view-container.view-dashboard .dashboard-home-stack { min-height: 0; flex: 0 0 auto; margin-top: 7px; }
  .view-container.view-dashboard .dashboard-home .birthday-card { padding: 11px 12px; }
  .view-container.view-dashboard .dashboard-home .birthday-list { margin-top: 2px; }
  .view-container.view-dashboard .dashboard-home .birthday-row { gap: 8px; padding: 4px 0; }
  .view-container.view-dashboard .dashboard-home .birthday-row .avatar-small { width: 28px; height: 28px; font-size: 10px; }
  .view-container.view-dashboard .dashboard-home .birthday-person strong { font-size: 10px; }
  .view-container.view-dashboard .dashboard-home .birthday-person small { margin-top: 2px; font-size: 8px; }
  .view-container.view-dashboard .dashboard-home .birthday-age { font-size: 9px; }
}

@media (max-width: 760px) and (max-height: 720px) {
  .view-container.view-dashboard { padding-top: 7px; }
  .view-container.view-dashboard .dashboard-home .view-header { margin-bottom: 5px; }
  .view-container.view-dashboard .dashboard-home .metric-card { padding: 9px 10px; }
  .view-container.view-dashboard .dashboard-home .birthday-card { padding: 9px 10px; }
  .view-container.view-dashboard .dashboard-home .birthday-row { padding: 3px 0; }
}

/* Escala visual del contenido: más aire y listados legibles sin tocar las barras fijas. */
.view-container:not(.view-dashboard):not(.view-member):not(.view-profile) { padding-top: 22px; }
.view-container:not(.view-dashboard):not(.view-member):not(.view-profile) .view-header { margin-bottom: 18px; }
@media (max-width: 760px) {
  .view-container:not(.view-dashboard):not(.view-member):not(.view-profile) { padding-top: 20px; }
  .view-container:not(.view-dashboard):not(.view-member):not(.view-profile) .view-header { margin-bottom: 15px; }
  .view-container.view-dashboard { padding: 18px 16px 68px; }
  .view-container.view-dashboard .dashboard-home .view-header { margin-bottom: 13px; }
  .view-container.view-dashboard .dashboard-home .view-header h1 { font-size: 24px; }
  .view-container.view-dashboard .dashboard-home .metric-card { gap: 12px; padding: 16px 15px; }
  .view-container.view-dashboard .dashboard-home .card-title h3 { font-size: 16px; }
  .view-container.view-dashboard .followup-status-grid { gap: 4px; }
  .view-container.view-dashboard .followup-status { gap: 5px; padding: 0 2px; }
  .view-container.view-dashboard .followup-status strong { width: 54px; height: 54px; border-width: 4px; font-size: 19px; }
  .view-container.view-dashboard .followup-status span { font-size: 9px; }
  .view-container.view-dashboard .followup-status small { font-size: 8px; }
  .view-container.view-dashboard .dashboard-home-stack { margin-top: 14px; }
  .view-container.view-dashboard .dashboard-home .birthday-card { padding: 16px 15px; }
  .view-container.view-dashboard .dashboard-home .birthday-list { margin-top: 7px; }
  .view-container.view-dashboard .dashboard-home .birthday-row { gap: 10px; padding: 9px 0; }
  .view-container.view-dashboard .dashboard-home .birthday-row .avatar-small { width: 36px; height: 36px; font-size: 11px; }
  .view-container.view-dashboard .dashboard-home .birthday-person strong { font-size: 12px; }
  .view-container.view-dashboard .dashboard-home .birthday-person small { font-size: 9px; }
  .view-container.view-dashboard .dashboard-home .birthday-age { font-size: 11px; }
}
@media (max-width: 760px) and (max-height: 720px) {
  .view-container.view-dashboard { padding-top: 12px; }
  .view-container.view-dashboard .dashboard-home .view-header { margin-bottom: 8px; }
  .view-container.view-dashboard .dashboard-home .metric-card { padding: 13px 12px; }
  .view-container.view-dashboard .followup-status strong { width: 48px; height: 48px; font-size: 17px; }
  .view-container.view-dashboard .dashboard-home-stack { margin-top: 10px; }
  .view-container.view-dashboard .dashboard-home .birthday-card { padding: 12px; }
  .view-container.view-dashboard .dashboard-home .birthday-row { padding: 6px 0; }
  .view-container.view-dashboard .dashboard-home .birthday-row .avatar-small { width: 32px; height: 32px; }
}

/* El listado de personas de Estructura debe caber dentro del marco móvil. */
@media (max-width: 760px) {
  .view-people .people-structure-people .data-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }
  .view-people .people-structure-people .data-table th,
  .view-people .people-structure-people .data-table td {
    padding-left: 9px;
    padding-right: 9px;
    overflow-wrap: anywhere;
  }
  .view-people .people-structure-people .data-table th:nth-child(1),
  .view-people .people-structure-people .data-table td:nth-child(1) { width: 58%; }
  .view-people .people-structure-people .data-table th:nth-child(2),
  .view-people .people-structure-people .data-table td:nth-child(2) { width: 27%; }
  .view-people .people-structure-people .data-table th:nth-child(3),
  .view-people .people-structure-people .data-table td:nth-child(3) { width: 15%; }
  .view-people .people-structure-people .person-cell { min-width: 0; gap: 7px; }
  .view-people .people-structure-people .person-cell > div { min-width: 0; }
  .view-people .people-structure-people .person-cell strong,
  .view-people .people-structure-people .person-cell small,
  .view-people .people-structure-people .last-visit {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .view-people .people-structure-people .table-action { padding: 6px 7px; font-size: 9px; }
}

/* Discípulos: encabezado y formulario más compactos. */
.button-compact { min-height: 35px; padding: 0 14px; font-size: 11px; box-shadow: none; }
.view-container.view-people { padding-top: 14px; }
.view-people .view-header { margin-bottom: 12px; }
.view-people .people-header-actions { margin-left: auto; }
.view-calendar .view-header { margin-bottom: 18px; }
.view-calendar .compact-header-actions { margin-left: auto; }
.view-structure .view-header .header-actions { margin-left: auto; }
.view-structure .view-header { margin-bottom: 12px; }
.view-structure .structure-layout { gap: 10px; }
.view-structure .structure-tree-card { padding: 15px 17px; }
.view-structure .structure-tree-card .tree-root { margin-top: 12px; padding: 10px; }
.view-structure .structure-people-title { padding: 13px 17px; }
.view-structure .structure-empty { padding: 18px 17px; }
.view-structure .button-compact { min-height: 32px; padding: 0 12px; font-size: 10px; }
.member-person-grid { gap: 10px 12px; }
.member-person-grid label { font-size: 10px; }
.member-person-grid input, .member-person-grid select { margin-top: 5px; padding: 9px 10px; font-size: 10px; }
.member-person-grid small.form-help { display: block; margin-top: 4px; font-size: 9px; }
@media (max-width: 760px) {
  .view-container.view-people { padding-top: 10px; }
  .view-people .view-header { flex-direction: row; align-items: center; margin-bottom: 8px; }
  .view-people .people-header-actions { width: auto; }
  .view-people .people-header-actions .button { flex: 0 0 auto; }
  .view-calendar .view-header { flex-direction: row; align-items: center; }
  .view-calendar .compact-header-actions { width: auto; }
  .view-calendar .compact-header-actions .button { flex: 0 0 auto; }
  .view-structure .view-header .header-actions { width: auto; }
  .view-structure .view-header .header-actions .button { flex: 0 0 auto; }
  .view-structure .view-header { flex-direction: row; align-items: center; }
  .member-person-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.member-person-grid .full { grid-column: 1 / -1; }
}

.invite-callout { display: grid; gap: 4px; padding: 13px 14px; margin-bottom: 14px; border: 1px solid rgba(30, 58, 138, .16); border-radius: 14px; background: rgba(30, 58, 138, .05); }
.invite-callout strong { color: var(--ink); font-size: 13px; }

/* Barra superior: el acceso al perfil se representa solo con la foto. */
.topbar-actions .profile-trigger { gap: 0; }
.topbar-actions .profile-trigger-name { display: none; }
.topbar-actions .profile-trigger .avatar { width: 50px; height: 50px; font-size: 15px; }

/* Alinea el logo y el avatar con un margen lateral equivalente. */
.topbar { padding-left: 6px; padding-right: 6px; }
#church-top-logo-trigger { left: 6px; }
.topbar-actions { width: 88px; }

@media (max-width: 760px) {
  .topbar { padding-left: 6px; padding-right: 6px; }
  #church-top-logo-trigger { left: 6px; }
  .topbar-actions { width: 88px; }
}

/* Marco móvil fijo para la vista local, también cuando se abre en un navegador ancho. */
.login-screen, .app-screen { width: min(100%, 440px); min-height: 100dvh; margin: 0 auto; box-sizing: border-box; }
.app-screen { overflow: hidden; background: #f8faff; box-shadow: 0 0 38px rgba(8,29,107,.14); }
.app-screen .topbar, .app-screen .bottom-nav { right: auto; left: 50%; width: min(100%, 440px); transform: translateX(-50%); }
.login-screen { display: flex; align-items: center; justify-content: center; padding: 28px 18px 32px; background: #f8faff; }
.login-card { width: 100%; padding: 26px 4px 20px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.login-card .app-logo { width: min(250px, 82%); margin-bottom: 20px; }
.login-card .app-logo { border-radius: 0; mix-blend-mode: multiply; }
.invite-callout span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.invite-message { min-height: 220px; font-size: 12px; line-height: 1.55; background: #fbfcfe; }

/* Ficha de crear/modificar miembro: compacta y completa dentro del marco móvil. */
.modal.modal-member-form { max-height: calc(100dvh - 24px); overflow: hidden; }
.modal-member-form .modal-head { padding: 12px 13px 9px; }
.modal-member-form .modal-head h2 { font-size: 17px; }
.modal-member-form .modal-head p { margin-top: 3px; font-size: 10px; }
.modal-member-form .modal-body { padding: 10px 13px 12px; overflow: hidden; }
.modal-member-form #member-form { display: flex; flex-direction: column; }
.member-editor-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.member-photo-picker { position: relative; display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 52px; overflow: hidden; border: 2px dashed #b5c3e5; border-radius: 50%; background: #f4f7ff; cursor: pointer; }
.member-photo-picker input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.member-photo-picker img { display: block; width: 100%; height: 100%; object-fit: cover; }
.member-photo-plus { color: var(--teal); font-size: 32px; font-weight: 300; line-height: 1; }
.member-photo-copy { display: flex; flex: 1 1 auto; min-width: 0; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.member-photo-copy strong { color: var(--navy); font-size: 11px; }
.member-photo-copy small { color: var(--muted); font-size: 9px; }
.modal-member-form .member-person-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 7px; }
.modal-member-form .member-person-grid label { color: var(--ink); font-size: 9px; }
.modal-member-form .member-person-grid input,
.modal-member-form .member-person-grid select { min-height: 29px; margin-top: 3px; padding: 6px 7px; font-size: 10px; }
.modal-member-form .member-person-grid .full,
.modal-member-form .member-consent-field,
.modal-member-form .member-consent-help { grid-column: 1 / -1; }
.modal-member-form .member-person-grid .form-help { margin-top: 2px; font-size: 8px; line-height: 1.2; }
.modal-member-form .member-consent-field input[type=file] { min-height: 27px; padding: 5px; font-size: 9px; }
.modal-member-form .member-consent-help { margin: 0; font-size: 8px; line-height: 1.2; }
.modal-member-form .modal-footer { margin-top: 8px; }
.modal-member-form .modal-footer .button { min-height: 34px; padding: 0 12px; font-size: 10px; }
.member-photo-crop { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 8px 10px; align-items: center; margin: 0 0 8px; padding: 7px 8px; border: 1px solid #e4e9f5; border-radius: 10px; background: #fbfcff; }
.member-photo-crop-stage { position: relative; width: 78px; height: 78px; overflow: hidden; border: 2px solid var(--teal); border-radius: 50%; background: #eef2ff; }
.member-photo-crop-stage img { position: absolute; display: block; max-width: none; }
.member-photo-crop-controls { display: grid; gap: 3px; min-width: 0; }
.member-photo-crop-controls label { display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 6px; color: var(--ink); font-size: 8px; font-weight: 750; }
.member-photo-crop-controls input[type=range] { width: 100%; min-width: 0; height: 14px; margin: 0; padding: 0; accent-color: var(--teal); }
.member-photo-crop-help { grid-column: 1 / -1; color: var(--muted); font-size: 8px; line-height: 1.25; }
.church-logo-crop { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 10px; align-items: center; margin: 10px 0 8px; padding: 7px 8px; border: 1px solid #e4e9f5; border-radius: 10px; background: #fbfcff; }
.church-logo-crop-stage { position: relative; width: 150px; height: 58px; overflow: hidden; border: 2px solid var(--teal); border-radius: 8px; background: #eef2ff; }
.church-logo-crop-stage img { position: absolute; display: block; max-width: none; }
.church-logo-crop-controls { display: grid; gap: 3px; min-width: 0; }
.church-logo-crop-controls label { display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 6px; color: var(--ink); font-size: 8px; font-weight: 750; }
.church-logo-crop-controls input[type=range] { width: 100%; min-width: 0; height: 14px; margin: 0; padding: 0; accent-color: var(--teal); }
.church-logo-crop-help { grid-column: 1 / -1; color: var(--muted); font-size: 8px; line-height: 1.25; }
@media (max-width: 680px) {
  .modal-member-form .member-person-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Citas: formulario compacto y usable dentro del marco móvil. */
#modal-root .modal.modal-appointment-form { display: flex; flex-direction: column; max-height: 100dvh; overflow: hidden; }
#modal-root .modal-appointment-form .modal-head { flex: 0 0 auto; padding: 12px 14px 10px; }
#modal-root .modal-appointment-form .modal-head h2 { font-size: 17px; }
#modal-root .modal-appointment-form .modal-head p { margin-top: 3px; font-size: 10px; }
#modal-root .modal-appointment-form .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 11px 13px 12px; }
#modal-root .modal-appointment-form .appointment-form-grid { gap: 8px; }
#modal-root .modal-appointment-form label { font-size: 10px; }
#modal-root .modal-appointment-form input,
#modal-root .modal-appointment-form select { min-height: 34px; margin-top: 3px; padding: 7px 9px; font-size: 11px; }
#modal-root .modal-appointment-form input[type="date"],
#modal-root .modal-appointment-form input[type="time"] { height: 34px; border: 1px solid #d9e2ea; border-radius: 8px; color: var(--ink); background: #fff; font: inherit; font-size: 11px; line-height: 1.2; }
#modal-root .modal-appointment-form textarea { min-height: 52px; padding: 7px 9px; font-size: 11px; }
#modal-root .modal-appointment-form .appointment-task-section { margin-top: 9px; padding-top: 9px; }
#modal-root .modal-appointment-form .appointment-task-add { min-height: 34px; padding: 0 11px; font-size: 11px; }
#modal-root .modal-appointment-form .appointment-task-fields { margin-top: 8px; padding: 8px; }
#modal-root .modal-appointment-form .appointment-task-fields .form-grid { gap: 8px; }
#modal-root .modal-appointment-form .modal-footer { position: sticky; bottom: 0; z-index: 1; margin-top: 10px; padding-top: 9px; padding-bottom: 2px; border-top: 1px solid var(--line); background: #fff; }
#modal-root .modal-appointment-form .modal-footer .button { min-height: 38px; padding: 0 12px; font-size: 11px; }
@media (max-width: 380px) {
  #modal-root .modal-appointment-form .modal-body { padding-left: 11px; padding-right: 11px; }
  #modal-root .modal-appointment-form .appointment-task-fields { padding: 7px; }
  #modal-root .modal-appointment-form .modal-footer .button { padding: 0 9px; font-size: 10px; }
}

/* Proyecto 2: actividad centrada en la persona que realiza el seguimiento. */
.view-container.view-activity { padding-top: 14px; }
.view-activity .view-header { margin-bottom: 12px; }
.view-activity .view-header h1 { margin-bottom: 0; }
.activity-card { padding: 16px 18px; }
.activity-card .card-title { align-items: flex-start; }
.activity-card .card-title small { margin-left: auto; text-align: right; }
.activity-card-title { align-items: flex-start !important; gap: 8px; }
.activity-card-title > div:first-child { min-width: 0; }
.activity-card-title > div:first-child h3 { white-space: nowrap; }
.activity-card-title .activity-actor-picker { display: grid; align-content: start; flex: 0 1 190px; max-width: 190px; min-width: 0; gap: 4px; margin-top: 0; margin-left: auto; }
.activity-card-title .activity-actor-picker > label { margin: 0; text-align: center; white-space: nowrap; }
.activity-card-title .activity-actor-picker > label { font-size: 11px; }
.activity-card-title .activity-actor-picker .activity-actor-search-wrap { min-width: 0; flex: 1 1 auto; }
.activity-card-title .activity-actor-picker .activity-actor-search-wrap > input { min-height: 34px; }
.activity-card-title .activity-actor-picker .activity-actor-search-wrap > input { min-height: 36px; }
.activity-actor-picker { margin-top: 10px; }
.activity-actor-picker > label { display: block; margin-bottom: 6px; color: var(--navy); font-size: 10px; font-weight: 750; }
.activity-actor-search-wrap { position: relative; }
.activity-actor-search { width: 100%; }
.activity-actor-search-wrap > input { width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; font: inherit; font-size: 11px; outline: none; }
.activity-actor-search-wrap > input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(31, 155, 142, .12); }
.activity-autocomplete-menu { position: absolute; z-index: 8; top: calc(100% + 5px); right: 0; left: 0; max-height: 210px; overflow-y: auto; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 12px 25px rgba(24, 42, 61, .14); }
.activity-autocomplete-option { display: flex; align-items: center; width: 100%; gap: 8px; padding: 7px; border: 0; border-radius: 8px; color: var(--ink); background: transparent; font: inherit; font-size: 10px; font-weight: 750; text-align: left; cursor: pointer; }
.activity-autocomplete-option:hover, .activity-autocomplete-option.active { color: var(--navy); background: #eefaf8; }
.activity-autocomplete-option .avatar { width: 28px; height: 28px; flex-basis: 28px; font-size: 9px; }
.activity-autocomplete-empty { margin: 9px 7px; color: var(--muted); font-size: 10px; }
.activity-selected { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.activity-selected strong, .activity-selected small { display: block; }
.activity-selected strong { color: var(--navy); font-size: 13px; }
.activity-selected small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.activity-selected-person { min-width: 0; flex: 1 1 auto; }
.activity-notify-toggle { display: inline-flex; align-items: center; gap: 9px; margin: 0 8px 0 auto; color: var(--navy); font-size: 10px; font-weight: 750; white-space: nowrap; cursor: pointer; }
.activity-notify-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--teal); cursor: pointer; }
.activity-divider { width: calc(100% - 24px); height: 1px; margin: 10px auto 0; background: var(--line); }
.activity-divider + .activity-record-list { margin-top: 9px; }
.activity-work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.activity-record-list { display: grid; gap: 8px; margin-top: 12px; }
.activity-record { display: flex; align-items: flex-start; gap: 9px; padding: 10px 0 10px 8px; border-left: 3px solid #3f6fda; border-top: 1px solid var(--line); }
.activity-appointment-record { gap: 8px; }
.activity-appointment-record .appointment-task-action { align-self: center; }
.activity-record.appointment-task-pending { border-left-color: var(--yellow); }
.activity-record.appointment-task-done { border-left-color: var(--green); }
.activity-record-clickable { cursor: pointer; border-radius: 8px; transition: background .18s ease; }
.activity-record-clickable:hover, .activity-record-clickable:focus-visible { background: #f7fbff; outline: none; }
.activity-record:first-child { border-top: 0; }
.activity-record-mark { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 25px; border-radius: 50%; color: var(--teal-dark); background: #e7f7f4; font-size: 12px; }
.activity-record-main { min-width: 0; }
.activity-record-main strong, .activity-record-main span, .activity-record-main small { display: block; }
.activity-record-main strong { overflow: hidden; color: var(--navy); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.activity-record-main span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.activity-task-status { color: var(--yellow) !important; font-weight: 800; }
.activity-task-status.is-done { color: var(--green) !important; }
.activity-record-date-box { display: grid; place-items: center; align-self: center; width: 48px; height: 48px; flex: 0 0 48px; margin-left: auto; border: 1px solid #dce5f8; border-radius: 9px; color: var(--navy); background: #eef2ff; text-align: center; }
.activity-record-date-box strong, .activity-record-date-box small { display: block; }
.activity-record-date-box strong { color: var(--navy); font-size: 16px; line-height: 1; }
.activity-record-date-box small { margin-top: 3px; color: var(--teal-dark); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.activity-private-detail { overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.activity-empty { padding: 22px; }
.activity-only-grid { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 760px) {
  .view-container.view-activity { padding-top: 10px; }
  .view-activity .view-header { display: block; margin-bottom: 8px; }
  .activity-card { padding: 12px 13px; }
  .activity-card .card-title small { max-width: 150px; }
  .activity-work-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
  .activity-card-title { align-items: flex-start !important; flex-direction: row; gap: 8px; }
  .activity-card-title > div:first-child { flex: 0 0 auto; padding-top: 8px; }
  .activity-card-title > div:first-child h3 { white-space: nowrap; font-size: 12px; }
  .activity-card-title .activity-actor-picker { width: auto; flex: 0 1 190px; max-width: 190px; min-width: 0; margin-left: auto; }
  .activity-card-title .activity-actor-picker > label { font-size: 9px; }
  .activity-card-title .activity-actor-picker > label { font-size: 10px; }
  .activity-card-title .activity-actor-picker .activity-actor-search-wrap > input { min-height: 32px; padding: 8px 9px; font-size: 10px; }
  .activity-selected { margin-top: 9px; padding-top: 9px; }
}
@media (max-width: 520px) {
  .activity-card-title { align-items: flex-start !important; flex-direction: row; gap: 7px; }
  .activity-card-title > div:first-child { padding-top: 7px; }
  .activity-card-title > div:first-child h3 { font-size: 11px; }
  .activity-card-title .activity-actor-picker { width: auto; min-width: 0; flex: 0 1 190px; flex-basis: 0; }
}

/* Los formularios deben respetar exactamente el mismo marco móvil que la app. */
#modal-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#modal-root .modal-backdrop { position: absolute; inset: 0; width: auto; max-width: none; padding: 0; transform: none; pointer-events: auto; }
#modal-root .modal { width: 100%; max-width: 100%; min-width: 0; max-height: 100%; border-radius: 0; overflow-x: hidden; }
@media (min-width: 761px) {
  #modal-root { left: 50%; right: auto; width: min(440px, 100vw); transform: translateX(-50%); }
}

/* Contención final para evitar cualquier desbordamiento horizontal del formulario. */
html, body { max-width: 100%; overflow-x: hidden; }
#modal-root, #modal-root .modal-backdrop, #modal-root .modal, #modal-root .modal-body, #modal-root form { max-width: 100%; overflow-x: hidden; }
#modal-root .modal-body, #modal-root form, #modal-root .form-grid { min-width: 0; }
#modal-root input[type="file"] { font-size: 9px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  #modal-root .modal-appointment-form .appointment-form-grid,
  #modal-root .modal-appointment-form .appointment-task-fields .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #modal-root .modal-appointment-form .appointment-form-grid .full,
  #modal-root .modal-appointment-form .appointment-task-fields .form-grid .full { grid-column: 1 / -1; }
}

/* Carga inicial: no se muestran vistas parciales mientras llega la iglesia desde Supabase. */
.view-container.view-loading { display: grid; place-items: center; min-height: calc(100dvh - 92px); padding: 18px; }
.app-loading { width: min(100%, 340px); padding: 28px 20px; text-align: center; }
.app-loading-mark { display: grid; place-items: center; width: 42px; height: 42px; margin: 0 auto 12px; border-radius: 50%; color: white; background: var(--teal); box-shadow: 0 8px 20px rgba(22,71,216,.2); animation: app-loading-pulse 1.2s ease-in-out infinite; }
.app-loading strong, .app-loading small { display: block; }
.app-loading strong { color: var(--navy); font-size: 14px; }
.app-loading small { margin-top: 6px; color: var(--muted); font-size: 10px; }
.app-screen.is-loading .bottom-nav, .app-screen.is-loading .profile-trigger, .app-screen.is-loading #church-top-logo-trigger { pointer-events: none; opacity: .5; }
@keyframes app-loading-pulse { 50% { transform: scale(1.08); opacity: .72; } }

/* El selector de actividad nunca puede empujar la tarjeta fuera del ancho del móvil. */
.activity-card-title { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 190px); align-items: start; gap: 8px; width: 100%; min-width: 0; }
.activity-card-title > div:first-child { min-width: 0; align-self: center; }
.activity-card-title > div:first-child h3 { max-width: 100%; overflow-wrap: anywhere; white-space: normal; }
.activity-card-title .activity-actor-picker { width: 100%; max-width: 190px; min-width: 0; margin-left: 0; justify-self: end; }
.activity-card-title .activity-actor-picker .activity-actor-search-wrap, .activity-card-title .activity-actor-picker .activity-actor-search-wrap > input { width: 100%; min-width: 0; max-width: 100%; }
.activity-card-title .activity-actor-picker > label { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .view-container.view-loading { min-height: calc(100dvh - 76px); }
  .activity-card-title { grid-template-columns: minmax(0, 1fr) minmax(0, 190px); }
  .activity-card-title > div:first-child { padding-top: 7px; }
  .activity-card-title > div:first-child h3 { font-size: 11px; line-height: 1.2; }
  .activity-card-title .activity-actor-picker { max-width: 190px; }
}
@media (max-width: 380px) {
  .activity-card-title { grid-template-columns: minmax(0, 1fr) minmax(0, 160px); gap: 6px; }
  .activity-card-title > div:first-child h3 { font-size: 10px; }
  .activity-card-title .activity-actor-picker { max-width: 160px; }
  .activity-card-title .activity-actor-picker > label { font-size: 9px; }
}

/* Actividad: selector limpio, sin repetir la persona seleccionada en el mismo recuadro. */
.view-activity > article.activity-card { padding: 14px 18px; }
.view-activity > article.activity-card .activity-card-title { display: block; }
.view-activity > article.activity-card .activity-card-title > div:first-child { display: none; }
.view-activity > article.activity-card .activity-actor-picker { display: grid; grid-template-columns: 1fr; width: min(100%, 330px); max-width: 330px; gap: 5px; margin: 0 auto; }
.view-activity > article.activity-card .activity-actor-picker > label { margin: 0; text-align: center; font-size: 12px; }
.view-activity > article.activity-card .activity-actor-picker .activity-actor-search-wrap,
.view-activity > article.activity-card .activity-actor-picker .activity-actor-search-wrap > input { width: 100%; max-width: 100%; min-width: 0; }
.view-activity > article.activity-card > .activity-selected { display: none; }
@media (max-width: 760px) {
  .view-activity > article.activity-card { padding: 11px 13px; }
  .view-activity > article.activity-card .activity-actor-picker { width: min(100%, 300px); max-width: 300px; }
  .view-activity > article.activity-card .activity-actor-picker > label { font-size: 11px; }
}

/* Actividad: selección en una línea y persona seleccionada en una segunda fila. */
.view-activity > article.activity-card .activity-card-title { display: block; }
.view-activity > article.activity-card .activity-card-title > div:first-child { display: none; }
.view-activity > article.activity-card .activity-card-title .activity-actor-picker { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; width: 100%; max-width: none; gap: 10px; margin: 0; }
.view-activity > article.activity-card .activity-card-title .activity-actor-picker > label { margin: 0; text-align: left; font-size: 11px; }
.view-activity > article.activity-card .activity-card-title .activity-actor-search-wrap,
.view-activity > article.activity-card .activity-card-title .activity-actor-search-wrap > input { width: 100%; min-width: 0; max-width: 100%; }
.view-activity > article.activity-card > .activity-selected { display: flex; margin-top: 11px; padding-top: 10px; }
@media (max-width: 380px) {
  .view-activity > article.activity-card .activity-card-title .activity-actor-picker { gap: 7px; }
  .view-activity > article.activity-card .activity-card-title .activity-actor-picker > label { font-size: 10px; }
}

/* Reportes de citas: selector breve y notificaciones accionables. */
.report-intro { margin: 0 0 10px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.report-superior-list { display: grid; gap: 8px; max-height: 230px; overflow-y: auto; margin: 10px 0 2px; padding-right: 2px; }
.report-superior-option { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; }
.report-superior-option:has(input:checked) { border-color: var(--teal); background: #f0fbf9; box-shadow: 0 0 0 2px rgba(31, 155, 142, .10); }
.report-superior-option input { width: 16px; height: 16px; flex: 0 0 16px; margin: 0; accent-color: var(--teal); }
.report-superior-option span { display: grid; min-width: 0; gap: 2px; }
.report-superior-option strong { overflow: hidden; color: var(--navy); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.report-superior-option small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.notification-clickable { cursor: pointer; }
.notification-clickable:hover, .notification-clickable:focus-visible { background: #f2f8ff; outline: none; }
.report-shared-note { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
#modal-root .member-photo-crop,
#modal-root .church-logo-crop {
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px 12px;
}

#modal-root .church-logo-crop {
  grid-template-columns: 150px minmax(0, 1fr);
}

.crop-touch-stage {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: grab;
}

.crop-touch-stage.is-dragging { cursor: grabbing; }
.crop-touch-stage img { pointer-events: none; user-select: none; -webkit-user-drag: none; }

.crop-touch-tools {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
}

.crop-touch-tools strong { color: var(--navy); font-size: 10px; }
.crop-touch-tools small { color: var(--muted); font-size: 8px; line-height: 1.35; }
.crop-touch-tools .crop-reset-button { min-height: 27px; margin-top: 2px; padding: 5px 9px; font-size: 9px; }
.crop-action-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.crop-action-row .button { min-width: 0; }

@media (max-width: 460px) {
  #modal-root .member-photo-crop { grid-template-columns: 86px minmax(0, 1fr); gap: 7px 9px; }
  #modal-root .church-logo-crop { grid-template-columns: 126px minmax(0, 1fr); gap: 7px 9px; }
  #modal-root .church-logo-crop-stage { width: 126px; height: 52px; }
}

/* Citas: reducir los huecos del formulario sin perder legibilidad en móvil. */
#modal-root .modal-appointment-form .modal-head { padding: 8px 12px 6px; }
#modal-root .modal-appointment-form .modal-head h2 { font-size: 16px; }
#modal-root .modal-appointment-form .modal-head p { margin-top: 2px; font-size: 9px; }
#modal-root .modal-appointment-form .modal-body { padding: 7px 12px 8px; }
#modal-root .modal-appointment-form .appointment-form-grid { row-gap: 5px; column-gap: 8px; }
#modal-root .modal-appointment-form label { line-height: 1.15; }
#modal-root .modal-appointment-form input,
#modal-root .modal-appointment-form select { min-height: 30px; margin-top: 2px; padding: 5px 8px; font-size: 10px; }
#modal-root .modal-appointment-form input[type="date"],
#modal-root .modal-appointment-form input[type="time"] { height: 30px; font-size: 10px; }
#modal-root .modal-appointment-form textarea { min-height: 42px; padding: 6px 8px; font-size: 10px; }
#modal-root .modal-appointment-form .appointment-task-section { margin-top: 6px; padding-top: 6px; }
#modal-root .modal-appointment-form .appointment-task-add { min-height: 30px; padding: 0 10px; font-size: 10px; }
#modal-root .modal-appointment-form .appointment-task-fields { margin-top: 6px; padding: 6px; }
#modal-root .modal-appointment-form .appointment-task-fields .form-grid { gap: 5px 7px; }
#modal-root .modal-appointment-form .appointment-task-fields .form-help { margin-top: 3px; font-size: 8px; }
#modal-root .modal-appointment-form .modal-footer { margin-top: 7px; padding-top: 6px; }

/* Fecha y hora: misma proporción y lectura estable en Safari/iOS. */
#modal-root .modal-appointment-form .appointment-form-grid > label:nth-child(1),
#modal-root .modal-appointment-form .appointment-form-grid > label:nth-child(2) { min-width: 0; }
#modal-root .modal-appointment-form .appointment-form-grid input[type="date"],
#modal-root .modal-appointment-form .appointment-form-grid input[type="time"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding-left: 6px;
  padding-right: 6px;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
  color-scheme: light;
}
#modal-root .modal-appointment-form .appointment-form-grid input[type="date"]::-webkit-date-and-time-value,
#modal-root .modal-appointment-form .appointment-form-grid input[type="time"]::-webkit-date-and-time-value { text-align: center; min-width: 0; }
#modal-root .modal-appointment-form .appointment-form-grid input[type="date"]::-webkit-calendar-picker-indicator,
#modal-root .modal-appointment-form .appointment-form-grid input[type="time"]::-webkit-calendar-picker-indicator { margin: 0; opacity: .58; }

/* Evita el zoom automático de iOS al enfocar campos, manteniendo el zoom manual. */
html { -webkit-text-size-adjust: 100%; }
@media (max-width: 760px) {
  #login-screen input,
  #view-container input,
  #view-container select,
  #view-container textarea,
  #modal-root input,
  #modal-root select,
  #modal-root textarea {
    font-size: 16px !important;
    -webkit-text-size-adjust: 100%;
  }
}

/* Edición de imágenes: área amplia para pellizcar y desplazar cómodamente en móvil. */
.modal.crop-editor-open .modal-body { overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 760px) {
  #modal-root .crop-editor-open .member-photo-crop,
  #modal-root .crop-editor-open .church-logo-crop {
    grid-template-columns: 1fr;
    gap: 11px;
    padding: 13px;
  }
  #modal-root .crop-editor-open .member-photo-crop-stage {
    width: min(78vw, 300px);
    height: min(78vw, 300px);
    margin: 0 auto;
  }
  #modal-root .crop-editor-open .church-logo-crop-stage {
    width: min(88vw, 360px);
    height: 136px;
    margin: 0 auto;
  }
  #modal-root .crop-editor-open .crop-touch-tools {
    align-items: stretch;
    gap: 8px;
    text-align: center;
  }
  #modal-root .crop-editor-open .crop-touch-tools strong { font-size: 13px; }
  #modal-root .crop-editor-open .crop-touch-tools small { font-size: 11px; line-height: 1.4; }
  #modal-root .crop-editor-open .crop-touch-tools .crop-reset-button {
    align-self: center;
    min-height: 38px;
    padding: 8px 13px;
    font-size: 12px;
  }
  #modal-root .crop-editor-open .member-photo-crop-help,
  #modal-root .crop-editor-open .church-logo-crop-help {
    font-size: 10px;
    line-height: 1.35;
    text-align: center;
  }
}

/* El tamaño debe depender de que el editor esté visible, no de una clase de estado.
   Así también funciona si el navegador conserva una versión anterior de app.js. */
@media (max-width: 760px) {
  #modal-root .member-photo-crop:not(.hidden),
  #modal-root .church-logo-crop:not(.hidden) {
    display: grid;
    grid-template-columns: 1fr;
    gap: 11px;
    padding: 13px;
  }

  #modal-root .member-photo-crop:not(.hidden) .member-photo-crop-stage {
    width: min(78vw, 300px);
    height: min(78vw, 300px);
    margin: 0 auto;
  }

  #modal-root .church-logo-crop:not(.hidden) .church-logo-crop-stage {
    width: min(88vw, 360px);
    height: 136px;
    margin: 0 auto;
  }

  #modal-root .member-photo-crop:not(.hidden) .crop-touch-tools,
  #modal-root .church-logo-crop:not(.hidden) .crop-touch-tools {
    align-items: stretch;
    gap: 8px;
    text-align: center;
  }

  #modal-root .member-photo-crop:not(.hidden) .crop-touch-tools strong,
  #modal-root .church-logo-crop:not(.hidden) .crop-touch-tools strong { font-size: 13px; }

  #modal-root .member-photo-crop:not(.hidden) .crop-touch-tools small,
  #modal-root .church-logo-crop:not(.hidden) .crop-touch-tools small { font-size: 11px; line-height: 1.4; }

  #modal-root .member-photo-crop:not(.hidden) .crop-action-row,
  #modal-root .church-logo-crop:not(.hidden) .crop-action-row {
    align-self: center;
    width: 100%;
  }

  #modal-root .member-photo-crop:not(.hidden) .crop-action-row .button,
  #modal-root .church-logo-crop:not(.hidden) .crop-action-row .button {
    min-height: 38px;
    padding: 8px 13px;
    font-size: 12px;
  }

  #modal-root .member-photo-crop:not(.hidden) .member-photo-crop-help,
  #modal-root .church-logo-crop:not(.hidden) .church-logo-crop-help {
    font-size: 10px;
    line-height: 1.35;
    text-align: center;
  }
}
.activity-section-title { align-items: center; }
.activity-section-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; margin-left: auto; }
.activity-filter-button { min-height: 30px; padding: 0 11px; border: 1px solid #d6e1f5; border-radius: 8px; color: var(--navy); background: #f1f5ff; font: inherit; font-size: 10px; font-weight: 800; cursor: pointer; }
.activity-filter-button:hover, .activity-filter-button.is-active { color: white; background: var(--navy); border-color: var(--navy); }
.modal-activity-filter .modal-body { padding-top: 18px; }

.mfa-setup { display: grid; gap: 16px; color: var(--navy); }
.mfa-setup > p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.mfa-setup ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.mfa-qr { display: block; width: min(220px, 72vw); aspect-ratio: 1; margin: 0 auto; padding: 10px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.mfa-secret { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.mfa-secret span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.mfa-secret code { overflow-wrap: anywhere; color: var(--navy); font-size: 12px; }
.mfa-code { text-align: center; font-size: 22px !important; font-weight: 800; letter-spacing: .28em; font-variant-numeric: tabular-nums; }
.activity-filter-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.activity-filter-grid label { color: var(--ink); font-size: 11px; font-weight: 750; }
.activity-filter-grid input, .activity-filter-grid select { margin-top: 5px; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; font: inherit; font-size: 12px; }
.activity-filter-help { margin: 15px 0 0; font-size: 10px; line-height: 1.45; }
@media (min-width: 520px) {
  .activity-filter-grid { grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(0, 1fr)); align-items: end; gap: 10px; }
}

/* El acceso completo, incluida la opción biométrica, cabe en el alto útil del móvil. */
@media (max-height: 940px) {
  .login-screen { padding: 12px 18px; }
  .login-card { padding-top: 4px; padding-bottom: 4px; }
  .login-card .app-logo { width: min(170px, 58%); margin-bottom: 6px; }
  .login-kicker { font-size: 10px; line-height: 1.25; }
  .login-card h1 { margin: 7px auto 5px; font-size: 24px; line-height: 1.08; }
  .login-verse { margin-bottom: 12px; font-size: 13px; line-height: 1.25; }
  .login-card .form-stack { gap: 9px; }
  .login-card .form-stack input:not([type="checkbox"]) { height: 40px; margin-top: 4px; padding-top: 7px; padding-bottom: 7px; }
  .login-card .remember-option { margin-top: 0; }
  .login-card .button-large { height: 42px; min-height: 42px; }
  .login-card .passkey-login { margin-top: 10px; }
  .login-card .login-divider { margin-bottom: 7px; }
  .login-card .passkey-login small { margin-top: 4px; }
  .login-card .login-options { margin-top: 12px; }
  .login-card .demo-hint { margin-top: 11px; padding-top: 9px; }
}

@media (max-height: 650px) {
  .login-screen { padding-top: 8px; padding-bottom: 8px; }
  .login-card .app-logo { width: min(130px, 48%); margin-bottom: 4px; }
  .login-card h1 { margin: 5px auto 4px; font-size: 21px; }
  .login-verse { margin-bottom: 8px; font-size: 12px; }
  .login-card .form-stack { gap: 7px; }
  .login-card .form-stack input:not([type="checkbox"]) { height: 38px; }
  .login-card .button-large { height: 40px; min-height: 40px; }
  .login-card .passkey-login { margin-top: 7px; }
  .login-card .login-divider { margin-bottom: 5px; }
  .login-card .login-options { margin-top: 8px; }
  .login-card .demo-hint { margin-top: 7px; padding-top: 7px; }
}
