/* ============================================================================
 * PHP IPTV Redirect Manager - Material Design 3 (Material You) Design System
 * Full Light & Dark Color Roles, Surface Containers, Typography, Shapes & Adaptive Navigation
 * ============================================================================ */

:root,
[data-theme="light"] {
    color-scheme: light;

    /* M3 Primary / Secondary / Tertiary Roles */
    --md-sys-color-primary: #295EA7;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #D6E3FF;
    --md-sys-color-on-primary-container: #001B3E;

    --md-sys-color-secondary: #555F71;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #D9E3F8;
    --md-sys-color-on-secondary-container: #121C2B;

    --md-sys-color-tertiary: #6F5675;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #F8D8FE;
    --md-sys-color-on-tertiary-container: #28132E;

    --md-sys-color-error: #BA1A1A;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #FFDAD6;
    --md-sys-color-on-error-container: #410002;

    /* Harmonized Semantic Roles */
    --md-sys-color-success: #146C2E;
    --md-sys-color-on-success: #FFFFFF;
    --md-sys-color-success-container: #C4EED0;
    --md-sys-color-on-success-container: #072711;

    --md-sys-color-warning: #8A5100;
    --md-sys-color-on-warning: #FFFFFF;
    --md-sys-color-warning-container: #FFDCBE;
    --md-sys-color-on-warning-container: #2C1700;

    --md-sys-color-info: #00658E;
    --md-sys-color-on-info: #FFFFFF;
    --md-sys-color-info-container: #C7E7FF;
    --md-sys-color-on-info-container: #001E2E;

    /* M3 Surface Hierarchy */
    --md-sys-color-background: #F8F9FD;
    --md-sys-color-on-background: #1A1C20;
    --md-sys-color-surface: #F8F9FD;
    --md-sys-color-surface-dim: #D8DAE2;
    --md-sys-color-surface-container-lowest: #FFFFFF;
    --md-sys-color-surface-container-low: #F2F3FA;
    --md-sys-color-surface-container: #ECEDF4;
    --md-sys-color-surface-container-high: #E6E8EE;
    --md-sys-color-surface-container-highest: #E0E2E9;
    --md-sys-color-on-surface: #1A1C20;
    --md-sys-color-on-surface-variant: #44474F;

    --md-sys-color-outline: #74777F;
    --md-sys-color-outline-variant: #C4C6D0;

    --md-sys-color-inverse-surface: #2E3036;
    --md-sys-color-inverse-on-surface: #F0F0F7;
    --md-sys-color-inverse-primary: #AAC7FF;

    --md-sys-color-scrim: rgba(15, 23, 42, 0.36);

    /* State Layer Opacities */
    --md-state-hover: rgba(26, 28, 32, 0.08);
    --md-state-pressed: rgba(26, 28, 32, 0.12);
    --md-state-primary-hover: rgba(41, 94, 167, 0.08);

    /* Elevation Shadows */
    --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.08), 0 1px 3px 1px rgba(0, 0, 0, 0.05);
    --md-sys-elevation-2: 0 1px 2px rgba(0, 0, 0, 0.10), 0 2px 6px 2px rgba(0, 0, 0, 0.07);
    --md-sys-elevation-3: 0 4px 8px 3px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.12);

    /* Shape Tokens */
    --md-sys-shape-xs: 4px;
    --md-sys-shape-sm: 8px;
    --md-sys-shape-md: 12px;
    --md-sys-shape-lg: 16px;
    --md-sys-shape-xl: 28px;
    --md-sys-shape-full: 9999px;

    /* Layout Dimensions */
    --m3-drawer-width: 280px;
    --m3-rail-width: 84px;
    --m3-topbar-height: 64px;
    --m3-bottom-bar-height: 76px;
}

[data-theme="dark"] {
    color-scheme: dark;

    --md-sys-color-primary: #AAC7FF;
    --md-sys-color-on-primary: #002F65;
    --md-sys-color-primary-container: #00458E;
    --md-sys-color-on-primary-container: #D6E3FF;

    --md-sys-color-secondary: #BDC7DC;
    --md-sys-color-on-secondary: #273141;
    --md-sys-color-secondary-container: #3E4759;
    --md-sys-color-on-secondary-container: #D9E3F8;

    --md-sys-color-tertiary: #DBBDE2;
    --md-sys-color-on-tertiary: #3E2845;
    --md-sys-color-tertiary-container: #563E5C;
    --md-sys-color-on-tertiary-container: #F8D8FE;

    --md-sys-color-error: #FFB4AB;
    --md-sys-color-on-error: #690005;
    --md-sys-color-error-container: #93000A;
    --md-sys-color-on-error-container: #FFDAD6;

    --md-sys-color-success: #6DD58C;
    --md-sys-color-on-success: #003915;
    --md-sys-color-success-container: #0F5223;
    --md-sys-color-on-success-container: #C4EED0;

    --md-sys-color-warning: #FFB870;
    --md-sys-color-on-warning: #4A2800;
    --md-sys-color-warning-container: #693C00;
    --md-sys-color-on-warning-container: #FFDCBE;

    --md-sys-color-info: #85CFFF;
    --md-sys-color-on-info: #00344C;
    --md-sys-color-info-container: #004C6D;
    --md-sys-color-on-info-container: #C7E7FF;

    --md-sys-color-background: #111318;
    --md-sys-color-on-background: #E2E2E9;
    --md-sys-color-surface: #111318;
    --md-sys-color-surface-dim: #111318;
    --md-sys-color-surface-container-lowest: #0C0E13;
    --md-sys-color-surface-container-low: #191B22;
    --md-sys-color-surface-container: #1E2027;
    --md-sys-color-surface-container-high: #282A31;
    --md-sys-color-surface-container-highest: #33353C;
    --md-sys-color-on-surface: #E2E2E9;
    --md-sys-color-on-surface-variant: #C4C6D0;

    --md-sys-color-outline: #8E9099;
    --md-sys-color-outline-variant: #44474F;

    --md-sys-color-inverse-surface: #E2E2E9;
    --md-sys-color-inverse-on-surface: #2E3036;
    --md-sys-color-inverse-primary: #295EA7;

    --md-sys-color-scrim: rgba(0, 0, 0, 0.58);

    --md-state-hover: rgba(226, 226, 233, 0.08);
    --md-state-pressed: rgba(226, 226, 233, 0.12);
    --md-state-primary-hover: rgba(170, 199, 255, 0.08);

    --md-sys-elevation-1: 0 1px 3px 1px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.45);
    --md-sys-elevation-2: 0 2px 6px 2px rgba(0, 0, 0, 0.40), 0 1px 2px rgba(0, 0, 0, 0.50);
    --md-sys-elevation-3: 0 4px 12px 3px rgba(0, 0, 0, 0.48), 0 2px 4px rgba(0, 0, 0, 0.52);
}

