@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&family=Playfair+Display:wght@400&display=swap");

:root {
    --page-bg: #f5f7fc;
    --surface: #f8fafc;
    --surface-card: #ffffff;
    --line: #dbe3f0;
    --text: #111827;
    --text-soft: #64748b;
    --navy: #10225a;
    --red: #DF0000;
    --green: #10b981;
    --neon-blue: #09b8ff;
    --neon-pink: #DF0000;
    --neon-violet: #8957ff;
    --neon-coral: #ff7a45;
}

html.theme-dark {
    --page-bg: #050814;
    --surface: #0c1227;
    --surface-card: #111832;
    --line: #2d4f8e;
    --text: #f7fbff;
    --text-soft: #a9c1ef;
    --navy: #09b8ff;
    --red: #DF0000;
    --green: #4dffbd;
    --neon-blue: #09b8ff;
    --neon-pink: #DF0000;
    --neon-violet: #8957ff;
    --neon-coral: #ff7a45;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Rubik", "Segoe UI", Tahoma, Arial, sans-serif;
    background: #f5f7fc;
    color: #111827;
}

body.login-page {
    background: #070707 url("../icons/login.png") center center / cover no-repeat fixed;
    color: #ffffff;
}

@keyframes portalFadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes portalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

html.theme-dark body {
    background:
        radial-gradient(circle at 14% 8%, rgba(223, 0, 0, 0.28), transparent 30%),
        radial-gradient(circle at 86% 12%, rgba(9, 184, 255, 0.26), transparent 32%),
        linear-gradient(135deg, #050814 0%, #09152f 52%, #140726 100%);
    color: #f7fbff;
}

html.theme-dark body.login-page {
    background: #070707 url("../icons/login.png") center center / cover no-repeat fixed;
    color: #ffffff;
}

.theme-toggle-btn {
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #ffffff;
    color: #1f2937;
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, color 160ms ease;
}

.theme-toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.14);
}

html.theme-dark .theme-toggle-btn {
    border-color: #475569;
    background: #0f172a;
    color: #e2e8f0;
}

.theme-toggle-icon svg {
    width: 18px;
    height: 18px;
}

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

.portal-topbar {
    position: relative;
    z-index: 1500;
    background: #ffffff;
    color: #1f2937;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #dbe3f0;
    animation: portalFadeIn 260ms ease-out both;
    overflow: visible;
}

.portal-topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-quick-icons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.portal-quick-icon {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid #cfd5e2;
    background: #ffffff;
    color: #10225a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.portal-topbar-right > .theme-toggle-btn {
    width: 38px;
    height: 38px;
    background: #ffffff;
    color: #10225a;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
}

.portal-quick-icon:hover,
.portal-quick-icon:focus-visible,
.portal-topbar-right > .theme-toggle-btn:hover,
.portal-topbar-right > .theme-toggle-btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 7px 14px rgba(15, 23, 42, 0.2);
    outline: 0;
}

.portal-quick-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.portal-notifications,
.portal-profile-menu-wrap {
    position: relative;
}

.portal-notifications summary,
.portal-profile-menu-wrap summary {
    list-style: none;
}

.portal-notifications summary::-webkit-details-marker,
.portal-profile-menu-wrap summary::-webkit-details-marker {
    display: none;
}

.portal-notify-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    padding: 0 5px;
    background: #df0000;
    color: #ffffff;
    border: 2px solid #ffffff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.portal-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: min(300px, calc(100vw - 32px));
    border: 1px solid #dbe3f0;
    border-radius: 12px;
    background: #ffffff;
    color: #111827;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
    padding: 12px;
    z-index: 1600;
}

.portal-popover-title {
    margin: 0 0 8px;
    color: #111827;
    font-size: 13px;
    font-weight: 800;
}

.portal-popover-detail,
.portal-popover-empty {
    margin: 0 0 6px;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.portal-notify-menu {
    display: grid;
    gap: 8px;
}

.portal-notify-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 9px;
    background: #f8fafc;
}

.portal-notify-item span {
    display: block;
    color: #111827;
    font-size: 12px;
    font-weight: 800;
}

.portal-notify-item small {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 11px;
    line-height: 1.35;
}

.portal-notify-item form {
    margin: 8px 0 0;
}

.portal-notify-item button,
.portal-profile-logout-btn {
    min-height: 32px;
    border: 0;
    border-radius: 8px;
    background: #df0000;
    color: #ffffff;
    padding: 6px 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.portal-profile-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.portal-profile-summary > span {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: #e8f0ff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 800;
    flex: 0 0 auto;
}

.portal-profile-logout-form {
    margin: 10px 0 0;
}

.portal-profile-logout-btn {
    width: 100%;
}

.portal-menu-link {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #c6cedf;
    background: #ffffff;
    color: #1f2937;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    flex: 0 0 auto;
    cursor: pointer;
}

.portal-menu-link span {
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    display: block;
}

html.theme-dark .portal-menu-link {
    border-color: #475569;
    background: #0f172a;
    color: #e2e8f0;
}

.portal-sidebar-overlay {
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    z-index: 1300;
    transition: opacity 180ms ease;
}

.portal-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 204px;
    background: #060606;
    color: #ffffff;
    border-right: 1px solid #1a1a1a;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    z-index: 1400;
}

.portal-sidebar-open .portal-sidebar {
    transform: translateX(0);
}

.portal-sidebar-open .portal-sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

.portal-sidebar-group-title {
    margin: 0 0 8px;
    color: #9bd3e8;
    font-size: 11px;
    line-height: 1.2;
    text-transform: uppercase;
}

.portal-sidebar-sep {
    width: 100%;
    border: 0;
    border-top: 1px solid #3d3f46;
    margin: auto 0 10px;
}

.portal-sidebar-profile {
    margin-top: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-radius: 10px;
    padding: 8px;
    background: #0f0f11;
    border: 1px solid #2e313a;
}

.portal-sidebar-profile > span {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #111827;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex: 0 0 42px;
}

.portal-sidebar-profile strong {
    display: block;
    font-size: 14px;
    line-height: 1.2;
}

.portal-sidebar-profile small {
    display: block;
    margin-top: 2px;
    color: #d1d5db;
    font-size: 11px;
}

.portal-sidebar-profile-top {
    margin-bottom: 8px;
}

.portal-sidebar-nav {
    display: grid;
    gap: 4px;
}

.portal-sidebar-nav a {
    color: #f3f4f6;
    text-decoration: none;
    font-size: 13px;
    border-radius: 8px;
    padding: 7px 8px;
    transition: background 160ms ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-sidebar-nav a:hover {
    background: #171717;
}

.portal-sidebar-nav a::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1.4px solid #e5e7eb;
    box-sizing: border-box;
    flex: 0 0 14px;
}

.portal-sidebar-logout-form {
    width: 100%;
    margin: 4px 0 0;
    padding-top: 0;
}

.portal-sidebar-logout-form button {
    width: 100%;
    min-height: 34px;
    border: 0;
    border-radius: 7px;
    background: #DF0000;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none;
}

.portal-sidebar-logout-form button:hover {
    background: #d91527;
}

html.theme-dark .portal-topbar {
    background: #111827;
    color: #e5e7eb;
    border-bottom-color: #334155;
}

html.theme-dark .portal-quick-icon,
html.theme-dark .portal-topbar-right > .theme-toggle-btn {
    border-color: #475569;
    background: #0f172a;
    color: #e2e8f0;
}

html.theme-dark .portal-quick-icon:hover,
html.theme-dark .portal-quick-icon:focus-visible,
html.theme-dark .portal-topbar-right > .theme-toggle-btn:hover,
html.theme-dark .portal-topbar-right > .theme-toggle-btn:focus-visible {
    background: #1e293b;
}

html.theme-dark .portal-notify-badge {
    border-color: #111827;
}

html.theme-dark .portal-popover {
    border-color: #334155;
    background: #111827;
    color: #e5e7eb;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

html.theme-dark .portal-popover-title,
html.theme-dark .portal-notify-item span {
    color: #f8fafc;
}

html.theme-dark .portal-popover-detail,
html.theme-dark .portal-popover-empty,
html.theme-dark .portal-notify-item small {
    color: #94a3b8;
}

html.theme-dark .portal-notify-item {
    border-color: #334155;
    background: #0f172a;
}

html.theme-dark .portal-profile-summary > span {
    background: #1e3a8a;
    color: #dbeafe;
}

.portal-brand {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: #4338ca;
    text-decoration: none;
}

html.theme-dark .portal-brand {
    color: #a5b4fc;
}

.portal-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #64748b;
}

html.theme-dark .portal-user {
    color: #94a3b8;
}

.portal-user button {
    border: none;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    padding: 6px 12px;
    font-weight: 600;
    cursor: pointer;
}

.portal-main {
    max-width: 1060px;
    margin: 0 auto;
    padding: 16px;
}

html.theme-dark .portal-main {
    color: #e5e7eb;
}

body.login-page .portal-topbar {
    display: none;
}

body.login-page .portal-main {
    max-width: none;
    margin: 0;
    padding: 0;
}

body.login-page .portal-shell {
    width: 100%;
    min-height: 100vh;
}

