/* Diocesan Management System - Custom Styles */

:root {
    --dms-primary: #2c3e50;
    --dms-primary-rgb: 44, 62, 80;
    --dms-secondary: #3498db;
    --dms-accent: #2ecc71;
    --dms-sidebar-width: 260px;
    --dio-primary: var(--dms-primary);
    --dio-accent: #c9a227;
    --bs-primary: var(--dms-primary);
    --bs-primary-rgb: var(--dms-primary-rgb);
    --bs-link-color: var(--dms-primary);
    --bs-link-hover-color: color-mix(in srgb, var(--dms-primary) 80%, #000);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f4f6f9;
}

/* Login Page */
.login-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #0f2744 0%, #1a4a6e 48%, #0d2137 100%);
    padding: 1.25rem;
}

.login-home-link {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #0f2744;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.65);
}

.login-home-link:hover,
.login-home-link:focus {
    background: #fff;
    color: #0b1c2c;
    text-decoration: none;
}

.login-brand-home {
    display: inline-block;
}

.login-brand-home:hover .login-brand-logo,
.login-brand-home:focus .login-brand-logo {
    opacity: 0.92;
}

.login-home-inline {
    display: inline-flex;
    align-items: center;
    color: #334155;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
}

.login-home-inline:hover,
.login-home-inline:focus {
    color: #0f2744;
    text-decoration: underline;
}

/* Branded login: solid fallback; cover image is on .login-page-bg (not body fixed-attachment) */
.login-page--branded {
    background: #0d1b2a;
}