/* Base Reset & Typography */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.font-monospace, code, pre, .m3-mono {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

code {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-primary);
    padding: 0.125rem 0.375rem;
    border-radius: 6px;
    font-size: 0.85em;
}

/* Material Symbols Rounded */
.material-symbols-rounded {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
    user-select: none;
    flex-shrink: 0;
}

.material-symbols-rounded.m3-icon-sm { font-size: 18px; }
.material-symbols-rounded.m3-icon-md { font-size: 22px; }
.material-symbols-rounded.m3-icon-lg { font-size: 26px; }
.material-symbols-rounded.m3-icon-xl { font-size: 32px; }

.m3-icon-filled,
.m3-nav-item.active .material-symbols-rounded,
.m3-bottom-item.active .material-symbols-rounded,
.nav-link.active .material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* Bootstrap Color Overrides for Seamless Theme Support */
.text-muted { color: var(--md-sys-color-on-surface-variant) !important; }
.text-secondary { color: var(--md-sys-color-on-surface-variant) !important; }
.text-dark { color: var(--md-sys-color-on-surface) !important; }
.text-white { color: var(--md-sys-color-on-surface) !important; }
.text-primary { color: var(--md-sys-color-primary) !important; }
.text-success { color: var(--md-sys-color-success) !important; }
.text-warning { color: var(--md-sys-color-warning) !important; }
.text-danger { color: var(--md-sys-color-error) !important; }
.text-info { color: var(--md-sys-color-info) !important; }
.border-top, .border-bottom, .border { border-color: var(--md-sys-color-outline-variant) !important; }

/* ============================================================================
 * M3 Typography Helpers
 * ============================================================================ */
.m3-headline-md { font-size: 1.75rem; font-weight: 500; line-height: 2.25rem; letter-spacing: 0; color: var(--md-sys-color-on-surface); }
.m3-headline-sm { font-size: 1.5rem; font-weight: 500; line-height: 2rem; letter-spacing: 0; color: var(--md-sys-color-on-surface); }
.m3-title-lg { font-size: 1.375rem; font-weight: 500; line-height: 1.75rem; color: var(--md-sys-color-on-surface); }
.m3-title-md { font-size: 1rem; font-weight: 500; line-height: 1.5rem; letter-spacing: 0.01em; color: var(--md-sys-color-on-surface); }
.m3-title-sm { font-size: 0.875rem; font-weight: 500; line-height: 1.25rem; letter-spacing: 0.007em; color: var(--md-sys-color-on-surface); }
.m3-body-md { font-size: 0.875rem; font-weight: 400; line-height: 1.25rem; color: var(--md-sys-color-on-surface-variant); }
.m3-body-sm { font-size: 0.75rem; font-weight: 400; line-height: 1rem; color: var(--md-sys-color-on-surface-variant); }
.m3-label-lg { font-size: 0.875rem; font-weight: 500; line-height: 1.25rem; letter-spacing: 0.006em; }
.m3-label-md { font-size: 0.75rem; font-weight: 500; line-height: 1rem; letter-spacing: 0.03em; }
.m3-label-sm { font-size: 0.6875rem; font-weight: 500; line-height: 1rem; letter-spacing: 0.04em; }

/* ============================================================================
 * Adaptive App Shell (Admin Panel)
 * ============================================================================ */
.m3-app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
    background-color: var(--md-sys-color-background);
}

/* M3 Navigation Drawer (Desktop & Modal on Tablet/Mobile) */
.m3-drawer {
    width: var(--m3-drawer-width);
    background-color: var(--md-sys-color-surface-container-low);
    border-right: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1045;
    flex-shrink: 0;
    transition: width 0.25s cubic-bezier(0.2, 0, 0, 1), transform 0.28s cubic-bezier(0.2, 0, 0, 1);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 12px;
}

.m3-drawer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 16px;
    text-decoration: none;
    color: var(--md-sys-color-on-surface);
}

.m3-drawer-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--md-sys-shape-md);
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--md-sys-elevation-1);
}

.m3-drawer-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.m3-drawer-brand-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
}

.m3-drawer-brand-sub {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    white-space: nowrap;
}

.m3-nav-section-label {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--md-sys-color-on-surface-variant);
    padding: 12px 16px 6px;
    white-space: nowrap;
}

.m3-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.m3-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 48px;
    padding: 0 16px;
    border-radius: var(--md-sys-shape-full);
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    transition: background-color 0.18s ease, color 0.18s ease;
    white-space: nowrap;
}

.m3-nav-item:hover {
    background-color: var(--md-state-hover);
    color: var(--md-sys-color-on-surface);
}

.m3-nav-item.active {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    font-weight: 600;
}

.m3-nav-item.active:hover {
    filter: brightness(0.97);
}

.m3-drawer-divider {
    height: 1px;
    background-color: var(--md-sys-color-outline-variant);
    margin: 10px 12px;
    opacity: 0.75;
}

.m3-drawer-footer {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.m3-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--md-sys-shape-lg);
    background-color: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.m3-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--md-sys-shape-full);
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Rail Collapsed State on Desktop */
body.m3-rail-collapsed .m3-drawer {
    width: var(--m3-rail-width);
    padding: 16px 8px;
    align-items: center;
}

body.m3-rail-collapsed .m3-drawer-brand {
    justify-content: center;
    padding: 8px 4px 12px;
}

body.m3-rail-collapsed .m3-drawer-brand-text,
body.m3-rail-collapsed .m3-nav-section-label,
body.m3-rail-collapsed .m3-nav-label,
body.m3-rail-collapsed .m3-portal-btn-label,
body.m3-rail-collapsed .m3-user-meta {
    display: none !important;
}

body.m3-rail-collapsed .m3-nav-item {
    width: 56px;
    height: 44px;
    padding: 0;
    justify-content: center;
    margin: 0 auto;
}

body.m3-rail-collapsed .m3-user-card {
    flex-direction: column;
    padding: 8px;
    gap: 8px;
}

/* Scrim for Modal Drawer */
.m3-drawer-scrim {
    position: fixed;
    inset: 0;
    background-color: var(--md-sys-color-scrim);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.24s ease, visibility 0.24s ease;
}

.m3-drawer-scrim.show {
    opacity: 1;
    visibility: visible;
}

