:root {
    --bg: #f4efe7;
    --bg-soft: #fbf8f3;
    --surface: rgba(255, 255, 255, 0.86);
    --surface-strong: #ffffff;
    --surface-dark: #1f2a30;
    --line: rgba(31, 42, 48, 0.12);
    --text: #1d2529;
    --muted: #617076;
    --accent: #0b8f88;
    --accent-dark: #0b6c66;
    --accent-soft: rgba(11, 143, 136, 0.12);
    --warning-soft: rgba(211, 140, 33, 0.12);
    --shadow: 0 22px 50px rgba(44, 46, 53, 0.12);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

body.app-shell {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(11, 143, 136, 0.15), transparent 30%),
        radial-gradient(circle at bottom right, rgba(211, 140, 33, 0.12), transparent 25%),
        linear-gradient(180deg, #efe5d6 0%, var(--bg) 52%, #f8f4ee 100%);
    color: var(--text);
    font-family: 'Manrope', sans-serif;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 290px;
    padding: 28px 20px;
    background: linear-gradient(180deg, rgba(24, 34, 39, 0.96), rgba(30, 42, 48, 0.98));
    color: #fff;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand-panel {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
}

.brand-panel h2,
.page-title {
    font-family: 'Oswald', sans-serif;
    letter-spacing: 0.02em;
}

.brand-panel h2 {
    margin: 0;
    font-size: 1.4rem;
}

.brand-panel p {
    margin: 0;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-family: 'Oswald', sans-serif;
    font-size: 1.25rem;
    color: #0f2d2b;
    background: linear-gradient(135deg, #f8d58a, #7ce4db);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.78);
    border-radius: 14px;
    padding: 12px 14px;
    transition: 0.2s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(11, 143, 136, 0.34), rgba(255, 255, 255, 0.08));
}

.app-main {
    flex: 1;
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.24em;
    color: var(--accent-dark);
    font-weight: 800;
    font-size: 0.72rem;
}

.page-title {
    font-size: 2.6rem;
    line-height: 1;
}

.page-subtitle {
    color: var(--muted);
    max-width: 700px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.46);
}

.user-chip {
    min-width: 160px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 18px rgba(44, 46, 53, 0.08);
}

.user-chip__role {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.logout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid rgba(31, 42, 48, 0.16);
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff, #f5f8f7);
    color: var(--surface-dark);
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(44, 46, 53, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.logout-button:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, var(--surface-dark), var(--accent-dark));
    color: #fff;
    box-shadow: 0 12px 24px rgba(31, 42, 48, 0.14);
}

.app-content {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.glass-card,
.stat-card,
.data-card,
.action-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    border-radius: var(--radius-xl);
}

.data-card,
.action-card {
    padding: 24px;
}

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

.stat-card {
    padding: 22px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    inset: auto -30px -30px auto;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(11, 143, 136, 0.18), rgba(248, 213, 138, 0.2));
}

.stat-card small {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 800;
}

.stat-card h3 {
    margin: 10px 0 4px;
    font-size: 2rem;
    font-weight: 800;
}

.grid-two {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 20px;
}

.table thead th {
    border-bottom: 0;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

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

.badge-soft {
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
}

.hero-panel {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 18px;
    padding: 28px;
}

.hero-panel__main {
    padding: 24px;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(31, 42, 48, 0.96), rgba(11, 143, 136, 0.92));
    color: #fff;
}

.hero-panel__main h2 {
    font-family: 'Oswald', sans-serif;
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.hero-panel__aside {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.quick-link {
    display: block;
    text-decoration: none;
    color: var(--text);
    padding: 16px 18px;
    border-radius: 20px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.quick-link:hover {
    transform: translateY(-2px);
    border-color: rgba(11, 143, 136, 0.35);
}

.search-panel {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.form-shell {
    padding: 26px;
}

.form-shell .form-control,
.form-shell .form-select {
    border-radius: 14px;
    border-color: rgba(31, 42, 48, 0.14);
    padding: 0.82rem 0.95rem;
}

/* Select2 adjustments to fit site visuals and prevent dropdown clipping */
.select2-container--bootstrap-5 .select2-selection--single {
    height: auto;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border-radius: 14px;
}
.select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 1.2;
}
.select2-container--bootstrap-5 .select2-dropdown {
    z-index: 3000;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: #0b8f88;
    color: #fff;
}
.select2-container--bootstrap-5 .select2-selection__arrow {
    height: 100%;
}

.readonly-block {
    border: 1px dashed rgba(11, 143, 136, 0.45);
    border-radius: 18px;
    padding: 16px;
    background: rgba(11, 143, 136, 0.06);
}

.profile-image-preview {
    display: grid;
    gap: 10px;
}

.profile-image-preview img {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(31, 42, 48, 0.12);
    background: #fff;
    box-shadow: 0 10px 24px rgba(44, 46, 53, 0.1);
}

.profile-image-preview a {
    color: var(--accent-dark);
    font-weight: 800;
}

.table-avatar {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(31, 42, 48, 0.12);
    background: #fff;
    box-shadow: 0 6px 14px rgba(44, 46, 53, 0.1);
}

.table-avatar--empty {
    display: inline-grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 900;
}

.record-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(40, 167, 69, 0.12);
    color: #1f7a36;
    font-size: 0.88rem;
    font-weight: 800;
}

.record-badge--danger {
    background: rgba(190, 18, 60, 0.1);
    color: #9f1239;
}

.report-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.64);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.58);
    box-shadow: 0 12px 28px rgba(44, 46, 53, 0.08);
}

.report-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid rgba(31, 42, 48, 0.12);
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff, #f8fbfa);
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(31, 42, 48, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.report-tab:hover {
    transform: translateY(-1px);
    border-color: rgba(11, 143, 136, 0.38);
    color: var(--accent-dark);
    box-shadow: 0 12px 24px rgba(31, 42, 48, 0.12);
}

.report-tab.active {
    border-color: rgba(11, 143, 136, 0.55);
    background: linear-gradient(135deg, var(--surface-dark), var(--accent-dark));
    color: #fff;
    box-shadow: 0 12px 26px rgba(11, 143, 136, 0.24);
}

.print-shell {
    max-width: 980px;
    margin: 0 auto;
    background: #fff;
    border-radius: 28px;
    padding: 28px;
}

@media (max-width: 1100px) {
    .sidebar {
        width: 240px;
    }
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .grid-two,
    .hero-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    .app-main {
        padding: 18px;
    }
    .topbar {
        flex-direction: column;
    }
    .page-title {
        font-size: 2rem;
    }
    .stat-grid {
        grid-template-columns: 1fr;
    }
    .hero-panel__main h2 {
        font-size: 1.85rem;
    }
}

@media print {
    .sidebar,
    .topbar,
    .btn,
    .no-print {
        display: none !important;
    }
    body.app-shell,
    .app-main,
    .app-content {
        background: #fff;
        padding: 0;
    }
    .print-shell,
    .data-card,
    .action-card {
        box-shadow: none;
        border: 0;
        padding: 0;
        background: #fff;
    }
}
