:root {
    --sidebar-width: 285px;
    --bg: #f4f7fb;
    --card-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --line: #e7ecf3;
    --text-muted: #64748b;
    --blue: #2563eb;
    --yellow: #d97706;
    --green: #15803d;
    --rose: #be123c;
    --dark: #0f172a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: linear-gradient(180deg, #f8fbff 0%, #f2f5fb 100%);
    color: #111827;
    min-height: 100vh;
}

.app-shell {
    min-height: 100vh;
}


.app-main {
    min-width: 0;
}

.sidebar {
    overflow-y: auto;
}

.page-actions,
.entry-action-bar,
.family-table-actions {
    max-width: 100%;
}

.table-responsive,
.tabs-wrap {
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 992px) {
    .app-main.with-sidebar {
        width: calc(100% - var(--sidebar-width));
    }
}


.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #fff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 0 30px rgba(2, 6, 23, .24);
    z-index: 1000;
}

.brand-box {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 16px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.06);
}

.brand-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    font-size: 1.35rem;
    color: #fff;
    font-weight: 800;
}

.brand-title {
    font-weight: 800;
}

.brand-subtitle {
    font-size: .88rem;
    color: rgba(255, 255, 255, .72);
}

.menu-list {
    display: grid;
    gap: 10px;
}

.menu-link {
    color: rgba(255, 255, 255, 0.84);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    transition: .2s ease;
}

.menu-link:hover,
.menu-link.active {
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    transform: translateX(2px);
}

.app-main.with-sidebar {
    margin-left: var(--sidebar-width);
}

.auth-main {
    min-height: 100vh;
}

.panel-card,
.stat-card,
.info-card,
.tab-panel,
.detail-box {
    background: #fff;
    border: 1px solid rgba(226, 232, 240, .94);
    border-radius: 28px;
    box-shadow: var(--card-shadow);
}

.panel-card,
.info-card {
    padding: 24px;
}

.page-title {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -.02em;
}

.page-subtitle {
    color: var(--text-muted);
}

.stat-card {
    padding: 22px;
    height: 100%;
}

.stat-label {
    color: var(--text-muted);
    font-size: .95rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    background: #eef4ff;
}

.login-shell-v2 {
    min-height: calc(100vh - 2rem);
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 14px 0;
}

.login-panel-v2 {
    width: min(1400px, 100%);
    padding: 0;
    overflow: hidden;
}

.login-grid-v2 {
    min-height: calc(100vh - 3.5rem);
    display: grid;
    grid-template-columns: minmax(420px, 1.12fr) minmax(380px, .88fr);
}

.login-hero-v2 {
    padding: 56px clamp(28px, 4vw, 58px);
    background:
        radial-gradient(circle at top left, rgba(255,255,255,.20), transparent 30%),
        linear-gradient(135deg, #1d4ed8 0%, #7c3aed 55%, #0f172a 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.login-kicker {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,.13);
    border: 1px solid rgba(255,255,255,.18);
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 18px;
}

.login-title-v2 {
    font-size: clamp(2rem, 3.8vw, 3.35rem);
    line-height: 1.05;
    letter-spacing: -.03em;
    font-weight: 900;
    margin: 0 0 18px;
    max-width: 11ch;
}

.login-desc-v2 {
    margin: 0;
    max-width: 60ch;
    color: rgba(255,255,255,.86);
    font-size: 1.04rem;
}

.login-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 30px;
}

.login-feature-item {
    padding: 16px 18px;
    border-radius: 22px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.14);
    backdrop-filter: blur(8px);
}

.login-feature-item strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 6px;
}

.login-feature-item span {
    display: block;
    color: rgba(255,255,255,.82);
    font-size: .95rem;
}

