/* Common Styles extracted from complete.css */
/* --- General Body & Typography --- */
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #555;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
}

.page-container {
    width: 95%;
    max-width: 1400px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

:root {
    /* Header palette */
    --header-bg: #fff1f5;
    --header-border: #fbcfe8;
    --header-text: #7a0f2e;
    --header-link: #e63b6f;
    --header-link-hover: #be123c;
    --header-cta-bg: #e63b6f;
    --header-cta-text: #ffffff;

    /* Navbar palette */
    --nav-bg: #fde8ef;
    --nav-border: #f9a8d4;
    --nav-text: #7a0f2e;
    --nav-text-hover: #9f1239;
    --nav-active-bg: #e63b6f;
    --nav-active-text: #ffffff;

    /* Dropdown palette */
    --dropdown-bg: #ffffff;
    --dropdown-border: #fbcfe8;
    --dropdown-item: #7a0f2e;
    --dropdown-item-hover: #be123c;
    --dropdown-hover-bg: #fff1f5;

    /* Footer palette */
    --footer-bg: #831843;
    --footer-text: #ffffff;
    --footer-heading: #ffffff;
    --footer-link: #fda4af;
    --footer-link-hover: #ffffff;
    --footer-border: #9d174d;

    /* Application tokens */
    --bg-primary: #ffffff;
    --bg-secondary: #fff5f8;
    --bg-muted: #f3f4f6;

    --text-primary: #1f2937;
    --text-secondary: #374151;
    --text-muted: #6b7280;

    --brand-pink: #e63b6f;
    --brand-pink-soft: #fde6ee;
    --brand-blue: #4f46e5;
    --brand-blue-soft: #e0e7ff;
    --brand-yellow: #fbbf24;
    --brand-yellow-soft: #fef3c7;

    --success: #16a34a;
    --success-soft: rgba(22, 163, 74, 0.12);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.16);
    --error: #ef4444;
    --error-soft: rgba(239, 68, 68, 0.16);
    --info: #2563eb;
    --info-soft: rgba(37, 99, 235, 0.16);

    --border-light: #f4dbe7;
    --border-muted: #e3c6d6;

    --shadow-sm: 0 12px 24px rgba(190, 24, 60, 0.12);
    --shadow-md: 0 20px 48px rgba(190, 24, 60, 0.16);

    --gradient-primary: linear-gradient(135deg, rgba(230, 59, 111, 0.92) 0%, rgba(249, 168, 212, 0.88) 48%, rgba(79, 70, 229, 0.92) 100%);

    --header-height: 60px;
}

/* --- Login Experience --- */
.login-page {
    min-height: 100vh;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: clamp(2rem, 5vw, 4rem);
    background: radial-gradient(circle at 12% 18%, rgba(254, 236, 250, 0.96) 0%, rgba(247, 217, 255, 0.92) 42%, rgba(255, 229, 218, 0.95) 100%);
    font-family: "Inter", "Poppins", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #4d1c30;
}

.login-shell {
    width: min(1160px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 500px);
    background: rgba(255, 255, 255, 0.28);
    border-radius: 28px;
    position: relative;
    box-shadow: 0 45px 90px rgba(90, 28, 56, 0.18);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    overflow: hidden;
}

.login-hero {
    position: relative;
    padding: clamp(3rem, 6vw, 4.75rem);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(132deg, rgba(243, 208, 247, 0.8) 0%, rgba(246, 193, 224, 0.82) 50%, rgba(231, 182, 245, 0.7) 100%);
}

.login-hero__highlight {
    position: absolute;
    width: 540px;
    height: 540px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    filter: blur(14px);
    animation: loginPulse 16s ease-in-out infinite;
}

.login-hero__graphic {
    position: relative;
    width: min(78%, 440px);
    aspect-ratio: 1;
    border-radius: 42px;
    background: linear-gradient(148deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.52) 100%);
    box-shadow: 0 32px 64px rgba(121, 39, 79, 0.18);
    overflow: hidden;
    align-self: center;
    z-index: 1;
}

.login-hero__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(6px);
    opacity: 0.85;
}

.login-hero__orb--one {
    width: 220px;
    height: 220px;
    top: 12%;
    left: 16%;
    background: radial-gradient(circle, rgba(250, 126, 177, 0.75) 0%, rgba(250, 126, 177, 0.18) 80%);
    animation: floatSoft 14s ease-in-out infinite;
}

.login-hero__orb--two {
    width: 280px;
    height: 280px;
    bottom: 10%;
    right: 14%;
    background: radial-gradient(circle, rgba(186, 147, 255, 0.7) 0%, rgba(186, 147, 255, 0.16) 80%);
    animation: floatSoft 16s ease-in-out infinite reverse;
}

.login-hero__logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 160px;
    height: 160px;
    border-radius: 36px;
    background: rgba(255, 255, 255, 0.82);
    display: grid;
    place-items: center;
    box-shadow: 0 28px 48px rgba(190, 18, 57, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.65);
}

.login-hero__logo img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 28px;
    box-shadow: 0 12px 28px rgba(190, 18, 57, 0.25);
}

.login-panel {
    position: relative;
    padding: clamp(2.9rem, 5vw, 3.6rem);
    display: flex;
    flex-direction: column;
    gap: 1.85rem;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
}

.login-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(241, 149, 203, 0.32);
    pointer-events: none;
}

.login-panel__brand {
    text-align: center;
}

.login-panel__title {
    margin: 0;
    font-size: clamp(1.7rem, 3vw, 2.15rem);
    font-weight: 800;
    color: #8a1234;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.login-panel__subtitle {
    margin: 0.35rem 0 0;
    font-size: 0.96rem;
    color: rgba(122, 15, 46, 0.75);
    font-weight: 500;
}

.login-alert {
    border-radius: 16px;
    padding: 0.95rem 1.1rem;
    font-weight: 600;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    transition: transform 0.3s ease;
}

