:root {
    --accent: #0f766e;
    --accent-strong: #0b5f58;
    --accent-soft: #def3ef;
    --ink: #1f2f46;
    --text: #1f2f46;
    --muted: #607086;
    --ink-soft: #5d6b7d;
    --line: #d5dfeb;
    --paper: #ffffff;
    --surface: #ffffff;
    --menu-width: min(360px, 92vw);
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
}

body.app-body {
    font-family: "Manrope", "Segoe UI", Tahoma, sans-serif;
    color: var(--ink);
}

.attendance-donut {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.attendance-donut-inner {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.attendance-donut-sm {
    width: 80px;
    height: 80px;
}

.attendance-donut-sm .attendance-donut-inner {
    width: 58px;
    height: 58px;
    font-size: 0.9rem;
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand span {
    font-family: "Source Serif 4", Georgia, serif;
}

.badge {
    font-family: "Manrope", "Segoe UI", Tahoma, sans-serif;
}

.bg-soft {
    background:
        radial-gradient(circle at 2% 2%, rgba(255, 237, 209, 0.8), transparent 30%),
        radial-gradient(circle at 95% 15%, rgba(219, 243, 238, 0.8), transparent 28%),
        linear-gradient(180deg, #f7fbff 0%, #f3f9ff 100%);
}

.login-bg {
    background:
        radial-gradient(circle at 90% 10%, rgba(229, 248, 242, 0.92), transparent 35%),
        linear-gradient(145deg, #f7fbff 0%, #fff6ee 100%);
}

.app-bg-solid {
    background: var(--app-bg-color, #f3f9ff);
}

.app-bg-image {
    background-color: #eef3f8;
    background-image: var(--app-bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.app-nav {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(213, 223, 235, 0.8);
    box-shadow: 0 6px 24px rgba(31, 47, 70, 0.08);
}

.app-nav .nav-link {
    font-weight: 600;
    color: #2c3e57;
    border-radius: 0.55rem;
    padding-inline: 0.75rem;
}

.app-nav .nav-link:hover,
.app-nav .nav-link:focus {
    color: var(--accent-strong);
    background: var(--accent-soft);
}

.nav-user-photo {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid rgba(15, 118, 110, 0.25);
    box-shadow: 0 6px 16px rgba(15, 118, 110, 0.15);
}

.nav-menu-toggle {
    width: 42px;
    height: 42px;
    border-radius: 0.7rem;
    border: 1px solid rgba(15, 118, 110, 0.28);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-menu-toggle:hover,
.nav-menu-toggle:focus {
    background: #f4fbf9;
    border-color: rgba(15, 118, 110, 0.55);
}

.app-menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.28rem;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0.65rem;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: var(--surface);
}

.app-menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
}

.app-user-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    text-decoration: none;
}

.app-user-photo,
.app-offcanvas-photo {
    border-radius: 999px;
    object-fit: cover;
}

.app-user-photo {
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    box-shadow: none;
}

.users-actions-menu {
    width: 36px;
    height: 36px;
    padding: 0;
}

.menu-bars {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #244464;
    position: relative;
}

.menu-bars::before,
.menu-bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #244464;
}

.menu-bars::before {
    top: -6px;
}

.menu-bars::after {
    top: 6px;
}

.app-menu-panel {
    width: min(360px, 92vw);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-left: 1px solid rgba(213, 223, 235, 0.95);
}

.app-offcanvas {
    width: var(--menu-width);
}

.app-offcanvas.offcanvas-end {
    border-left: 1px solid var(--line);
    border-right: 0;
}

.app-offcanvas.offcanvas-start {
    border-right: 1px solid var(--line);
}

.app-offcanvas-kicker {
    margin-bottom: 0.25rem;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-offcanvas-user {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.25rem 0 0.75rem;
}

.app-menu-sections {
    display: grid;
    gap: 1rem;
}

.app-menu-section {
    display: grid;
    gap: 0.5rem;
}

.app-menu-section + .app-menu-section {
    margin-top: 0.25rem;
    padding-top: 0.9rem;
    border-top: 1px solid #dbe5f0;
}

.app-offcanvas-photo {
    width: 3.5rem;
    height: 3.5rem;
    border: 1px solid var(--line);
}

.app-nav-links {
    display: grid;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    background: #f8fafc;
    overflow: hidden;
}

.app-nav-link {
    display: block;
    padding: 0.62rem 0.85rem;
    border-bottom: 1px solid #e2e8f0;
    background: transparent;
    color: var(--text);
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 0.18s ease, padding-left 0.18s ease;
}

.app-nav-links .app-nav-link:last-child {
    border-bottom: 0;
}

.app-nav-link:active,
.app-nav-link:hover {
    background: #eef2ff;
    padding-left: 0.98rem;
    color: var(--text);
}

.menu-user-head {
    padding: 0.75rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(203, 216, 230, 0.95);
    background: linear-gradient(130deg, #ffffff 0%, #f6fbff 100%);
}

.menu-user-photo {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid rgba(15, 118, 110, 0.22);
}

.menu-group-title {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #607086;
    font-weight: 800;
    margin-bottom: 0.4rem;
}

.menu-link {
    display: block;
    text-decoration: none;
    color: #1f3857;
    font-weight: 600;
    padding: 0.6rem 0.7rem;
    border-radius: 0.65rem;
}

.menu-link:hover,
.menu-link:focus {
    color: #0b5f58;
    background: #eaf7f4;
}

.page-shell {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 26px rgba(20, 45, 73, 0.08);
    padding: 1rem;
}

.page-head {
    border-bottom: 1px solid rgba(213, 223, 235, 0.9);
    padding-bottom: 0.75rem;
}

.eyebrow {
    margin: 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
    font-weight: 800;
}

.form-shell {
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
}

.login-card {
    width: 100%;
    max-width: 430px;
    border-radius: var(--radius-xl);
}

.brand-logo,
.login-logo,
.preview-logo {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 0.7rem;
    border: 1px solid rgba(15, 118, 110, 0.2);
    box-shadow: 0 6px 18px rgba(15, 118, 110, 0.16);
}

.login-logo {
    width: 76px;
    height: 76px;
    border-radius: 0.85rem;
}

.preview-logo {
    width: 90px;
    height: 90px;
}

.logo-fallback {
    width: 42px;
    height: 42px;
    border-radius: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.card-user {
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #ffffff 0%, #fbfcff 100%);
    border: 1px solid var(--line);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-user:hover {
    transform: translateY(-3px);
    box-shadow: 0 1rem 1.7rem rgba(22, 50, 79, 0.13) !important;
}

.card-user.is-unlinked {
    position: relative;
    overflow: hidden;
}

.card-user.is-unlinked::before {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    content: "";
    border-top: 2.25rem solid #f59e0b;
    border-right: 2.25rem solid transparent;
    pointer-events: none;
}

.student-tag-card {
    border: 1px solid #c7d4e6 !important;
    background: linear-gradient(135deg, #f8fbff 0%, #f3f8ff 100%);
}

.attendance-user-tag {
    cursor: pointer;
    border: 1px solid #c7d4e6 !important;
    background: linear-gradient(135deg, #ffffff 0%, #f7fbff 100%);
}

.attendance-user-photo {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid #e7f3f0;
    flex-shrink: 0;
}

.attendance-user-check {
    width: 1.05rem;
    height: 1.05rem;
}

.selectable-user-card {
    cursor: pointer;
}

.selectable-user-card.is-selected {
    border-color: rgba(13, 110, 253, 0.7) !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15) !important;
    background: rgba(13, 110, 253, 0.04);
}

.selectable-user-card .user-card-select {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

.user-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 999px;
    flex-shrink: 0;
    border: 3px solid #e7f3f0;
}

.user-photo-preview {
    width: 112px;
    height: 112px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #d7e2f0;
    box-shadow: 0 6px 14px rgba(22, 50, 79, 0.12);
}

.catalog-church-thumb {
    width: 2.75rem;
    height: 2.75rem;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid var(--line);
}

.linked-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 5.5rem;
    padding: 0.75rem;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 0.45rem;
    background: #fff;
}

.linked-user-info {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 0.75rem;
    color: var(--text);
}

.linked-user-info:hover,
.linked-user-info:focus {
    color: var(--text);
}

.linked-user-row .user-thumb {
    width: 3.25rem;
    height: 3.25rem;
}

.linked-user-row small {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted);
}

.access-photo-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.access-photo-control {
    display: grid;
    gap: 0.4rem;
    justify-items: center;
}

.access-photo-button {
    position: relative;
    display: inline-flex;
    width: 112px;
    height: 112px;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.access-photo-button::after {
    position: absolute;
    inset: 0;
    content: "";
    background: rgba(15, 47, 70, 0.55);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.access-photo-button-label {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    width: max-content;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.access-photo-button:hover::after,
.access-photo-button:focus-visible::after,
.access-photo-button:hover .access-photo-button-label,
.access-photo-button:focus-visible .access-photo-button-label {
    opacity: 1;
}

.access-photo-button:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.45);
    outline-offset: 3px;
}

.cropper-wrap {
    width: 100%;
    min-height: 320px;
    background: #f4f7fb;
    border-radius: 0.75rem;
    overflow: hidden;
}

.cropper-image {
    display: block;
    max-width: 100%;
}

.rich-text-editor {
    border: 1px solid var(--line);
    border-radius: 0.45rem;
    overflow: hidden;
    background: var(--paper);
}

.rich-text-toolbar {
    display: flex;
    gap: 0.35rem;
    padding: 0.45rem;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.rich-text-toolbar .btn {
    min-width: 2.25rem;
}

.rich-text-content {
    min-height: 20rem;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow-y: auto;
    white-space: pre-wrap;
}

.rich-text-content:focus {
    border: 0;
    box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.28);
}

.rich-text-content:empty::before {
    content: "Escribe aqui...";
    color: var(--muted);
}

.terms-content {
    min-height: 14rem;
    max-height: 28rem;
    padding: 1rem;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 0.45rem;
    background: #f8fafc;
    white-space: pre-wrap;
}

.terms-content:empty::before {
    content: "Este texto todavia no esta configurado.";
    color: var(--muted);
}

.terms-content a {
    color: var(--accent-strong);
    text-decoration: underline;
}

.phone-prefix-select {
    flex: 0 0 min(12.5rem, 55%);
    max-width: min(12.5rem, 55%);
}

.user-pills {
    gap: 0.5rem;
}

.user-pills .nav-link {
    border-radius: 999px;
    font-weight: 700;
    color: #315070;
    border: 1px solid #ced8e8;
    background: #fff;
}

.user-pills .nav-link:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.user-pills .nav-link.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.yn-toggle .btn {
    min-width: 64px;
    border-radius: 0.65rem;
    font-weight: 700;
}

.yn-toggle .btn + .btn {
    margin-left: 0.35rem;
}

.yn-toggle .btn-check:checked + .btn-outline-success {
    background: #198754;
    border-color: #198754;
    color: #fff;
}

.yn-toggle .yn-no {
    border-color: #8a95a3;
    color: #5f6c7a;
    background: #fff;
}

.yn-toggle .yn-no:hover,
.yn-toggle .yn-no:focus {
    border-color: #6f7b89;
    color: #465362;
    background: #f1f4f7;
}

.is-invalid-group {
    padding: 0.35rem;
    border: 1px solid #dc3545;
    border-radius: 0.7rem;
}

.signature-canvas.is-invalid {
    border: 2px solid #dc3545;
}

.yn-toggle .btn-check:checked + .yn-no {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

.yn-toggle .btn-check:focus + .yn-no,
.yn-toggle .btn-check:focus + .yn-yes {
    box-shadow: 0 0 0 0.18rem rgba(108, 117, 125, 0.22);
}

.tab-nav {
    border-top: 1px solid rgba(213, 223, 235, 0.8);
    padding-top: 1rem;
}

.form-control,
.form-select {
    border: 1px solid #c7d4e6;
    border-radius: 0.7rem;
    min-height: 2.7rem;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(15, 118, 110, 0.6);
    box-shadow: 0 0 0 0.22rem rgba(15, 118, 110, 0.16);
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.signature-canvas {
    width: 100%;
    max-width: 100%;
    border: 2px dashed #9eb6cf;
    border-radius: 0.8rem;
    touch-action: none;
    background: var(--paper);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    font-weight: 700;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

.table {
    --bs-table-bg: transparent;
}

.table thead th {
    color: #385272;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.alert {
    border-radius: 0.85rem;
}

.required-mark {
    color: #dc3545;
    font-weight: 700;
    font-size: 0.85em;
    vertical-align: super;
    line-height: 1;
}

.text-bg-purple {
    color: #fff;
    background-color: #6f42c1;
}

@media (min-width: 768px) {
    .page-shell {
        padding: 1.4rem;
    }

    .user-thumb {
        width: 88px;
        height: 88px;
    }
}