/* Main Workspace */
.m3-main-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* M3 Top App Bar */
.m3-topbar {
    height: var(--m3-topbar-height);
    background-color: var(--md-sys-color-surface);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 1020;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.m3-topbar.scrolled {
    background-color: var(--md-sys-color-surface-container);
    box-shadow: var(--md-sys-elevation-1);
}

.m3-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.m3-topbar-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.m3-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Content Canvas */
.m3-content-body {
    flex: 1;
    padding: 24px;
    max-width: 1520px;
    width: 100%;
    margin: 0 auto;
}

.m3-footer {
    background-color: var(--md-sys-color-surface-container-low);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    padding: 16px 24px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--md-sys-color-on-surface-variant);
}

/* M3 Bottom Navigation Bar (Mobile) */
.m3-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--m3-bottom-bar-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background-color: var(--md-sys-color-surface-container);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    z-index: 1030;
    justify-content: space-around;
    align-items: center;
    box-shadow: var(--md-sys-elevation-2);
}

.m3-bottom-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: var(--md-sys-color-on-surface-variant);
    background: transparent;
    border: none;
    padding: 8px 4px;
    cursor: pointer;
    min-width: 0;
}

.m3-bottom-indicator {
    width: 64px;
    height: 32px;
    border-radius: var(--md-sys-shape-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.m3-bottom-item.active .m3-bottom-indicator {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.m3-bottom-item.active {
    color: var(--md-sys-color-on-surface);
}

.m3-bottom-label {
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* M3 Floating Action Button (Mobile/Tablet) */
.m3-fab {
    display: none;
    position: fixed;
    right: 16px;
    bottom: calc(var(--m3-bottom-bar-height) + env(safe-area-inset-bottom, 0px) + 16px);
    z-index: 1025;
    height: 56px;
    min-width: 56px;
    padding: 0 20px;
    border-radius: var(--md-sys-shape-lg);
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    box-shadow: var(--md-sys-elevation-3);
    text-decoration: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.m3-fab:hover {
    color: var(--md-sys-color-on-primary-container);
    transform: translateY(-2px);
}

/* ============================================================================
 * Responsive Shell Breakpoints (PC, Tablet, Mobile)
 * ============================================================================ */
@media (max-width: 1199.98px) {
    .m3-drawer {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 296px !important;
        transform: translateX(-104%);
        box-shadow: var(--md-sys-elevation-3);
        border-radius: 0 var(--md-sys-shape-lg) var(--md-sys-shape-lg) 0;
    }

    body.m3-drawer-open .m3-drawer {
        transform: translateX(0);
    }

    body.m3-rail-collapsed .m3-drawer-brand-text,
    body.m3-rail-collapsed .m3-nav-section-label,
    body.m3-rail-collapsed .m3-nav-label,
    body.m3-rail-collapsed .m3-portal-btn-label,
    body.m3-rail-collapsed .m3-user-meta {
        display: initial !important;
    }

    body.m3-rail-collapsed .m3-nav-item {
        width: auto;
        justify-content: flex-start;
        padding: 0 16px;
        margin: 0;
    }

    body.m3-rail-collapsed .m3-user-card {
        flex-direction: row;
        padding: 10px 12px;
    }
}

@media (max-width: 767.98px) {
    .m3-topbar {
        padding: 0 12px 0 8px;
        height: 60px;
    }

    .m3-topbar-title {
        font-size: 1.075rem;
    }

    .m3-content-body {
        padding: 16px 12px 24px;
    }

    .m3-bottom-nav {
        display: flex;
    }

    .m3-fab {
        display: inline-flex;
    }

    .m3-footer {
        padding-bottom: calc(var(--m3-bottom-bar-height) + env(safe-area-inset-bottom, 0px) + 16px);
    }
}

/* ============================================================================
 * Material 3 Cards & Containers
 * ============================================================================ */
.m3-card,
.card {
    background-color: var(--md-sys-color-surface-container-lowest);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-lg);
    box-shadow: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.m3-card-elevated {
    background-color: var(--md-sys-color-surface-container-low);
    border: 1px solid transparent;
    box-shadow: var(--md-sys-elevation-1);
}

.m3-card-filled {
    background-color: var(--md-sys-color-surface-container);
    border: 1px solid transparent;
}

.m3-card-tonal {
    background-color: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.m3-card-header,
.card-header {
    background-color: transparent !important;
    border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;
    padding: 16px 20px;
    color: var(--md-sys-color-on-surface);
}

.card-body {
    padding: 20px;
}

@media (max-width: 575.98px) {
    .m3-card-header, .card-header { padding: 14px 16px; }
    .card-body { padding: 16px; }
}

/* M3 Stat Cards */
.m3-stat-card {
    background-color: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-lg);
    padding: 18px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.m3-stat-card:hover {
    border-color: var(--md-sys-color-primary);
    box-shadow: var(--md-sys-elevation-1);
    transform: translateY(-1px);
}

.m3-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--md-sys-shape-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.m3-tone-primary { background-color: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.m3-tone-secondary { background-color: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.m3-tone-tertiary { background-color: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.m3-tone-success { background-color: var(--md-sys-color-success-container); color: var(--md-sys-color-on-success-container); }
.m3-tone-warning { background-color: var(--md-sys-color-warning-container); color: var(--md-sys-color-on-warning-container); }
.m3-tone-error { background-color: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.m3-tone-info { background-color: var(--md-sys-color-info-container); color: var(--md-sys-color-on-info-container); }

/* ============================================================================
 * Material 3 Buttons (Filled, Tonal, Outlined, Text, Icon)
 * ============================================================================ */
.m3-btn,
.btn {
    border-radius: var(--md-sys-shape-full);
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    min-height: 40px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    transition: background-color 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, color 0.16s ease;
    text-decoration: none;
    cursor: pointer;
}

.btn-sm, .m3-btn-sm {
    min-height: 34px;
    padding: 0 14px;
    font-size: 0.8125rem;
    gap: 6px;
}

.btn-lg, .m3-btn-lg {
    min-height: 48px;
    padding: 0 26px;
    font-size: 0.9375rem;
}

/* Filled Primary */
.btn-primary, .m3-btn-filled {
    background-color: var(--md-sys-color-primary) !important;
    color: var(--md-sys-color-on-primary) !important;
    border: 1px solid transparent !important;
}

.btn-primary:hover, .m3-btn-filled:hover {
    box-shadow: var(--md-sys-elevation-1);
    filter: brightness(1.06);
}

/* Filled Tonal */
.m3-btn-tonal {
    background-color: var(--md-sys-color-secondary-container) !important;
    color: var(--md-sys-color-on-secondary-container) !important;
    border: 1px solid transparent !important;
}

.m3-btn-tonal:hover {
    box-shadow: var(--md-sys-elevation-1);
    filter: brightness(0.97);
}

.m3-btn-tonal-primary {
    background-color: var(--md-sys-color-primary-container) !important;
    color: var(--md-sys-color-on-primary-container) !important;
    border: 1px solid transparent !important;
}

.m3-btn-tonal-warning {
    background-color: var(--md-sys-color-warning-container) !important;
    color: var(--md-sys-color-on-warning-container) !important;
    border: 1px solid transparent !important;
}

.m3-btn-tonal-danger {
    background-color: var(--md-sys-color-error-container) !important;
    color: var(--md-sys-color-on-error-container) !important;
    border: 1px solid transparent !important;
}

/* Outlined Buttons */
.btn-outline-secondary, .btn-outline-primary, .btn-outline-info, .btn-outline-warning, .btn-outline-danger, .btn-outline-success,
.m3-btn-outlined {
    background-color: transparent !important;
    border: 1px solid var(--md-sys-color-outline) !important;
    color: var(--md-sys-color-on-surface) !important;
}

.btn-outline-primary { color: var(--md-sys-color-primary) !important; border-color: var(--md-sys-color-outline) !important; }
.btn-outline-danger { color: var(--md-sys-color-error) !important; border-color: var(--md-sys-color-error) !important; }
.btn-outline-warning { color: var(--md-sys-color-warning) !important; border-color: var(--md-sys-color-warning) !important; }
.btn-outline-success { color: var(--md-sys-color-success) !important; border-color: var(--md-sys-color-success) !important; }
.btn-outline-info { color: var(--md-sys-color-info) !important; border-color: var(--md-sys-color-outline) !important; }

.btn-outline-secondary:hover, .btn-outline-primary:hover, .btn-outline-info:hover,
.btn-outline-warning:hover, .btn-outline-danger:hover, .btn-outline-success:hover,
.m3-btn-outlined:hover {
    background-color: var(--md-state-hover) !important;
}

.btn-warning {
    background-color: var(--md-sys-color-warning-container) !important;
    color: var(--md-sys-color-on-warning-container) !important;
    border: 1px solid transparent !important;
}

.btn-success {
    background-color: var(--md-sys-color-success) !important;
    color: var(--md-sys-color-on-success) !important;
    border: 1px solid transparent !important;
}

.btn-light, .btn-secondary {
    background-color: var(--md-sys-color-surface-container-high) !important;
    color: var(--md-sys-color-on-surface) !important;
    border: 1px solid var(--md-sys-color-outline-variant) !important;
}

.m3-btn-text {
    background-color: transparent !important;
    border: none !important;
    color: var(--md-sys-color-primary) !important;
    padding: 0 14px;
}

.m3-btn-text:hover {
    background-color: var(--md-state-primary-hover) !important;
}

/* M3 Icon Button (40x40 touch target) */
.m3-icon-btn {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: var(--md-sys-shape-full);
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: background-color 0.16s ease, color 0.16s ease;
    flex-shrink: 0;
}

.m3-icon-btn:hover {
    background-color: var(--md-state-hover);
    color: var(--md-sys-color-on-surface);
}

.m3-icon-btn.m3-icon-btn-tonal {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.m3-icon-btn.m3-icon-btn-primary { color: var(--md-sys-color-primary); }
.m3-icon-btn.m3-icon-btn-warning { color: var(--md-sys-color-warning); }
.m3-icon-btn.m3-icon-btn-danger { color: var(--md-sys-color-error); }
.m3-icon-btn.m3-icon-btn-success { color: var(--md-sys-color-success); }

.m3-action-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ============================================================================
 * Material 3 Chips & Badges
 * ============================================================================ */
.m3-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: var(--md-sys-shape-sm);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1;
    border: 1px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
    white-space: nowrap;
}

.m3-chip:hover {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.m3-chip.active, .m3-chip.selected {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-color: transparent;
}

.m3-chip-pill {
    border-radius: var(--md-sys-shape-full);
}

.m3-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: var(--md-sys-shape-full);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.1;
    white-space: nowrap;
}

.m3-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: currentColor;
    flex-shrink: 0;
}

.m3-badge-success { background-color: var(--md-sys-color-success-container); color: var(--md-sys-color-on-success-container); }
.m3-badge-warning { background-color: var(--md-sys-color-warning-container); color: var(--md-sys-color-on-warning-container); }
.m3-badge-danger { background-color: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.m3-badge-primary { background-color: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.m3-badge-info { background-color: var(--md-sys-color-info-container); color: var(--md-sys-color-on-info-container); }
.m3-badge-neutral { background-color: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface-variant); }

/* ============================================================================
 * Material 3 Form Controls, Outlined Fields, Switches & Search Bar
 * ============================================================================ */
.form-label {
    color: var(--md-sys-color-on-surface-variant) !important;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-control, .form-select {
    background-color: var(--md-sys-color-surface-container-lowest) !important;
    color: var(--md-sys-color-on-surface) !important;
    border: 1px solid var(--md-sys-color-outline) !important;
    border-radius: var(--md-sys-shape-md);
    min-height: 46px;
    padding: 10px 14px;
    font-size: 0.9375rem;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea.form-control {
    min-height: 84px;
}

.form-control-sm, .form-select-sm {
    min-height: 38px;
    padding: 6px 12px;
    font-size: 0.875rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--md-sys-color-primary) !important;
    box-shadow: 0 0 0 1px var(--md-sys-color-primary) !important;
    outline: none;
}

.form-control::placeholder {
    color: var(--md-sys-color-outline) !important;
}

.form-control[readonly] {
    background-color: var(--md-sys-color-surface-container-low) !important;
}

.input-group-text {
    background-color: var(--md-sys-color-surface-container) !important;
    color: var(--md-sys-color-on-surface-variant) !important;
    border: 1px solid var(--md-sys-color-outline) !important;
    border-radius: var(--md-sys-shape-md);
}

.input-group .form-control {
    min-height: 46px;
}

.input-group-sm .form-control,
.input-group-sm .input-group-text {
    min-height: 38px;
}

/* M3 Password Field Wrapper */
.m3-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.m3-input-wrap .m3-input-leading {
    position: absolute;
    left: 14px;
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none;
    z-index: 2;
}

.m3-input-wrap .form-control.has-leading {
    padding-left: 44px;
}

.m3-input-wrap .form-control.has-trailing {
    padding-right: 46px;
}

.m3-input-wrap .m3-input-trailing-btn {
    position: absolute;
    right: 4px;
    z-index: 3;
}

/* M3 Switch */
.form-switch .form-check-input {
    width: 52px;
    height: 30px;
    border-radius: var(--md-sys-shape-full);
    background-color: var(--md-sys-color-surface-container-highest);
    border: 2px solid var(--md-sys-color-outline);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2.5' fill='%2374777F'/%3e%3c/svg%3e");
    background-position: left 3px center;
    background-size: 20px 20px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    margin-top: 0;
}

.form-switch .form-check-input:checked {
    background-color: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3.1' fill='%23FFFFFF'/%3e%3c/svg%3e");
    background-position: right 3px center;
}

.form-switch .form-check-input:focus {
    box-shadow: 0 0 0 4px var(--md-state-primary-hover);
}

/* M3 Search Bar */
.m3-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--md-sys-color-surface-container-high);
    border: 1px solid transparent;
    border-radius: var(--md-sys-shape-full);
    height: 48px;
    padding: 0 16px;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.m3-search-bar:focus-within {
    background-color: var(--md-sys-color-surface-container-lowest);
    border-color: var(--md-sys-color-primary);
    box-shadow: var(--md-sys-elevation-1);
}

.m3-search-bar input {
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface);
    font-size: 0.9375rem;
    width: 100%;
    outline: none;
}

.m3-search-bar input::placeholder {
    color: var(--md-sys-color-on-surface-variant);
}

/* M3 Selectable Provider Radio Cards */
.m3-radio-card {
    border: 1px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-container-lowest);
    border-radius: var(--md-sys-shape-lg);
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.m3-radio-card:hover {
    background-color: var(--md-sys-color-surface-container-low);
}

.m3-radio-card.selected {
    border: 2px solid var(--md-sys-color-primary);
    background-color: var(--md-sys-color-primary-container);
    background-color: color-mix(in srgb, var(--md-sys-color-primary-container) 32%, var(--md-sys-color-surface-container-lowest));
}

/* ============================================================================
 * Material 3 Segmented Tabs & Pills
 * ============================================================================ */
.m3-segmented-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px;
    background-color: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-full);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.m3-segmented-tabs .nav-link {
    border-radius: var(--md-sys-shape-full);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.m3-segmented-tabs .nav-link:hover {
    background-color: var(--md-state-hover);
    color: var(--md-sys-color-on-surface);
}

.m3-segmented-tabs .nav-link.active {
    background-color: var(--md-sys-color-secondary-container) !important;
    color: var(--md-sys-color-on-secondary-container) !important;
    font-weight: 600;
}

/* ============================================================================
 * Material 3 Data Tables & Responsive Mobile Cards
 * ============================================================================ */
.m3-table {
    width: 100%;
    margin-bottom: 0;
    color: var(--md-sys-color-on-surface);
    --bs-table-bg: transparent;
    --bs-table-color: var(--md-sys-color-on-surface);
    --bs-table-hover-bg: var(--md-state-hover);
    --bs-table-hover-color: var(--md-sys-color-on-surface);
    --bs-table-border-color: var(--md-sys-color-outline-variant);
}

.m3-table thead th {
    background-color: var(--md-sys-color-surface-container-low) !important;
    color: var(--md-sys-color-on-surface-variant) !important;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 14px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;
    white-space: nowrap;
}

.m3-table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.m3-table tbody tr:last-child td {
    border-bottom: none;
}

/* Mobile Responsive Card Stack for Wide Tables */
@media (max-width: 991.98px) {
    .m3-table-cards thead {
        display: none;
    }

    .m3-table-cards,
    .m3-table-cards tbody,
    .m3-table-cards tr,
    .m3-table-cards td {
        display: block;
        width: 100%;
    }

    .m3-table-cards tbody {
        padding: 12px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        background-color: var(--md-sys-color-surface-container-low);
    }

    .m3-table-cards tbody tr:not(.m3-empty-row) {
        background-color: var(--md-sys-color-surface-container-lowest);
        border: 1px solid var(--md-sys-color-outline-variant);
        border-radius: var(--md-sys-shape-lg);
        padding: 12px 14px;
        box-shadow: var(--md-sys-elevation-1);
    }

    .m3-table-cards tbody tr.m3-empty-row {
        background-color: var(--md-sys-color-surface-container-lowest);
        border-radius: var(--md-sys-shape-lg);
        padding: 24px 12px;
    }

    .m3-table-cards tbody tr:not(.m3-empty-row) td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 0 !important;
        border-bottom: 1px dashed var(--md-sys-color-outline-variant);
        text-align: right;
    }

    .m3-table-cards tbody tr:not(.m3-empty-row) td:last-child {
        border-bottom: none;
        padding-bottom: 2px !important;
    }

    .m3-table-cards tbody tr:not(.m3-empty-row) td[data-label]::before {
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--md-sys-color-on-surface-variant);
        text-align: left;
        flex-shrink: 0;
        padding-top: 2px;
    }

    .m3-table-cards tbody tr:not(.m3-empty-row) td .m3-cell-val {
        text-align: right;
        min-width: 0;
        max-width: 100%;
    }

    .m3-table-cards tbody tr:not(.m3-empty-row) td.m3-td-block {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }

    .m3-table-cards tbody tr:not(.m3-empty-row) td.m3-td-block .m3-cell-val {
        text-align: left;
        width: 100%;
    }

    .m3-table-cards .m3-action-group {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ============================================================================
 * URL Copy Pill Box
 * ============================================================================ */
.m3-url-box {
    background-color: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-md);
    padding: 5px 6px 5px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.m3-url-text {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    color: var(--md-sys-color-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    user-select: all;
}

/* ============================================================================
 * Material 3 Dialogs (Modals) & Banners & Snackbars
 * ============================================================================ */
.modal-content {
    background-color: var(--md-sys-color-surface-container-high) !important;
    color: var(--md-sys-color-on-surface) !important;
    border: 1px solid var(--md-sys-color-outline-variant) !important;
    border-radius: var(--md-sys-shape-xl) !important;
    box-shadow: var(--md-sys-elevation-3) !important;
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;
    padding: 20px 24px 16px;
    background-color: transparent !important;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    border-top: none !important;
    padding: 12px 24px 20px;
    background-color: transparent !important;
    gap: 8px;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* M3 Inline Banners (Flash Alerts) */
.m3-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--md-sys-shape-lg);
    border: none;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.m3-banner-success {
    background-color: var(--md-sys-color-success-container);
    color: var(--md-sys-color-on-success-container);
}

.m3-banner-error {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.m3-banner-warning {
    background-color: var(--md-sys-color-warning-container);
    color: var(--md-sys-color-on-warning-container);
}

.m3-banner-info {
    background-color: var(--md-sys-color-info-container);
    color: var(--md-sys-color-on-info-container);
}

/* M3 Snackbar */
.m3-snackbar-host {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 1090;
    pointer-events: none;
    width: max-content;
    max-width: calc(100vw - 32px);
}

@media (max-width: 767.98px) {
    .m3-snackbar-host {
        bottom: calc(var(--m3-bottom-bar-height) + env(safe-area-inset-bottom, 0px) + 16px);
    }
}

.m3-snackbar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 10px 18px;
    border-radius: var(--md-sys-shape-xs);
    background-color: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    box-shadow: var(--md-sys-elevation-3);
    font-size: 0.875rem;
    font-weight: 500;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.m3-snackbar.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================================
 * Auth Pages (Admin Login & Client Portal Login/2FA/Password)
 * ============================================================================ */
.m3-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background:
        radial-gradient(65% 55% at 15% 10%, color-mix(in srgb, var(--md-sys-color-primary-container) 55%, transparent), transparent 70%),
        radial-gradient(55% 45% at 85% 90%, color-mix(in srgb, var(--md-sys-color-tertiary-container) 45%, transparent), transparent 70%),
        var(--md-sys-color-background);
}

.m3-auth-card {
    width: 100%;
    max-width: 440px;
    background-color: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-xl);
    box-shadow: var(--md-sys-elevation-2);
    overflow: hidden;
    padding: 32px 28px;
}

.m3-auth-card-wide {
    max-width: 500px;
}

.m3-auth-badge {
    width: 56px;
    height: 56px;
    border-radius: var(--md-sys-shape-lg);
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

/* ============================================================================
 * Client Portal Top App Bar & Specific Layout
 * ============================================================================ */
.m3-portal-topbar {
    background-color: var(--md-sys-color-surface-container-low);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    position: sticky;
    top: 0;
    z-index: 1020;
    backdrop-filter: blur(12px);
}

.m3-portal-nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--md-sys-shape-full);
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.m3-portal-nav-pill:hover {
    background-color: var(--md-state-hover);
    color: var(--md-sys-color-on-surface);
}

.m3-portal-nav-pill.active {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    font-weight: 600;
}

.m3-playlist-card {
    background-color: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-xl);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.m3-playlist-card:hover {
    border-color: var(--md-sys-color-primary);
    box-shadow: var(--md-sys-elevation-1);
}

/* Ripple Effect */
.m3-ripple-ink {
    position: absolute;
    border-radius: 50%;
    background-color: currentColor;
    opacity: 0.18;
    transform: scale(0);
    animation: m3-ripple-anim 0.55s cubic-bezier(0.2, 0, 0, 1);
    pointer-events: none;
}

@keyframes m3-ripple-anim {
    to {
        transform: scale(2.8);
        opacity: 0;
    }
}

/* Code terminal block (Cron, etc.) */
.m3-code-block {
    background-color: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-md);
    padding: 12px 14px;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    word-break: break-all;
}

/* Mobile Header Actions Stack */
.m3-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

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

@media (max-width: 575.98px) {
    .m3-page-header {
        margin-bottom: 16px;
    }
    .m3-page-actions {
        width: 100%;
    }
    .m3-page-actions .btn, .m3-page-actions .m3-btn {
        flex: 1 1 auto;
    }
}

/* ============================================================================
 * Expandable Provider/Device Sub-rows & M3 Channel Organizer
 * ============================================================================ */
.m3-expand-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--md-sys-shape-full);
    border: 1px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), background-color 0.16s ease, border-color 0.16s ease;
    flex-shrink: 0;
}

.m3-expand-btn:hover {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-color: var(--md-sys-color-primary);
}

.m3-expand-btn .material-symbols-rounded {
    transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1);
}

.m3-expand-btn[aria-expanded="true"] {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-color: var(--md-sys-color-primary);
}

.m3-expand-btn[aria-expanded="true"] .material-symbols-rounded {
    transform: rotate(90deg);
}

.m3-provider-row.is-expanded > td {
    background-color: color-mix(in srgb, var(--md-sys-color-primary-container) 18%, transparent);
}

.m3-subrow > td.m3-subrow-cell {
    padding: 0 !important;
    background-color: var(--md-sys-color-surface-container-low);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.m3-subrow-inner {
    padding: 16px 20px 20px;
    border-left: 4px solid var(--md-sys-color-primary);
    background: color-mix(in srgb, var(--md-sys-color-surface-container) 65%, transparent);
}

.m3-device-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.m3-device-item {
    background-color: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-lg);
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.m3-device-item:hover {
    border-color: color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-outline-variant));
    box-shadow: var(--md-sys-elevation-1);
}

.m3-device-item.is-default {
    border-color: color-mix(in srgb, var(--md-sys-color-primary) 45%, var(--md-sys-color-outline-variant));
    background: linear-gradient(90deg, color-mix(in srgb, var(--md-sys-color-primary-container) 26%, var(--md-sys-color-surface-container-lowest)), var(--md-sys-color-surface-container-lowest));
}

.m3-device-item.is-inactive {
    opacity: 0.78;
    border-style: dashed;
}

.m3-device-meta {
    min-width: 220px;
    flex: 1 1 250px;
}

.m3-device-url {
    flex: 1 1 280px;
    min-width: 240px;
    max-width: 420px;
}

.m3-device-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex: 1 1 auto;
}

@media (max-width: 991.98px) {
    .m3-table-cards tbody tr.m3-subrow {
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-top: -6px;
    }

    .m3-table-cards tbody tr.m3-subrow > td.m3-subrow-cell {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: 1px solid var(--md-sys-color-outline-variant) !important;
        border-radius: var(--md-sys-shape-lg);
        overflow: hidden;
        text-align: left !important;
    }

    .m3-subrow-inner {
        padding: 12px;
    }

    .m3-device-item {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }

    .m3-device-url {
        max-width: 100%;
        min-width: 0;
    }

    .m3-device-actions {
        justify-content: flex-start;
    }
}

/* Channel & Group Organizer */
.m3-editor-sticky {
    position: sticky;
    top: 68px;
    z-index: 1015;
    background-color: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-xl);
    box-shadow: var(--md-sys-elevation-2);
    backdrop-filter: blur(10px);
}

.m3-group-sidebar {
    max-height: 68vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

.m3-group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--md-sys-shape-md);
    border: 1px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-container-lowest);
    cursor: pointer;
    transition: background-color 0.14s ease, border-color 0.14s ease;
}