.login-alert--error {
    background: rgba(255, 228, 230, 0.92);
    color: #b91c1c;
    border: 1px solid rgba(248, 113, 113, 0.32);
    box-shadow: 0 18px 36px rgba(248, 113, 113, 0.18);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.login-field__control {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(250, 207, 230, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
    padding: 0;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.login-field__icon {
    position: absolute;
    left: 1.05rem;
    font-size: 1.05rem;
    color: rgba(190, 18, 60, 0.7);
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.login-field__input {
    width: 100%;
    padding: 1.05rem 3.2rem 0.95rem 3rem;
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: 500;
    color: #68132b;
    caret-color: #be123c;
}

.login-field__input--password {
    padding-right: 3.6rem;
}

.login-field__input:focus {
    outline: none;
}

.login-field__floating {
    position: absolute;
    left: 3rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.96rem;
    font-weight: 500;
    color: rgba(108, 30, 57, 0.7);
    pointer-events: none;
    transition: transform 0.25s ease, color 0.25s ease, font-size 0.25s ease;
}

.login-field__toggle {
    position: absolute;
    right: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(233, 30, 99, 0.08);
    color: rgba(122, 15, 46, 0.75);
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.login-field__toggle:hover,
.login-field__toggle:focus-visible,
.login-field__toggle.is-active {
    background: rgba(233, 30, 99, 0.18);
    color: #8a1234;
    outline: none;
    transform: translateY(-1px);
}

.login-field__toggle-icon {
    font-size: 1rem;
}

.login-field__control:focus-within {
    border-color: rgba(233, 30, 99, 0.85);
    box-shadow: 0 0 0 4px rgba(233, 30, 99, 0.18);
}

.login-field__input:focus + .login-field__floating,
.login-field__input:not(:placeholder-shown) + .login-field__floating {
    transform: translateY(-1.7rem) scale(0.88);
    color: #be123c;
    font-weight: 600;
}

.login-field__input:focus ~ .login-field__icon,
.login-field__input:not(:placeholder-shown) ~ .login-field__icon {
    transform: translateY(-2px) scale(0.95);
    opacity: 0.8;
}

/* Keep floating labels clear when the browser autofills saved credentials */
.login-field__input:-webkit-autofill {
    -webkit-text-fill-color: #68132b;
    transition: background-color 9999s ease-out;
}

.login-field__input:-webkit-autofill + .login-field__floating {
    transform: translateY(-1.7rem) scale(0.88);
    color: #be123c;
    font-weight: 600;
}

.login-field__input:-webkit-autofill ~ .login-field__icon {
    transform: translateY(-2px) scale(0.95);
    opacity: 0.8;
}

.login-action {
    margin-top: 0.6rem;
    padding: 0.95rem 1.2rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(134deg, #f472b6 0%, #be123c 100%);
    color: #fff;
    font-size: 1.02rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
    box-shadow: 0 24px 38px rgba(190, 18, 57, 0.28);
}

.login-action:hover,
.login-action:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 28px 46px rgba(190, 18, 57, 0.32);
    filter: brightness(1.02);
    outline: none;
}

.login-meta {
    font-size: 0.86rem;
    color: rgba(73, 24, 42, 0.65);
    text-align: center;
    padding-bottom: 1.4rem;
}

@keyframes loginPulse {
    0% { transform: scale(0.9); opacity: 0.35; }
    50% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(0.9); opacity: 0.35; }
}

@keyframes floatSoft {
    0% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(-8px, -10px, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

@media (max-width: 1024px) {
    .login-shell {
        grid-template-columns: 1fr;
    }
    .login-hero {
        display: none;
    }
    .login-panel {
        border-radius: 28px;
    }
}

@media (max-width: 540px) {
    .login-shell {
        background: transparent;
        box-shadow: none;
    }
    .login-panel {
        padding: 2.6rem 1.9rem;
        border-radius: 22px;
        box-shadow: 0 24px 60px rgba(90, 28, 56, 0.24);
    }
    .login-panel__title {
        font-size: 1.65rem;
        white-space: normal;
    }
    .login-field__control {
        border-radius: 14px;
    }
    .login-field__floating {
        left: 2.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-hero__highlight,
    .login-hero__orb,
    .login-field__control,
    .login-field__icon,
    .login-field__floating,
    .login-field__toggle,
    .login-action,
    .login-alert {
        transition: none !important;
        animation: none !important;
    }
}


/* --- Main Header --- */
.main-header {
    background-color: var(--header-bg);
    padding: 0 2.5%;
    border-bottom: 1px solid var(--header-border);
    box-shadow: 0 6px 18px rgba(250, 207, 231, 0.35);
    position: sticky;
    top: 0;
    z-index: 1100;
    backdrop-filter: blur(6px);
}

.main-header a {
    color: var(--header-link);
    text-decoration: none;
    transition: color 0.25s ease;
}

.main-header a:hover,
.main-header a:focus-visible {
    color: var(--header-link-hover);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
}

.logo-area a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--header-text);
    text-decoration: none;
}

.logo-area a:hover {
    color: var(--header-link-hover);
}

.logo-area img {
    height: 42px;
    width: 42px;
    object-fit: contain;
}

.logo-area span {
    line-height: 1;
}

.user-info-area {
    display: flex;
    align-items: center;
}

.user-info-area span {
    margin-right: 20px;
    font-weight: 500;
    color: var(--header-text);
}

.main-header .btn-logout {
    background-color: var(--header-cta-bg);
    color: var(--header-cta-text);
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.main-header .btn-logout:hover {
    background-color: var(--header-link-hover);
    color: #ffffff;
}

.main-header .btn-logout:focus-visible {
    outline: 2px solid var(--header-link);
    outline-offset: 2px;
}

/* --- Dashboard --- */
.dashboard-container h1 {
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.action-card {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 25px;
    text-decoration: none;
    color: #333;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.action-card h2 {
    margin-top: 0;
    color: #007bff;
}

/* --- Forms --- */
.form-container, .table-container {
    padding: 20px;
}

fieldset {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
}

legend {
    font-weight: 600;
    color: #0056b3;
    padding: 0 10px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input, .form-group select, .form-group textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

#selected-tests-list {
    list-style: none;
    padding: 10px;
    margin-top: 10px;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 4px;
}

#selected-packages-list {
    list-style: none;
    padding: 10px;
    margin-top: 10px;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 4px;
    background: #f9fcff;
}

#selected-tests-list li {
    background: #e9ecef;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

#selected-packages-list li {
    background: #eef6ff;
    border: 1px solid #d4e5fb;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
}

.btn-submit {
    background-color: #28a745;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.selected-test-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 60%;
}

.selected-test-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.screening-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.screening-button {
    background: #6c757d;
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s ease;
}

.screening-button:hover {
    background: #5a6268;
}

.screening-button.active {
    background: #17a2b8;
}

.screening-custom-container {
    display: none;
    align-items: center;
    gap: 6px;
}

.screening-custom-label {
    font-size: 12px;
    color: #495057;
}

.screening-custom-input {
    width: 90px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
}

.screening-summary {
    font-size: 12px;
    font-weight: 500;
    color: #343a40;
}

.package-includes {
    margin-top: 6px;
}

.package-includes-list {
    margin: 4px 0 0;
    padding-left: 18px;
}

.package-includes-list li {
    margin: 2px 0;
    font-size: 12px;
    color: #334155;
}

.btn-submit:hover {
    background-color: #218838;
}

.btn-submit:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}
.btn-cancel {
    background-color: #6c757d;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-left: 10px;
}

.split-payment-details {
    margin-top: 0.35rem;
    padding: 0.85rem;
    border: 1px solid #d9e7ff;
    border-radius: 10px;
    background: #f8fbff;
}

.split-payment-details .form-group {
    min-width: 180px;
}

.split-payment-note {
    margin-top: 0.45rem;
    font-size: 0.86rem;
    color: #475569;
}

.split-payment-note strong {
    color: #1d4ed8;
}


/* --- Data Table & History --- */
.search-bar-container {
    margin-bottom: 20px;
}
#bill-search {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}
.data-table th, .data-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}
.data-table th {
    background-color: #f2f2f2;
}
.status-paid {
    background-color: #d4edda;
    color: #155724;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9em;
    display: inline-block;
}

.status-pending, .status-due, .status-partial-paid, .status-query-raised {
    background-color: #fff3cd;
    color: #856404;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9em;
    display: inline-block;
}

.btn-action {
    padding: 5px 10px;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    margin-right: 5px;
    font-size: 0.9em;
}
.btn-view { background-color: #007bff; }
.btn-edit { background-color: #ffc107; color: #212529; }
.btn-disabled { background-color: #6c757d; cursor: not-allowed; opacity: 0.6; }
.btn-paid { background-color: #28a745; border: none; font-family: 'Inter', sans-serif; cursor: pointer; }

/* --- Unified Pagination --- */
.unified-pagination,
.pagination {
    margin: 0.95rem 0 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.34rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    scrollbar-width: thin;
}

.unified-pagination .page-item,
.pagination a,
.page-link,
.pagination-controls .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.58rem;
    border-radius: 8px;
    border: 1px solid #f0c4d9;
    background: #fff;
    color: #475569;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: all 0.18s ease;
    box-sizing: border-box;
}

.unified-pagination .page-item:hover,
.pagination a:hover,
.page-link:hover,
.pagination-controls .page-btn:hover {
    border-color: #e63b6f;
    color: #be123c;
    background: #fff6fa;
}

.unified-pagination .page-number.is-active,
.pagination a.active,
.page-link.active,
.pagination-controls .page-btn.active,
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, #e63b6f 0%, #de2d63 100%) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 8px 16px rgba(230, 59, 111, 0.24);
}

.unified-pagination .is-disabled,
.page-link.disabled,
.pagination-controls .page-btn[aria-disabled="true"],
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.48;
    pointer-events: none;
}

.unified-pagination .page-ellipsis,
.page-ellipsis,
.dataTables_wrapper .dataTables_paginate .ellipsis {
    border: none !important;
    background: transparent !important;
    min-width: auto;
    padding: 0 0.15rem;
    color: #94a3b8;
}

/* DataTables control polish */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-top: 0.28rem;
    margin-bottom: 0.2rem;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_info {
    font-size: 0.86rem;
    color: #6b7280;
    font-weight: 600;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    height: 34px;
    border-radius: 8px;
    border: 1px solid #f2bfd5;
    background: #fff;
    color: #374151;
    padding: 0.3rem 0.6rem;
    font-size: 0.86rem;
}

.dataTables_wrapper .dataTables_filter input {
    min-width: 180px;
}

.dataTables_wrapper .dataTables_paginate {
    display: flex;
    justify-content: flex-end;
    gap: 0.34rem;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.58rem !important;
    border-radius: 8px !important;
    border: 1px solid #f0c4d9 !important;
    background: #fff !important;
    color: #475569 !important;
    margin: 0 !important;
    line-height: 1;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    border-color: #e63b6f !important;
    color: #be123c !important;
    background: #fff6fa !important;
}


/* --- Footer --- */
.main-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    text-align: center;
    padding: 24px 0;
    margin-top: auto;
    border-top: 1px solid var(--footer-border);
}

.main-footer p {
    color: var(--footer-text) !important;
    margin: 0;
}

.main-footer h1,
.main-footer h2,
.main-footer h3,
.main-footer h4,
.main-footer h5,
.main-footer h6 {
    color: var(--footer-heading);
    margin: 0 0 0.5rem;
}

.main-footer a {
    color: var(--footer-link);
    text-decoration: none;
    transition: color 0.25s ease;
}

.main-footer a:hover,
.main-footer a:focus-visible {
    color: var(--footer-link-hover);
}


/* --- Printable Bill & Report Styles --- */
.print-controls {
    text-align: center;
    padding: 20px;
    background: #F8BBD0;
}
.print-controls button, .print-controls a {
    background-color: #E91E63;
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    margin: 0 10px;
    cursor: pointer;
    font-size: 16px;
}
.print-controls a[href*="dashboard"] {
    background-color: #C2185B;
}

.print-area {
    width: 80%;
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.bill-header {
    text-align: center;
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
    margin-bottom: 20px;
}
.bill-header h1 {
    margin: 0;
    color: #0056b3;
}
.bill-header h2 {
    margin: 10px 0 0;
    display: inline-block;
    padding: 5px 20px;
    border: 1px solid #333;
    border-radius: 5px;
}

.bill-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.patient-details {
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}
.patient-details h3 {
    margin-top: 0;
}
.patient-details p {
    margin: 5px 0;
}

.bill-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}
.bill-table th, .bill-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}
.bill-table th {
    background-color: #f2f2f2;
}
.bill-table .text-right {
    text-align: right;
}
.bill-table tfoot .total-row {
    font-size: 1.2em;
    background-color: #e9ecef;
}

.bill-footer {
    margin-top: 30px;
    text-align: center;
}
.bill-footer .signature {
    margin-top: 40px;
    border-top: 1px solid #ccc;
    padding-top: 5px;
    display: inline-block;
}


/* Print Styles */
/* Detailed print styles trimmed in this build; ensure section wrappers remain intact. */

/* --- Delete Button Link Styling --- */
a.btn-action.btn-delete {
    color: red !important;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
}

a.btn-action.btn-delete:hover {
    color: darkred !important;
    text-decoration: underline;
}

.management-form .form-group label {
    font-weight: 600;
    color: #333;
}

/* Navbar */
.main-navbar {
    background: var(--nav-bg);
    padding: 0.85rem 2.75rem;
    box-shadow: 0 12px 24px rgba(249, 168, 212, 0.35);
    border-bottom: 1px solid var(--nav-border);
    position: sticky;
    top: var(--header-height);
    z-index: 900;
    transition: max-height 0.35s ease, padding 0.35s ease, opacity 0.25s ease, border-width 0.3s ease;
    max-height: 320px;
    overflow: visible;
}

body.nav-collapsed .main-navbar {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    border-width: 0;
    pointer-events: none;
    overflow: hidden;
}

.main-navbar ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: visible;
}

.main-navbar ul li {
    position: relative;
    flex: 0 1 auto;
}

.main-navbar ul li a {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--nav-text);
    text-decoration: none;
    padding: 0.7rem 1.4rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 999px;
    background: transparent;
    border: none;
    position: relative;
    z-index: 1;
    transition: transform 0.28s ease, color 0.24s ease;
}

