:root {
    --bg: #f0f5f3;
    --bg-accent: #e4f0eb;
    --surface: #ffffff;
    --text: #14231f;
    --muted: #5c6f69;
    --primary: #0f766e;
    --primary-hover: #0d5f59;
    --primary-soft: #d8efe9;
    --accent: #c2410c;
    --accent-soft: #ffedd5;
    --success: #047857;
    --error: #b91c1c;
    --border: #d5e2dc;
    --shadow: 0 8px 28px rgba(20, 35, 31, 0.07);
    --radius: 14px;
    --font-display: "Fraunces", "Georgia", serif;
    --font-body: "Plus Jakarta Sans", "Segoe UI", sans-serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    background:
        radial-gradient(ellipse 80% 50% at 10% -10%, rgba(15, 118, 110, 0.12), transparent 55%),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(194, 65, 12, 0.07), transparent 50%),
        linear-gradient(180deg, #eaf3ef 0%, var(--bg) 38%, #eef4f1 100%);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, .navbar-title, .stat-value, .auth-header h1 {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    letter-spacing: -0.02em;
}

.navbar {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
}

.navbar-brand small {
    font-weight: 500;
    color: var(--muted);
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: linear-gradient(145deg, #14978c 0%, var(--primary) 100%);
    color: white;
    border-radius: 10px;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.28);
}

.logo.large {
    width: 60px;
    height: 60px;
    font-size: 1.55rem;
    margin: 0 auto 1rem;
    border-radius: 16px;
}

.navbar-links {
    display: flex;
    gap: 0.25rem;
}

.navbar-links a {
    text-decoration: none;
    color: var(--muted);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.navbar-links a:hover,
.navbar-links a.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.navbar-links a.logout,
.navbar-links button.logout {
    color: var(--error);
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 10px;
}

.navbar-links a.logout:hover,
.navbar-links button.logout:hover {
    background: #fef2f2;
}

.logout-form,
.bottom-nav-logout-form {
    display: contents;
}

.bottom-nav-logout-form button.bottom-nav-item {
    width: 100%;
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
    color: inherit;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    animation: page-in 0.45s var(--ease) both;
}

@keyframes page-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes rise-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.85rem;
    font-weight: 650;
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--muted);
}

.card {
    background: var(--surface);
    border: 1px solid rgba(213, 226, 220, 0.85);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 650;
}

.card-form {
    max-width: 640px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid rgba(213, 226, 220, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    animation: rise-in 0.5s var(--ease) both;
}

.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }
.stat-card:nth-child(5) { animation-delay: 0.2s; }

.stat-value {
    font-size: 2rem;
    font-weight: 650;
    color: var(--primary);
    line-height: 1.15;
}