.login-form-v2 {
    padding: clamp(28px, 4vw, 54px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.login-form-head {
    max-width: 520px;
}

.login-form-stack {
    display: grid;
    gap: 18px;
    width: 100%;
    max-width: 520px;
}

.login-helper-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.login-helper-chip {
    border-radius: 999px;
    padding: 8px 12px;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 700;
    font-size: .88rem;
}

.form-control,
.form-select {
    border-radius: 16px;
    min-height: 48px;
    border: 1px solid #dbe3ee;
    background: #fff;
    padding: .78rem .95rem;
}

.form-control-lg {
    min-height: 56px;
    font-size: 1rem;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 .25rem rgba(59,130,246,.12);
}

.form-label {
    font-weight: 700;
    margin-bottom: 8px;
    display: block;
}

.badge-soft {
    padding: 8px 12px;
    background: #eef2ff;
    color: #4338ca;
    border-radius: 999px;
    font-weight: 800;
    font-size: .9rem;
}

.section-label {
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #64748b;
    margin-bottom: 14px;
    font-weight: 800;
}

.entry-layout-v2 {
    display: grid;
    grid-template-columns: minmax(330px, 420px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.entry-side-v2,
.entry-main-v2 {
    position: relative;
}

.entry-side-head,
.entry-main-head,
.tab-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.entry-side-head,
.entry-main-head {
    margin-bottom: 18px;
}

.entry-section-title {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.entry-side-v2 {
    position: sticky;
    top: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.book-note {
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(90deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px dashed #bfdbfe;
}

.book-note strong,
.book-note span {
    display: block;
}

.book-note strong {
    margin-bottom: 6px;
    color: #1d4ed8;
}

.entry-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.entry-form-grid-right {
    margin-top: 18px;
}

.form-group-full {
    grid-column: 1 / -1;
}

.tabs-wrap-v2 {
    margin-bottom: 10px;
}

.sacrament-nav-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.sacrament-nav-grid .nav-item {
    width: 100%;
}

.tabs-wrap .nav-link {
    border: 0;
    border-radius: 22px;
    padding: 0;
    margin-right: 0;
    color: #475569;
    font-weight: 700;
    width: 100%;
}

.tab-block {
    display: flex !important;
    align-items: center;
    gap: 14px;
    padding: 18px 18px;
    min-height: 88px;
    text-align: left;
    border: 1px solid transparent;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.tab-block:hover {
    transform: translateY(-1px);
}

.tab-step {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1rem;
    background: rgba(255,255,255,.75);
    flex: 0 0 auto;
}

.tab-texts {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tab-texts strong {
    font-size: 1.03rem;
}

.tab-texts small {
    font-size: .84rem;
    color: inherit;
    opacity: .85;
}

.tab-blue { background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%); color: #1d4ed8; border-color: #bfdbfe; }
.tab-yellow { background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%); color: #b45309; border-color: #fed7aa; }
.tab-green { background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%); color: #15803d; border-color: #bbf7d0; }
.tab-rose { background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%); color: #be123c; border-color: #fecdd3; }

.tabs-wrap .nav-link.active {
    color: #fff;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.10);
}

.tab-blue.active { background: linear-gradient(135deg, #2563eb, #1d4ed8) !important; border-color: #2563eb; }
.tab-yellow.active { background: linear-gradient(135deg, #f59e0b, #d97706) !important; border-color: #d97706; }
.tab-green.active { background: linear-gradient(135deg, #16a34a, #15803d) !important; border-color: #15803d; }
.tab-rose.active { background: linear-gradient(135deg, #e11d48, #be123c) !important; border-color: #be123c; }

.tab-panel {
    padding: 24px;
    border-radius: 26px;
}

.tab-panel-blue { background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%); border-color: #dbeafe; }
.tab-panel-yellow { background: linear-gradient(180deg, #ffffff 0%, #fffaf2 100%); border-color: #ffedd5; }
.tab-panel-green { background: linear-gradient(180deg, #ffffff 0%, #f7fff9 100%); border-color: #dcfce7; }
.tab-panel-rose { background: linear-gradient(180deg, #ffffff 0%, #fff8f8 100%); border-color: #ffe4e6; }

.tab-title {
    font-size: 1.12rem;
    font-weight: 900;
    margin-bottom: 14px;
}

.tab-title.blue { color: var(--blue); }
.tab-title.yellow { color: var(--yellow); }
.tab-title.green { color: var(--green); }
.tab-title.rose { color: var(--rose); }

.tab-note {
    color: var(--text-muted);
    font-size: .95rem;
}

.step-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 800;
    font-size: .86rem;
    white-space: nowrap;
}

.step-blue { background: #dbeafe; color: var(--blue); }
.step-yellow { background: #ffedd5; color: var(--yellow); }
.step-green { background: #dcfce7; color: var(--green); }
.step-rose { background: #ffe4e6; color: var(--rose); }

.tab-preview-chip {
    border-radius: 999px;
    padding: 9px 12px;
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-weight: 700;
    font-size: .9rem;
}

.entry-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.table thead th {
    color: #475569;
    font-weight: 800;
    border-bottom-width: 1px;
}

.table tbody tr td {
    vertical-align: middle;
}

.sample-box {
    background: linear-gradient(90deg, #eef2ff 0%, #f8fafc 100%);
    border: 1px dashed #c7d2fe;
    padding: 14px 16px;
    border-radius: 18px;
}

.detail-box {
    background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
    border: 1px solid #e5edf8;
    border-radius: 18px;
    padding: 14px 16px;
    height: 100%;
}

.detail-box strong {
    display: block;
    color: #475569;
    margin-bottom: 6px;
    font-size: .92rem;
}

.detail-box span {
    display: block;
    font-weight: 700;
    min-height: 24px;
}

.login-card .row { align-items: stretch; }
.login-card [class*='col-'] { display: block; }

@media (max-width: 1199.98px) {
    .entry-layout-v2 {
        grid-template-columns: 1fr;
    }

    .entry-side-v2 {
        position: static;
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        position: static;
        width: auto;
        min-height: auto;
        border-radius: 0 0 24px 24px;
    }

    .app-main.with-sidebar {
        margin-left: 0;
    }

    .login-grid-v2 {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .login-feature-grid,
    .sacrament-nav-grid,
    .entry-form-grid {
        grid-template-columns: 1fr;
    }

    .login-title-v2 {
        max-width: none;
    }
}

@media (max-width: 575.98px) {
    .panel-card,
    .info-card,
    .tab-panel {
        border-radius: 22px;
    }

    .login-shell-v2 {
        padding: 0;
    }

    .login-panel-v2 {
        border-radius: 0;
    }

    .tab-block {
        min-height: 76px;
        padding: 14px;
    }

    .entry-action-bar .btn {
        width: 100%;
    }
}


.family-member-choice input.form-check-input {
    flex: 0 0 auto;
}


/* ===== Gia đình: bố cục an toàn khi host không tải Bootstrap đầy đủ ===== */
.family-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.family-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.family-filter-grid {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(220px, 1fr) auto;
    gap: 16px;
    align-items: end;
}
.family-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.family-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
.family-stat-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.family-table-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.table-responsive {
    width: 100%;
    overflow-x: auto;
}
.table-light th {
    background: #f8fafc;
}
.table-hover tbody tr:hover {
    background: #f8fbff;
}
.text-center { text-align: center; }
.text-end { text-align: right; }
.justify-content-end { justify-content: flex-end; }
.btn-sm { padding: .5rem .85rem; font-size: .9rem; }
.btn-outline-primary { background:#fff; border-color:#93c5fd; color:#1d4ed8; }
.btn-outline-info { background:#fff; border-color:#67e8f9; color:#0f766e; }
.btn-outline-success { background:#fff; border-color:#86efac; color:#166534; }
.btn-outline-warning { background:#fff; border-color:#fcd34d; color:#a16207; }
.text-bg-primary { background:#dbeafe; color:#1d4ed8; padding:6px 10px; border-radius:999px; font-weight:700; display:inline-flex; }
.text-bg-light { background:#f8fafc; color:#475569; padding:6px 10px; border-radius:999px; font-weight:700; display:inline-flex; }
.col-6 { width: 50%; }
.col-md-3, .col-xl-3 { width: 100%; }
@media (min-width: 768px) {
    .col-md-3 { width: 25%; }
}
@media (min-width: 1200px) {
    .col-xl-3 { width: 25%; }
}
@media (max-width: 1199px) {
    .family-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991px) {
    .family-filter-grid { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
    .family-stat-grid { grid-template-columns: 1fr; }
    .family-toolbar { align-items: flex-start; }
}