.main-navbar ul li a i {
    font-size: 1rem;
    color: inherit;
    transition: transform 0.24s ease;
}

.main-navbar ul li a::after {
    display: none;
}

.main-navbar ul li a:hover,
.main-navbar ul li a:focus-visible,
.main-navbar ul li a.active {
    transform: translateY(-1px);
}

.main-navbar ul li a:hover:not(.active),
.main-navbar ul li a:focus-visible:not(.active) {
    color: var(--nav-text-hover);
}

.main-navbar ul li a.active {
    color: var(--nav-active-text);
}

.main-navbar ul li a.active i,
.main-navbar ul li a:hover i,
.main-navbar ul li a:focus-visible i {
    transform: scale(1.05);
}

.main-navbar .nav-pill-indicator {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 999px;
    background: var(--nav-active-bg);
    box-shadow: 0 8px 20px rgba(230, 59, 111, 0.35);
    transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1), width 0.35s ease, height 0.35s ease, opacity 0.25s ease;
    pointer-events: none;
    opacity: 0;
    z-index: 0;
}

.main-navbar .nav-pill-indicator[data-state="hover"] {
    background: var(--dropdown-hover-bg);
    box-shadow: 0 10px 22px rgba(122, 15, 46, 0.18);
}

@media (prefers-reduced-motion: reduce) {
    .main-navbar .nav-pill-indicator {
        transition: none;
    }
    .main-navbar ul li a {
        transition: none;
    }
}