.m3-group-item:hover {
    background-color: var(--md-state-hover);
}

.m3-group-item.active {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-color: var(--md-sys-color-primary);
}

.m3-group-item.is-all-hidden {
    opacity: 0.6;
}

.m3-channel-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background-color: var(--md-sys-color-surface-container-lowest);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    transition: background-color 0.14s ease, opacity 0.14s ease;
}

.m3-channel-row:last-child {
    border-bottom: none;
}

.m3-channel-row:hover {
    background-color: var(--md-state-hover);
}

.m3-channel-row.is-hidden {
    opacity: 0.52;
    background-color: color-mix(in srgb, var(--md-sys-color-surface-container) 55%, transparent);
}

.m3-channel-row.is-new {
    border-left: 3px solid var(--md-sys-color-info);
}

.m3-channel-row.is-modified {
    border-left: 3px solid var(--md-sys-color-warning);
}

.m3-channel-row.is-dragging {
    opacity: 0.45;
    background-color: var(--md-sys-color-primary-container);
}

.m3-channel-row.drag-over-top {
    box-shadow: inset 0 3px 0 0 var(--md-sys-color-primary);
}

.m3-channel-row.drag-over-bottom {
    box-shadow: inset 0 -3px 0 0 var(--md-sys-color-primary);
}