body.login-page .portal-flash {
    position: relative;
    z-index: 3;
    width: min(360px, calc(100% - 24px));
    margin: 14px auto 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.login-ui {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 32px 16px;
    background:
        linear-gradient(rgba(0, 0, 0, 0.64), rgba(0, 0, 0, 0.64)),
        url("../icons/login.png") center center / cover no-repeat;
    font-family: "Rubik", "Segoe UI", Tahoma, Arial, sans-serif;
}

.login-ui-left {
    width: min(100%, 400px);
    margin: 0 auto;
    padding: 0;
    background: transparent;
}

.login-ui-form-wrap {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.login-ui-logo {
    display: block;
    width: 164px;
    height: auto;
    margin: 0 auto 56px;
    transform: translateY(-52px);
}

.login-ui-form-wrap h1 {
    display: none;
}

.login-ui-role {
    display: none;
}

.login-ui-inline-flash {
    border-radius: 10px;
    padding: 10px 12px;
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 500;
}

.login-ui-inline-flash.success {
    background: #dcfce7;
    border: 1px solid #16a34a;
    color: #14532d;
}

.login-ui-inline-flash.error {
    background: #fee2e2;
    border: 1px solid #dc2626;
    color: #7f1d1d;
}

.auto-dismiss {
    transition: opacity 320ms ease, transform 320ms ease;
}

.auto-dismiss.is-hidden {
    opacity: 0;
    transform: translateY(-4px);
}

.login-ui-form {
    display: grid;
    gap: 24px;
    width: 100%;
    font-family: inherit;
    margin-top: 22px;
}

.login-ui-field {
    display: grid;
    grid-template-columns: 58px 1fr;
    align-items: center;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.2);
    padding: 0 9px 0 0;
    overflow: hidden;
}

.login-ui-password-field {
    grid-template-columns: 58px minmax(0, 1fr);
    padding-right: 9px;
}

.login-ui-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 100%;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.28);
}

.login-ui-icon svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
    stroke: none;
}

.login-ui-field input,
.login-ui-field select {
    width: 100%;
    height: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: #ffffff;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    font-family: "Rubik", "Segoe UI", Tahoma, Arial, sans-serif;
    text-align: left;
    padding-left: 14px;
}

.login-ui-field select {
    cursor: pointer;
}

.login-ui-field input::placeholder {
    color: #ffffff;
    font-weight: 400;
    opacity: 1;
    font-family: "Rubik", "Segoe UI", Tahoma, Arial, sans-serif;
}

.login-ui-field input:-webkit-autofill,
.login-ui-field input:-webkit-autofill:hover,
.login-ui-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: #111827;
    box-shadow: 0 0 0 1000px #e8f0fe inset;
}

.login-ui-password-toggle {
    display: none;
}

.login-ui-password-toggle:hover,
.login-ui-password-toggle:focus-visible {
    background: rgba(15, 23, 42, 0.08);
    color: #111827;
    outline: none;
}

.login-ui-password-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-ui-password-toggle .password-toggle-eye-off,
.login-ui-password-toggle[aria-pressed="true"] .password-toggle-eye {
    display: none;
}

.login-ui-password-toggle[aria-pressed="true"] .password-toggle-eye-off {
    display: block;
}

.login-ui-remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: -2px;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
    font-family: "Playfair Display", "Times New Roman", serif;
    line-height: 1.2;
    cursor: pointer;
    user-select: none;
}

.login-ui-remember input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #DF0000;
    appearance: auto;
    -webkit-appearance: checkbox;
    cursor: pointer;
    flex: 0 0 auto;
    vertical-align: middle;
}

.login-ui-submit {
    width: 126px;
    height: 36px;
    margin-top: 154px;
    border: 0;
    border-radius: 5px;
    background: #ff1f32;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    font-family: "Rubik", "Segoe UI", Tahoma, Arial, sans-serif;
    cursor: pointer;
    justify-self: center;
    box-shadow: none;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.login-ui-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(255, 31, 50, 0.28);
}

.login-ui-links {
    display: none;
}

.login-ui-links a {
    color: #384a6b;
    font-size: 13px;
    font-weight: 400;
    font-family: "Playfair Display", "Times New Roman", serif;
    text-decoration: none;
}

.login-ui-right {
    display: none;
}

.login-ui-right::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.26);
    pointer-events: none;
}

.login-ui-hero {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
    padding: clamp(36px, 6vh, 64px) clamp(30px, 4vw, 52px);
    background: transparent;
    border: 0;
    box-shadow: none;
}

.login-ui-hero p {
    margin: 0;
    color: #fff;
    font-size: clamp(27px, 3vw, 40px);
    line-height: 1.26;
    font-weight: 700;
    max-width: 380px;
}

.login-ui-hero img {
    position: absolute;
    right: clamp(24px, 4vw, 56px);
    bottom: clamp(24px, 5vh, 64px);
    width: min(560px, 78%);
    height: auto;
    object-fit: contain;
    border-bottom-right-radius: 0;
}

@media (max-width: 1280px) {
    .login-ui {
        padding-top: 32px;
    }

    .login-ui-form-wrap {
        max-width: 400px;
    }

    .login-ui-hero {
        min-height: 100vh;
    }
}

@media (max-width: 900px) {
    .login-ui {
        min-height: 100vh;
    }

    .login-ui-right {
        display: none;
    }

    .login-ui-left {
        min-height: 0;
        padding: 0;
    }
}

.portal-flash {
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.portal-flash.success {
    background: #dcfce7;
    border: 1px solid #16a34a;
}

.portal-flash.error {
    background: #fee2e2;
    border: 1px solid #dc2626;
}

.portal-flash ul {
    margin: 0;
    padding-left: 16px;
}

.card {
    background: #fff;
    border: 1px solid #dbe3f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    animation: portalFadeUp 320ms ease-out both;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

html.theme-dark .card {
    background: #111827;
    border-color: #334155;
    box-shadow: none;
}

.card h1,
.card h2 {
    margin-top: 0;
}

.dashboard-header-card {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    border: 0;
    color: #ffffff;
    text-align: center;
}

.dashboard-header-card h1,
.dashboard-header-card p {
    color: #ffffff;
}

.dashboard-header-card .quick-links,
.dashboard-header-card .stats-grid {
    justify-content: center;
}

.dashboard-header-card .quick-links {
    margin-top: 14px;
}

.dashboard-header-card .stat {
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.7);
    text-align: center;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16);
}

.dashboard-header-card .stat strong {
    color: #0f172a;
}

.dashboard-header-card .stat span {
    color: #334155;
}

.dashboard-header-card .stats-grid .stat:nth-child(1) {
    background: #f8e9ee;
    border-color: #f3c7d3;
}

.dashboard-header-card .stats-grid .stat:nth-child(2) {
    background: #fff2df;
    border-color: #fed7aa;
}

.dashboard-header-card .stats-grid .stat:nth-child(3) {
    background: #e8f0ff;
    border-color: #bfdbfe;
}

.dashboard-header-card .stats-grid .stat:nth-child(4) {
    background: #e8f8ef;
    border-color: #bbf7d0;
}

.dashboard-header-card .btn-link {
    background: #0f172a;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
}

.dashboard-header-card .btn-link:hover,
.dashboard-header-card .btn-link:focus-visible {
    background: #111f47;
}

.dashboard-header-card .btn-link.alt {
    background: #ffffff;
    color: #1e3a8a;
    border-color: #ffffff;
}

.dashboard-header-card .btn-link.alt:hover,
.dashboard-header-card .btn-link.alt:focus-visible {
    background: #eef4ff;
}

.hierarchy-card {
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
}

.district-card {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.auth-card p {
    margin-top: 4px;
}

.auth-card.narrow {
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}

.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.role-item {
    border: 1px solid #dbe0eb;
    border-radius: 10px;
    padding: 12px;
    background: #f9fafb;
}

html.theme-dark .role-item {
    border-color: #334155;
    background: #0f172a;
}

.role-item h3 {
    margin: 0 0 10px;
}

.role-actions,
.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-link {
    text-decoration: none;
    border-radius: 999px;
    background: #1e3a8a;
    color: #fff;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
}

.btn-link.alt {
    background: #edf4ff;
    color: #1e3a8a;
}

html.theme-dark .btn-link.alt {
    background: #1e3a8a;
    color: #dbeafe;
}

.manage-users-actions {
    margin-bottom: 10px;
}

.user-table-actions {
    gap: 6px;
}

.user-table-actions .btn-link {
    padding: 6px 10px;
    font-size: 12px;
}

.manage-users-toggle {
    width: 100%;
}

.manage-users-toggle > summary,
.manage-users-group > summary {
    cursor: pointer;
    list-style: none;
}

.manage-users-toggle > summary::-webkit-details-marker,
.manage-users-group > summary::-webkit-details-marker {
    display: none;
}

.manage-users-toggle > summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 28px;
    gap: 12px;
    align-items: center;
}

.manage-users-toggle > summary::after,
.manage-users-group > summary::after {
    content: "+";
    width: 26px;
    height: 26px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    color: #1e3a8a;
    background: #eef3ff;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
}