.main-navbar .nav-badge {
    margin-left: 0.4rem;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(230, 59, 111, 0.15);
    color: var(--nav-text);
    transition: background 0.24s ease, color 0.24s ease;
}

.main-navbar ul li a.active .nav-badge,
.main-navbar ul li a:hover .nav-badge,
.main-navbar ul li a:focus-visible .nav-badge {
    background: rgba(230, 59, 111, 0.3);
    color: var(--nav-active-text);
}

.main-navbar ul li ul {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--dropdown-bg);
    border: 1px solid var(--dropdown-border);
    border-radius: 12px;
    box-shadow: 0 16px 32px rgba(122, 15, 46, 0.12);
    padding: 0.5rem 0;
    list-style: none;
    display: none;
    z-index: 950;
}

.main-navbar ul li:hover > ul,
.main-navbar ul li:focus-within > ul {
    display: block;
}

.main-navbar ul li ul li a {
    display: block;
    padding: 0.65rem 1.25rem;
    color: var(--dropdown-item);
    border-radius: 0;
    transform: none;
}

.main-navbar ul li ul li a:hover,
.main-navbar ul li ul li a:focus-visible {
    background: var(--dropdown-hover-bg);
    color: var(--dropdown-item-hover);
}

@media (max-width: 1024px) {
    .main-navbar {
        padding: 0.65rem 1.75rem;
    }

    .main-navbar ul {
        justify-content: flex-start;
    }

    .main-navbar ul li a {
        padding: 0.65rem 1.1rem;
    }
}

@media (max-width: 640px) {
    .main-navbar {
        padding: 0.55rem 1rem;
    }

    .main-navbar ul {
        gap: 0.45rem;
    }

    .main-navbar ul li a {
        padding: 0.55rem 0.95rem;
        font-size: 0.9rem;
    }
}

/* Dashboard charts */
.charts-section {
    align-items: stretch;
    gap: 1.5rem;
}

.charts-section .chart-container {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 320px;
}

.charts-section .chart-container h3 {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
}

.charts-section .chart-container canvas {
    flex: 1 1 auto;
    width: 100% !important;
    max-width: 100%;
    min-height: 260px;
    max-height: 380px;
}

/* ===== DESKTOP: Compact Filter Forms (Single Row Layout) ===== */
.filter-form.compact-filters {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.filter-form.compact-filters .filter-group {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    min-width: auto;
}

.filter-form.compact-filters .filter-group label {
    min-width: auto;
    white-space: nowrap;
    font-size: 0.9rem;
    margin: 0;
}

.filter-form.compact-filters .filter-group input,
.filter-form.compact-filters .filter-group select {
    width: 140px;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    height: 36px;
}

.filter-form.compact-filters .filter-actions {
    flex: 0 0 auto;
    margin-left: auto;
    display: flex;
    gap: 0.4rem;
    margin-top: 0;
}

.filter-form.compact-filters .filter-actions .btn-submit,
.filter-form.compact-filters .filter-actions .btn-cancel {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    white-space: nowrap;
    height: 36px;
    display: flex;
    align-items: center;
}

@media (max-width: 768px) {
    .charts-section {
        gap: 1rem;
    }

    .charts-section .chart-container {
        min-height: 280px;
        padding: 1rem 1.15rem;
    }

    .charts-section .chart-container h3 {
        margin-bottom: 0.75rem;
    }

    .charts-section .chart-container canvas {
        min-height: 220px;
        max-height: 320px;
    }
}

/* --- Global Popup System --- */
#global-popup-container {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: clamp(300px, 100%, 420px);
    pointer-events: none;
}

.global-popup {
    background: #ffffff;
    border: 1px solid var(--border-light, #e5e7eb);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    overflow: hidden;
    pointer-events: auto;
    animation: popupSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
}

.global-popup-header {
    background: var(--brand-pink-soft, #fce7f3);
    padding: 0.85rem 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light, #fbcfe8);
}

.global-popup-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--header-text, #831843);
}

.global-popup-close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.global-popup-close:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary, #1f2937);
}