.m3-drag-handle {
    cursor: grab;
    color: var(--md-sys-color-on-surface-variant);
    display: inline-flex;
    align-items: center;
    padding: 4px 2px;
    user-select: none;
    touch-action: none;
}

.m3-drag-handle:active {
    cursor: grabbing;
}

.m3-order-input {
    width: 68px;
    text-align: center;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    padding: 4px 6px !important;
    min-height: 32px !important;
}

.m3-ch-logo {
    width: 34px;
    height: 34px;
    border-radius: var(--md-sys-shape-sm);
    object-fit: contain;
    background-color: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    padding: 2px;
    flex-shrink: 0;
}

.m3-ch-logo-placeholder {
    width: 34px;
    height: 34px;
    border-radius: var(--md-sys-shape-sm);
    background-color: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface-variant);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@media (max-width: 767.98px) {
    .m3-channel-row {
        flex-wrap: wrap;
        padding: 10px 12px;
    }
}

/* Client Portal Providers Toolbar & Sortable Table Headers */
.cp-table-toolbar {
    padding: 14px 20px;
    background-color: var(--md-sys-color-surface-container-low);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.m3-search-bar.m3-search-bar-sm {
    height: 40px;
    padding: 0 12px;
    gap: 8px;
}

.m3-search-bar.m3-search-bar-sm input {
    font-size: 0.875rem;
}

.cp-search-clear-btn {
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.cp-search-clear-btn:hover {
    background-color: var(--md-state-hover);
    color: var(--md-sys-color-on-surface);
}

.cp-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: var(--md-sys-shape-sm);
    color: inherit;
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.cp-sort-btn:hover {
    background-color: var(--md-state-hover);
    color: var(--md-sys-color-on-surface);
}

.cp-sort-btn.is-sorted {
    color: var(--md-sys-color-primary);
}

.cp-sort-btn .cp-sort-icon {
    font-size: 16px;
    opacity: 0.65;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.cp-sort-btn.is-sorted .cp-sort-icon {
    opacity: 1;
}

.cp-persist-box {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 4px 12px;
    border-radius: var(--md-sys-shape-full);
    background-color: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
}

@media (max-width: 767.98px) {
    .cp-table-toolbar {
        padding: 12px 14px;
    }
}

/* Wide Fluid Container & Zero-Scroll Responsive Table for Client Portal */
.cp-wide-container {
    width: 100%;
    max-width: 1680px;
    margin-left: auto;
    margin-right: auto;
    padding-left: clamp(12px, 2vw, 32px);
    padding-right: clamp(12px, 2vw, 32px);
}

#cpProvidersTable thead th {
    padding: 12px 10px;
}

#cpProvidersTable tbody tr.m3-provider-row > td {
    padding: 12px 10px;
}

#cpProvidersTable .cp-th-wrap {
    white-space: normal;
    line-height: 1.25;
}