.manage-users-toggle[open] > summary::after,
.manage-users-group[open] > summary::after {
    content: "-";
}

.manage-users-toggle > summary:focus-visible,
.manage-users-group > summary:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 4px;
    border-radius: 8px;
}

.manage-users-heading {
    font-size: 20px;
    font-weight: 800;
}

.manage-users-summary-count {
    color: #334155;
    font-size: 13px;
    font-weight: 800;
}

.manage-users-groups {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.manage-users-group {
    border: 1px solid #dbe4f4;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.66);
    padding: 10px;
}

.manage-users-group > summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 28px;
    gap: 10px;
    align-items: center;
}

.manage-users-group > summary span {
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}

.manage-users-group .analytics-table-wrap {
    margin-top: 10px;
}

.form-grid {
    display: grid;
    gap: 10px;
}

.form-grid label {
    display: grid;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
}

.district-permissions-field {
    display: grid;
    gap: 6px;
}

.district-permissions-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.form-grid input,
.form-grid select {
    height: 40px;
    border-radius: 8px;
    border: 1px solid #c6cbd7;
    padding: 0 10px;
    background: #fff;
    font-size: 14px;
}

html.theme-dark .form-grid input,
html.theme-dark .form-grid select,
html.theme-dark .analytics-inline-filter input,
html.theme-dark .analytics-inline-filter select,
html.theme-dark .analytics-filter-form input,
html.theme-dark .analytics-filter-form select {
    background: #0f172a;
    color: #e5e7eb;
    border-color: #475569;
}

.form-grid input[type="checkbox"] {
    width: 16px;
    height: 16px;
    padding: 0;
    border-radius: 3px;
    border: 1px solid #64748b;
    background: #fff;
    appearance: auto;
    -webkit-appearance: checkbox;
    accent-color: #1d4ed8;
    cursor: pointer;
}

.form-grid select.district-multi-select {
    height: auto;
    min-height: 170px;
    padding: 8px 10px;
}

.district-checkbox-grid {
    max-height: 240px;
    overflow: auto;
    border: 1px solid #c6cbd7;
    border-radius: 8px;
    padding: 8px;
    background: #fff;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
}

.district-province-select {
    height: auto !important;
    min-height: 110px;
    padding: 8px 10px !important;
}

.province-checkbox-grid {
    max-height: 170px;
    overflow: auto;
    border: 1px solid #c6cbd7;
    border-radius: 8px;
    padding: 8px;
    background: #fff;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
}

.province-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #1f2937;
    font-weight: 500 !important;
}

.province-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.province-checkbox-item>label {
    display: inline;
    gap: 0;
    font-size: 13px;
    font-weight: 500 !important;
    cursor: pointer;
}

.district-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #1f2937;
    font-weight: 500 !important;
}

.district-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.district-checkbox-item>label {
    display: inline;
    gap: 0;
    font-size: 13px;
    font-weight: 500 !important;
    cursor: pointer;
}

.province-checkbox-item input[type="checkbox"],
.district-checkbox-item input[type="checkbox"] {
    pointer-events: auto;
}

.province-checkbox-item,
.district-checkbox-item {
    cursor: pointer;
}

.inline-check {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 500 !important;
}

.inline-check input {
    height: 16px;
    width: 16px;
}

.btn-primary {
    border: none;
    border-radius: 10px;
    height: 42px;
    background: #1e293b;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.helper-links {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.helper-links a {
    color: #1d4ed8;
    text-decoration: none;
    font-size: 13px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 10px 0 14px;
}

.stat {
    border: 1px solid #dbe0eb;
    border-radius: 10px;
    background: #f8fafc;
    padding: 10px;
    text-align: center;
    animation: portalFadeUp 340ms ease-out both;
    transition: transform 170ms ease, box-shadow 170ms ease;
}

.stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.1);
}

.stats-grid .stat:nth-child(1) {
    animation-delay: 80ms;
}

.stats-grid .stat:nth-child(2) {
    animation-delay: 130ms;
}

.stats-grid .stat:nth-child(3) {
    animation-delay: 180ms;
}

.stats-grid .stat:nth-child(4) {
    animation-delay: 230ms;
}

.stat:nth-child(1) {
    background: #fdecef;
}

.stat:nth-child(2) {
    background: #fff4ea;
}

.stat:nth-child(3) {
    background: #edf4ff;
}

.stat:nth-child(4) {
    background: #ecfdf5;
}

html.theme-dark .stat {
    border-color: #334155;
}

html.theme-dark .stat strong {
    color: #f8fafc;
}

html.theme-dark .stat span {
    color: #cbd5e1;
}

html.theme-dark .stat:nth-child(1) {
    background: #3f1d2b;
}

html.theme-dark .stat:nth-child(2) {
    background: #3f2b1d;
}

html.theme-dark .stat:nth-child(3) {
    background: #1e3356;
}

html.theme-dark .stat:nth-child(4) {
    background: #1d3a33;
}

.stat strong {
    display: block;
    font-size: 26px;
    color: #111827;
}

.stat span {
    font-size: 12px;
    color: #475569;
}

.list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.list li {
    border: 1px solid #e1e5ee;
    border-radius: 10px;
    padding: 10px 12px;
    display: grid;
    gap: 3px;
}

html.theme-dark .list li {
    border-color: #334155;
    background: #0f172a;
}

.list strong {
    font-size: 15px;
}

.list span {
    font-size: 13px;
    color: #4b5563;
}

.hierarchy-list li {
    gap: 8px;
}

.hierarchy-toggle {
    width: 100%;
}

.hierarchy-toggle summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    cursor: pointer;
    list-style: none;
}

.hierarchy-toggle summary::-webkit-details-marker {
    display: none;
}

.hierarchy-toggle summary::after {
    content: "+";
    width: 26px;
    height: 26px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    color: #1e3a8a;
    background: #eef3ff;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
}

.hierarchy-toggle[open] > summary::after {
    content: "-";
}

.hierarchy-toggle summary:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 4px;
    border-radius: 8px;
}

.hierarchy-summary-main {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.hierarchy-summary-counts {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

.hierarchy-children {
    margin-top: 4px;
    padding-left: 10px;
    border-left: 2px solid #dbe4f4;
    display: grid;
    gap: 8px;
}

.hierarchy-child {
    border: 1px solid #dbe4f4;
    border-radius: 10px;
    background: #f8fbff;
    padding: 8px 10px;
    display: block;
}

html.theme-dark .hierarchy-child {
    border-color: #334155;
    background: #1f2937;
}

html.theme-dark .hierarchy-toggle summary::after {
    border-color: #334155;
    background: #172033;
    color: #dbeafe;
}

html.theme-dark .hierarchy-summary-counts {
    color: #cbd5e1;
}

html.theme-dark .manage-users-toggle > summary::after,
html.theme-dark .manage-users-group > summary::after {
    border-color: #334155;
    background: #172033;
    color: #dbeafe;
}

html.theme-dark .manage-users-summary-count,
html.theme-dark .manage-users-group > summary span {
    color: #cbd5e1;
}

html.theme-dark .manage-users-group {
    border-color: #334155;
    background: rgba(15, 23, 42, 0.62);
}

.hierarchy-metric-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 12px 0 14px;
}

.hierarchy-metric-btn {
    min-height: 38px;
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.14);
    transition: transform 150ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.hierarchy-metric-btn:hover,
.hierarchy-metric-btn:focus-visible {
    transform: translateY(-1px);
    outline: 0;
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.18);
}

.hierarchy-metric-btn.active {
    background: #2563eb;
}

.hierarchy-metric-btn.active:hover,
.hierarchy-metric-btn.active:focus-visible {
    background: #1d4ed8;
}

.hierarchy-metric-btn.booking {
    background: #0f766e;
}

.hierarchy-metric-btn.booking:hover,
.hierarchy-metric-btn.booking:focus-visible {
    background: #0f5f59;
}

.hierarchy-metric-btn.lost {
    background: #df0000;
}

.hierarchy-metric-btn.lost:hover,
.hierarchy-metric-btn.lost:focus-visible {
    background: #bb0000;
}

.hierarchy-metric-btn.closed {
    background: #166534;
}

.hierarchy-metric-btn.closed:hover,
.hierarchy-metric-btn.closed:focus-visible {
    background: #14532d;
}

.hierarchy-metric-btn.analytics {
    background: #0f172a;
}

.hierarchy-metric-btn.analytics:hover,
.hierarchy-metric-btn.analytics:focus-visible {
    background: #1e293b;
}

.hierarchy-metric-btn.followup {
    background: #7c3aed;
}

.hierarchy-metric-btn.followup:hover,
.hierarchy-metric-btn.followup:focus-visible {
    background: #6d28d9;
}

html.theme-dark .hierarchy-metric-btn {
    box-shadow: 0 8px 18px rgba(1, 7, 22, 0.34);
}

.lead-overview-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px;
    align-items: center;
    background: #050505;
    border: 1px solid #101010;
    border-radius: 0;
    padding: 18px 36px 12px;
    margin: 12px 0 0;
}