.login-page-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.login-page .login-container {
    position: relative;
    z-index: 1;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    border-radius: 12px;
    border: none;
    background: #fff;
    color: inherit;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.login-card-body {
    padding: 1.15rem 1.35rem 1.25rem !important;
}

.login-brand-block {
    margin-bottom: 0.85rem;
}

.login-brand-fallback {
    font-size: 2rem;
    color: var(--bs-primary, #0d6efd);
}

.login-brand-sub {
    margin: 0;
    font-size: 0.85rem;
}

.login-form .login-field {
    margin-bottom: 0.65rem;
}

.login-form .form-label {
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.login-form .form-control,
.login-form .input-group .btn {
    min-height: 2.15rem;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    font-size: 0.92rem;
}

.login-form .btn-primary {
    min-height: 2.25rem;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
    font-size: 0.92rem;
}

.login-register-wrap {
    margin-top: 0.75rem;
}

.login-register-wrap .login-or {
    margin-bottom: 0.55rem;
}

.login-home-row {
    margin-top: 0.55rem;
}

.login-forgot {
    margin-top: 0.65rem;
    font-size: 0.75rem !important;
    line-height: 1.35;
}

.login-brand-abbr {
    font-size: clamp(1.05rem, 3.2vw, 1.35rem);
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #0f172a;
    margin-top: 0.25rem;
    line-height: 1.15;
}

.login-brand-title {
    font-size: clamp(0.98rem, 2.6vw, 1.2rem);
    font-weight: 750;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: #0f172a;
    margin: 0.25rem 0 0.15rem;
}

.login-brand-title--words {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.12rem 0.28rem;
    margin-top: 0.2rem;
    font-size: clamp(0.72rem, 2vw, 0.86rem);
    font-weight: 650;
    letter-spacing: 0.01em;
    color: #64748b;
}

.login-brand-word {
    white-space: nowrap;
}

.login-brand-cap {
    font-size: 1.12em;
    font-weight: 750;
    letter-spacing: 0.01em;
    color: #475569;
}

.login-brand-rest {
    font-size: 0.92em;
    font-weight: 550;
    letter-spacing: 0.01em;
    opacity: 0.95;
}

/* Login — tablets / iPads / pads (not phones) */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .login-page {
        padding: 1.35rem 1.5rem;
        align-items: center;
        min-height: 100dvh;
    }

    .login-container {
        max-width: 400px;
        width: min(100%, 400px);
    }

    .login-card {
        border-radius: 0.9rem;
        box-shadow: 0 0.75rem 1.75rem rgba(0, 0, 0, 0.18);
    }

    .login-card .card-body,
    .login-card-body {
        padding: 1.15rem 1.35rem 1.2rem !important;
    }

    .login-brand-logo {
        max-height: 52px;
    }

    .login-brand-logo.logo-shape-round,
    .login-brand-logo.logo-shape-square {
        width: 52px;
        height: 52px;
        max-height: 52px;
    }

    .login-brand-abbr {
        font-size: clamp(1.15rem, 2.2vw, 1.4rem);
        margin-top: 0.35rem;
        letter-spacing: 0.1em;
    }

    .login-brand-title {
        font-size: clamp(0.95rem, 1.8vw, 1.1rem);
        margin-bottom: 0.2rem;
    }

    .login-brand-title--words {
        font-size: clamp(0.72rem, 1.4vw, 0.85rem);
        gap: 0.14rem 0.28rem;
        max-width: 22rem;
        margin-left: auto;
        margin-right: auto;
        margin-top: 0.25rem;
    }

    .login-page .mb-4 {
        margin-bottom: 1rem !important;
    }

    .login-page .mb-3 {
        margin-bottom: 0.75rem !important;
    }

    .login-page .form-control,
    .login-page .input-group .btn {
        min-height: 2.35rem;
        font-size: 0.92rem;
    }

    .login-page .form-label {
        font-size: 0.85rem;
        font-weight: 600;
        margin-bottom: 0.3rem;
    }

    .login-page .btn-primary,
    .login-page .btn-outline-primary {
        min-height: 2.4rem;
        font-size: 0.95rem;
        font-weight: 650;
        border-radius: 0.45rem;
    }

    .login-page .text-muted {
        font-size: 0.85rem;
    }

    .login-page .text-muted.small,
    .login-page .small {
        font-size: 0.78rem !important;
    }
}

@media (min-width: 1024px) and (max-width: 1199.98px) {
    .login-container {
        max-width: 420px;
    }

    .login-card .card-body {
        padding: 1.65rem 1.75rem !important;
    }
}

/* Dashboard Layout */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

.dashboard-sidebar {
    width: var(--dms-sidebar-width);
    background: var(--dms-primary);
    color: #fff;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.dashboard-sidebar.sidebar-lock-active {
    overflow: hidden;
}

.dashboard-sidebar .brand {
    padding: 1rem 1.15rem 1.15rem;
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.55rem;
}

.sidebar-brand-text {
    width: 100%;
}

.sidebar-brand-logo-wrap {
    flex-shrink: 0;
}

.sidebar-brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.12);
}

.sidebar-brand-logo-lg {
    width: 56px !important;
    height: 56px !important;
    max-width: 56px !important;
    max-height: 56px !important;
    border-radius: 4px;
    object-fit: contain;
    background: rgba(255,255,255,0.95);
    padding: 4px;
}

/* Diocese / parish logo shape preference (Config → Logo shape) */
.logo-shape-original {
    border-radius: 0 !important;
    object-fit: contain !important;
}
.logo-shape-round {
    border-radius: 50% !important;
    object-fit: cover !important;
    padding: 0 !important;
}
.logo-shape-square {
    border-radius: 4px !important;
    object-fit: contain !important;
}
.login-or {
    position: relative;
}
.login-or span {
    position: relative;
    z-index: 1;
    background: #fff;
    padding: 0 0.65rem;
}
.login-or::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 1px solid #dee2e6;
}
.login-brand-logo {
    max-height: 52px;
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 0.15rem;
}
.login-brand-logo.logo-shape-round {
    width: 52px;
    height: 52px;
    max-height: 52px;
}
.login-brand-logo.logo-shape-square {
    width: 52px;
    height: 52px;
    max-height: 52px;
}
.config-logo-preview {
    max-height: 100px;
    width: auto;
    object-fit: contain;
    border: 1px solid #dee2e6;
    background: #fff;
}
.config-logo-preview.logo-shape-round {
    width: 100px;
    height: 100px;
    max-height: 100px;
}
.config-logo-preview.logo-shape-square {
    width: 100px;
    height: 100px;
    max-height: 100px;
}