.global-popup-body {
    padding: 1rem 1.1rem;
    font-size: 0.9rem;
    color: var(--text-secondary, #374151);
    max-height: 60vh;
    overflow-y: auto;
}

.global-popup-body p {
    margin: 0 0 0.5rem;
}

.global-popup-body ul {
    margin: 0.5rem 0;
    padding-left: 1.2rem;
}

.global-popup-body li {
    margin-bottom: 0.25rem;
}

.global-popup-actions {
    padding: 0.75rem 1.1rem;
    background: var(--bg-secondary, #f9fafb);
    border-top: 1px solid var(--border-light, #f3f4f6);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.popup-action-btn {
    padding: 0.45rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-light, #d1d5db);
    background: white;
    color: var(--text-secondary, #374151);
    transition: all 0.2s;
}

.popup-action-btn:hover {
    background: var(--bg-muted, #f3f4f6);
}

.popup-action-btn.variant-primary {
    background: var(--brand-pink, #be185d);
    color: white;
    border-color: var(--brand-pink, #be185d);
}

.popup-action-btn.variant-primary:hover {
    background: #9d174d;
    border-color: #9d174d;
}

@keyframes popupSlideIn {
    from { 
        transform: translateY(20px); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0); 
        opacity: 1; 
    }
}


/* =========================================
   Responsive Design & Mobile Optimization
   ========================================= */

/* Global Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Mobile Toggle Button */
#mobile-menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--header-text);
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
    margin-left: -0.5rem;
}

/* Responsive Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border: 1px solid var(--border-light, #eee);
    border-radius: 8px;
}
.data-table {
    min-width: 700px; /* Force scroll on small screens */
    margin-bottom: 0; /* Remove margin as wrapper handles it */
}

/* Media Queries */
@media screen and (max-width: 900px) {
    .page-container {
        width: 100%;
        padding: 1rem;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start !important; /* Force alignment */
        gap: 1rem;
    }
    
    .dashboard-header .btn-submit,
    .dashboard-header .btn-cancel,
    .dashboard-header div {
        width: 100%;
    }
    
    .dashboard-header .btn-submit {
        justify-content: center;
    }
}

@media screen and (max-width: 768px) {
    /* Header & Navigation */
    #mobile-menu-toggle {
        display: block;
    }

    .header-container {
        padding: 0.5rem 1rem;
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
    }

    .logo-area {
        flex: 1;
        display: flex;
        align-items: center;
        min-width: 200px;
    }
    
    .logo-area a span {
        font-size: 1.1rem; /* Smaller logo text */
    }

    .user-info-area {
        width: 100%;
        justify-content: space-between;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(0,0,0,0.05);
        font-size: 0.9rem;
    }

    /* Main Navbar Mobile */
    .main-navbar {
        background: var(--nav-bg);
        border-bottom: 1px solid var(--nav-border);
        position: static;
        top: 0;
        max-height: none;
        overflow: visible;
        padding: 0.5rem 0;
    }

    body.nav-collapsed .main-navbar {
        max-height: none;
        opacity: 1;
        border-width: 1px;
        pointer-events: auto;
    }
    
    .main-navbar ul {
        display: none; /* Hidden by default */
        flex-direction: column;
        width: 100%;
        padding: 0;
        margin: 0;
        max-height: none;
        overflow: visible;
    }

    .main-navbar ul.show {
        display: flex;
    }

    .main-navbar ul li {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        margin: 0;
    }

    .main-navbar ul li a {
        padding: 1rem;
        display: flex;
        align-items: center;
        width: 100%;
        border-radius: 0; /* Remove rounded corners on mobile */
    }
    
    .main-navbar ul li a:hover::after {
        display: none; /* Remove hover underline effect if exists */
    }

    .quick-date-pills {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .quick-date-pills .btn-action {
        flex: 1 1 40%; /* 2 per row approx */
        text-align: center;
        margin-bottom: 5px;
    }

    /* Cards & Grids */
    .summary-cards, .charts-section, .dashboard-actions {
        grid-template-columns: 1fr !important; /* Stack cards */
    }

    .form-row {
        flex-direction: column;
    }
    
    /* Dialogs/Modals */
    .form-container, .table-container {
        padding: 1rem;
    }
}

/* =========================================
   Unified App Shell (All Auth Roles)
   ========================================= */
body.app-layout {
    --shell-header-height: 68px;
    --shell-sidebar-width: 272px;
    --shell-sidebar-collapsed-width: 84px;
    display: block;
    min-height: 100vh;
    padding-top: var(--shell-header-height);
    background: #f7f7fb;
}

body.app-layout .main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--shell-header-height);
    z-index: 1300;
    padding: 0 1.1rem;
    border-bottom: 1px solid var(--header-border);
    box-shadow: 0 8px 24px rgba(250, 207, 231, 0.4);
    display: flex;
    align-items: center;
    backdrop-filter: blur(8px);
}

body.app-layout .header-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

body.app-layout .logo-area {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

body.app-layout .logo-area a {
    display: inline-flex;
    align-items: center;
    gap: 0.62rem;
    min-width: 0;
}

body.app-layout .logo-area img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--header-border);
    background: #fff;
    object-fit: cover;
}

body.app-layout .logo-area span {
    font-size: 1.28rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

body.app-layout .shell-icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: #fff;
    color: var(--header-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

body.app-layout .shell-icon-btn:hover,
body.app-layout .shell-icon-btn:focus-visible {
    background: var(--brand-pink-soft);
    color: var(--header-link-hover);
    transform: translateY(-1px);
    outline: none;
}

body.app-layout .header-notification {
    position: relative;
    display: inline-flex;
    align-items: center;
}

body.app-layout .notification-bell-btn {
    position: relative;
}

body.app-layout .notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    margin: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.35);
}

body.app-layout .notification-badge.is-hidden {
    display: none;
}

html.notification-dropdown-open,
body.notification-dropdown-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}

body.app-layout .notification-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(390px, calc(100vw - 1.5rem));
    max-height: min(70vh, 520px);
    border-radius: 14px;
    border: 1px solid #f1d4e3;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
    z-index: 1700;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    overscroll-behavior: contain;
    animation: notificationDropdownIn 0.24s ease;
}

body.app-layout .notification-dropdown[hidden] {
    display: none !important;
}

body.app-layout .notification-dropdown::before {
    content: "";
    position: absolute;
    top: -8px;
    right: 12px;
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid #f1d4e3;
    border-left: 1px solid #f1d4e3;
    transform: rotate(45deg);
}