.lead-overview-tab {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    background: #5f5f5f;
    color: #ffffff;
    padding: 9px 16px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
    transition: background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.lead-overview-tab:hover,
.lead-overview-tab:focus-visible {
    background: #737373;
    outline: 0;
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.lead-overview-tab.is-active {
    background: #ff0808;
}

.lead-overview-tab.is-active:hover,
.lead-overview-tab.is-active:focus-visible {
    background: #e60000;
}

.lead-overview-panel.is-hidden {
    display: none;
}

.hierarchy-leaf-wrap {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hierarchy-pill {
    border: 1px solid #d5deec;
    background: #eef3ff;
    color: #1e3a8a;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
}

.hierarchy-consultant-pill {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: inherit;
}

.hierarchy-consultant-pill span {
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: #df0000;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
}

.hierarchy-consultant-pill.is-active,
.hierarchy-consultant-pill:hover,
.hierarchy-consultant-pill:focus-visible {
    background: #1e3a8a;
    color: #ffffff;
    outline: 0;
}

.consultant-pending-card {
    background: #f8fbff;
}

.consultant-pending-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.consultant-pending-head h2,
.consultant-detail-title h3,
.consultant-pending-section h4 {
    margin: 0;
}

.consultant-pending-head p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 13px;
}

.consultant-detail-panel {
    display: grid;
    gap: 12px;
}

.consultant-detail-panel[hidden] {
    display: none;
}

.consultant-detail-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border: 1px solid #dbe4f4;
    border-radius: 10px;
    background: #ffffff;
    padding: 12px;
}

.consultant-detail-title span {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.consultant-reminder-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.consultant-reminder-btn {
    border: 0;
    min-height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    background: #df0000;
    color: #ffffff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 8px 16px rgba(223, 0, 0, 0.18);
    cursor: pointer;
    white-space: nowrap;
}

.consultant-reminder-email-btn {
    background: #1d4ed8;
    box-shadow: 0 8px 16px rgba(29, 78, 216, 0.18);
}

.consultant-reminder-system-btn {
    background: #df0000;
    box-shadow: 0 8px 16px rgba(223, 0, 0, 0.18);
}

.consultant-reminder-form {
    margin: 0;
}

.consultant-reminder-btn.disabled {
    background: #94a3b8;
    box-shadow: none;
}

.consultant-pending-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.consultant-pending-kpi {
    border: 1px solid #dbe4f4;
    border-radius: 10px;
    background: #ffffff;
    padding: 10px;
    text-align: left;
    font-family: inherit;
}

.consultant-pending-kpi strong {
    display: block;
    color: #0f172a;
    font-size: 24px;
    line-height: 1;
}

.consultant-pending-kpi span {
    display: block;
    margin-top: 6px;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
}

.consultant-pending-details {
    display: grid;
    gap: 12px;
}

.consultant-pending-details > summary {
    min-height: 40px;
    border: 1px solid #dbe4f4;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    list-style: none;
    font-size: 13px;
    font-weight: 800;
}

.consultant-pending-details > summary::-webkit-details-marker {
    display: none;
}

.consultant-pending-details > summary::after {
    content: "+";
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: #e8f0ff;
    color: #1d4ed8;
    font-size: 18px;
    line-height: 1;
    flex: 0 0 auto;
}

.consultant-pending-details[open] > summary::after {
    content: "-";
}

.consultant-pending-details > summary strong {
    margin-left: auto;
    color: #64748b;
    font-size: 12px;
    white-space: nowrap;
}

html.theme-dark .consultant-pending-details > summary {
    border-color: #334155;
    background: #0f172a;
    color: #f8fafc;
}

html.theme-dark .consultant-pending-details > summary strong {
    color: #94a3b8;
}

html.theme-dark .consultant-pending-details > summary::after {
    background: #1e3a8a;
    color: #dbeafe;
}

.consultant-pending-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.consultant-pending-section {
    border: 1px solid #dbe4f4;
    border-radius: 10px;
    background: #ffffff;
    padding: 12px;
}

.consultant-pending-section h4 {
    color: #0f172a;
    font-size: 14px;
}

.consultant-pending-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.consultant-pending-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 10px;
    border: 1px solid #edf1f7;
    border-radius: 8px;
    padding: 8px;
    color: #0f172a;
    text-decoration: none;
}

.consultant-pending-row span,
.consultant-pending-row small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.consultant-pending-row span {
    font-size: 13px;
    font-weight: 800;
}

.consultant-pending-row small,
.consultant-pending-row em {
    color: #64748b;
    font-size: 11px;
    font-style: normal;
}

.consultant-pending-row strong {
    grid-row: span 2;
    align-self: center;
    color: #1d4ed8;
    font-size: 11px;
}

.consultant-pending-empty {
    margin: 10px 0 0;
    color: #64748b;
    font-size: 13px;
}

.followup-escalation-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.followup-escalation-head h2 {
    margin-bottom: 4px;
}

.followup-escalation-head p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
}

.followup-escalation-head > span {
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #1e293b;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.followup-escalation-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.followup-escalation-bucket {
    border: 1px solid #dbe3f0;
    border-radius: 10px;
    background: #f8fafc;
    padding: 10px;
    display: grid;
    align-content: start;
    gap: 10px;
}

.followup-escalation-bucket-head h3 {
    margin: 0 0 4px;
    font-size: 15px;
    color: #0f172a;
}

.followup-escalation-bucket-head small {
    color: #64748b;
    font-size: 12px;
}

.followup-escalation-list {
    display: grid;
    gap: 8px;
}

.followup-escalation-row {
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    background: #ffffff;
    padding: 9px;
    display: grid;
    gap: 8px;
}

.followup-escalation-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.followup-escalation-copy strong {
    font-size: 14px;
    color: #111827;
}

.followup-escalation-copy span,
.followup-escalation-copy small {
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
}

.followup-escalation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.followup-escalation-btn {
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1;
}

.followup-escalation-btn.disabled {
    background: #e5e7eb;
    color: #64748b;
    cursor: not-allowed;
    text-decoration: none;
}

.followup-summary-tabs {
    position: relative;
}

.followup-tab-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.followup-summary-tabbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 1px solid #dbe3f0;
    margin-bottom: 12px;
}

.followup-summary-tabbar label {
    min-height: 42px;
    border: 1px solid #b7d7ef;
    border-bottom: 0;
    background: #2f7eb8;
    color: #ffffff;
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

#followupTabSummary:checked ~ .followup-summary-tabbar label[for="followupTabSummary"],
#followupTabOverall:checked ~ .followup-summary-tabbar label[for="followupTabOverall"],
#followupTabType:checked ~ .followup-summary-tabbar label[for="followupTabType"],
#followupTabArea:checked ~ .followup-summary-tabbar label[for="followupTabArea"],
#followupTabConsultants:checked ~ .followup-summary-tabbar label[for="followupTabConsultants"] {
    background: #ffffff;
    color: #1e293b;
    box-shadow: inset 0 3px 0 #b7d7ef;
}

.followup-summary-panel {
    display: none;
}

#followupTabSummary:checked ~ .followup-summary-panels [data-followup-panel="summary"],
#followupTabOverall:checked ~ .followup-summary-panels [data-followup-panel="overall"],
#followupTabType:checked ~ .followup-summary-panels [data-followup-panel="type"],
#followupTabArea:checked ~ .followup-summary-panels [data-followup-panel="area"],
#followupTabConsultants:checked ~ .followup-summary-panels [data-followup-panel="consultants"] {
    display: block;
}

.followup-summary-kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.followup-summary-kpi {
    border: 1px solid #dbe3f0;
    border-radius: 10px;
    background: #f8fafc;
    padding: 14px;
    display: grid;
    gap: 8px;
}

.followup-summary-kpi span {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.followup-summary-kpi strong {
    color: #2563eb;
    font-size: 30px;
    line-height: 1;
}

.followup-chart-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.followup-chart-card {
    border: 1px solid #dbe3f0;
    border-radius: 10px;
    background: #ffffff;
    padding: 12px;
    min-height: 280px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
}

.followup-chart-card-wide {
    margin-bottom: 12px;
}

.followup-chart-card h3 {
    margin: 0;
    color: #0f172a;
    font-size: 14px;
}

.followup-chart-card canvas {
    width: 100% !important;
    height: 230px !important;
    max-height: 230px;
}

.followup-summary-table {
    min-width: 680px;
}

.followup-summary-table-wrap {
    border: 1px solid #dbe3f0;
    border-radius: 10px;
}

.followup-escalation-empty {
    margin: 0;
    color: #64748b;
    font-size: 12px;
}

html.theme-dark .followup-escalation-head p,
html.theme-dark .followup-escalation-bucket-head small,
html.theme-dark .followup-escalation-copy span,
html.theme-dark .followup-escalation-copy small,
html.theme-dark .followup-escalation-empty {
    color: #94a3b8;
}

html.theme-dark .followup-escalation-head > span,
html.theme-dark .followup-escalation-bucket,
html.theme-dark .followup-escalation-row,
html.theme-dark .followup-summary-kpi,
html.theme-dark .followup-chart-card,
html.theme-dark .followup-summary-table-wrap {
    border-color: #334155;
    background: #0f172a;
}

html.theme-dark .followup-escalation-bucket-head h3,
html.theme-dark .followup-escalation-copy strong,
html.theme-dark .followup-chart-card h3 {
    color: #e5e7eb;
}

html.theme-dark .followup-escalation-btn.disabled {
    background: #1f2937;
    color: #94a3b8;
}

html.theme-dark .followup-summary-tabbar {
    border-bottom-color: #334155;
}

html.theme-dark .followup-summary-tabbar label {
    border-color: #334155;
    background: #1d4f75;
    color: #e5e7eb;
}

html.theme-dark #followupTabSummary:checked ~ .followup-summary-tabbar label[for="followupTabSummary"],
html.theme-dark #followupTabOverall:checked ~ .followup-summary-tabbar label[for="followupTabOverall"],
html.theme-dark #followupTabType:checked ~ .followup-summary-tabbar label[for="followupTabType"],
html.theme-dark #followupTabArea:checked ~ .followup-summary-tabbar label[for="followupTabArea"],
html.theme-dark #followupTabConsultants:checked ~ .followup-summary-tabbar label[for="followupTabConsultants"] {
    background: #0f172a;
    color: #e5e7eb;
    box-shadow: inset 0 3px 0 #3b82f6;
}