.sidebar-brand-logo-fallback {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.35);
    font-size: 1.65rem;
    color: rgba(255,255,255,0.95);
}

.sidebar-brand-name {
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.2;
}

.sidebar-brand-unit {
    margin-top: 0.2rem;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.28rem;
    max-width: 100%;
}

.sidebar-brand-unit-name {
    font-size: 0.78rem;
    font-weight: 650;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.sidebar-brand-unit-kind {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: none;
    opacity: 0.88;
    white-space: nowrap;
}

.sidebar-brand-abbr {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.15;
    margin-top: 0.15rem;
}

.sidebar-brand-app {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: normal;
    opacity: 0.95;
    margin-top: 0.2rem;
}

/* Diocesan Management System — large D/M/S, smaller rest */
.sidebar-brand-dms {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.28rem 0.35rem;
    margin-top: 0.3rem;
    line-height: 1.15;
}

.sidebar-brand-dms .dms-word {
    white-space: nowrap;
}

.sidebar-brand-dms .dms-cap {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.sidebar-brand-dms .dms-rest {
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    opacity: 0.9;
}

.dashboard-sidebar .nav {
    flex: 1 1 auto;
}

.dashboard-sidebar .nav-link {
    color: rgba(255,255,255,0.85);
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.dashboard-sidebar .nav-link:hover,
.dashboard-sidebar .nav-link.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.dashboard-sidebar .nav-link i {
    margin-right: 0.5rem;
    width: 1.25rem;
}

/* Diocese sidebar: Institutions row + chevron → Employees submenu */
.dashboard-sidebar .sidebar-nav-group .nav-link.flex-grow-1 {
    min-width: 0;
}

.dashboard-sidebar .sidebar-submenu-chevron-btn {
    cursor: pointer;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.dashboard-sidebar .sidebar-submenu-chevron-btn:hover,
.dashboard-sidebar .sidebar-submenu-chevron-btn:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.dashboard-sidebar .sidebar-submenu-chevron-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.35);
    outline-offset: -2px;
}

.dashboard-sidebar .sidebar-submenu-chevron-btn:not(.collapsed) .sidebar-submenu-chevron {
    transform: rotate(180deg);
}

.dashboard-sidebar .sidebar-submenu-toggle {
    cursor: pointer;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dashboard-sidebar .sidebar-submenu-toggle:hover,
.dashboard-sidebar .sidebar-submenu-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.dashboard-sidebar .sidebar-submenu-toggle:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.35);
    outline-offset: -2px;
}

.dashboard-sidebar .sidebar-submenu-chevron {
    opacity: 0.85;
    transition: transform 0.2s ease;
}

.dashboard-sidebar .sidebar-submenu-toggle:not(.collapsed) .sidebar-submenu-chevron {
    transform: rotate(180deg);
}

.dashboard-sidebar .sidebar-nav-group .collapse {
    background: rgba(0, 0, 0, 0.15);
}

.dashboard-sidebar .nav-link-sub {
    padding-left: 2.25rem !important;
    font-size: 0.92rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dashboard-sidebar .nav-link-sub i {
    margin-right: 0.45rem;
    width: 1.1rem;
}

/* Diocese sidebar refresh: modern, cleaner navigation layout */
.dashboard-sidebar--diocese {
    background:
        radial-gradient(1200px 380px at -20% -10%, rgba(255,255,255,0.16), transparent 55%),
        linear-gradient(180deg, color-mix(in srgb, var(--dms-primary) 86%, #0f172a 14%) 0%, color-mix(in srgb, var(--dms-primary) 70%, #0b1220 30%) 100%);
    border-right: 1px solid rgba(255,255,255,0.1);
    box-shadow: 10px 0 30px rgba(2, 8, 23, 0.24);
}

.dashboard-sidebar--diocese .brand {
    padding: 1.1rem 1rem 0.95rem;
    border-bottom: 1px solid rgba(255,255,255,0.14);
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
}

.dashboard-sidebar--diocese .sidebar-brand-name {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.dashboard-sidebar--diocese .nav {
    padding: 0.65rem 0.55rem 0.85rem;
    gap: 0.2rem;
}

.dashboard-sidebar--diocese .nav-link {
    border-bottom: 0;
    border-radius: 10px;
    margin: 0;
    padding: 0.62rem 0.75rem;
    color: rgba(241, 245, 249, 0.9);
    transition: background-color 0.18s ease, transform 0.16s ease, box-shadow 0.18s ease;
}

.dashboard-sidebar--diocese .nav-link:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
    transform: translateX(2px);
}

.dashboard-sidebar--diocese .nav-link.active {
    background: linear-gradient(135deg, rgba(255,255,255,0.26), rgba(255,255,255,0.14));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 6px 16px rgba(15, 23, 42, 0.2);
}

.dashboard-sidebar--diocese .nav-link i {
    width: 1.2rem;
    opacity: 0.96;
}

.dashboard-sidebar--diocese .sidebar-nav-group {
    border-bottom: 0 !important;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.dashboard-sidebar--diocese .sidebar-nav-group > .d-flex .nav-link {
    border-radius: 0;
}

.dashboard-sidebar--diocese .sidebar-submenu-chevron-btn {
    border-left: 0 !important;
    min-width: 36px;
}

.dashboard-sidebar--diocese .sidebar-nav-group .collapse {
    background: rgba(2, 6, 23, 0.18);
}

.dashboard-sidebar--diocese .nav-link-sub {
    padding-left: 1.95rem !important;
    font-size: 0.89rem;
    color: rgba(226, 232, 240, 0.9);
}

.dashboard-sidebar--diocese .nav-link-sub:hover,
.dashboard-sidebar--diocese .nav-link-sub.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.dashboard-sidebar--diocese .sidebar-theme-picker {
    margin: 0.35rem 0.6rem 0.8rem;
    border-top: 0;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.32);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.sidebar-theme-picker {
    border-top: 1px solid rgba(255,255,255,0.12);
    padding: 0.85rem 1rem 1rem;
    background: rgba(0,0,0,0.14);
}

.sidebar-diocese-social {
    margin: 0.55rem 0.75rem 0.35rem;
    padding: 0.7rem 0.75rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-diocese-social-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 0.45rem;
    line-height: 1.25;
}

.sidebar-diocese-social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.sidebar-diocese-social-link {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    text-decoration: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.sidebar-diocese-social-link:hover,
.sidebar-diocese-social-link:focus-visible {
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
    transform: translateY(-1px);
}

.sidebar-diocese-social-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.45);
    outline-offset: 1px;
}

.sidebar-theme-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.8);
    cursor: pointer;
}

.sidebar-theme-swatch:hover {
    transform: translateY(-1px);
}

.sidebar-lock-overlay {
    position: absolute;
    inset: 0;
    z-index: 1200;
    background: rgba(16, 24, 39, 0.82);
    backdrop-filter: blur(1px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.sidebar-lock-card {
    width: 100%;
    max-width: 220px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(0,0,0,0.45);
    border-radius: 12px;
    color: #fff;
    padding: 0.75rem;
    text-align: center;
    box-shadow: 0 8px 26px rgba(0,0,0,0.35);
}

.dashboard-main {
    flex: 1;
    margin-left: var(--dms-sidebar-width);
    padding: 1.5rem;
    min-width: 0;
}

.dashboard-sidebar-toggle {
    display: none;
    align-items: center;
}

.dashboard-sidebar-backdrop {
    display: none;
}

.dashboard-header {
    background: #fff;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.dashboard-header-bar {
    display: grid;
    grid-template-columns: minmax(7rem, 1fr) minmax(0, 2.4fr) minmax(7rem, 1fr);
    align-items: center;
    gap: 0.75rem;
}

.dashboard-header-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.15rem;
    min-width: 0;
}

.dashboard-header-diocese {
    font-size: clamp(0.78rem, 1.2vw, 0.95rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #64748b;
    line-height: 1.2;
    text-align: center;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.dashboard-header-unit {
    font-size: clamp(1.05rem, 1.8vw, 1.45rem);
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--dms-primary, #2c3e50);
    line-height: 1.2;
    text-align: center;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.dashboard-header-page {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1f2937;
    text-align: center;
}

.dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-header-actions--start {
    justify-content: flex-start;
}

.dashboard-header-actions--end {
    justify-content: flex-end;
}

/* Shared filter rows: wrap cleanly on tablet widths */
.filter-bar,
.diocese-dashboard .filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.85rem;
}

.filter-bar .form-select,
.filter-bar .form-control,
.diocese-dashboard .filter-bar .form-select,
.diocese-dashboard .filter-bar .form-control {
    max-width: 100%;
}

/* Tablets / iPads / pads — not phones (<768) */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .dashboard-sidebar-toggle {
        display: inline-flex;
    }

    .dashboard-sidebar {
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        z-index: 1045;
        box-shadow: none;
    }

    .dashboard-wrapper.sidebar-open .dashboard-sidebar {
        transform: translateX(0);
        box-shadow: 8px 0 28px rgba(15, 23, 42, 0.28);
    }

    .dashboard-main {
        margin-left: 0;
        padding: 1.1rem 1.15rem 1.5rem;
    }

    .dashboard-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1040;
        background: rgba(15, 23, 42, 0.42);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .dashboard-wrapper.sidebar-open .dashboard-sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .dashboard-wrapper.sidebar-open .dashboard-sidebar-backdrop[hidden] {
        display: block;
    }

    .dashboard-header {
        padding: 0.85rem 1rem;
        margin-bottom: 1.15rem;
    }

    .dashboard-header-bar {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 0.55rem;
    }

    .dashboard-header-diocese {
        font-size: clamp(0.72rem, 1.1vw, 0.85rem);
        letter-spacing: 0.04em;
    }

    .dashboard-header-unit {
        font-size: clamp(0.95rem, 1.6vw, 1.2rem);
        letter-spacing: 0.03em;
    }

    .dashboard-header-page {
        font-size: 0.95rem;
    }

    .dashboard-header-actions .btn {
        white-space: nowrap;
    }

    .dashboard-sidebar-toggle-label {
        display: none;
    }

    /* Prefer full-width table scroll areas and avoid fixed-width filters overflowing */
    .table-responsive {
        max-width: 100%;
    }

    .filter-bar .form-select,
    .filter-bar .form-control,
    .diocese-dashboard .filter-bar .form-select,
    .diocese-dashboard .filter-bar .form-control {
        width: auto;
        min-width: 10.5rem;
        flex: 1 1 10.5rem;
    }

    .card-modern,
    .dashboard-section,
    .users-table-card,
    .pu-table-card {
        overflow-x: auto;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .dashboard-header-actions--end .text-muted {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .dashboard-sidebar-toggle {
        display: none !important;
    }
    .dashboard-header-bar {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }
    .dashboard-header-actions--start,
    .dashboard-header-actions--end {
        justify-content: center;
    }
    .dashboard-header-unit {
        font-size: 1.1rem;
    }
}

/* Stats Cards */
.stat-card {
    border-radius: 10px;
    border: none;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .card-body {
    padding: 1.25rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

/* Tables */
.table-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Forms */
.form-label.required::after {
    content: ' *';
    color: #dc3545;
}

/* Searchable selects (Tom Select) — keep Bootstrap from breaking the control */
.ts-wrapper {
    display: block;
    width: 100%;
}
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
    border: 1px solid #ced4da !important;
    border-radius: 0.375rem !important;
    min-height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem !important;
    background-color: #fff !important;
    background-image: none !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center;
    gap: 0.35rem;
}
.ts-wrapper.single .ts-control input,
.ts-wrapper.multi .ts-control input {
    min-width: 4rem !important;
    font-size: inherit !important;
}
.ts-wrapper.focus .ts-control {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}
.ts-wrapper.disabled .ts-control,
.ts-wrapper .ts-control.disabled {
    background-color: #e9ecef !important;
    opacity: 1;
}
.ts-dropdown {
    z-index: 3000 !important;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
}
.ts-dropdown .option {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}
.ts-dropdown .option.active,
.ts-dropdown .option.selected {
    background-color: var(--dms-primary);
    color: #fff;
}
.ts-dropdown .no-results {
    padding: 0.65rem 0.75rem;
    color: #6c757d;
}
.modal .ts-dropdown,
.modal-open .ts-dropdown {
    z-index: 2100 !important;
}

/* Theme-aware Bootstrap primary (follows sidebar color picker) */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--dms-primary);
    --bs-btn-border-color: var(--dms-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: color-mix(in srgb, var(--dms-primary) 86%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--dms-primary) 82%, #000);
    --bs-btn-focus-shadow-rgb: var(--dms-primary-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: color-mix(in srgb, var(--dms-primary) 78%, #000);
    --bs-btn-active-border-color: color-mix(in srgb, var(--dms-primary) 74%, #000);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--dms-primary);
    --bs-btn-disabled-border-color: var(--dms-primary);
}
.btn-outline-primary {
    --bs-btn-color: var(--dms-primary);
    --bs-btn-border-color: var(--dms-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--dms-primary);
    --bs-btn-hover-border-color: var(--dms-primary);
    --bs-btn-focus-shadow-rgb: var(--dms-primary-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--dms-primary);
    --bs-btn-active-border-color: var(--dms-primary);
    --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    --bs-btn-disabled-color: var(--dms-primary);
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: var(--dms-primary);
}
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: var(--dms-primary) !important;
    color: #fff !important;
}
.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    color: var(--dms-primary) !important;
    border-color: var(--bs-border-color) var(--bs-border-color) #fff !important;
}
.nav-tabs .nav-link:hover,
.nav-tabs .nav-link:focus {
    color: var(--dms-primary);
}
.page-link {
    color: var(--dms-primary);
}
.page-link:hover {
    color: color-mix(in srgb, var(--dms-primary) 80%, #000);
}
.page-item.active .page-link {
    background-color: var(--dms-primary) !important;
    border-color: var(--dms-primary) !important;
    color: #fff !important;
}
.bg-primary {
    background-color: var(--dms-primary) !important;
}
.text-primary {
    color: var(--dms-primary) !important;
}
.border-primary {
    border-color: var(--dms-primary) !important;
}
.badge.text-bg-primary,
.badge.bg-primary {
    background-color: var(--dms-primary) !important;
    color: #fff !important;
}
.form-check-input:checked {
    background-color: var(--dms-primary);
    border-color: var(--dms-primary);
}
.form-check-input:focus {
    border-color: color-mix(in srgb, var(--dms-primary) 55%, #fff);
    box-shadow: 0 0 0 0.25rem rgba(var(--dms-primary-rgb), 0.25);
}
.form-control:focus,
.form-select:focus {
    border-color: color-mix(in srgb, var(--dms-primary) 55%, #fff);
    box-shadow: 0 0 0 0.25rem rgba(var(--dms-primary-rgb), 0.25);
}
.list-group-item.active {
    background-color: var(--dms-primary) !important;
    border-color: var(--dms-primary) !important;
}
.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--dms-primary) !important;
}
.progress-bar {
    background-color: var(--dms-primary);
}
.fin-type-tabs .nav-link.active,
.finance-page .fin-type-tabs .nav-link.active {
    background: var(--dms-primary) !important;
    color: #fff !important;
}
.dashboard-header .btn-outline-primary.active,
.dashboard-header .btn-outline-primary:active {
    background-color: var(--dms-primary);
    border-color: var(--dms-primary);
    color: #fff;
}