#cpProvidersTable .cp-provider-cell {
    max-width: 220px;
    white-space: normal;
    word-break: break-word;
}

#cpProvidersTable .m3-action-group {
    flex-wrap: nowrap;
    gap: 6px;
}

#cpProvidersTable .m3-action-group .btn {
    white-space: nowrap;
    padding: 6px 11px;
    font-size: 0.8125rem;
}

#cpProvidersTable .cp-switch-group .form-check-label {
    white-space: nowrap;
}

@media (max-width: 1399.98px) {
    #cpProvidersTable thead th {
        padding: 11px 8px;
        font-size: 0.7rem;
    }

    #cpProvidersTable tbody tr.m3-provider-row > td {
        padding: 11px 8px;
    }

    #cpProvidersTable .m3-status-badge {
        padding: 4px 8px;
        font-size: 0.72rem;
    }

    #cpProvidersTable .m3-action-group .btn {
        padding: 5px 9px;
        font-size: 0.78rem;
    }
}

@media (max-width: 1199.98px) {
    .m3-table-cards-xl thead {
        display: none;
    }

    .m3-table-cards-xl,
    .m3-table-cards-xl tbody,
    .m3-table-cards-xl tr,
    .m3-table-cards-xl td {
        display: block;
        width: 100%;
    }

    .m3-table-cards-xl tbody {
        padding: 12px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        background-color: var(--md-sys-color-surface-container-low);
    }

    .m3-table-cards-xl tbody tr:not(.m3-empty-row) {
        background-color: var(--md-sys-color-surface-container-lowest);
        border: 1px solid var(--md-sys-color-outline-variant);
        border-radius: var(--md-sys-shape-lg);
        padding: 12px 14px;
        box-shadow: var(--md-sys-elevation-1);
    }

    .m3-table-cards-xl tbody tr.m3-empty-row {
        background-color: var(--md-sys-color-surface-container-lowest);
        border-radius: var(--md-sys-shape-lg);
        padding: 24px 12px;
    }

    .m3-table-cards-xl tbody tr:not(.m3-empty-row) td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 0 !important;
        border-bottom: 1px dashed var(--md-sys-color-outline-variant);
        text-align: right;
        max-width: none !important;
    }

    .m3-table-cards-xl tbody tr:not(.m3-empty-row) td:last-child {
        border-bottom: none;
        padding-bottom: 2px !important;
    }

    .m3-table-cards-xl tbody tr:not(.m3-empty-row) td[data-label]::before {
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--md-sys-color-on-surface-variant);
        text-align: left;
        flex-shrink: 0;
        padding-top: 2px;
    }

    .m3-table-cards-xl tbody tr:not(.m3-empty-row) td .m3-cell-val {
        text-align: right;
        min-width: 0;
        max-width: 100%;
    }

    .m3-table-cards-xl tbody tr:not(.m3-empty-row) td[data-label="Provider"] .d-flex {
        justify-content: flex-end !important;
    }

    .m3-table-cards-xl tbody tr:not(.m3-empty-row) td[data-label="Limitowanie"] .form-check {
        justify-content: flex-end !important;
    }

    .m3-table-cards-xl .m3-action-group {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap !important;
    }

    .m3-table-cards-xl tbody tr.m3-subrow {
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-top: -6px;
    }

    .m3-table-cards-xl tbody tr.m3-subrow > td.m3-subrow-cell {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: 1px solid var(--md-sys-color-outline-variant) !important;
        border-radius: var(--md-sys-shape-lg);
        overflow: hidden;
        text-align: left !important;
    }
}