html.theme-dark .followup-summary-kpi span {
    color: #94a3b8;
}

html.theme-dark .followup-summary-kpi strong {
    color: #93c5fd;
}

.analytics-card h2 {
    margin-bottom: 10px;
}

.analytics-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 14px;
}

.analytics-card-titlebar {
    align-items: center;
    margin-bottom: 10px;
}

.analytics-card-titlebar h2 {
    margin-bottom: 0;
}

.analytics-minimize-toggle {
    border: 0;
    cursor: pointer;
    white-space: nowrap;
}

.analytics-card.is-minimized > :not(.analytics-head) {
    display: none !important;
}

.analytics-card.is-minimized > .analytics-head {
    margin-bottom: 0;
}

.analytics-head p {
    margin: 0;
    color: #475569;
    font-size: 13px;
}

.analytics-filter-note {
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #d5dcef;
    background: #f4f7ff;
    color: #1e3a8a;
    font-size: 13px;
}

html.theme-dark .analytics-filter-note {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

.analytics-filter-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.analytics-filter-form label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.analytics-filter-form input,
.analytics-filter-form select {
    height: 38px;
    border-radius: 8px;
    border: 1px solid #cdd5e1;
    padding: 0 10px;
    background: #fff;
    font-size: 13px;
}

.analytics-filter-actions {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.analytics-filter-btn {
    height: 42px;
    padding: 0 18px;
    font-size: 13px;
    border-radius: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 150ms ease, box-shadow 180ms ease, background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.analytics-filter-actions .btn-primary.analytics-filter-btn {
    background: linear-gradient(135deg, #1f2d46 0%, #101827 100%);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.24);
}

.analytics-filter-actions .btn-primary.analytics-filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(15, 23, 42, 0.28);
}

.analytics-filter-actions .btn-primary.analytics-filter-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.34), 0 14px 24px rgba(15, 23, 42, 0.28);
}

.analytics-filter-actions .btn-link.alt.analytics-filter-btn {
    background: #e8f0ff;
    color: #16387f;
    border: 1px solid #bfd3ff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.analytics-filter-actions .btn-link.alt.analytics-filter-btn:hover {
    background: #dce8ff;
    transform: translateY(-1px);
}

.analytics-filter-actions .btn-link.alt.analytics-filter-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3);
}

.analytics-filter-actions .analytics-filter-reset {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cad5e4;
}

.analytics-filter-actions .analytics-filter-reset:hover {
    background: #f8fafc;
    color: #1e293b;
    transform: translateY(-1px);
}

.analytics-toggle-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.analytics-toggle-actions[hidden] {
    display: none !important;
}

.analytics-active-toggle {
    min-height: 34px;
    border: 0;
    border-radius: 8px;
    background: #2563eb;
    color: #ffffff;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.22);
}

.analytics-booking-toggle {
    min-height: 34px;
    border: 0;
    border-radius: 8px;
    background: #0f766e;
    color: #ffffff;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(15, 118, 110, 0.22);
}

.analytics-lost-toggle {
    min-height: 34px;
    border: 0;
    border-radius: 8px;
    background: #DF0000;
    color: #ffffff;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(223, 0, 0, 0.22);
}

.analytics-closed-toggle {
    min-height: 34px;
    border: 0;
    border-radius: 8px;
    background: #1f7a45;
    color: #ffffff;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(31, 122, 69, 0.22);
}

.analytics-active-toggle:hover,
.analytics-active-toggle:focus-visible {
    background: #1d4ed8;
    color: #ffffff;
    outline: 0;
}

.analytics-booking-toggle:hover,
.analytics-booking-toggle:focus-visible {
    background: #0f5f59;
    color: #ffffff;
    outline: 0;
}

.analytics-lost-toggle:hover,
.analytics-lost-toggle:focus-visible {
    background: #bb0000;
    color: #ffffff;
    outline: 0;
}

.analytics-closed-toggle:hover,
.analytics-closed-toggle:focus-visible {
    background: #176337;
    color: #ffffff;
    outline: 0;
}

.lost-analytics-card[hidden] {
    display: none;
}

.lost-analytics-head {
    align-items: center;
}

.lost-analytics-head h2 {
    margin-bottom: 4px;
}

.lost-analytics-head strong {
    color: #1e3a8a;
    font-size: 14px;
}

.lost-analytics-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 10px;
    border-bottom: 1px solid #d8dee9;
}

.lost-analytics-tab {
    min-height: 44px;
    border: 1px solid #b7d7ef;
    border-bottom: 0;
    background: #2f7eb8;
    color: #ffffff;
    padding: 10px 15px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.lost-analytics-tab.active {
    background: #ffffff;
    color: #1e293b;
    box-shadow: inset 0 3px 0 #b7d7ef;
}

.lost-analytics-chart-wrap {
    position: relative;
    border: 1px solid #d8dee9;
    border-radius: 8px;
    background: #ffffff;
    padding: 8px 10px 16px;
    min-height: 360px;
}

.lost-analytics-chart-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 4px;
}

.lost-analytics-chart-top h3 {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 700;
}

.lost-analytics-chart-top span {
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}

.analytics-chart-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.analytics-drill-back {
    min-height: 28px;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
}

.analytics-drill-back[hidden] {
    display: none;
}

.lost-analytics-chart-wrap canvas {
    width: 100% !important;
    height: 300px !important;
}

