html,
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background: linear-gradient(180deg, #f5f8fc 0%, #eef3f8 100%);
    color: #17212f;
    font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

:root {
    --bs-border-radius: 0.45rem;
    --bs-border-radius-sm: 0.35rem;
    --bs-border-radius-lg: 0.55rem;
}

.dashboard-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    min-width: 0;
    width: 100%;
}

.sidebar {
    width: 280px;
    max-width: 280px;
    min-width: 280px;
    background: var(--sidebar-bg);
    color: #fff;
    padding: 1.75rem 1.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}

.brand-mark,
.brand-mark img {
    width: 52px;
    height: 52px;
    border-radius: 10px;
}

.brand-mark {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand-secondary), #fff3);
    overflow: hidden;
    font-weight: 700;
}

.sidebar-brand h1 {
    font-size: 1.1rem;
    margin-bottom: 0.1rem;
}

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

.company-switcher {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.9rem;
    margin-bottom: 1.2rem;
}

.company-switcher-label {
    display: block;
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin-bottom: 0.45rem;
}

.company-switcher-control .form-select {
    background-color: rgba(255, 255, 255, 0.96);
    border-color: rgba(255, 255, 255, 0.18);
    color: #17212f;
}

.company-switcher-control .form-select:focus {
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 0 0.15rem rgba(255, 255, 255, 0.12);
}

.company-switcher-note {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.82rem;
    line-height: 1.4;
    margin-top: 0.55rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-link {
    color: var(--sidebar-link);
    text-decoration: none;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--sidebar-link-hover);
    color: white;
}

.main-content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 1.5rem;
    overflow-x: hidden;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title {
    margin-bottom: 0.2rem;
    font-weight: 700;
}

.page-subtitle {
    color: #607087;
}

.content-area {
    min-width: 0;
    padding-bottom: 2rem;
}

.search-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    border-radius: 8px;
    padding: 0.55rem 0.9rem;
    box-shadow: 0 10px 30px rgba(11, 31, 58, 0.08);
}

.search-pill input {
    border: 0;
    outline: 0;
    width: 220px;
}

.notification-bell {
    position: relative;
    background: white;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    text-decoration: none;
    color: #17212f;
    box-shadow: 0 10px 30px rgba(11, 31, 58, 0.08);
}

.notification-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.75rem;
    display: grid;
    place-items: center;
}

.user-chip {
    background: white;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    box-shadow: 0 10px 30px rgba(11, 31, 58, 0.08);
}

.user-chip small {
    display: block;
    color: #607087;
}

.shadow-soft {
    box-shadow: 0 20px 50px rgba(11, 31, 58, 0.08);
}

.table-modern th,
.table-modern td {
    padding: 1rem 1.1rem;
    vertical-align: middle;
}

.filter-panel {
    padding: 1.35rem 1.4rem;
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-group {
    background: #f8fafc;
    border: 1px solid #e3eaf2;
    border-radius: 8px;
    padding: 0.95rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 185px));
    gap: 0.75rem;
    justify-content: start;
}

.filter-grid-wide {
    grid-template-columns: repeat(auto-fit, minmax(165px, 195px));
}

.filter-field {
    min-width: 0;
    width: 100%;
}

.filter-section-title {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #607087;
    font-weight: 700;
    margin-bottom: 0.7rem;
}

.filter-label {
    font-size: 0.78rem;
    color: #607087;
    margin-bottom: 0.32rem;
    font-weight: 600;
}

.filter-panel .form-control,
.filter-panel .form-select {
    min-height: 38px;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    font-size: 0.92rem;
}

.filter-combobox {
    position: relative;
}

.filter-combobox-toggle {
    width: 100%;
    min-height: 46px;
    padding: 0.75rem 4.5rem 0.75rem 1rem;
    color: #17324d;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    text-align: left;
    background-image: none;
    border-color: #d7dcf0;
    background-color: #ffffff;
}