body.app-layout .notification-dropdown__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.88rem 1rem;
    background: #fdeaf2;
    border-bottom: 1px solid #f6d5e5;
    position: sticky;
    top: 0;
    z-index: 2;
    flex: 0 0 auto;
}

body.app-layout .notification-dropdown__title-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.16rem;
    min-width: 0;
}

body.app-layout .notification-dropdown__title {
    margin: 0;
    color: #831843;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
}

body.app-layout .notification-dropdown__count {
    margin: 0;
    color: #9f1239;
    font-size: 0.8rem;
    font-weight: 600;
}

body.app-layout .notification-dropdown__close {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.app-layout .notification-dropdown__close:hover,
body.app-layout .notification-dropdown__close:focus-visible {
    background: rgba(15, 23, 42, 0.08);
    color: #111827;
    outline: none;
}

body.app-layout .notification-dropdown__body {
    padding: 0.9rem 1rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

body.app-layout .notification-dropdown__summary {
    margin: 0 0 0.65rem;
    color: #334155;
    font-size: 0.88rem;
    line-height: 1.45;
}

body.app-layout .notification-dropdown__list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: clamp(220px, 45vh, 360px);
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

body.app-layout .notification-dropdown__item {
    padding: 0.58rem 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

body.app-layout .notification-dropdown__item:last-child {
    border-bottom: none;
}

body.app-layout .notification-dropdown__item strong {
    color: #0f172a;
    font-size: 0.84rem;
    font-weight: 700;
}

body.app-layout .notification-dropdown__meta {
    color: #475569;
    font-size: 0.82rem;
}

body.app-layout .notification-dropdown__actions {
    padding: 0.75rem 1rem;
    border-top: 1px solid #f3f4f6;
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    position: sticky;
    bottom: 0;
    z-index: 2;
    flex: 0 0 auto;
}

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

body.app-layout .user-info-area {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin-left: auto;
}

body.app-layout .user-info-area > span {
    margin: 0;
}

body.app-layout .user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0.58rem 0.3rem 0.35rem;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    background: #fff;
    color: var(--text-primary);
    max-width: 320px;
}

body.app-layout .user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 800;
    color: #fff;
    background: var(--brand-pink);
    flex: 0 0 auto;
}

body.app-layout .user-meta {
    display: inline-flex;
    flex-direction: column;
    min-width: 0;
}

body.app-layout .user-meta strong,
body.app-layout .user-meta small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.app-layout .user-meta strong {
    font-size: 0.85rem;
    line-height: 1.1;
}

body.app-layout .user-meta small {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.1;
}

body.app-layout .main-header .btn-logout {
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
}

body.app-layout .app-shell {
    display: block;
}

body.app-layout .main-navbar {
    position: fixed;
    top: var(--shell-header-height);
    left: 0;
    bottom: 0;
    width: var(--shell-sidebar-width);
    padding: 0.95rem 0.75rem 1.15rem;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1200;
    background: linear-gradient(180deg, #fef1f6 0%, #fce7f1 100%);
    border-right: 1px solid var(--nav-border);
    box-shadow: 8px 0 28px rgba(249, 168, 212, 0.3);
    max-height: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
    transition: width 0.24s ease, padding 0.24s ease, transform 0.24s ease;
}

body.app-layout .main-navbar::-webkit-scrollbar {
    width: 0;
    height: 0;
}

body.app-layout .main-navbar:hover {
    scrollbar-width: thin;
}

body.app-layout .main-navbar:hover::-webkit-scrollbar {
    width: 6px;
}

body.app-layout .main-navbar:hover::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.45);
    border-radius: 999px;
}

body.app-layout .main-navbar:hover::-webkit-scrollbar-thumb {
    background: rgba(224, 55, 106, 0.55);
    border-radius: 999px;
}

body.app-layout .sidebar-role-label {
    margin: 0.25rem 0.35rem 0.8rem;
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--nav-text-hover);
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(230, 59, 111, 0.22);
}

body.app-layout .main-navbar .nav-pill-indicator {
    display: none !important;
}

body.app-layout .main-navbar ul {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.42rem;
}

body.app-layout .main-navbar ul li {
    width: 100%;
}

body.app-layout .main-navbar ul li a {
    width: 100%;
    border-radius: 12px;
    padding: 0.7rem 0.78rem;
    justify-content: flex-start;
    gap: 0.72rem;
    font-size: 0.92rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
    overflow: hidden;
}

body.app-layout .main-navbar ul li a i {
    width: 1.1rem;
    min-width: 1.1rem;
    text-align: center;
}

body.app-layout .main-navbar ul li a .nav-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.app-layout .main-navbar ul li a:hover,
body.app-layout .main-navbar ul li a:focus-visible {
    background: #ffffff;
    border-color: rgba(230, 59, 111, 0.2);
    transform: none;
}