.lost-analytics-empty {
    margin: 80px 0 0;
    color: #64748b;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

html.theme-dark .analytics-filter-actions .btn-primary.analytics-filter-btn {
    background: linear-gradient(135deg, #334155 0%, #0f172a 100%);
    box-shadow: 0 10px 20px rgba(2, 6, 23, 0.45);
}

html.theme-dark .analytics-filter-actions .btn-link.alt.analytics-filter-btn {
    background: #1e3a8a;
    color: #dbeafe;
    border-color: #3056b3;
}

html.theme-dark .analytics-filter-actions .btn-link.alt.analytics-filter-btn:hover {
    background: #28479c;
}

html.theme-dark .analytics-filter-actions .analytics-filter-reset {
    background: #0f172a;
    color: #cbd5e1;
    border-color: #334155;
}

html.theme-dark .analytics-filter-actions .analytics-filter-reset:hover {
    background: #172033;
    color: #e2e8f0;
}

html.theme-dark .analytics-active-toggle {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

html.theme-dark .analytics-active-toggle:hover,
html.theme-dark .analytics-active-toggle:focus-visible {
    background: #1d4ed8;
}

html.theme-dark .analytics-booking-toggle {
    background: #0f766e;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.25);
}

html.theme-dark .analytics-booking-toggle:hover,
html.theme-dark .analytics-booking-toggle:focus-visible {
    background: #0f5f59;
}

html.theme-dark .analytics-lost-toggle {
    background: #DF0000;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(223, 0, 0, 0.25);
}

html.theme-dark .analytics-lost-toggle:hover,
html.theme-dark .analytics-lost-toggle:focus-visible {
    background: #bb0000;
}

html.theme-dark .analytics-closed-toggle {
    background: #1f7a45;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(31, 122, 69, 0.25);
}

html.theme-dark .analytics-closed-toggle:hover,
html.theme-dark .analytics-closed-toggle:focus-visible {
    background: #176337;
}

html.theme-dark .lost-analytics-head strong {
    color: #dbeafe;
}

html.theme-dark .lost-analytics-tabs {
    border-bottom-color: #334155;
}

html.theme-dark .lost-analytics-tab {
    border-color: #334155;
    background: #1d4f75;
    color: #e5e7eb;
}

html.theme-dark .lost-analytics-tab.active {
    background: #0f172a;
    color: #e5e7eb;
    box-shadow: inset 0 3px 0 #3b82f6;
}

html.theme-dark .lost-analytics-chart-wrap {
    border-color: #334155;
    background: #0f172a;
}

html.theme-dark .lost-analytics-chart-top h3,
html.theme-dark .lost-analytics-empty {
    color: #cbd5e1;
}

html.theme-dark .lost-analytics-chart-top span {
    color: #a9c1ef;
}

.analytics-inline-filters {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(160px, 1fr)) auto;
    gap: 10px;
    margin-bottom: 10px;
}

.analytics-inline-filter {
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.analytics-inline-filter input,
.analytics-inline-filter select {
    height: 38px;
    border-radius: 8px;
    border: 1px solid #cdd5e1;
    padding: 0 10px;
    background: #fff;
    font-size: 13px;
}

.analytics-inline-reset {
    align-self: end;
    height: 38px;
    border: none;
    cursor: pointer;
}

.analytics-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.analytics-kpi {
    border: 1px solid #dbe0eb;
    border-radius: 10px;
    background: #f8fafc;
    padding: 10px;
    animation: portalFadeUp 360ms ease-out both;
    transition: transform 170ms ease, box-shadow 170ms ease;
}

.analytics-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.1);
}

.analytics-kpi-grid .analytics-kpi:nth-child(1) {
    animation-delay: 60ms;
}

.analytics-kpi-grid .analytics-kpi:nth-child(2) {
    animation-delay: 100ms;
}

.analytics-kpi-grid .analytics-kpi:nth-child(3) {
    animation-delay: 140ms;
}

.analytics-kpi-grid .analytics-kpi:nth-child(4) {
    animation-delay: 180ms;
}

.analytics-kpi-grid .analytics-kpi:nth-child(5) {
    animation-delay: 220ms;
}

.analytics-kpi-grid .analytics-kpi:nth-child(6) {
    animation-delay: 260ms;
}

.analytics-kpi:nth-child(1) {
    background: #edf4ff;
}

.analytics-kpi:nth-child(2) {
    background: #ecfdf5;
}

.analytics-kpi:nth-child(3) {
    background: #fdecef;
}

.analytics-kpi:nth-child(4) {
    background: #fff4ea;
}

.analytics-kpi:nth-child(5) {
    background: #f3f4f6;
}

.analytics-kpi:nth-child(6) {
    background: #eef2ff;
}

html.theme-dark .analytics-kpi {
    border-color: #334155;
}

html.theme-dark .analytics-kpi span {
    color: #cbd5e1;
}

html.theme-dark .analytics-kpi strong {
    color: #f8fafc;
}

html.theme-dark .analytics-kpi:nth-child(1) {
    background: #1e3356;
}

html.theme-dark .analytics-kpi:nth-child(2) {
    background: #1d3a33;
}

html.theme-dark .analytics-kpi:nth-child(3) {
    background: #3f1d2b;
}

html.theme-dark .analytics-kpi:nth-child(4) {
    background: #3f2b1d;
}

html.theme-dark .analytics-kpi:nth-child(5) {
    background: #1f2937;
}

html.theme-dark .analytics-kpi:nth-child(6) {
    background: #2c2f58;
}

.analytics-kpi span {
    display: block;
    color: #334155;
    font-size: 12px;
    margin-bottom: 4px;
}

.analytics-kpi strong {
    font-size: 26px;
    line-height: 1;
}

.analytics-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.analytics-chart-card {
    border: 1px solid #dde2ec;
    border-radius: 12px;
    padding: 12px;
    background: #ffffff;
    min-height: 280px;
    animation: portalFadeUp 380ms ease-out both;
    transition: transform 180ms ease, box-shadow 180ms ease;
    display: flex;
    flex-direction: column;
}

.analytics-chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

html.theme-dark .analytics-chart-card {
    border-color: #334155;
    background: #0f172a;
}

.analytics-chart-card h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #1e293b;
    text-align: center;
}

html.theme-dark .analytics-chart-card h3 {
    color: #cbd5e1;
}

/* Fixed chart canvas sizing - prevents horizontal stretching */
.analytics-chart-card canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 220px;
    aspect-ratio: 16 / 9;
}

/* Ensure charts maintain proper proportions */
.analytics-chart-card canvas {
    max-width: 100%;
    min-height: 180px;
}

.hierarchy-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hierarchy-badges span {
    border: 1px solid #d5deec;
    background: #eef3ff;
    color: #1e3a8a;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.analytics-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.analytics-table {
    width: 100%;
    min-width: 940px;
    border-collapse: collapse;
    font-size: 13px;
}

.analytics-table th,
.analytics-table td {
    border: 1px solid #dbe1eb;
    padding: 8px 10px;
    text-align: left;
    white-space: nowrap;
}

html.theme-dark .analytics-table th,
html.theme-dark .analytics-table td {
    border-color: #334155;
}

.analytics-table thead th {
    background: #f1f5f9;
    color: #0f172a;
}

html.theme-dark .analytics-table thead th {
    background: #1e293b;
    color: #e2e8f0;
}

.analytics-table tbody tr:nth-child(even) {
    background: #fafcff;
}

html.theme-dark .analytics-table tbody tr:nth-child(even) {
    background: #111827;
}

html.theme-dark .analytics-table tbody tr:nth-child(odd) {
    background: #0f172a;
}

.district-overview-grid {
    display: grid;
    grid-template-columns: minmax(300px, 430px) minmax(320px, 1fr);
    gap: 12px;
    align-items: start;
}

.district-map-card {
    border: 1px solid #e7edf7;
    border-radius: 10px;
    background: #f8fafc;
    padding: 10px;
}

.district-lead-map {
    width: 100%;
    min-height: 460px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
    border-radius: 8px;
    overflow: hidden;
}

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

.district-map-svg:focus,
.district-map-path:focus {
    outline: none;
}

.district-map-path {
    cursor: pointer;
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 720ms cubic-bezier(0.2, 0.9, 0.2, 1), fill 280ms ease, stroke 280ms ease, stroke-width 280ms ease, filter 720ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.district-map-path:hover {
    transform: scale(1.03);
    fill: #1e40af !important;
    stroke: #1e3a8a;
    stroke-width: 1.6;
}

.district-map-path.is-selected {
    transform: translate(var(--district-pop-x, 0), var(--district-pop-y, 0)) scale(var(--district-select-scale, 1.06));
    fill: #dc2626 !important;
    stroke: #991b1b;
    stroke-width: 2.4;
    filter: drop-shadow(0 0 18px rgba(220, 38, 38, 0.58));
}

.district-map-path.is-selected:hover {
    transform: translate(var(--district-pop-x, 0), var(--district-pop-y, 0)) scale(var(--district-select-scale, 1.06));
    fill: #dc2626 !important;
    stroke: #991b1b;
}

.district-map-label-layer {
    pointer-events: none;
}

.district-map-marker {
    fill: #0f172a;
    opacity: 0.92;
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 560ms ease, fill 260ms ease, opacity 260ms ease;
}

.district-map-marker.is-selected {
    transform: scale(2.75);
    fill: #991b1b;
    opacity: 1;
}

.district-map-count-label {
    fill: #ffffff;
    font-size: 7px;
    font-weight: 700;
    font-family: "Rubik", "Segoe UI", Tahoma, Arial, sans-serif;
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 560ms ease, fill 260ms ease;
}

.district-map-count-label.is-selected {
    transform: scale(2.45);
    fill: #ffffff;
}

.district-map-scale {
    margin-top: 10px;
}

.district-map-scale-title {
    display: block;
    font-size: 12px;
    color: #334155;
    margin-bottom: 6px;
    font-weight: 600;
}

.district-map-scale-bar {
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, #93c5fd 0%, #1d4ed8 100%);
    border: 1px solid #bfdbfe;
}

.district-map-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 11px;
    color: #64748b;
}

.district-map-error {
    margin: 0;
    color: #b91c1c;
    font-size: 13px;
}

.district-summary-card {
    border: 1px solid #dbe1eb;
    border-radius: 10px;
    background: #ffffff;
    padding: 10px;
}

.district-lead-info-card {
    border: 1px solid #dbe7fb;
    border-radius: 12px;
    background: linear-gradient(165deg, #f8fbff 0%, #edf4ff 100%);
    padding: 12px;
    margin-bottom: 10px;
    transition: transform 320ms ease, box-shadow 320ms ease;
}

.district-lead-info-card.is-animating {
    transform: scale(1.03);
    box-shadow: 0 10px 24px rgba(30, 64, 175, 0.16);
}

.district-lead-info-label {
    display: block;
    margin-bottom: 4px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.district-lead-info-name {
    margin: 0;
    color: #0f2d6b;
    font-size: 20px;
    line-height: 1.2;
}

.district-lead-info-value {
    margin: 6px 0 0;
    color: #1d4ed8;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
}

.district-summary-row {
    cursor: pointer;
    transition: background-color 220ms ease, transform 220ms ease;
}

.district-summary-row:hover {
    background: #eff6ff;
}

.district-summary-row.is-selected {
    background: #dbeafe;
    transform: scale(1.01);
}

.district-summary-table {
    min-width: 100%;
}

/* District EPR Modal Styles */
.district-epr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.district-epr-modal.active {
    opacity: 1;
    visibility: visible;
}

.district-epr-modal-content {
    background: var(--surface-card);
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.district-epr-modal.active .district-epr-modal-content {
    transform: scale(1);
}

.district-epr-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(135deg, var(--navy) 0%, #1a2650 100%);
    color: white;
}

.district-epr-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.district-epr-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.district-epr-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.district-epr-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.district-epr-stats {
    background: var(--surface);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.district-epr-count {
    font-size: 14px;
    font-weight: 500;
}

.district-epr-count strong {
    font-size: 28px;
    color: var(--red);
    margin-right: 4px;
}

.district-epr-location-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-soft);
    background: var(--surface-card);
    padding: 6px 12px;
    border-radius: 20px;
}

.district-epr-location-note svg {
    width: 14px;
    height: 14px;
}

.district-epr-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.district-epr-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    transition: all 0.2s ease;
}

.district-epr-card:hover {
    transform: translateX(4px);
    border-color: var(--red);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.district-epr-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.district-epr-customer {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
}

.district-epr-phone {
    font-size: 13px;
    color: var(--text-soft);
    font-family: monospace;
}

.district-epr-vehicle {
    font-size: 14px;
    color: var(--text-soft);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--line);
}

.district-epr-details {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
}

.district-epr-details span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-soft);
}