.filter-combobox-label {
    display: block;
    max-width: calc(100% - 2.5rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 0.4rem;
}

.filter-combobox-toggle::after {
    content: "";
    position: absolute;
    right: 1.35rem;
    top: 50%;
    width: 0.6rem;
    height: 0.6rem;
    border-right: 3px solid #6a3dff;
    border-bottom: 3px solid #6a3dff;
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}

.filter-combobox-toggle[aria-expanded="true"] {
    border-color: #6a3dff;
    box-shadow: 0 0 0 0.28rem rgba(106, 61, 255, 0.14);
}

.filter-combobox-toggle[aria-expanded="true"]::after {
    transform: translateY(-35%) rotate(-135deg);
}

.filter-combobox-menu {
    position: absolute;
    z-index: 20;
    width: 100%;
    margin-top: 0.55rem;
    padding: 0.5rem;
    background: #ffffff;
    border: 1px solid #eef1fa;
    border-radius: 16px;
    box-shadow: 0 28px 60px rgba(117, 140, 196, 0.2);
    max-height: 240px;
    overflow-y: auto;
}

.filter-combobox-option {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 0.95rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.98rem;
    color: #241b63;
}

.filter-combobox-option:hover {
    background: #f4f5ff;
}

.filter-combobox-option input {
    margin: 0;
    width: 1.05rem;
    height: 1.05rem;
    accent-color: #6a3dff;
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.8rem;
    flex-wrap: wrap;
}

.btn-brand {
    --bs-btn-color: #ffffff;
    --bs-btn-bg: var(--brand-primary);
    --bs-btn-border-color: var(--brand-primary);
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: #0a2d52;
    --bs-btn-hover-border-color: #0a2d52;
    --bs-btn-focus-shadow-rgb: 13, 59, 102;
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: #082746;
    --bs-btn-active-border-color: #082746;
    --bs-btn-disabled-color: #ffffff;
    --bs-btn-disabled-bg: var(--brand-primary);
    --bs-btn-disabled-border-color: var(--brand-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-primary);
    color: #ffffff !important;
    border-color: var(--brand-primary);
    text-decoration: none;
}

.btn-brand:hover,
.btn-brand:focus,
.btn-brand:active,
.btn-brand.active,
.show > .btn-brand.dropdown-toggle {
    background: #0a2d52;
    color: #ffffff !important;
    border-color: #0a2d52;
    text-decoration: none;
}

.btn,
.form-control,
.form-select,
.input-group-text,
.card,
.alert,
.badge,
.pagination .page-link {
    border-radius: 6px !important;
}

.btn {
    font-weight: 600;
    padding: 0.55rem 0.95rem;
    box-shadow: none !important;
}

.btn-app {
    border: 1px solid #d3dce8;
    background: #ffffff;
    color: #17324d;
}

.btn-app:hover {
    background: #f4f7fb;
    color: #0f2740;
    border-color: #bcc8d8;
}

.btn-app-primary {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.btn-app-primary:hover {
    background: #0a2d52;
    border-color: #0a2d52;
    color: #fff;
}

.btn-app-secondary {
    background: #f8fafc;
    border-color: #d6e0ea;
    color: #17324d;
}

.btn-app-danger {
    background: #fff5f5;
    border-color: #f0c8c8;
    color: #9f2f2f;
}

.btn-app-danger:hover {
    background: #ffe9e9;
    border-color: #e5b3b3;
    color: #8d2222;
}

.form-control,
.form-select {
    padding: 0.65rem 0.8rem;
    border-color: #d4dde8;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.15rem rgba(13, 59, 102, 0.14);
}

.form-switch-inline {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.form-switch-inline .form-check-input {
    margin-top: 0;
    width: 2.6rem;
    height: 1.35rem;
    cursor: pointer;
}

.form-switch-inline .form-check-label {
    margin-bottom: 0;
    font-weight: 600;
    cursor: pointer;
}

.detail-header-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.detail-header-actions form {
    margin: 0;
}

.detail-header-actions .btn {
    padding: 0.55rem 0.9rem;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.kpi-card,
.report-card {
    background: white;
    border-radius: 10px;
    padding: 1rem 1.05rem;
    box-shadow: 0 20px 50px rgba(11, 31, 58, 0.08);
    height: 100%;
}

.kpi-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.65rem;
}

.kpi-card span {
    display: block;
    color: #607087;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.35;
}

.kpi-card strong {
    display: block;
    font-size: 1.65rem;
    line-height: 1;
    color: #17324d;
}

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #edf3f9;
    color: var(--brand-primary);
    font-size: 1rem;
    flex-shrink: 0;
}

.kpi-card.success .kpi-icon {
    background: #e9f7ef;
    color: #198754;
}

.kpi-card.warning .kpi-icon {
    background: #fff3e7;
    color: #fd7e14;
}

.kpi-card.danger .kpi-icon {
    background: #fff0f0;
    color: #dc3545;
}

.kpi-card.success {
    border-left: 4px solid #198754;
}

.kpi-card.warning {
    border-left: 4px solid #fd7e14;
}

.kpi-card.danger {
    border-left: 4px solid #dc3545;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    background: radial-gradient(circle at top left, rgba(244, 162, 97, 0.28), transparent 35%), linear-gradient(180deg, #f5f8fc 0%, #e9f1fb 100%);
}

.login-card {
    width: 100%;
    max-width: 460px;
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 24px 64px rgba(11, 31, 58, 0.12);
}

.eyebrow {
    color: var(--brand-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    font-weight: 700;
}

.avatar-lg,
.avatar-fallback {
    width: 72px;
    height: 72px;
    border-radius: 10px;
}

.doctor-photo-trigger {
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 10px;
    cursor: zoom-in;
    line-height: 0;
}

.doctor-photo-trigger img {
    display: block;
}

.doctor-photo-trigger:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 4px;
}

.avatar-fallback {
    display: grid;
    place-items: center;
    background: var(--brand-primary);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.company-logo-preview {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 10px;
}

.authenticator-panel,
.authenticator-setup {
    border: 1px solid #dfe7f1;
    border-radius: 10px;
    background: #f9fbfd;
    padding: 1.15rem;
}

.authenticator-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.authenticator-panel-copy {
    flex: 1 1 320px;
}

.authenticator-setup {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.authenticator-qr-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.authenticator-qr {
    width: 220px;
    height: 220px;
    padding: 0.8rem;
    background: #ffffff;
    border: 1px solid #dce4ef;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(11, 31, 58, 0.06);
}

.authenticator-qr svg {
    width: 100%;
    height: 100%;
}

.authenticator-secret {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.7rem 0.85rem;
    background: #ffffff;
    border: 1px dashed #cad6e4;
    border-radius: 8px;
    font-family: Consolas, "Courier New", monospace;
    letter-spacing: 0.08em;
    color: #17324d;
}

.doctor-photo-modal {
    border: 0;
    border-radius: 14px;
}

.doctor-photo-modal .modal-header {
    padding: 1.1rem 1.1rem 0;
}

.doctor-photo-modal .btn-close {
    font-size: 0.9rem;
}

.doctor-photo-modal-image {
    max-width: 100%;
    max-height: 72vh;
    border-radius: 12px;
    object-fit: contain;
    box-shadow: 0 20px 50px rgba(11, 31, 58, 0.12);
}

.doctor-list-person {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.doctor-list-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(11, 31, 58, 0.08);
}

.country-display {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.country-flag-icon {
    width: 18px;
    height: 14px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(23, 33, 47, 0.08);
    flex-shrink: 0;
}

.brand-preview {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand-preview-card {
    min-width: 180px;
    padding: 0.9rem 1rem;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    background: #f8fafc;
}

.brand-preview-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #607087;
    font-weight: 700;
    margin-bottom: 0.55rem;
}

.brand-preview-chip {
    width: 100%;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(23, 33, 47, 0.08);
    margin-bottom: 0.45rem;
}

.brand-preview-card small {
    color: #4d6078;
    font-weight: 600;
}

.chart-frame {
    position: relative;
    height: 280px;
    width: 100%;
}

.chart-frame canvas {
    width: 100% !important;
    height: 100% !important;
    min-height: 0;
}

.chart-empty {
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #607087;
    font-size: 0.95rem;
    background: #f8fafc;
    border: 1px dashed #d5deea;
    border-radius: 8px;
}

.dashboard-map-summary {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.summary-pill {
    min-width: 160px;
    padding: 0.8rem 0.95rem;
    background: #f8fafc;
    border: 1px solid #dde6f0;
    border-radius: 8px;
}

.summary-pill span {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #607087;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.summary-pill strong {
    color: #17324d;
    font-size: 0.98rem;
}

.dashboard-map-grid {
    display: block;
}

.country-map-panel,
.country-ranking-panel {
    min-width: 0;
}

.country-map-frame {
    width: 100%;
    height: 1520px;
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
    border: 1px solid #dde6f0;
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
}

.country-map-frame .jvm-container {
    width: 100%;
    height: 100%;
}

.country-map-frame svg {
    width: 100%;
    height: 100%;
}

.country-map-legend {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.8rem;
    flex-wrap: wrap;
}

.legend-gradient {
    flex: 1 1 160px;
    min-width: 160px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, #d6e4f0 0%, #0d3b66 100%);
    border: 1px solid rgba(23, 33, 47, 0.08);
}

.legend-label {
    font-size: 0.82rem;
    color: #607087;
    font-weight: 600;
}

.country-map-empty {
    height: 100%;
    min-height: 320px;
}

.jvm-tooltip {
    background: #17324d;
    color: #ffffff;
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    box-shadow: 0 16px 36px rgba(11, 31, 58, 0.18);
    font-size: 0.88rem;
    max-width: 220px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 1200;
}

.jvm-tooltip.active {
    opacity: 1;
}

.detail-list dt {
    color: #607087;
    font-weight: 600;
}

.allocation-row,
.activity-row,
.dashboard-activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.95rem 0;
    border-top: 1px solid #edf2f7;
}

.allocation-row:first-of-type,
.activity-row:first-of-type,
.dashboard-activity-item:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.activity-link {
    text-decoration: none;
    font-weight: 600;
    color: #17324d;
}

.activity-link:hover {
    color: var(--brand-primary);
}

.empty-state {
    border: 1px dashed #d5deea;
    background: #f9fbfd;
    padding: 1rem;
    border-radius: 8px;
}

@media (max-width: 991.98px) {
    .dashboard-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        height: auto;
        position: relative;
    }

    .main-content {
        padding: 1rem;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .authenticator-setup {
        grid-template-columns: 1fr;
    }

    .country-map-frame {
        height: 1240px;
    }
}

@media (max-width: 575.98px) {
    .filter-grid,
    .filter-grid-wide {
        grid-template-columns: 1fr;
    }

    .country-map-frame {
        height: 920px;
    }
}