/* M3 Inline Help Button & Dark/Light Theme Popover */
.cp-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.cp-help-btn:hover,
.cp-help-btn:focus-visible {
    background-color: var(--md-state-primary-hover);
    color: var(--md-sys-color-primary);
    outline: none;
}

.popover.cp-m3-popover {
    --bs-popover-bg: var(--md-sys-color-surface-container-high);
    --bs-popover-border-color: var(--md-sys-color-outline-variant);
    --bs-popover-header-bg: var(--md-sys-color-surface-container);
    --bs-popover-header-color: var(--md-sys-color-on-surface);
    --bs-popover-body-color: var(--md-sys-color-on-surface);
    --bs-popover-max-width: 340px;
    --bs-popover-border-radius: var(--md-sys-shape-lg);
    box-shadow: var(--md-sys-elevation-3);
    z-index: 1080;
}

.popover.cp-m3-popover .popover-header {
    font-size: 0.84rem;
    font-weight: 600;
    border-bottom-color: var(--md-sys-color-outline-variant);
}

.popover.cp-m3-popover .popover-body {
    font-size: 0.8rem;
    line-height: 1.45;
}

/* M3 Slot Swap Candidate Radio Cards */
.m3-swap-candidate-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--md-sys-shape-md);
    border: 1.5px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    margin: 0;
}