.district-epr-details svg {
    width: 14px;
    height: 14px;
}

.district-epr-address {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 6px;
}

.district-epr-location-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--green);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
}

.district-epr-no-location {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ff9800;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
}

.district-epr-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-soft);
}

.district-epr-loading {
    text-align: center;
    padding: 40px;
}

.district-epr-loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--line);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* District Zoom Styles */
.district-map-path {
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.district-map-path.zooming {
    transform: scale(1.08);
    filter: drop-shadow(0 0 8px rgba(239, 31, 45, 0.5));
}

.district-map-path.zoom-animation {
    animation: districtPop 0.4s ease-out;
}

@keyframes districtPop {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(239, 31, 45, 0));
    }
    50% {
        transform: scale(1.12);
        filter: drop-shadow(0 0 12px rgba(239, 31, 45, 0.7));
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 4px rgba(239, 31, 45, 0.3));
    }
}

/* ============================================
   District Map Styles for Super Admin Dashboard
   ============================================ */

.district-map-card {
    overflow: visible !important;
}

.district-lead-map {
    overflow: visible !important;
    min-height: 500px;
    position: relative;
}

.district-map-svg {
    width: 100%;
    height: auto;
    overflow: visible !important;
}

.district-group {
    cursor: pointer;
    transform-origin: center;
    transform-box: fill-box;
    transition: transform 0.5s cubic-bezier(0.34, 1.2, 0.64, 1), filter 0.3s ease-out;
}

/* Hover effect - pastel green */
.district-group:hover .district-map-path {
    fill: #a8e6cf !important;
    stroke: #a8e6cf !important;
    transition: fill 0.2s ease, stroke 0.2s ease;
}

.district-group.district-zoomed {
    transform: scale(1.6);
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
}

.district-group.district-zoom-in {
    animation: zoomInBounce 0.5s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

.district-group.district-zoom-out {
    animation: zoomOutBounce 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes zoomInBounce {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0));
    }
    40% {
        transform: scale(1.75);
        filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
    }
    70% {
        transform: scale(1.55);
        filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.4));
    }
    100% {
        transform: scale(1.6);
        filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
    }
}

@keyframes zoomOutBounce {
    0% {
        transform: scale(1.6);
        filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
    }
    50% {
        transform: scale(0.92);
        filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.1));
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0));
    }
}

.district-group.district-pulse {
    animation: pulseGlow 0.4s ease-in-out;
}

@keyframes pulseGlow {
    0% { filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5)); }
    50% { filter: drop-shadow(0 0 20px rgba(168, 230, 207, 0.8)); }
    100% { filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5)); }
}

.district-map-path {
    transform-origin: center;
    transform-box: fill-box;
    transition: fill 0.2s ease, stroke 0.2s ease;
}

.district-number-marker {
    pointer-events: none;
    transform-origin: center;
}

.district-number-marker circle {
    transition: all 0.2s ease;
}

.district-group:hover .district-number-marker circle {
    stroke: #a8e6cf;
}

.district-no-data-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 1000;
    font-size: 14px;
    white-space: nowrap;
    animation: fadeOutMsg 2.5s ease forwards;
}

@keyframes fadeOutMsg {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    30% { transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; transform: translate(-50%, -50%) scale(0.95); }
}

.district-summary-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

.district-summary-row:hover {
    background: rgba(168, 230, 207, 0.3);
    transform: translateX(5px);
}