body.app-layout .main-navbar ul li a.active {
    background: linear-gradient(135deg, #e63b6f 0%, #de2d63 100%);
    color: var(--nav-active-text);
    border-color: transparent;
    box-shadow: 0 10px 18px rgba(230, 59, 111, 0.32);
}

body.app-layout .main-navbar .nav-badge {
    margin-left: auto;
    padding: 0.14rem 0.5rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.1;
    background: rgba(230, 59, 111, 0.18);
    color: var(--nav-text-hover);
}

body.app-layout .main-navbar ul li a.active .nav-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

body.app-layout .app-main {
    margin-left: var(--shell-sidebar-width);
    padding: 0.85rem 0.9rem 1rem;
    min-height: calc(100vh - var(--shell-header-height));
    transition: margin-left 0.24s ease;
}

body.app-layout .app-main .page-container,
body.app-layout .app-main .table-container,
body.app-layout .app-main .form-container,
body.app-layout .app-main .dashboard-container {
    width: 100%;
    max-width: none;
    margin: 0 0 0.8rem;
}

body.app-layout .app-main .dashboard-header {
    margin-bottom: 0.7rem;
    padding-bottom: 0.55rem;
}

body.app-layout .app-main .dashboard-header h1 {
    margin: 0;
}

body.app-layout .app-main .dashboard-header p {
    margin: 0.18rem 0 0;
}

body.app-layout .app-main .filter-form.compact-filters {
    margin-bottom: 0.85rem !important;
}

body.app-layout .app-main .summary-cards,
body.app-layout .app-main .charts-section {
    margin-bottom: 0.85rem;
}

body.app-layout .app-main .table-container > h2,
body.app-layout .app-main .table-container > h3 {
    margin: 0 0 0.65rem;
}

body.app-layout .main-footer {
    margin-left: var(--shell-sidebar-width);
    transition: margin-left 0.24s ease;
}

/* ===== Collapsed Sidebar State =====
   Uses !important to beat role-specific CSS that re-declares
   .main-navbar width (manager.css, accountant.css, superadmin.css, etc.)
   ===================================== */

body.app-layout.sidebar-collapsed .main-navbar {
    width: var(--shell-sidebar-collapsed-width) !important;
    padding: 0.95rem 0.55rem 1.15rem !important;
    overflow: visible; /* allow tooltips to peek out */
}

body.app-layout.sidebar-collapsed .main-navbar ul li a {
    justify-content: center !important;
    padding: 0.7rem 0 !important;
    gap: 0 !important;
    position: relative;
    border-radius: 12px !important;
}

body.app-layout.sidebar-collapsed .main-navbar ul li a .nav-label,
body.app-layout.sidebar-collapsed .main-navbar .sidebar-role-label,
body.app-layout.sidebar-collapsed .main-navbar .nav-badge {
    display: none !important;
}

body.app-layout.sidebar-collapsed .main-navbar ul li a i {
    margin: 0 !important;
    font-size: 1.15rem;
    width: auto;
    min-width: auto;
}

body.app-layout.sidebar-collapsed .app-main,
body.app-layout.sidebar-collapsed .main-footer {
    margin-left: var(--shell-sidebar-collapsed-width) !important;
}

/* Tooltip on hover in collapsed mode */
body.app-layout.sidebar-collapsed .main-navbar ul li a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-primary, #1e293b);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

body.app-layout.sidebar-collapsed .main-navbar ul li a:hover::after {
    opacity: 1;
}

@media (max-width: 1200px) {
    body.app-layout .user-chip {
        max-width: 240px;
    }
}

@media (max-width: 1024px) {
    body.app-layout {
        padding-top: var(--shell-header-height);
    }

    body.app-layout .main-navbar {
        transform: translateX(-108%);
        width: min(80vw, 300px) !important;
        box-shadow: 16px 0 34px rgba(0, 0, 0, 0.18);
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    body.app-layout::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(20, 20, 30, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 1190;
    }

    body.app-layout.sidebar-open .main-navbar {
        transform: translateX(0);
    }

    body.app-layout.sidebar-open::before {
        opacity: 1;
        pointer-events: auto;
    }

    body.app-layout .app-main,
    body.app-layout .main-footer,
    body.app-layout.sidebar-collapsed .app-main,
    body.app-layout.sidebar-collapsed .main-footer {
        margin-left: 0 !important;
    }

    body.app-layout .app-main {
        padding: 0.85rem;
    }

    body.app-layout .user-chip {
        max-width: 190px;
    }
}

@media (max-width: 768px) {
    body.app-layout .main-header {
        padding: 0 0.65rem;
    }

    body.app-layout .logo-area span {
        font-size: 1.05rem;
    }

    body.app-layout .user-info-area {
        gap: 0.35rem;
    }

    body.app-layout .user-chip {
        padding-right: 0.45rem;
        max-width: 128px;
    }

    body.app-layout .user-meta small {
        display: none;
    }

    body.app-layout .shell-icon-btn {
        width: 33px;
        height: 33px;
    }

    body.app-layout .notification-dropdown {
        position: fixed;
        top: calc(var(--shell-header-height) + 0.35rem);
        right: 0.5rem;
        width: min(360px, calc(100vw - 1rem));
    }

    body.app-layout .notification-dropdown::before {
        display: none;
    }

    body.app-layout .main-header .btn-logout {
        padding: 0.45rem 0.65rem;
        font-size: 0.8rem;
    }

    /* The header is fixed at --shell-header-height. The older phone rules for
       the header before the shell (the 768px block further up) wrap the user
       controls onto a second row, which spilled out of the fixed header over
       every page's title. One row, always. */
    body.app-layout .header-container {
        flex-wrap: nowrap;
        padding: 0;
        min-height: 0;
    }

    body.app-layout .logo-area {
        flex: 0 1 auto;
        min-width: 0;
    }

    body.app-layout .user-info-area {
        width: auto;
        flex: 0 0 auto;
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
    }
}

@media (max-width: 480px) {
    /* A phone: the logo without the name beside it, and the user's initial
       without their name (the chip's tooltip still has it), so the bell,
       settings and Logout fit on the one row. */
    body.app-layout .logo-area a span,
    body.app-layout .user-meta {
        display: none;
    }

    body.app-layout .user-chip {
        padding: 0.2rem;
        max-width: none;
    }

    /* The old `.user-info-area span` margin, which on a wider screen is the
       space before the name. */
    body.app-layout .user-chip .user-avatar {
        margin-right: 0;
    }
}

/* =========================================
   Unified Table Fit (No Horizontal Scroll)
   ========================================= */
body.app-layout .table-responsive,
body.app-layout .table-container,
body.app-layout .upload-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
}

body.app-layout table,
body.app-layout .data-table,
body.app-layout .upload-table,
body.app-layout .custom-table,
body.app-layout .report-table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100%;
    table-layout: fixed;
}