.stat-label {
    color: var(--muted);
    font-size: 0.88rem;
    margin-top: 0.2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(180deg, #14978c 0%, var(--primary) 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(15, 118, 110, 0.28);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #eef4f1;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e2ebe7;
}

.btn-danger {
    background: #fef2f2;
    color: var(--error);
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
}

.btn-sm {
    padding: 0.4rem 0.875rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.form h2 {
    font-size: 0.8rem;
    margin: 1.75rem 0 1rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-body);
    font-weight: 700;
}

.form h2:first-child {
    margin-top: 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

input, textarea, select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
}

.field-error {
    display: block;
    color: var(--error);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.field-hint {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.form-actions {
    margin-top: 1.5rem;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: var(--primary-soft);
    color: #115e59;
    border: 1px solid #9fd5cb;
    margin-bottom: 1.5rem;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.status {
    display: inline-block;
    padding: 0.2rem 0.625rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-in {
    background: #ecfdf5;
    color: var(--success);
}

.status-visitor {
    background: #fef3c7;
    color: #b45309;
}

.status-member {
    background: var(--primary-soft);
    color: var(--primary);
}

.status-out {
    background: #eef2f0;
    color: var(--muted);
}

.badge {
    display: inline-block;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 0.2rem 0.625rem;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 700;
    font-size: 0.85rem;
}

.pickup-code {
    font-family: monospace;
    font-size: 1.25rem;
    letter-spacing: 0.1em;
}

.empty {
    color: var(--muted);
    text-align: center;
    padding: 2rem;
}

.auth-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.auth-page .container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.auth-page .footer {
    margin-top: auto;
}

.auth-card {
    max-width: 420px;
    width: 100%;
    margin: 2rem auto;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(213, 226, 220, 0.95);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: 0 20px 50px rgba(20, 35, 31, 0.1);
    padding: 2.5rem 2rem;
    animation: rise-in 0.55s var(--ease) both;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.65rem;
    font-weight: 650;
    margin-bottom: 0.35rem;
}

.auth-header p {
    color: var(--muted);
}

.hint {
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 1.5rem;
}

.checkin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.checkin-grid-3 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.7fr);
}

.child-list-presentes {
    gap: 0.5rem;
}

.child-list-presentes .child-item-checkout {
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.7rem 0.85rem;
}

.child-list-presentes .child-info {
    gap: 0.2rem;
    min-width: 0;
}

.child-list-presentes .pickup-list {
    margin-top: 0.15rem;
    gap: 0.25rem;
}

.child-list-presentes .actions-cell-checkout {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    min-width: 10.5rem;
}

.child-list-presentes .checkout-who-select {
    width: 100%;
    font-size: 0.8rem;
    padding: 0.3rem 0.45rem;
}

@media (max-width: 1100px) {
    .checkin-grid-3 {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.45fr);
    }
}

@media (max-width: 1024px) {
    .checkin-grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .checkin-grid-3 .card-presentes {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .checkin-grid,
    .checkin-grid-3 {
        grid-template-columns: 1fr;
    }

    .checkin-grid-3 .card-presentes {
        grid-column: auto;
    }

    .child-list-presentes .actions-cell-checkout {
        width: 100%;
        min-width: 0;
    }
}

.search-form-page {
    margin-bottom: 1.5rem;
    max-width: 640px;
}

.card-highlight {
    border-color: #9fd5cb;
    background: linear-gradient(180deg, #e8f6f2 0%, var(--surface) 72%);
    margin-bottom: 1.5rem;
}

.staff-assign-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.staff-assign-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fbfa;
    cursor: pointer;
}

.staff-assign-item input {
    margin-top: 0.2rem;
    accent-color: var(--primary);
}

.staff-assign-item span {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.staff-assign-item small {
    color: var(--muted);
    font-size: 0.85rem;
}

.room-volunteers {
    font-size: 0.9rem;
    color: var(--muted);
}

.card-hint {
    color: var(--muted);
    font-size: 0.875rem;
    margin: 0 0 1rem;
}

.pickup-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    margin-top: 0.35rem;
}

.pickup-list-label {
    font-size: 0.8rem;
    color: var(--muted);
    margin-right: 0.15rem;
}

.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 11rem;
}

.checkout-who-label {
    font-size: 0.75rem;
    color: var(--muted);
}

.checkout-who-select {
    font-size: 0.9rem;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.35rem 0.5rem;
    background: #fff;
}

.child-item-checkout {
    align-items: flex-start;
}

.actions-cell-checkout {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

.child-item-pre {
    border-left: 3px solid var(--primary);
    background: #f4fbf9;
}

.status-pre {
    background: var(--primary-soft);
    color: #115e59;
}

.badge-warn {
    background: #fef3c7;
    color: #92400e;
}

.badge-photo {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-leave-ok {
    background: #dcfce7;
    color: #166534;
}

.badge-leave-no {
    background: #fee2e2;
    color: #991b1b;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-form input {
    flex: 1;
}

.child-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.child-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.1rem;
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: 12px;
    gap: 1rem;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}

.child-item:hover {
    border-color: var(--border);
    background: #f7fbf9;
}

.child-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.child-info strong {
    font-size: 1.02rem;
}

.child-info small {
    color: var(--muted);
    font-size: 0.85rem;
}

.error-page {
    text-align: center;
    padding: 4rem 0;
}

.error-page h1 {
    font-size: 4rem;
    color: var(--primary);
}

.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.page-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.admin-card {
    background: var(--surface);
    border: 1px solid rgba(213, 226, 220, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}

.admin-card:hover {
    transform: translateY(-3px);
    border-color: #9fd5cb;
    box-shadow: 0 14px 36px rgba(20, 35, 31, 0.12);
}

.admin-card-icon {
    font-size: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: 0.85rem;
    border-radius: 12px;
    background: var(--primary-soft);
}

.admin-card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.admin-card p {
    color: var(--muted);
    font-size: 0.9rem;
}

.inline-form {
    display: inline;
}

.actions-cell {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    align-items: center;
}

.badge-role {
    background: #f3f4f6;
    color: var(--text);
    font-family: inherit;
    font-weight: 600;
}

.row-inactive {
    opacity: 0.6;
}

.muted {
    color: var(--muted);
}

.admin-birthday-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .admin-birthday-grid { grid-template-columns: 1fr; }
}

.card-birthday-today {
    border: 1px solid #fcd34d;
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
}

.birthday-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.birthday-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: 8px;
}

.birthday-item small {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

.birthday-item-today {
    background: #fef3c7;
}

.status-birthday {
    background: #fef3c7;
    color: #b45309;
}

.row-birthday {
    background: #fffbeb;
}

.empty-compact {
    padding: 1.25rem;
}

.period-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.card-filter {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
}

.children-filter-form .field-hint {
    margin: 0.25rem 0 0;
}

.children-filter-row {
    align-items: end;
}

.children-filter-actions-label {
    display: block;
    visibility: hidden;
}

@media (max-width: 768px) {
    .children-filter-actions-label {
        display: none;
    }
}

.freq-cell {
    min-width: 140px;
    width: 20%;
}

.freq-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.freq-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    min-width: 0;
    transition: width 0.2s;
}

.row-no-visits {
    opacity: 0.75;
}

.attendance-filter-card {
    margin-bottom: 1.5rem;
}

.attendance-date-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.attendance-date-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.attendance-date-row input[type="date"] {
    width: auto;
    min-width: 11rem;
}

.frequency-date-form .attendance-date-row {
    align-items: flex-end;
}

.frequency-date-form label {
    margin-bottom: 0;
}

.frequency-date-form label input {
    display: block;
    margin-top: 0.5rem;
}

.badge-visitor {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #fff7ed;
    color: #c2410c;
    font-size: 0.7rem;
    font-weight: 700;
}

select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: white;
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
}

/* ——— Manual do administrador ——— */

.help-layout {
    display: grid;
    grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.help-nav {
    position: sticky;
    top: 5.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 1rem;
    max-height: calc(100vh - 7rem);
    overflow: auto;
}

.help-nav strong {
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
    font-family: var(--font-display);
}

.help-nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.help-nav a {
    padding: 0.5rem;
    border-radius: 7px;
    color: var(--muted);
    font-size: 0.85rem;
    text-decoration: none;
}

.help-nav a:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.help-content {
    min-width: 0;
}

.help-section {
    position: relative;
    scroll-margin-top: 5.5rem;
}

.help-section h2 {
    margin: 0 0 0.8rem;
    padding-right: 2.5rem;
    font-family: var(--font-display);
    font-size: 1.35rem;
}

.help-section h3 {
    margin: 1.2rem 0 0.45rem;
    font-size: 1rem;
}

.help-section p,
.help-section li {
    line-height: 1.65;
}

.help-section ul,
.help-section ol {
    margin: 0.6rem 0 0.8rem 1.3rem;
}

.help-section a {
    color: var(--primary);
    font-weight: 600;
}

.help-step {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}

.help-eyebrow {
    display: inline-block;
    margin-bottom: 0.5rem;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.help-callout,
.help-note {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
    background: var(--primary-soft);
}

.help-callout-warning {
    border-left-color: var(--accent);
    background: var(--accent-soft);
}

.help-permission-grid,
.help-link-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.help-permission-grid > div,
.help-link-grid > a {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f8fbfa;
    text-decoration: none;
}

.help-permission-grid span,
.help-link-grid span {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.45;
}

.help-section details {
    border-top: 1px solid var(--border);
    padding: 0.8rem 0;
}

.help-section details:last-child {
    border-bottom: 1px solid var(--border);
}

.help-section summary {
    cursor: pointer;
    color: var(--text);
    font-weight: 600;
}

.help-section details p {
    margin: 0.65rem 0 0;
    color: var(--muted);
}

/* ——— Mobile / touch ——— */

.bottom-nav {
    display: none;
}

body.has-mobile-nav {
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 900px) {
    .help-layout {
        display: block;
    }

    .help-nav {
        position: static;
        max-height: none;
        overflow: visible;
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
        margin-bottom: 1rem;
        padding: 1rem;
    }

    .help-nav strong {
        margin-bottom: 0;
        padding: 0;
    }

    .help-nav-links {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
        margin: 0 -0.25rem;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
        scrollbar-width: thin;
    }

    .help-nav-links a,
    .help-nav > a {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 0.45rem 0.75rem;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: #f8fbfa;
        color: var(--text);
        font-size: 0.8rem;
        font-weight: 600;
        line-height: 1.2;
    }

    .help-permission-grid,
    .help-link-grid {
        grid-template-columns: 1fr;
    }

    .help-section {
        scroll-margin-top: 4.5rem;
    }

    .help-section h2 {
        font-size: 1.15rem;
        padding-right: 2.4rem;
    }

    .help-step {
        top: 0.85rem;
        right: 0.85rem;
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    body.has-mobile-nav {
        padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
    }

    body.has-mobile-nav .help-layout {
        padding-bottom: 1rem;
    }

    .navbar {
        height: auto;
        min-height: 56px;
        padding: 0.625rem 1rem;
    }

    .navbar-brand {
        flex-wrap: wrap;
        gap: 0.35rem 0.5rem;
        min-width: 0;
    }

    .navbar-title {
        font-size: 0.95rem;
    }

    .navbar-church {
        flex-basis: 100%;
        margin-left: 2.5rem !important;
        font-size: 0.75rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .navbar-links-desktop {
        display: none;
    }

    .container {
        padding: 1rem 0.875rem 1.5rem;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 1rem;
    }

    .page-header h1 {
        font-size: 1.45rem;
    }

    .page-header .btn,
    .page-actions .btn {
        width: 100%;
    }

    .page-actions {
        flex-direction: column;
    }

    .card {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.625rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .btn {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }

    .btn-sm {
        min-height: 40px;
        padding: 0.5rem 0.875rem;
    }

    .search-form,
    .search-form-page {
        flex-direction: column;
        max-width: none;
    }

    .search-form .btn,
    .search-form-page .btn {
        width: 100%;
    }

    .child-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .child-item form,
    .child-item .btn {
        width: 100%;
    }

    .actions-cell {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .actions-cell form,
    .actions-cell .btn {
        width: 100%;
    }

    .inline-form {
        display: block;
        width: 100%;
    }

    .inline-form .btn {
        width: 100%;
    }

    th, td {
        padding: 0.625rem 0.5rem;
        font-size: 0.875rem;
    }

    .auth-card {
        margin: 1.5rem auto;
        padding: 1.75rem 1.25rem;
    }

    .period-filter {
        gap: 0.375rem;
    }

    .period-filter .btn-sm {
        flex: 1 1 calc(50% - 0.375rem);
        min-width: 0;
    }

    .attendance-date-row {
        flex-direction: column;
        align-items: stretch;
    }

    .attendance-date-row input[type="date"],
    .attendance-date-row .btn {
        width: 100%;
    }

    .footer {
        padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
        font-size: 0.8rem;
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 200;
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        padding: 0.4rem 0.25rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -8px 28px rgba(20, 35, 31, 0.08);
        justify-content: space-around;
        align-items: stretch;
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        padding: 0.35rem 0.25rem;
        min-height: 54px;
        text-decoration: none;
        color: var(--muted);
        border-radius: 12px;
        font-size: 0.65rem;
        font-weight: 600;
        transition: background 0.2s var(--ease), color 0.2s var(--ease);
    }

    .bottom-nav-item.active {
        color: var(--primary);
        background: var(--primary-soft);
    }

    .bottom-nav-item-primary .bottom-nav-icon {
        background: linear-gradient(180deg, #14978c 0%, var(--primary) 100%);
        color: #fff;
        width: 2.15rem;
        height: 2.15rem;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(15, 118, 110, 0.3);
    }

    .bottom-nav-item-primary.active .bottom-nav-icon {
        background: var(--primary-hover);
    }

    .bottom-nav-icon {
        width: 1.35rem;
        height: 1.35rem;
        display: inline-block;
        position: relative;
        line-height: 1;
    }

    .bottom-nav-icon::before,
    .bottom-nav-icon::after {
        content: "";
        position: absolute;
        inset: 0;
        margin: auto;
    }

    .icon-home::before {
        width: 0.85rem;
        height: 0.7rem;
        border: 2px solid currentColor;
        border-top: 0;
        bottom: 0;
        top: auto;
        border-radius: 2px;
    }

    .icon-home::after {
        width: 0.55rem;
        height: 0.55rem;
        border-left: 2px solid currentColor;
        border-top: 2px solid currentColor;
        transform: rotate(45deg);
        top: 0.05rem;
        bottom: auto;
    }

    .icon-check::before {
        width: 0.45rem;
        height: 0.75rem;
        border-right: 2.5px solid #fff;
        border-bottom: 2.5px solid #fff;
        transform: rotate(40deg) translate(-1px, -1px);
    }

    .icon-kids::before {
        width: 0.45rem;
        height: 0.45rem;
        border-radius: 50%;
        background: currentColor;
        top: 0.05rem;
        bottom: auto;
    }

    .icon-kids::after {
        width: 0.85rem;
        height: 0.55rem;
        border: 2px solid currentColor;
        border-top: 0;
        border-radius: 0 0 8px 8px;
        top: auto;
        bottom: 0.1rem;
    }

    .icon-admin::before {
        width: 0.85rem;
        height: 0.85rem;
        border: 2px solid currentColor;
        border-radius: 3px;
    }

    .icon-admin::after {
        width: 0.35rem;
        height: 0.35rem;
        border-radius: 50%;
        background: currentColor;
    }

    .icon-exit::before {
        width: 0.7rem;
        height: 0.7rem;
        border: 2px solid currentColor;
        border-left: 0;
        border-radius: 0 4px 4px 0;
        left: 0.15rem;
    }

    .icon-exit::after {
        width: 0.55rem;
        height: 2px;
        background: currentColor;
        left: 0;
        box-shadow: 0.35rem -0.2rem 0 -0.05rem currentColor, 0.35rem 0.2rem 0 -0.05rem currentColor;
    }

    .bottom-nav-label {
        line-height: 1.1;
        text-align: center;
    }

    .bottom-nav-logout {
        color: #b91c1c;
    }
}

@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .bottom-nav-label {
        font-size: 0.6rem;
    }
}

.guardian-block {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.1rem 1.1rem;
    margin-bottom: 1rem;
    background: #f7fbf9;
}

.guardian-block legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 0 0.35rem;
    font-weight: 700;
    font-size: 0.95rem;
}

.guardian-primary-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--muted);
    cursor: pointer;
}

.guardian-perms {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin: 0.75rem 0 1rem;
}

.guardian-perms label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
    font-size: 0.88rem;
    margin: 0;
    cursor: pointer;
}

.guardian-perms input[type="checkbox"] {
    width: auto;
    margin: 0;
}

#guardian-add {
    margin-bottom: 1.25rem;
}

.guardian-remove {
    margin-top: 0.25rem;
}

.duplicate-alert .duplicate-list {
    margin: 0.75rem 0;
    padding-left: 1.15rem;
}

.duplicate-alert .duplicate-list li {
    margin-bottom: 0.35rem;
}

.duplicate-force {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.duplicate-force input {
    width: auto;
    margin: 0;
}

.consent-box {
    margin-top: 1.25rem;
    padding: 1rem;
    background: #f4f9f7;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.consent-box h2 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.consent-text {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.45;
    margin-bottom: 0.75rem;
}

.consent-check {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
}

.consent-check input {
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.consent-check small {
    font-weight: 400;
    color: var(--muted);
}

.field-none-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--muted);
}

.field-none-check input {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.field-none-check:has(input:checked) {
    color: var(--ink);
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