.m3-swap-candidate-card:hover {
    background-color: var(--md-sys-color-surface-container);
    border-color: var(--md-sys-color-outline);
}

.m3-swap-candidate-card:has(input[type="radio"]:checked) {
    border-color: var(--md-sys-color-warning);
    background-color: var(--md-sys-color-warning-container);
    color: var(--md-sys-color-on-warning-container);
    box-shadow: var(--md-sys-elevation-1);
}

.m3-swap-candidate-card .form-check-input {
    margin-top: 3px;
    flex-shrink: 0;
    cursor: pointer;
}

.m3-swap-candidate-card .m3-swap-candidate-meta {
    color: var(--md-sys-color-on-surface-variant);
}

.m3-swap-candidate-card:has(input[type="radio"]:checked) .m3-swap-candidate-meta {
    color: var(--md-sys-color-on-warning-container);
    opacity: 0.88;
}

/* Clickable Channels Badge Button in Table */
button.cp-channels-badge-btn,
a.cp-channels-badge-btn {
    border: 1px solid var(--md-sys-color-outline-variant);
    cursor: pointer;
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: var(--md-sys-shape-full);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
}

button.cp-channels-badge-btn:hover,
a.cp-channels-badge-btn:hover {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-color: var(--md-sys-color-primary);
    box-shadow: var(--md-sys-elevation-1);
    transform: translateY(-1px);
}

button.cp-channels-badge-btn:active,
a.cp-channels-badge-btn:active {
    transform: translateY(0);
}

.cp-channels-badge-arrow {
    font-size: 13px !important;
    opacity: 0.7;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

button.cp-channels-badge-btn:hover .cp-channels-badge-arrow,
a.cp-channels-badge-btn:hover .cp-channels-badge-arrow {
    opacity: 1;
    transform: translate(1px, -1px);
}

/* Modal Channels List Table */
.cp-modal-channels-scroll {
    max-height: 58vh;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.cp-modal-channels-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--md-sys-color-surface-container-high);
}

/* Karta wyboru trybu autoryzacji (Strefa Klienta) */
.cp-auth-mode-card {
    border: 2px solid var(--md-sys-color-outline-variant, #e0e0e0);
    background-color: var(--md-sys-color-surface-container-low, #fcfcfc);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}

.cp-auth-mode-card:hover:not(.disabled) {
    border-color: var(--md-sys-color-primary, #2563eb);
    background-color: var(--md-sys-color-surface-container, #f3f4f6);
    transform: translateY(-2px);
    box-shadow: var(--md-sys-elevation-1, 0 2px 6px rgba(0,0,0,0.06));
}

.cp-auth-mode-card.selected {
    border-color: var(--md-sys-color-primary, #2563eb);
    background-color: var(--md-sys-color-primary-container, rgba(37,99,235,0.08));
    box-shadow: 0 0 0 1px var(--md-sys-color-primary, #2563eb);
}

.cp-auth-mode-card.disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background-color: var(--md-sys-color-surface-variant, #f1f1f1);
}

/* Material 3 Styling for Authorizations View (/klient/authorizations) */
.cp-auth-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.cp-auth-table thead th {
    background-color: var(--md-sys-color-surface-container-low) !important;
    color: var(--md-sys-color-on-surface-variant) !important;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 12px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;
    white-space: nowrap;
}

.cp-auth-table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface);
}

.cp-auth-table tbody tr:last-child td {
    border-bottom: none;
}

.cp-auth-ip-badge {
    display: inline-block;
    font-family: var(--bs-font-monospace);
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--md-sys-shape-sm);
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-primary);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.cp-auth-player-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--md-sys-shape-md);
    background-color: var(--md-sys-color-surface-container-high);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.cp-auth-player-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    word-break: break-all;
    line-height: 1.3;
}

.cp-auth-family-badge {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: var(--md-sys-shape-full);
}

.cp-auth-nav-tabs {
    border-bottom: none !important;
    gap: 8px;
    display: flex;
    flex-wrap: wrap;
}

.cp-auth-nav-tabs .nav-item {
    margin-bottom: 0;
}

.cp-auth-nav-tabs .nav-link {
    border-radius: var(--md-sys-shape-full) !important;
    border: 1px solid var(--md-sys-color-outline-variant) !important;
    background-color: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface-variant);
    padding: 6px 14px;
    font-weight: 500;
    font-size: 0.8125rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.cp-auth-nav-tabs .nav-link:hover {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    border-color: var(--md-sys-color-outline) !important;
}

.cp-auth-nav-tabs .nav-link.active {
    background-color: var(--md-sys-color-primary) !important;
    color: var(--md-sys-color-on-primary) !important;
    border-color: var(--md-sys-color-primary) !important;
    box-shadow: var(--md-sys-elevation-1);
}

.cp-auth-nav-tabs .nav-link.active .badge {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: #fff !important;
}

.cp-auth-modal-box {
    background-color: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-md);
}