body.app-layout .data-table th,
body.app-layout .data-table td,
body.app-layout .report-table th,
body.app-layout .report-table td,
body.app-layout .upload-table th,
body.app-layout .upload-table td {
    padding: 0.54rem 0.5rem;
    font-size: 0.86rem;
    line-height: 1.28;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.app-layout .data-table th,
body.app-layout .report-table th,
body.app-layout .upload-table th {
    font-size: 0.76rem;
    letter-spacing: 0.03em;
}

/* =========================================
   Master Product Visual System (All Roles)
   ========================================= */
body.app-layout {
    background: linear-gradient(180deg, #f4f8ff 0%, #eef5fb 100%) !important;
    font-family: "Inter", "Segoe UI", "Manrope", sans-serif !important;
    color: #1f3553 !important;
}

body.app-layout .page-container,
body.app-layout .table-container,
body.app-layout .form-container,
body.app-layout .dashboard-container {
    background: #ffffff !important;
    border: 1px solid #d8e4f4 !important;
    border-radius: 16px !important;
    box-shadow: 0 14px 34px rgba(15, 47, 87, 0.08) !important;
    padding: clamp(0.65rem, 1.2vw, 1rem) !important;
}

body.app-layout .dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: linear-gradient(135deg, #0f2f57 0%, #0e4d66 100%) !important;
    border: 1px solid #1d4b77 !important;
    border-radius: 14px !important;
    box-shadow: 0 14px 34px rgba(15, 47, 87, 0.2) !important;
    padding: clamp(0.55rem, 1.2vw, 0.85rem) !important;
}

body.app-layout .dashboard-header h1,
body.app-layout .dashboard-header h2,
body.app-layout .dashboard-header h3 {
    color: #ffffff !important;
    margin: 0 !important;
    font-weight: 800 !important;
    letter-spacing: 0.01em;
}

body.app-layout .dashboard-header p,
body.app-layout .dashboard-header span {
    color: rgba(236, 246, 255, 0.9) !important;
    margin: 0.2rem 0 0 !important;
}

body.app-layout h1 {
    font-size: clamp(1.25rem, 2.2vw, 1.65rem) !important;
    font-weight: 800 !important;
    color: #14385f !important;
}

body.app-layout h2 {
    font-size: clamp(1.06rem, 1.8vw, 1.3rem) !important;
    font-weight: 700 !important;
    color: #1b466f !important;
}

body.app-layout h3 {
    font-size: clamp(0.9rem, 1.3vw, 1.02rem) !important;
    font-weight: 700 !important;
    color: #2a4f78 !important;
}

body.app-layout .summary-card,
body.app-layout .chart-container,
body.app-layout .settings-card,
body.app-layout .visit-card,
body.app-layout .info-card,
body.app-layout .detail-section {
    background: #ffffff !important;
    border: 1px solid #d9e4f3 !important;
    border-left: 4px solid #2f6ea7 !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 24px rgba(15, 47, 87, 0.08) !important;
}

body.app-layout .payment-summary,
body.app-layout .history-summary,
body.app-layout .patient-details-header,
body.app-layout .patient-address-details {
    background: #f6faff !important;
    border: 1px solid #d4e2f3 !important;
    border-left: 4px solid #2e7d6f !important;
    border-radius: 12px !important;
    padding: 0.75rem 0.88rem !important;
}

body.app-layout fieldset {
    background: #fbfdff !important;
    border: 1px solid #d7e4f5 !important;
    border-left: 4px solid #3b75a9 !important;
    border-radius: 12px !important;
}

body.app-layout legend {
    color: #1f4f7d !important;
    font-weight: 700 !important;
    font-size: 0.88rem !important;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

body.app-layout .form-group label,
body.app-layout .settings-field label {
    display: block;
    margin-bottom: 0.34rem;
    font-size: 0.74rem !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #5b7698 !important;
    font-weight: 700 !important;
}

body.app-layout input,
body.app-layout select,
body.app-layout textarea {
    border-radius: 10px !important;
    border: 1px solid #c9d8eb !important;
    background: #ffffff !important;
    color: #193c63 !important;
    padding: 0.55rem 0.72rem !important;
    box-shadow: inset 0 1px 2px rgba(15, 47, 87, 0.04);
}

body.app-layout input:focus,
body.app-layout select:focus,
body.app-layout textarea:focus {
    border-color: #2f6ea7 !important;
    box-shadow: 0 0 0 3px rgba(47, 110, 167, 0.16) !important;
    outline: none !important;
}

body.app-layout .data-table,
body.app-layout .report-table,
body.app-layout .upload-table,
body.app-layout .preview-table,
body.app-layout .items-table {
    border: 1px solid #d7e3f2 !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    box-shadow: 0 8px 22px rgba(15, 47, 87, 0.06) !important;
}

body.app-layout .data-table thead,
body.app-layout .report-table thead,
body.app-layout .upload-table thead,
body.app-layout .preview-table thead,
body.app-layout .items-table thead {
    background: #edf4ff !important;
}

body.app-layout .data-table th,
body.app-layout .report-table th,
body.app-layout .upload-table th,
body.app-layout .preview-table th,
body.app-layout .items-table th {
    color: #4a6588 !important;
    font-weight: 700 !important;
    font-size: 0.72rem !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid #d7e4f4 !important;
}

body.app-layout .data-table td,
body.app-layout .report-table td,
body.app-layout .upload-table td,
body.app-layout .preview-table td,
body.app-layout .items-table td {
    border-bottom: 1px solid #e5edf8 !important;
    color: #1f3553 !important;
    font-size: 0.84rem !important;
}

body.app-layout .data-table tbody tr:nth-child(even),
body.app-layout .report-table tbody tr:nth-child(even),
body.app-layout .upload-table tbody tr:nth-child(even),
body.app-layout .preview-table tbody tr:nth-child(even),
body.app-layout .items-table tbody tr:nth-child(even) {
    background: #f9fbff !important;
}

body.app-layout .btn-submit,
body.app-layout .btn-action,
body.app-layout .btn-edit,
body.app-layout .btn-view,
body.app-layout .btn-update,
body.app-layout .btn-cancel,
body.app-layout .btn-delete,
body.app-layout .btn-danger {
    border-radius: 10px !important;
    border: 1px solid transparent !important;
    padding: 0.45rem 0.82rem !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em;
    text-decoration: none !important;
    box-shadow: 0 6px 15px rgba(15, 47, 87, 0.1);
}

body.app-layout .btn-submit,
body.app-layout .btn-view,
body.app-layout .btn-update,
body.app-layout .btn-edit {
    background: linear-gradient(135deg, #0f4c81 0%, #13648e 100%) !important;
    color: #ffffff !important;
}

body.app-layout .btn-cancel,
body.app-layout .btn-danger,
body.app-layout .btn-delete {
    background: #fff4f6 !important;
    border-color: #e7bfca !important;
    color: #b62d4f !important;
}

body.app-layout .btn-submit:hover,
body.app-layout .btn-action:hover,
body.app-layout .btn-edit:hover,
body.app-layout .btn-view:hover,
body.app-layout .btn-update:hover,
body.app-layout .btn-cancel:hover,
body.app-layout .btn-delete:hover,
body.app-layout .btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 47, 87, 0.14);
}

body.app-layout .status-paid,
body.app-layout .status-completed,
body.app-layout .status-approved {
    background: #ecfdf4 !important;
    color: #166534 !important;
    border: 1px solid #bce8cb !important;
}

body.app-layout .status-due,
body.app-layout .status-pending,
body.app-layout .status-rejected {
    background: #fff4f4 !important;
    color: #b91c1c !important;
    border: 1px solid #f0c6c6 !important;
}

body.app-layout .status-partial-paid,
body.app-layout .status-in-progress,
body.app-layout .status-query-raised {
    background: #fff9eb !important;
    color: #9a5b08 !important;
    border: 1px solid #f1dcad !important;
}