.district-lead-info-card {
    transition: all 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.district-lead-info-card.animate {
    transform: scale(1.03);
    background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
}

.district-map-scale-bar {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #93c5fd, #1d4ed8);
}

.district-map-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #64748b;
    margin-top: 5px;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

@media (max-width: 760px) {
    .portal-topbar {
        gap: 8px;
        padding: 8px 10px;
    }

    .portal-brand {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 15px;
    }

    .portal-topbar-right,
    .portal-quick-icons {
        gap: 6px;
    }

    .portal-quick-icon,
    .portal-topbar-right > .theme-toggle-btn {
        width: 36px;
        height: 36px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-filter-form {
        grid-template-columns: 1fr;
    }

    .analytics-filter-actions {
        align-items: center;
        gap: 8px;
    }

    .analytics-filter-actions .analytics-filter-btn {
        width: 100%;
    }

    .analytics-inline-filters {
        grid-template-columns: 1fr;
    }

    .analytics-inline-reset {
        justify-content: center;
    }

    .analytics-chart-grid {
        grid-template-columns: 1fr;
    }

    .followup-escalation-head,
    .followup-escalation-grid {
        grid-template-columns: 1fr;
    }

    .followup-escalation-head {
        display: grid;
    }

    .followup-summary-tabbar {
        display: grid;
        grid-template-columns: 1fr;
    }

    .followup-summary-tabbar label {
        width: 100%;
        justify-content: flex-start;
        white-space: normal;
    }

    .followup-summary-kpis {
        grid-template-columns: 1fr;
    }

    .followup-chart-grid {
        grid-template-columns: 1fr;
    }

    .followup-chart-card {
        min-height: 250px;
    }

    .followup-chart-card canvas {
        height: 200px !important;
        max-height: 200px;
    }

    .lost-analytics-tab {
        flex: 1 1 140px;
        min-height: 40px;
        padding: 9px 10px;
    }

    .lost-analytics-chart-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .lost-analytics-chart-wrap {
        min-height: 320px;
    }

    .lost-analytics-chart-wrap canvas {
        height: 260px !important;
    }

    .hierarchy-toggle summary {
        grid-template-columns: minmax(0, 1fr) 28px;
    }

    .hierarchy-summary-counts {
        text-align: left;
    }

    .manage-users-toggle > summary,
    .manage-users-group > summary {
        grid-template-columns: minmax(0, 1fr) 28px;
    }

    .manage-users-summary-count,
    .manage-users-group > summary span {
        grid-column: 1 / -1;
    }

    .consultant-detail-title,
    .consultant-pending-head {
        display: grid;
    }

    .consultant-reminder-actions,
    .consultant-reminder-form,
    .consultant-reminder-btn {
        width: 100%;
    }

    .consultant-reminder-actions {
        justify-content: stretch;
    }

    .consultant-pending-details > summary {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .consultant-pending-details > summary strong {
        margin-left: 0;
        white-space: normal;
    }

    .consultant-pending-details > summary::after {
        margin-left: auto;
    }

    .consultant-pending-kpis,
    .consultant-pending-sections {
        grid-template-columns: 1fr;
    }

    .consultant-pending-row {
        grid-template-columns: 1fr;
    }

    .consultant-pending-row strong {
        grid-row: auto;
    }

    .analytics-chart-card {
        min-height: 260px;
    }

    .analytics-chart-card canvas {
        height: 200px !important;
        max-height: 200px;
    }

    .district-overview-grid {
        grid-template-columns: 1fr;
    }

    .lead-overview-toggle {
        gap: 10px;
        padding: 12px;
    }

    .lead-overview-tab {
        min-height: 38px;
        padding: 8px 10px;
        font-size: 13px;
    }

    .district-lead-map {
        min-height: 420px;
    }
}

/* Neon dark system theme */
html.theme-dark .portal-topbar,
html.theme-dark .portal-sidebar {
    background:
        linear-gradient(180deg, rgba(13, 19, 42, 0.96), rgba(5, 8, 20, 0.98)),
        radial-gradient(circle at 18% 0%, rgba(223, 0, 0, 0.28), transparent 34%) !important;
    border-color: rgba(9, 184, 255, 0.34) !important;
    box-shadow: 0 12px 30px rgba(1, 7, 22, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

html.theme-dark .portal-sidebar-overlay,
html.theme-dark .district-epr-modal {
    background: rgba(2, 6, 23, 0.68) !important;
}

html.theme-dark .portal-brand,
html.theme-dark .dashboard-header-card h1,
html.theme-dark .card h1,
html.theme-dark .card h2,
html.theme-dark .analytics-chart-card h3,
html.theme-dark .district-lead-info-name {
    color: #ffffff !important;
    text-shadow: 0 0 14px rgba(9, 184, 255, 0.24);
}

html.theme-dark .portal-user,
html.theme-dark .portal-sidebar-group-title,
html.theme-dark .district-map-scale-title,
html.theme-dark .district-map-scale-labels {
    color: #a9c1ef !important;
}

html.theme-dark .card,
html.theme-dark .role-item,
html.theme-dark .district-checkbox-grid,
html.theme-dark .province-checkbox-grid,
html.theme-dark .list li,
html.theme-dark .hierarchy-child,
html.theme-dark .followup-escalation-head > span,
html.theme-dark .followup-escalation-bucket,
html.theme-dark .followup-escalation-row,
html.theme-dark .followup-summary-kpi,
html.theme-dark .followup-chart-card,
html.theme-dark .followup-summary-table-wrap,
html.theme-dark .analytics-chart-card,
html.theme-dark .analytics-kpi,
html.theme-dark .stat,
html.theme-dark .district-map-card,
html.theme-dark .district-summary-card,
html.theme-dark .district-lead-info-card,
html.theme-dark .district-epr-modal-content,
html.theme-dark .district-epr-card {
    background:
        linear-gradient(145deg, rgba(17, 24, 50, 0.94), rgba(7, 13, 31, 0.96)),
        radial-gradient(circle at 12% 0%, rgba(9, 184, 255, 0.12), transparent 28%),
        radial-gradient(circle at 100% 100%, rgba(223, 0, 0, 0.12), transparent 34%) !important;
    border-color: rgba(9, 184, 255, 0.32) !important;
    color: #f7fbff !important;
    box-shadow: 0 18px 36px rgba(1, 7, 22, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

html.theme-dark .dashboard-header-card,
html.theme-dark .users-card,
html.theme-dark .hierarchy-card,
html.theme-dark .district-card,
html.theme-dark .analytics-card-enhanced,
html.theme-dark .analytics-filter-note {
    background:
        linear-gradient(135deg, rgba(16, 22, 48, 0.96), rgba(28, 12, 55, 0.9)),
        radial-gradient(circle at 88% 0%, rgba(223, 0, 0, 0.32), transparent 36%) !important;
    border-color: rgba(223, 0, 0, 0.32) !important;
}

html.theme-dark .theme-toggle-btn,
html.theme-dark .portal-menu-link,
html.theme-dark .portal-quick-icon,
html.theme-dark .analytics-filter-reset,
html.theme-dark .district-epr-modal-close {
    background: rgba(15, 26, 58, 0.94) !important;
    border-color: rgba(9, 184, 255, 0.45) !important;
    color: #dff7ff !important;
    box-shadow: 0 8px 18px rgba(1, 7, 22, 0.38), inset 0 0 0 1px rgba(223, 0, 0, 0.1) !important;
}

html.theme-dark .theme-toggle-btn:hover,
html.theme-dark .portal-menu-link:hover,
html.theme-dark .portal-quick-icon:hover,
html.theme-dark .portal-quick-icon:focus-visible,
html.theme-dark .analytics-filter-reset:hover,
html.theme-dark .district-epr-modal-close:hover {
    border-color: rgba(223, 0, 0, 0.62) !important;
    color: #ffffff !important;
    box-shadow: 0 10px 24px rgba(1, 7, 22, 0.42), 0 0 18px rgba(223, 0, 0, 0.22) !important;
}

html.theme-dark .portal-user button,
html.theme-dark .portal-sidebar-logout-form button,
html.theme-dark .btn-primary,
html.theme-dark .btn-link,
html.theme-dark .analytics-filter-actions .btn-primary.analytics-filter-btn,
html.theme-dark .analytics-filter-actions .btn-link.alt.analytics-filter-btn,
html.theme-dark .followup-escalation-btn,
html.theme-dark .district-epr-modal-header {
    background: linear-gradient(135deg, var(--neon-pink) 0%, var(--neon-violet) 48%, var(--neon-blue) 100%) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
    box-shadow: 0 10px 22px rgba(223, 0, 0, 0.28), 0 0 22px rgba(9, 184, 255, 0.18) !important;
}

html.theme-dark .btn-link.alt {
    background: rgba(15, 26, 58, 0.94) !important;
    border: 1px solid rgba(9, 184, 255, 0.45) !important;
    color: #dff7ff !important;
}

html.theme-dark .portal-sidebar-profile,
html.theme-dark .portal-sidebar-nav a:hover,
html.theme-dark .hierarchy-badges span,
html.theme-dark .followup-summary-tabbar label,
html.theme-dark .analytics-table thead th,
html.theme-dark .analytics-table tbody tr:nth-child(even),
html.theme-dark .analytics-table tbody tr:nth-child(odd),
html.theme-dark .district-summary-row:hover,
html.theme-dark .district-summary-row.is-selected {
    background: rgba(15, 26, 58, 0.86) !important;
    border-color: rgba(137, 87, 255, 0.38) !important;
    color: #dff7ff !important;
}

html.theme-dark .form-grid input,
html.theme-dark .form-grid select,
html.theme-dark .analytics-inline-filter input,
html.theme-dark .analytics-inline-filter select,
html.theme-dark .analytics-filter-form input,
html.theme-dark .analytics-filter-form select,
html.theme-dark .district-province-select,
html.theme-dark .district-multi-select {
    background: rgba(5, 11, 28, 0.86) !important;
    border-color: rgba(9, 184, 255, 0.42) !important;
    color: #f7fbff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 0 1px rgba(223, 0, 0, 0.06) !important;
}

html.theme-dark .form-grid input:focus,
html.theme-dark .form-grid select:focus,
html.theme-dark .analytics-inline-filter input:focus,
html.theme-dark .analytics-inline-filter select:focus,
html.theme-dark .analytics-filter-form input:focus,
html.theme-dark .analytics-filter-form select:focus {
    border-color: rgba(223, 0, 0, 0.76) !important;
    box-shadow: 0 0 0 3px rgba(223, 0, 0, 0.16), 0 0 22px rgba(9, 184, 255, 0.12) !important;
}

html.theme-dark .stat strong,
html.theme-dark .analytics-kpi strong,
html.theme-dark .district-lead-info-value,
html.theme-dark .district-epr-count strong {
    color: var(--neon-pink) !important;
    text-shadow: 0 0 18px rgba(223, 0, 0, 0.32);
}

html.theme-dark .stat span,
html.theme-dark .analytics-kpi span,
html.theme-dark .followup-summary-kpi span,
html.theme-dark .district-lead-info-label,
html.theme-dark .district-epr-details span,
html.theme-dark .district-epr-address,
html.theme-dark .district-epr-vehicle,
html.theme-dark .district-epr-phone {
    color: #a9c1ef !important;
}

html.theme-dark .district-lead-map {
    background:
        radial-gradient(circle at 28% 12%, rgba(9, 184, 255, 0.16), transparent 30%),
        linear-gradient(145deg, rgba(5, 11, 28, 0.96), rgba(16, 9, 34, 0.94)) !important;
}

html.theme-dark .district-map-scale-bar {
    background: linear-gradient(90deg, var(--neon-blue), var(--neon-violet), var(--neon-pink)) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 0 18px rgba(223, 0, 0, 0.28);
}

html.theme-dark .district-map-path:hover,
html.theme-dark .district-group:hover .district-map-path {
    fill: var(--neon-pink) !important;
    stroke: var(--neon-blue) !important;
}

html.theme-dark .district-map-path.is-selected {
    fill: var(--neon-pink) !important;
    stroke: #ffffff !important;
    filter: drop-shadow(0 0 18px rgba(223, 0, 0, 0.65));
}

html.theme-dark body.login-page {
    background: #070707 url("../icons/login.png") center center / cover no-repeat fixed !important;
    color: #ffffff !important;
}

html.theme-dark .login-ui-left {
    background: transparent !important;
}

html.theme-dark .login-ui-form-wrap h1 {
    color: #ffffff !important;
    text-shadow: 0 0 18px rgba(223, 0, 0, 0.26);
}

html.theme-dark .login-ui-role,
html.theme-dark .login-ui-links a,
html.theme-dark .login-ui-remember {
    color: rgba(255, 255, 255, 0.78) !important;
}

html.theme-dark .login-ui-field {
    background: rgba(0, 0, 0, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.95) !important;
    box-shadow: none !important;
}

html.theme-dark .login-ui-field input,
html.theme-dark .login-ui-field select {
    color: #f7fbff !important;
}

html.theme-dark .login-ui-icon,
html.theme-dark .login-ui-field input::placeholder,
html.theme-dark .login-ui-password-toggle {
    color: #ffffff !important;
}

html.theme-dark .login-ui-password-toggle:hover,
html.theme-dark .login-ui-password-toggle:focus-visible {
    background: rgba(9, 184, 255, 0.14) !important;
    color: #ffffff !important;
}

html.theme-dark .login-ui-submit {
    background: #ff1f32 !important;
    box-shadow: none !important;
}

html.theme-dark .login-ui-right {
    display: none !important;
}

html.theme-dark .login-ui-right::before {
    background: linear-gradient(135deg, rgba(5, 8, 20, 0.24), rgba(20, 7, 38, 0.34)) !important;
}
