:root {
    /* Primary colors */
    --md-sys-color-primary: #1976d2;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #d1e4ff;
    --md-sys-color-on-primary-container: #001d36;
    
    /* Secondary colors */
    --md-sys-color-secondary: #565e71;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #dae2f9;
    --md-sys-color-on-secondary-container: #131c2b;
    
    /* Tertiary colors */
    --md-sys-color-tertiary: #705574;
    --md-sys-color-on-tertiary: #ffffff;
    --md-sys-color-tertiary-container: #fad8fd;
    --md-sys-color-on-tertiary-container: #29132d;
    
    /* Error colors */
    --md-sys-color-error: #ba1a1a;
    --md-sys-color-on-error: #ffffff;
    --md-sys-color-error-container: #ffdad6;
    --md-sys-color-on-error-container: #410002;
    
    /* Background colors */
    --md-sys-color-background: #fafafa;
    --md-sys-color-on-background: #1a1c1e;
    
    /* Surface colors */
    --md-sys-color-surface: #ffffff;
    --md-sys-color-on-surface: #1c1b1f;
    --md-sys-color-surface-variant: #f5f5f5;
    --md-sys-color-on-surface-variant: #44474f;
    
    /* Surface container colors */
    --md-sys-color-surface-container-lowest: #ffffff;
    --md-sys-color-surface-container-low: #f4f4f7;
    --md-sys-color-surface-container: #eeeef1;
    --md-sys-color-surface-container-high: #e8e8eb;
    --md-sys-color-surface-container-highest: #e3e2e6;
    
    /* Outline colors */
    --md-sys-color-outline: #79747e;
    --md-sys-color-outline-variant: #c4c7c5;
    
    /* Elevation levels */
    --md-sys-elevation-level0: none;
    --md-sys-elevation-level1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-level2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-level3: 0 4px 8px 3px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.3);
    --md-sys-elevation-level4: 0 6px 10px 4px rgba(0, 0, 0, 0.15), 0 2px 3px rgba(0, 0, 0, 0.3);
    --md-sys-elevation-level5: 0 8px 12px 6px rgba(0, 0, 0, 0.15), 0 4px 4px rgba(0, 0, 0, 0.3);
    
    /* Shape/Border radius tokens */
    --md-sys-shape-corner-none: 0;
    --md-sys-shape-corner-extra-small: 4px;
    --md-sys-shape-corner-small: 8px;
    --md-sys-shape-corner-medium: 12px;
    --md-sys-shape-corner-large: 16px;
    --md-sys-shape-corner-extra-large: 28px;
    --md-sys-shape-corner-full: 9999px;
    
    /* Typography scale - Display */
    --md-sys-typescale-display-large-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-display-large-font-weight: 400;
    --md-sys-typescale-display-large-font-size: 57px;
    --md-sys-typescale-display-large-line-height: 64px;
    --md-sys-typescale-display-large-letter-spacing: -0.25px;
    
    --md-sys-typescale-display-medium-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-display-medium-font-weight: 400;
    --md-sys-typescale-display-medium-font-size: 45px;
    --md-sys-typescale-display-medium-line-height: 52px;
    --md-sys-typescale-display-medium-letter-spacing: 0;
    
    --md-sys-typescale-display-small-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-display-small-font-weight: 400;
    --md-sys-typescale-display-small-font-size: 36px;
    --md-sys-typescale-display-small-line-height: 44px;
    --md-sys-typescale-display-small-letter-spacing: 0;
    
    /* Typography scale - Headline */
    --md-sys-typescale-headline-large-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-headline-large-font-weight: 400;
    --md-sys-typescale-headline-large-font-size: 32px;
    --md-sys-typescale-headline-large-line-height: 40px;
    --md-sys-typescale-headline-large-letter-spacing: 0;
    
    --md-sys-typescale-headline-medium-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-headline-medium-font-weight: 400;
    --md-sys-typescale-headline-medium-font-size: 28px;
    --md-sys-typescale-headline-medium-line-height: 36px;
    --md-sys-typescale-headline-medium-letter-spacing: 0;
    
    --md-sys-typescale-headline-small-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-headline-small-font-weight: 400;
    --md-sys-typescale-headline-small-font-size: 24px;
    --md-sys-typescale-headline-small-line-height: 32px;
    --md-sys-typescale-headline-small-letter-spacing: 0;
    
    /* Typography scale - Title */
    --md-sys-typescale-title-large-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-title-large-font-weight: 400;
    --md-sys-typescale-title-large-font-size: 22px;
    --md-sys-typescale-title-large-line-height: 28px;
    --md-sys-typescale-title-large-letter-spacing: 0;
    
    --md-sys-typescale-title-medium-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-title-medium-font-weight: 500;
    --md-sys-typescale-title-medium-font-size: 16px;
    --md-sys-typescale-title-medium-line-height: 24px;
    --md-sys-typescale-title-medium-letter-spacing: 0.15px;
    
    --md-sys-typescale-title-small-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-title-small-font-weight: 500;
    --md-sys-typescale-title-small-font-size: 14px;
    --md-sys-typescale-title-small-line-height: 20px;
    --md-sys-typescale-title-small-letter-spacing: 0.1px;
    
    /* Typography scale - Body */
    --md-sys-typescale-body-large-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-body-large-font-weight: 400;
    --md-sys-typescale-body-large-font-size: 16px;
    --md-sys-typescale-body-large-line-height: 24px;
    --md-sys-typescale-body-large-letter-spacing: 0.5px;
    
    --md-sys-typescale-body-medium-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-body-medium-font-weight: 400;
    --md-sys-typescale-body-medium-font-size: 14px;
    --md-sys-typescale-body-medium-line-height: 20px;
    --md-sys-typescale-body-medium-letter-spacing: 0.25px;
    
    --md-sys-typescale-body-small-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-body-small-font-weight: 400;
    --md-sys-typescale-body-small-font-size: 12px;
    --md-sys-typescale-body-small-line-height: 16px;
    --md-sys-typescale-body-small-letter-spacing: 0.4px;
    
    /* Typography scale - Label */
    --md-sys-typescale-label-large-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-label-large-font-weight: 500;
    --md-sys-typescale-label-large-font-size: 14px;
    --md-sys-typescale-label-large-line-height: 20px;
    --md-sys-typescale-label-large-letter-spacing: 0.1px;
    
    --md-sys-typescale-label-medium-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-label-medium-font-weight: 500;
    --md-sys-typescale-label-medium-font-size: 12px;
    --md-sys-typescale-label-medium-line-height: 16px;
    --md-sys-typescale-label-medium-letter-spacing: 0.5px;
    
    --md-sys-typescale-label-small-font-family: 'Roboto', sans-serif;
    --md-sys-typescale-label-small-font-weight: 500;
    --md-sys-typescale-label-small-font-size: 11px;
    --md-sys-typescale-label-small-line-height: 16px;
    --md-sys-typescale-label-small-letter-spacing: 0.5px;
    
    /* State layer opacity values */
    --md-sys-state-hover-opacity: 0.08;
    --md-sys-state-focus-opacity: 0.12;
    --md-sys-state-pressed-opacity: 0.12;
    --md-sys-state-dragged-opacity: 0.16;
    --md-sys-state-disabled-opacity: 0.38;
    --md-sys-state-disabled-container-opacity: 0.12;
    
    /* Motion tokens - Easing */
    --md-sys-motion-easing-standard: cubic-bezier(0.4, 0.0, 0.2, 1);
    --md-sys-motion-easing-standard-decelerate: cubic-bezier(0.0, 0.0, 0.2, 1);
    --md-sys-motion-easing-standard-accelerate: cubic-bezier(0.4, 0.0, 1, 1);
    --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0.0, 0, 1);
    --md-sys-motion-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1.0);
    --md-sys-motion-easing-emphasized-accelerate: cubic-bezier(0.3, 0.0, 0.8, 0.15);
    
    /* Motion tokens - Duration */
    --md-sys-motion-duration-short1: 50ms;
    --md-sys-motion-duration-short2: 100ms;
    --md-sys-motion-duration-short3: 150ms;
    --md-sys-motion-duration-short4: 200ms;
    --md-sys-motion-duration-medium1: 250ms;
    --md-sys-motion-duration-medium2: 300ms;
    --md-sys-motion-duration-medium3: 350ms;
    --md-sys-motion-duration-medium4: 400ms;
    --md-sys-motion-duration-long1: 450ms;
    --md-sys-motion-duration-long2: 500ms;
    --md-sys-motion-duration-long3: 550ms;
    --md-sys-motion-duration-long4: 600ms;
    --md-sys-motion-duration-extra-long1: 700ms;
    --md-sys-motion-duration-extra-long2: 800ms;
    --md-sys-motion-duration-extra-long3: 900ms;
    --md-sys-motion-duration-extra-long4: 1000ms;
}

/* Dark mode support - system preference */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        /* Primary colors - dark mode */
        --md-sys-color-primary: #a8c7fa;
        --md-sys-color-on-primary: #003258;
        --md-sys-color-primary-container: #004a77;
        --md-sys-color-on-primary-container: #d1e4ff;

        /* Secondary colors - dark mode */
        --md-sys-color-secondary: #bec6dc;
        --md-sys-color-on-secondary: #283041;
        --md-sys-color-secondary-container: #3e4759;
        --md-sys-color-on-secondary-container: #dae2f9;

        /* Tertiary colors - dark mode */
        --md-sys-color-tertiary: #debcdf;
        --md-sys-color-on-tertiary: #402843;
        --md-sys-color-tertiary-container: #583e5b;
        --md-sys-color-on-tertiary-container: #fad8fd;

        /* Error colors - dark mode */
        --md-sys-color-error: #ffb4ab;
        --md-sys-color-on-error: #690005;
        --md-sys-color-error-container: #93000a;
        --md-sys-color-on-error-container: #ffdad6;

        /* Background colors - dark mode */
        --md-sys-color-background: #1a1c1e;
        --md-sys-color-on-background: #e2e2e6;

        /* Surface colors - dark mode */
        --md-sys-color-surface: #1a1c1e;
        --md-sys-color-on-surface: #e2e2e6;
        --md-sys-color-surface-variant: #44474f;
        --md-sys-color-on-surface-variant: #c4c6d0;

        /* Surface container colors - dark mode */
        --md-sys-color-surface-container-lowest: #0c0e11;
        --md-sys-color-surface-container-low: #1a1c1e;
        --md-sys-color-surface-container: #1e2023;
        --md-sys-color-surface-container-high: #282a2d;
        --md-sys-color-surface-container-highest: #333538;

        /* Outline colors - dark mode */
        --md-sys-color-outline: #8e9099;
        --md-sys-color-outline-variant: #44474f;
    }
}

/* Dark mode support - explicit override */
:root[data-theme="dark"] {
    /* Primary colors - dark mode */
    --md-sys-color-primary: #a8c7fa;
    --md-sys-color-on-primary: #003258;
    --md-sys-color-primary-container: #004a77;
    --md-sys-color-on-primary-container: #d1e4ff;

    /* Secondary colors - dark mode */
    --md-sys-color-secondary: #bec6dc;
    --md-sys-color-on-secondary: #283041;
    --md-sys-color-secondary-container: #3e4759;
    --md-sys-color-on-secondary-container: #dae2f9;

    /* Tertiary colors - dark mode */
    --md-sys-color-tertiary: #debcdf;
    --md-sys-color-on-tertiary: #402843;
    --md-sys-color-tertiary-container: #583e5b;
    --md-sys-color-on-tertiary-container: #fad8fd;

    /* Error colors - dark mode */
    --md-sys-color-error: #ffb4ab;
    --md-sys-color-on-error: #690005;
    --md-sys-color-error-container: #93000a;
    --md-sys-color-on-error-container: #ffdad6;

    /* Background colors - dark mode */
    --md-sys-color-background: #1a1c1e;
    --md-sys-color-on-background: #e2e2e6;

    /* Surface colors - dark mode */
    --md-sys-color-surface: #1a1c1e;
    --md-sys-color-on-surface: #e2e2e6;
    --md-sys-color-surface-variant: #44474f;
    --md-sys-color-on-surface-variant: #c4c6d0;

    /* Surface container colors - dark mode */
    --md-sys-color-surface-container-lowest: #0c0e11;
    --md-sys-color-surface-container-low: #1a1c1e;
    --md-sys-color-surface-container: #1e2023;
    --md-sys-color-surface-container-high: #282a2d;
    --md-sys-color-surface-container-highest: #333538;

    /* Outline colors - dark mode */
    --md-sys-color-outline: #8e9099;
    --md-sys-color-outline-variant: #44474f;
}

* {
    box-sizing: border-box;
}

/* Material Symbols */
.material-symbols-outlined {
    font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
}

body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Base Form Element Styles - Apply MD3 styling to all form elements */
input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    padding: 12px 16px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 4px;
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 11px 15px; /* Compensate for thicker border */
}

input:not([type="checkbox"]):not([type="radio"]):hover,
textarea:hover,
select:hover {
    border-color: var(--md-sys-color-on-surface);
}

input:not([type="checkbox"]):not([type="radio"]):disabled,
textarea:disabled,
select:disabled {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.6;
    cursor: not-allowed;
}

/* Select-specific styling */
select {
    appearance: none;
    cursor: pointer;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23666'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 20px;
}

select:focus {
    padding-right: 39px; /* Compensate for thicker border */
}

select option {
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    padding: 8px;
}

/* Label styling */
label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 8px;
}

/* Button base styling */
button {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 24px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

button:hover {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

button:disabled {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.6;
    cursor: not-allowed;
}

/* Link styling */
a {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--md-sys-color-primary-container);
    text-decoration: underline;
}

/* Table styling */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--md-sys-color-surface);
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

th {
    background-color: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background-color: var(--md-sys-color-surface-container-low);
}

tr:last-child td {
    border-bottom: none;
}

/* App Bar */
.app-bar {
    background-color: var(--md-sys-color-surface);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.app-bar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    gap: 24px;
    width: 100%;
}

.app-bar-start {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.brand-link:hover {
    opacity: 0.8;
}

.logo {
    width: 32px;
    height: 32px;
}

.brand-name {
    font-size: 20px;
    font-weight: 500;
}

/* Company Selector */
.company-selector {
    margin-left: 24px;
    position: relative;
}

.company-select {
    appearance: none;
    background: var(--md-sys-color-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 8px;
    padding: 8px 32px 8px 12px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    min-width: 180px;
    max-width: 250px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2379747e'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 20px;
}

.company-select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    background-color: var(--md-sys-color-surface);
}

.company-select:hover {
    border-color: var(--md-sys-color-primary);
}

.company-select option {
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    padding: 8px;
}

.app-bar-center {
    flex: 0 1 600px;
    display: flex;
    justify-content: center;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--md-sys-color-outline);
    pointer-events: none;
    z-index: 1;
}

.search-field {
    width: 100%;
    padding: 12px 16px;
    padding-left: 44px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 28px;
    background-color: var(--md-sys-color-surface-variant);
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    transition: all 0.2s ease;
    color: var(--md-sys-color-on-surface);
    box-sizing: border-box;
}

.search-field:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    background-color: var(--md-sys-color-surface);
}

.search-field::placeholder {
    color: var(--md-sys-color-outline);
}

/* Remove browser default search styling */
.search-field::-webkit-search-decoration,
.search-field::-webkit-search-cancel-button,
.search-field::-webkit-search-results-button,
.search-field::-webkit-search-results-decoration {
    -webkit-appearance: none;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    transition: background-color 0.15s ease;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: var(--md-sys-color-surface-variant);
}

.autocomplete-title {
    font-weight: 500;
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 4px;
}

.autocomplete-title strong {
    color: var(--md-sys-color-primary);
}

.autocomplete-description {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.autocomplete-description strong {
    color: var(--md-sys-color-primary);
    font-weight: 600;
}

.app-bar-end {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 1;
}

.icon-button {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: var(--md-sys-color-on-surface);
}

.icon-button:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.sign-in-button {
    padding: 8px 24px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: 20px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sign-in-button:hover {
    background-color: #1565c0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: none;
    padding: 0;
    background: none;
    transition: opacity 0.2s ease;
}

.user-avatar:hover {
    opacity: 0.8;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: var(--md-sys-color-surface);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    min-width: 280px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    display: none;
}

.user-dropdown.show {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.dropdown-user-info {
    flex: 1;
    min-width: 0;
}

.dropdown-user-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-user-email {
    font-size: 12px;
    color: var(--md-sys-color-outline);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--md-sys-color-outline);
    opacity: 0.2;
}

.dropdown-section {
    padding: 12px 16px;
}

.dropdown-section-title {
    font-size: 11px;
    font-weight: 500;
    color: var(--md-sys-color-outline);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.dropdown-section-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dropdown-customer-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 4px;
}

.dropdown-uuid-info {
    display: flex;
    gap: 8px;
    font-size: 12px;
    align-items: center;
}

.dropdown-label {
    color: var(--md-sys-color-outline);
    font-weight: 400;
}

.dropdown-uuid {
    color: var(--md-sys-color-on-surface-variant);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    word-break: break-all;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--md-sys-color-on-surface);
    transition: background-color 0.2s ease;
    font-size: 14px;
}

.dropdown-item:hover {
    background-color: var(--md-sys-color-surface-variant);
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.dropdown-item .material-symbols-outlined {
    font-size: 20px;
}


/* Main Content */
.main-content {
    padding: 24px;
}

/* Dashboard */
.dashboard-container {
    width: 100%;
    padding: 0 24px;
}

.welcome-section {
    margin-bottom: 48px;
    text-align: center;
}

.welcome-section h1 {
    margin: 0 0 16px 0;
}

.welcome-section p {
    margin: 0;
    color: var(--md-sys-color-outline);
}

/* Modules Grid */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

.module-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.module-card {
    background-color: var(--md-sys-color-surface);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    transition: all 0.3s ease;
    overflow: hidden;
}

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}

.module-content {
    padding: 24px;
}

.module-icon {
    font-size: 48px;
    color: var(--md-sys-color-primary);
    margin-bottom: 16px;
    display: block;
}

.module-content h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 400;
}

.module-content p {
    margin: 0 0 16px 0;
    color: var(--md-sys-color-outline);
}

.module-actions {
    display: flex;
    justify-content: flex-start;
}

.module-link {
    color: var(--md-sys-color-primary);
    font-weight: 500;
}

/* Auth Page */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    padding: 24px;
}

.auth-card {
    max-width: 400px;
    width: 100%;
    background-color: var(--md-sys-color-surface);
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.auth-content {
    padding: 48px 32px;
    text-align: center;
}

.auth-logo {
    width: 300px;
    height: 100px;
    margin-bottom: 24px;
}

.auth-content h1 {
    margin: 0 0 32px 0;
    font-weight: 400;
}

.auth-providers {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.google-signin-button {
    width: 100%;
    padding: 12px 24px;
    background-color: #fff;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #3c4043;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.google-signin-button:hover {
    background-color: #f8f9fa;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.google-icon {
    width: 18px;
    height: 18px;
}

.divider {
    margin: 16px 0;
    text-align: center;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: var(--md-sys-color-outline);
}

.divider span {
    background-color: var(--md-sys-color-surface);
    padding: 0 16px;
    position: relative;
}

.email-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.text-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    background-color: var(--md-sys-color-surface);
    transition: all 0.2s ease;
}

.text-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

.primary-button {
    padding: 12px 24px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.primary-button:hover {
    background-color: #1565c0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.auth-links {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
}

.text-link {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.text-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Footer */
.app-footer {
    background-color: var(--md-sys-color-surface);
    border-top: 1px solid var(--md-sys-color-outline);
    margin-top: auto;
    padding: 24px;
}

.footer-content {
    text-align: center;
}

.footer-content p {
    margin: 0;
    color: var(--md-sys-color-outline);
    font-size: 14px;
}

/* Ensure main content grows to push footer down */
.main-content {
    flex: 1;
}

/* MD3 Utility Classes */

/* Typography utilities */
.md-typescale-display-large {
    font-family: var(--md-sys-typescale-display-large-font-family);
    font-weight: var(--md-sys-typescale-display-large-font-weight);
    font-size: var(--md-sys-typescale-display-large-font-size);
    line-height: var(--md-sys-typescale-display-large-line-height);
    letter-spacing: var(--md-sys-typescale-display-large-letter-spacing);
}

.md-typescale-display-medium {
    font-family: var(--md-sys-typescale-display-medium-font-family);
    font-weight: var(--md-sys-typescale-display-medium-font-weight);
    font-size: var(--md-sys-typescale-display-medium-font-size);
    line-height: var(--md-sys-typescale-display-medium-line-height);
    letter-spacing: var(--md-sys-typescale-display-medium-letter-spacing);
}

.md-typescale-display-small {
    font-family: var(--md-sys-typescale-display-small-font-family);
    font-weight: var(--md-sys-typescale-display-small-font-weight);
    font-size: var(--md-sys-typescale-display-small-font-size);
    line-height: var(--md-sys-typescale-display-small-line-height);
    letter-spacing: var(--md-sys-typescale-display-small-letter-spacing);
}

.md-typescale-headline-large {
    font-family: var(--md-sys-typescale-headline-large-font-family);
    font-weight: var(--md-sys-typescale-headline-large-font-weight);
    font-size: var(--md-sys-typescale-headline-large-font-size);
    line-height: var(--md-sys-typescale-headline-large-line-height);
    letter-spacing: var(--md-sys-typescale-headline-large-letter-spacing);
}

.md-typescale-headline-medium {
    font-family: var(--md-sys-typescale-headline-medium-font-family);
    font-weight: var(--md-sys-typescale-headline-medium-font-weight);
    font-size: var(--md-sys-typescale-headline-medium-font-size);
    line-height: var(--md-sys-typescale-headline-medium-line-height);
    letter-spacing: var(--md-sys-typescale-headline-medium-letter-spacing);
}

.md-typescale-headline-small {
    font-family: var(--md-sys-typescale-headline-small-font-family);
    font-weight: var(--md-sys-typescale-headline-small-font-weight);
    font-size: var(--md-sys-typescale-headline-small-font-size);
    line-height: var(--md-sys-typescale-headline-small-line-height);
    letter-spacing: var(--md-sys-typescale-headline-small-letter-spacing);
}

.md-typescale-title-large {
    font-family: var(--md-sys-typescale-title-large-font-family);
    font-weight: var(--md-sys-typescale-title-large-font-weight);
    font-size: var(--md-sys-typescale-title-large-font-size);
    line-height: var(--md-sys-typescale-title-large-line-height);
    letter-spacing: var(--md-sys-typescale-title-large-letter-spacing);
}

.md-typescale-title-medium {
    font-family: var(--md-sys-typescale-title-medium-font-family);
    font-weight: var(--md-sys-typescale-title-medium-font-weight);
    font-size: var(--md-sys-typescale-title-medium-font-size);
    line-height: var(--md-sys-typescale-title-medium-line-height);
    letter-spacing: var(--md-sys-typescale-title-medium-letter-spacing);
}

.md-typescale-title-small {
    font-family: var(--md-sys-typescale-title-small-font-family);
    font-weight: var(--md-sys-typescale-title-small-font-weight);
    font-size: var(--md-sys-typescale-title-small-font-size);
    line-height: var(--md-sys-typescale-title-small-line-height);
    letter-spacing: var(--md-sys-typescale-title-small-letter-spacing);
}

.md-typescale-body-large {
    font-family: var(--md-sys-typescale-body-large-font-family);
    font-weight: var(--md-sys-typescale-body-large-font-weight);
    font-size: var(--md-sys-typescale-body-large-font-size);
    line-height: var(--md-sys-typescale-body-large-line-height);
    letter-spacing: var(--md-sys-typescale-body-large-letter-spacing);
}

.md-typescale-body-medium {
    font-family: var(--md-sys-typescale-body-medium-font-family);
    font-weight: var(--md-sys-typescale-body-medium-font-weight);
    font-size: var(--md-sys-typescale-body-medium-font-size);
    line-height: var(--md-sys-typescale-body-medium-line-height);
    letter-spacing: var(--md-sys-typescale-body-medium-letter-spacing);
}

.md-typescale-body-small {
    font-family: var(--md-sys-typescale-body-small-font-family);
    font-weight: var(--md-sys-typescale-body-small-font-weight);
    font-size: var(--md-sys-typescale-body-small-font-size);
    line-height: var(--md-sys-typescale-body-small-line-height);
    letter-spacing: var(--md-sys-typescale-body-small-letter-spacing);
}

.md-typescale-label-large {
    font-family: var(--md-sys-typescale-label-large-font-family);
    font-weight: var(--md-sys-typescale-label-large-font-weight);
    font-size: var(--md-sys-typescale-label-large-font-size);
    line-height: var(--md-sys-typescale-label-large-line-height);
    letter-spacing: var(--md-sys-typescale-label-large-letter-spacing);
}

.md-typescale-label-medium {
    font-family: var(--md-sys-typescale-label-medium-font-family);
    font-weight: var(--md-sys-typescale-label-medium-font-weight);
    font-size: var(--md-sys-typescale-label-medium-font-size);
    line-height: var(--md-sys-typescale-label-medium-line-height);
    letter-spacing: var(--md-sys-typescale-label-medium-letter-spacing);
}

.md-typescale-label-small {
    font-family: var(--md-sys-typescale-label-small-font-family);
    font-weight: var(--md-sys-typescale-label-small-font-weight);
    font-size: var(--md-sys-typescale-label-small-font-size);
    line-height: var(--md-sys-typescale-label-small-line-height);
    letter-spacing: var(--md-sys-typescale-label-small-letter-spacing);
}

/* Elevation utilities */
.md-elevation-0 { box-shadow: var(--md-sys-elevation-level0); }
.md-elevation-1 { box-shadow: var(--md-sys-elevation-level1); }
.md-elevation-2 { box-shadow: var(--md-sys-elevation-level2); }
.md-elevation-3 { box-shadow: var(--md-sys-elevation-level3); }
.md-elevation-4 { box-shadow: var(--md-sys-elevation-level4); }
.md-elevation-5 { box-shadow: var(--md-sys-elevation-level5); }

/* Shape utilities */
.md-shape-none { border-radius: var(--md-sys-shape-corner-none); }
.md-shape-extra-small { border-radius: var(--md-sys-shape-corner-extra-small); }
.md-shape-small { border-radius: var(--md-sys-shape-corner-small); }
.md-shape-medium { border-radius: var(--md-sys-shape-corner-medium); }
.md-shape-large { border-radius: var(--md-sys-shape-corner-large); }
.md-shape-extra-large { border-radius: var(--md-sys-shape-corner-extra-large); }
.md-shape-full { border-radius: var(--md-sys-shape-corner-full); }

/* Surface utilities */
.md-surface {
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
}

.md-surface-container-lowest {
    background-color: var(--md-sys-color-surface-container-lowest);
    color: var(--md-sys-color-on-surface);
}

.md-surface-container-low {
    background-color: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface);
}

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

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

.md-surface-container-highest {
    background-color: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
}

/* State layer utilities */
.md-ripple {
    position: relative;
    overflow: hidden;
}

.md-ripple::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: currentColor;
    opacity: 0;
    transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
    pointer-events: none;
}

.md-ripple:hover::before {
    opacity: var(--md-sys-state-hover-opacity);
}

.md-ripple:focus::before {
    opacity: var(--md-sys-state-focus-opacity);
}

.md-ripple:active::before {
    opacity: var(--md-sys-state-pressed-opacity);
}

/* Common MD3 component patterns */
.md-card {
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    box-shadow: var(--md-sys-elevation-level1);
    transition: box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.md-card:hover {
    box-shadow: var(--md-sys-elevation-level2);
}

.md-button {
    font-family: var(--md-sys-typescale-label-large-font-family);
    font-weight: var(--md-sys-typescale-label-large-font-weight);
    font-size: var(--md-sys-typescale-label-large-font-size);
    line-height: var(--md-sys-typescale-label-large-line-height);
    letter-spacing: var(--md-sys-typescale-label-large-letter-spacing);
    padding: 10px 24px;
    border-radius: var(--md-sys-shape-corner-full);
    border: none;
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
    position: relative;
    overflow: hidden;
}

.md-button-filled {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.md-button-filled:hover {
    box-shadow: var(--md-sys-elevation-level1);
}

.md-button-outlined {
    background-color: transparent;
    color: var(--md-sys-color-primary);
    border: 1px solid var(--md-sys-color-outline);
}

.md-button-text {
    background-color: transparent;
    color: var(--md-sys-color-primary);
}

.md-button-elevated {
    background-color: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-primary);
    box-shadow: var(--md-sys-elevation-level1);
}

.md-button-elevated:hover {
    box-shadow: var(--md-sys-elevation-level2);
}

.md-button-tonal {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

/* FAB (Floating Action Button) utilities */
.md-fab {
    width: 56px;
    height: 56px;
    border-radius: var(--md-sys-shape-corner-large);
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    box-shadow: var(--md-sys-elevation-level3);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.md-fab:hover {
    box-shadow: var(--md-sys-elevation-level4);
}

.md-fab-small {
    width: 40px;
    height: 40px;
}

.md-fab-large {
    width: 96px;
    height: 96px;
    border-radius: var(--md-sys-shape-corner-extra-large);
}

/* Chip utilities */
.md-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    height: 32px;
    border-radius: var(--md-sys-shape-corner-small);
    background-color: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface-variant);
    font-family: var(--md-sys-typescale-label-large-font-family);
    font-weight: var(--md-sys-typescale-label-large-font-weight);
    font-size: var(--md-sys-typescale-label-large-font-size);
    line-height: var(--md-sys-typescale-label-large-line-height);
    letter-spacing: var(--md-sys-typescale-label-large-letter-spacing);
    transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
    cursor: pointer;
}

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

.md-chip-elevated {
    box-shadow: var(--md-sys-elevation-level1);
}

/* MD3 Form Elements */
.md-text-field {
    position: relative;
    margin-bottom: 16px;
}

.md-text-field input,
.md-text-field textarea,
.md-text-field select {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-small);
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    font-family: var(--md-sys-typescale-body-large-font-family);
    font-size: var(--md-sys-typescale-body-large-font-size);
    line-height: var(--md-sys-typescale-body-large-line-height);
    transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.md-text-field input:focus,
.md-text-field textarea:focus,
.md-text-field select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 15px;
}

.md-text-field input:disabled,
.md-text-field textarea:disabled,
.md-text-field select:disabled {
    opacity: var(--md-sys-state-disabled-opacity);
    cursor: not-allowed;
}

.md-text-field-filled input,
.md-text-field-filled textarea,
.md-text-field-filled select {
    background-color: var(--md-sys-color-surface-container-highest);
    border: none;
    border-bottom: 1px solid var(--md-sys-color-on-surface-variant);
    border-radius: var(--md-sys-shape-corner-extra-small) var(--md-sys-shape-corner-extra-small) 0 0;
}

.md-text-field-filled input:focus,
.md-text-field-filled textarea:focus,
.md-text-field-filled select:focus {
    border-bottom: 2px solid var(--md-sys-color-primary);
    padding-bottom: 15px;
}

.md-text-field label {
    position: absolute;
    left: 16px;
    top: 16px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-large-font-size);
    pointer-events: none;
    transition: all var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
    background-color: var(--md-sys-color-surface);
    padding: 0 4px;
}

.md-text-field input:focus + label,
.md-text-field input:not(:placeholder-shown) + label,
.md-text-field textarea:focus + label,
.md-text-field textarea:not(:placeholder-shown) + label {
    top: -8px;
    left: 12px;
    font-size: var(--md-sys-typescale-body-small-font-size);
    color: var(--md-sys-color-primary);
}

.md-text-field-helper {
    margin-top: 4px;
    font-size: var(--md-sys-typescale-body-small-font-size);
    color: var(--md-sys-color-on-surface-variant);
}

.md-text-field-error {
    color: var(--md-sys-color-error);
}

/* MD3 Select Field Specific Styles (component library pattern) */
.md-text-field--select {
    position: relative;
}

.md-text-field--select select {
    appearance: none;
    padding-right: 48px;
    cursor: pointer;
    width: 100%;
    padding: 16px 48px 16px 16px;
    border: 2px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-small);
    background-color: transparent;
    color: var(--md-sys-color-on-surface);
    font-family: var(--md-sys-typescale-body-large-font-family);
    font-size: var(--md-sys-typescale-body-large-font-size);
    line-height: var(--md-sys-typescale-body-large-line-height);
    transition: all var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
}

/* Handle the outlined variant */
.md-text-field--outlined select {
    background-color: transparent;
    border: 2px solid var(--md-sys-color-outline);
}

.md-text-field--select select:hover {
    border-color: var(--md-sys-color-on-surface);
    background-color: rgba(0, 0, 0, 0.04);
}

.md-text-field--select select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    background-color: transparent;
}

/* Floating label for select - special handling */
.md-text-field--select label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    transition: all var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
    background-color: var(--md-sys-color-surface);
    padding: 0 4px;
    pointer-events: none;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-large-font-size);
}

/* Move label when select has value or is focused */
.md-text-field--select select:focus ~ label,
.md-text-field--select select:not([value=""]):valid ~ label,
.md-text-field--select.has-value label {
    top: 0;
    transform: translateY(-50%);
    font-size: var(--md-sys-typescale-body-small-font-size);
    color: var(--md-sys-color-primary);
}

/* Handle when select has a selected option that's not the placeholder */
.md-text-field--select select:has(option:checked:not([value=""])) ~ label {
    top: 0;
    transform: translateY(-50%);
    font-size: var(--md-sys-typescale-body-small-font-size);
}

/* Dropdown icon styling */
.md-text-field__icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none;
    transition: all var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
    font-size: 24px;
}

/* Icon color when focused */
.md-text-field--select select:focus ~ .md-text-field__icon {
    color: var(--md-sys-color-primary);
}

/* Helper text styling */
.md-text-field__helper {
    margin-top: 4px;
    padding: 0 16px;
    font-size: var(--md-sys-typescale-body-small-font-size);
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.25;
}

/* Error state */
.md-text-field--error select {
    border-color: var(--md-sys-color-error);
}

.md-text-field--error label {
    color: var(--md-sys-color-error);
}

.md-text-field--error .md-text-field__icon {
    color: var(--md-sys-color-error);
}

.md-text-field--error .md-text-field__helper {
    color: var(--md-sys-color-error);
}

/* Disabled state */
.md-text-field--disabled select,
.md-text-field--select select:disabled {
    opacity: var(--md-sys-state-disabled-opacity);
    cursor: not-allowed;
    background-color: rgba(0, 0, 0, 0.04);
    border-color: var(--md-sys-color-outline);
}

.md-text-field--disabled label,
.md-text-field--disabled .md-text-field__icon {
    opacity: var(--md-sys-state-disabled-opacity);
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .md-text-field--select select:hover {
        background-color: rgba(255, 255, 255, 0.08);
    }

    :root:not([data-theme="light"]) .md-text-field--disabled select,
    :root:not([data-theme="light"]) .md-text-field--select select:disabled {
        background-color: rgba(255, 255, 255, 0.04);
    }

    :root:not([data-theme="light"]) .md-text-field--select label {
        background-color: var(--md-sys-color-surface);
    }
}

:root[data-theme="dark"] .md-text-field--select select:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .md-text-field--disabled select,
:root[data-theme="dark"] .md-text-field--select select:disabled {
    background-color: rgba(255, 255, 255, 0.04);
}

:root[data-theme="dark"] .md-text-field--select label {
    background-color: var(--md-sys-color-surface);
}

/* Checkbox and Radio */
.md-checkbox,
.md-radio {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    gap: 12px;
    padding: 8px;
    border-radius: var(--md-sys-shape-corner-full);
    transition: background-color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.md-checkbox:hover,
.md-radio:hover {
    background-color: rgba(var(--md-sys-color-on-surface), var(--md-sys-state-hover-opacity));
}

.md-checkbox input[type="checkbox"],
.md-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--md-sys-color-primary);
}

/* Switch */
.md-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 32px;
}

.md-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.md-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--md-sys-color-surface-variant);
    border: 2px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-full);
    transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.md-switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 6px;
    bottom: 6px;
    background-color: var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-full);
    transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.md-switch input:checked + .md-switch-slider {
    background-color: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}

.md-switch input:checked + .md-switch-slider:before {
    background-color: var(--md-sys-color-on-primary);
    transform: translateX(20px);
    width: 24px;
}

/* MD3 Tables */
.md-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    overflow: hidden;
    box-shadow: var(--md-sys-elevation-level1);
}

.md-table thead {
    background-color: var(--md-sys-color-surface-container);
}

.md-table th {
    padding: 16px;
    text-align: left;
    font-weight: var(--md-sys-typescale-title-small-font-weight);
    font-size: var(--md-sys-typescale-title-small-font-size);
    color: var(--md-sys-color-on-surface);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.md-table td {
    padding: 16px;
    font-size: var(--md-sys-typescale-body-medium-font-size);
    color: var(--md-sys-color-on-surface);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.md-table tbody tr {
    transition: background-color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.md-table tbody tr:hover {
    background-color: var(--md-sys-color-surface-container-low);
}

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

/* MD3 Alerts/Notifications */
.md-alert {
    padding: 16px;
    border-radius: var(--md-sys-shape-corner-medium);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--md-sys-typescale-body-medium-font-size);
    animation: md-fade-in var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized-decelerate);
}

.md-alert-success {
    background-color: #e8f5e9;
    color: #1b5e20;
}

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

.md-alert-warning {
    background-color: #fff3e0;
    color: #e65100;
}

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

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

/* MD3 Badges */
.md-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: var(--md-sys-typescale-label-small-font-size);
    font-weight: var(--md-sys-typescale-label-small-font-weight);
    line-height: 1;
    white-space: nowrap;
}

.md-badge-primary {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.md-badge-secondary {
    background-color: var(--md-sys-color-secondary);
    color: var(--md-sys-color-on-secondary);
}

.md-badge-success {
    background-color: #4caf50;
    color: white;
}

.md-badge-warning {
    background-color: #ff9800;
    color: white;
}

.md-badge-error {
    background-color: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.md-badge-info {
    background-color: #2196f3;
    color: white;
}

/* MD3 Modal/Dialog */
.md-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: md-fade-in var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
}

.md-dialog {
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-extra-large);
    box-shadow: var(--md-sys-elevation-level3);
    max-width: 560px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: md-scale-in var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized-decelerate);
}

.md-dialog-header {
    padding: 24px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.md-dialog-title {
    font-size: var(--md-sys-typescale-headline-small-font-size);
    font-weight: var(--md-sys-typescale-headline-small-font-weight);
    color: var(--md-sys-color-on-surface);
    margin: 0;
}

.md-dialog-content {
    padding: 24px;
}

.md-dialog-actions {
    padding: 16px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

@keyframes md-scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* MD3 Navigation Components */
.md-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--md-sys-typescale-body-medium-font-size);
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 16px;
}

.md-breadcrumb a {
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    transition: color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.md-breadcrumb a:hover {
    color: var(--md-sys-color-primary);
}

.md-breadcrumb-separator {
    color: var(--md-sys-color-outline);
}

.md-breadcrumb-current {
    color: var(--md-sys-color-on-surface);
    font-weight: 500;
}

/* MD3 Tabs */
.md-tabs {
    display: flex;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    margin-bottom: 24px;
}

.md-tab {
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-title-small-font-size);
    font-weight: var(--md-sys-typescale-title-small-font-weight);
    cursor: pointer;
    position: relative;
    transition: all var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
}

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

.md-tab.active {
    color: var(--md-sys-color-primary);
}

.md-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--md-sys-color-primary);
    animation: md-tab-indicator var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-emphasized);
}

@keyframes md-tab-indicator {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

/* MD3 Loading States */
.md-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--md-sys-color-surface-variant);
    border-top-color: var(--md-sys-color-primary);
    border-radius: 50%;
    animation: md-spin var(--md-sys-motion-duration-extra-long2) linear infinite;
}

.md-spinner-large {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

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

.md-skeleton {
    background: linear-gradient(
        90deg,
        var(--md-sys-color-surface-container) 25%,
        var(--md-sys-color-surface-container-high) 50%,
        var(--md-sys-color-surface-container) 75%
    );
    background-size: 200% 100%;
    animation: md-skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--md-sys-shape-corner-extra-small);
}

@keyframes md-skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* MD3 List Components */
.md-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: var(--md-sys-color-surface);
}

.md-list-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    min-height: 56px;
    transition: background-color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
    cursor: pointer;
}

.md-list-item:hover {
    background-color: var(--md-sys-color-surface-container-low);
}

.md-list-item-icon {
    margin-right: 16px;
    color: var(--md-sys-color-on-surface-variant);
}

.md-list-item-content {
    flex: 1;
}

.md-list-item-primary {
    font-size: var(--md-sys-typescale-body-large-font-size);
    color: var(--md-sys-color-on-surface);
}

.md-list-item-secondary {
    font-size: var(--md-sys-typescale-body-medium-font-size);
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 4px;
}

/* MD3 Divider */
.md-divider {
    height: 1px;
    background-color: var(--md-sys-color-outline-variant);
    margin: 16px 0;
    border: none;
}

.md-divider-vertical {
    width: 1px;
    height: auto;
    margin: 0 16px;
}

/* HTMX Integration Styles */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

.htmx-settling {
    opacity: 0.5;
}

.htmx-swapping {
    opacity: 0.5;
    transition: opacity var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.htmx-added {
    animation: md-fade-in var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized-decelerate);
}

/* MD3 Empty State */
.md-empty-state {
    text-align: center;
    padding: 48px 24px;
}

.md-empty-state-icon {
    font-size: 64px;
    color: var(--md-sys-color-outline);
    margin-bottom: 16px;
}

.md-empty-state-title {
    font-size: var(--md-sys-typescale-headline-small-font-size);
    color: var(--md-sys-color-on-surface);
    margin-bottom: 8px;
}

.md-empty-state-description {
    font-size: var(--md-sys-typescale-body-medium-font-size);
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 24px;
}

/* MD3 Pagination */
.md-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 24px 0;
}

.md-pagination-button {
    min-width: 40px;
    height: 40px;
    padding: 8px;
    border: none;
    background-color: transparent;
    color: var(--md-sys-color-on-surface);
    border-radius: var(--md-sys-shape-corner-full);
    cursor: pointer;
    transition: background-color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
    display: flex;
    align-items: center;
    justify-content: center;
}

.md-pagination-button:hover:not(:disabled) {
    background-color: var(--md-sys-color-surface-container-high);
}

.md-pagination-button:disabled {
    opacity: var(--md-sys-state-disabled-opacity);
    cursor: not-allowed;
}

.md-pagination-button.active {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

/* ====================================
   Component Library Integration Styles
   ==================================== */

/* Component Container Isolation */
.module-container {
    --module-padding: 24px;
    --module-transition: var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
    padding: var(--module-padding);
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-medium);
    min-height: calc(100vh - 180px);
    animation: moduleLoad var(--module-transition);
}

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

/* Module iframe integration */
.module-iframe-container {
    width: 100%;
    min-height: calc(100vh - 120px);
    border: none;
    border-radius: var(--md-sys-shape-corner-medium);
    overflow: hidden;
}

/* Component Spacing Harmonization */
.md-component-stack > * + * {
    margin-top: var(--md-sys-spacing-medium, 16px);
}

.md-component-group {
    display: flex;
    gap: var(--md-sys-spacing-small, 8px);
    flex-wrap: wrap;
    align-items: center;
}

/* Responsive component grid system */
.md-responsive-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.md-responsive-grid.compact {
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.md-responsive-grid.wide {
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
}

/* Enhanced Button Groups */
.md-button-group {
    display: inline-flex;
    gap: 8px;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-surface-container-low);
    padding: 4px;
    align-items: center;
}

.md-button-group.vertical {
    flex-direction: column;
    border-radius: var(--md-sys-shape-corner-medium);
}

.md-button-group .md-button {
    box-shadow: none;
    margin: 0;
}

.md-button-group .md-button:hover {
    background-color: var(--md-sys-color-surface-container-high);
}

.md-button-group .md-button.active {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

/* Enhanced Table Styling */
.md-table-container {
    overflow-x: auto;
    border-radius: var(--md-sys-shape-corner-medium);
    box-shadow: var(--md-sys-elevation-level1);
    background: var(--md-sys-color-surface);
}

.md-table-container .md-table {
    box-shadow: none;
    border-radius: 0;
}

.md-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--md-sys-color-surface-container);
    backdrop-filter: blur(10px);
}

.md-table tbody tr.selected {
    background: var(--md-sys-color-primary-container);
}

.md-table tbody tr.selected:hover {
    background: var(--md-sys-color-primary-container);
    opacity: 0.9;
}

.md-table-actions {
    padding: 16px;
    background: var(--md-sys-color-surface-container-low);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.md-table-bulk-actions {
    display: flex;
    gap: 8px;
}

/* Form Field Enhancements */
.md-field-container {
    position: relative;
    margin-bottom: 24px;
}

.md-field-container label {
    transition: all var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
    transform-origin: left center;
}

.md-field-container.focused label,
.md-field-container.filled label {
    transform: translateY(-150%) scale(0.85);
    color: var(--md-sys-color-primary);
}

.md-field-error {
    border-color: var(--md-sys-color-error) !important;
}

.md-field-error:focus {
    border-color: var(--md-sys-color-error) !important;
    box-shadow: 0 0 0 1px var(--md-sys-color-error);
}

.md-field-success {
    border-color: #4caf50 !important;
}

.md-field-success:focus {
    border-color: #4caf50 !important;
    box-shadow: 0 0 0 1px #4caf50;
}

.md-field-helper {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: var(--md-sys-typescale-body-small-font-size);
}

.md-field-error-message {
    color: var(--md-sys-color-error);
}

.md-field-success-message {
    color: #4caf50;
}

.md-field-counter {
    color: var(--md-sys-color-on-surface-variant);
}

/* Enhanced Select/Dropdown Styling */
.md-select-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.md-select {
    appearance: none;
    width: 100%;
    padding: 16px 48px 16px 16px;
    background-color: var(--md-sys-color-surface-container-highest);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-small);
    color: var(--md-sys-color-on-surface);
    font-family: var(--md-sys-typescale-body-large-font-family);
    font-size: var(--md-sys-typescale-body-large-font-size);
    line-height: var(--md-sys-typescale-body-large-line-height);
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%2379747e'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 24px;
}

/* Outlined variant */
.md-select.outlined {
    background-color: transparent;
    border: 2px solid var(--md-sys-color-outline);
}

/* Filled variant */
.md-select.filled {
    background-color: var(--md-sys-color-surface-container-highest);
    border: none;
    border-bottom: 1px solid var(--md-sys-color-on-surface-variant);
    border-radius: var(--md-sys-shape-corner-extra-small) var(--md-sys-shape-corner-extra-small) 0 0;
    padding: 20px 48px 8px 16px;
}

.md-select:hover {
    border-color: var(--md-sys-color-on-surface);
    background-color: var(--md-sys-color-surface-container);
}

.md-select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 15px 47px 15px 15px;
}

.md-select.filled:focus {
    border-bottom-width: 2px;
    padding: 20px 48px 7px 16px;
}

.md-select:disabled {
    opacity: var(--md-sys-state-disabled-opacity);
    cursor: not-allowed;
    background-color: var(--md-sys-color-surface-container-low);
}

/* Select with floating label */
.md-select-floating {
    position: relative;
    margin-top: 16px;
}

.md-select-floating label {
    position: absolute;
    left: 16px;
    top: 16px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-large-font-size);
    pointer-events: none;
    transition: all var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
    background-color: var(--md-sys-color-surface);
    padding: 0 4px;
}

.md-select-floating select:focus + label,
.md-select-floating select:not(:placeholder-shown) + label,
.md-select-floating.has-value label {
    top: -8px;
    left: 12px;
    font-size: var(--md-sys-typescale-body-small-font-size);
    color: var(--md-sys-color-primary);
}

/* Custom dropdown menu (for custom implementations) */
.md-dropdown {
    position: relative;
    display: inline-block;
    width: 100%;
}

.md-dropdown-trigger {
    width: 100%;
    padding: 16px 48px 16px 16px;
    background-color: var(--md-sys-color-surface-container-highest);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-small);
    color: var(--md-sys-color-on-surface);
    font-family: var(--md-sys-typescale-body-large-font-family);
    font-size: var(--md-sys-typescale-body-large-font-size);
    text-align: left;
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
    position: relative;
}

.md-dropdown-trigger::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--md-sys-color-on-surface-variant);
    transition: transform var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.md-dropdown.open .md-dropdown-trigger::after {
    transform: translateY(-50%) rotate(180deg);
}

.md-dropdown-trigger:hover {
    background-color: var(--md-sys-color-surface-container);
    border-color: var(--md-sys-color-on-surface);
}

.md-dropdown-trigger:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 15px 47px 15px 15px;
}

.md-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background-color: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-extra-small);
    box-shadow: var(--md-sys-elevation-level2);
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-emphasized-decelerate);
}

.md-dropdown.open .md-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.md-dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-body-large-font-size);
}

.md-dropdown-item:hover {
    background-color: var(--md-sys-color-surface-container-high);
}

.md-dropdown-item.selected {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-weight: 500;
}

.md-dropdown-item.disabled {
    opacity: var(--md-sys-state-disabled-opacity);
    cursor: not-allowed;
}

.md-dropdown-item.disabled:hover {
    background-color: transparent;
}

.md-dropdown-item-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.md-dropdown-item-text {
    flex: 1;
}

.md-dropdown-item-badge {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 2px 8px;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: var(--md-sys-typescale-label-small-font-size);
    font-weight: 500;
}

/* Dropdown divider */
.md-dropdown-divider {
    height: 1px;
    margin: 8px 0;
    background-color: var(--md-sys-color-outline-variant);
}

/* Dropdown header */
.md-dropdown-header {
    padding: 8px 16px;
    font-size: var(--md-sys-typescale-label-small-font-size);
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.1px;
}

/* Multi-select dropdown styles */
.md-dropdown-item.multi-select {
    padding-left: 48px;
    position: relative;
}

.md-dropdown-item.multi-select::before {
    content: '';
    position: absolute;
    left: 16px;
    width: 18px;
    height: 18px;
    border: 2px solid var(--md-sys-color-outline);
    border-radius: 2px;
    transition: all var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.md-dropdown-item.multi-select.selected::before {
    background-color: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}

.md-dropdown-item.multi-select.selected::after {
    content: '✓';
    position: absolute;
    left: 19px;
    top: 8px;
    color: var(--md-sys-color-on-primary);
    font-size: 14px;
    font-weight: bold;
}

/* Searchable dropdown */
.md-dropdown-search {
    padding: 12px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    position: sticky;
    top: 0;
    background-color: var(--md-sys-color-surface-container);
    z-index: 1;
}

.md-dropdown-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-small);
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-body-medium-font-size);
}

.md-dropdown-search-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

/* Dropdown size variants */
.md-dropdown.small .md-dropdown-trigger,
.md-select.small {
    padding: 8px 36px 8px 12px;
    font-size: var(--md-sys-typescale-body-small-font-size);
}

.md-dropdown.large .md-dropdown-trigger,
.md-select.large {
    padding: 20px 52px 20px 20px;
    font-size: var(--md-sys-typescale-body-large-font-size);
}

/* Dropdown animation states */
@keyframes dropdownSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Dark mode enhancements for dropdowns */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .md-select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23c4c6d0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    }

    :root:not([data-theme="light"]) .md-dropdown-trigger::after {
        border-top-color: var(--md-sys-color-on-surface-variant);
    }

    :root:not([data-theme="light"]) .md-dropdown-menu {
        background-color: var(--md-sys-color-surface-container-high);
    }

    :root:not([data-theme="light"]) .md-dropdown-item:hover {
        background-color: var(--md-sys-color-surface-container-highest);
    }
}

:root[data-theme="dark"] .md-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23c4c6d0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] .md-dropdown-trigger::after {
    border-top-color: var(--md-sys-color-on-surface-variant);
}

:root[data-theme="dark"] .md-dropdown-menu {
    background-color: var(--md-sys-color-surface-container-high);
}

:root[data-theme="dark"] .md-dropdown-item:hover {
    background-color: var(--md-sys-color-surface-container-highest);
}

/* Enhanced Card System */
.md-card-interactive {
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
}

.md-card-interactive:hover {
    transform: translateY(-4px);
    box-shadow: var(--md-sys-elevation-level3);
}

.md-card-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.md-card-header-compact {
    padding: 16px;
}

.md-card-title {
    font-size: var(--md-sys-typescale-title-large-font-size);
    font-weight: var(--md-sys-typescale-title-large-font-weight);
    margin: 0;
}

.md-card-subtitle {
    font-size: var(--md-sys-typescale-body-medium-font-size);
    color: var(--md-sys-color-on-surface-variant);
    margin: 4px 0 0;
}

.md-card-content {
    padding: 24px;
}

.md-card-content-compact {
    padding: 16px;
}

.md-card-actions {
    padding: 8px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.md-card-actions.start {
    justify-content: flex-start;
}

.md-card-actions.center {
    justify-content: center;
}

.md-card-actions.space-between {
    justify-content: space-between;
}

/* Modal & Dialog Improvements */
.md-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    z-index: 999;
    animation: fadeIn var(--md-sys-motion-duration-short3) ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.md-modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    animation: slideUp var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized-decelerate);
    max-height: 85vh;
    overflow-y: auto;
    width: 90%;
    max-width: 560px;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, -40%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

.md-modal-fullscreen {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
}

/* Loading States & Skeletons */
.md-component-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.md-component-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--md-sys-color-surface);
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

.md-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

/* Skeleton variations */
.md-skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    border-radius: var(--md-sys-shape-corner-extra-small);
}

.md-skeleton-text.title {
    height: 24px;
    width: 60%;
}

.md-skeleton-text.subtitle {
    height: 20px;
    width: 40%;
}

.md-skeleton-button {
    height: 40px;
    width: 120px;
    border-radius: var(--md-sys-shape-corner-full);
}

.md-skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.md-skeleton-card {
    height: 200px;
    border-radius: var(--md-sys-shape-corner-medium);
}

.md-skeleton-image {
    height: 240px;
    border-radius: var(--md-sys-shape-corner-medium);
}

/* Enhanced HTMX Integration */
.htmx-request .md-button {
    position: relative;
    color: transparent !important;
}

.htmx-request .md-button::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--md-sys-color-on-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.htmx-request .md-button.md-button-outlined::after {
    border-color: var(--md-sys-color-primary);
    border-top-color: transparent;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Smooth content swapping */
[hx-swap] {
    transition: opacity var(--md-sys-motion-duration-short4) ease;
}

.htmx-swapping {
    opacity: 0.5;
}

.htmx-settling {
    opacity: 0.5;
}

.htmx-added {
    animation: htmxFadeIn var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized-decelerate);
}

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

/* Progress indicators for HTMX */
.htmx-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--md-sys-color-primary);
    transform-origin: left;
    animation: htmxProgress 2s ease-in-out;
    z-index: 9999;
}

@keyframes htmxProgress {
    0% { transform: scaleX(0); }
    50% { transform: scaleX(0.5); }
    100% { transform: scaleX(1); opacity: 0; }
}

/* Accessibility Improvements */
.md-button:focus-visible,
.md-field:focus-visible,
.md-card-interactive:focus-visible,
.md-chip:focus-visible {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 8px 16px;
    text-decoration: none;
    border-radius: var(--md-sys-shape-corner-small);
    z-index: 10000;
}

.skip-to-content:focus {
    top: 8px;
    left: 8px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .md-button-outlined {
        border-width: 2px;
    }

    .md-card {
        border: 1px solid var(--md-sys-color-outline);
    }

    .md-field {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Additional Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .md-component-border {
        border-color: var(--md-sys-color-outline-variant);
    }

    :root:not([data-theme="light"]) .md-subtle-background {
        background: var(--md-sys-color-surface-container-low);
    }

    :root:not([data-theme="light"]) .md-interactive-surface:hover {
        background: var(--md-sys-color-surface-container-high);
    }

    :root:not([data-theme="light"]) .md-skeleton {
        background: linear-gradient(
            90deg,
            var(--md-sys-color-surface-container) 25%,
            var(--md-sys-color-surface-container-highest) 50%,
            var(--md-sys-color-surface-container) 75%
        );
    }

    /* MDC Component dark mode support */
    .mdc-card {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }

    .mdc-data-table {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }

    .mdc-data-table__header-row {
        background-color: var(--md-sys-color-surface-container-high);
    }

    .mdc-data-table__header-cell {
        color: var(--md-sys-color-on-surface);
        border-bottom-color: var(--md-sys-color-outline-variant);
    }

    .mdc-data-table__cell {
        color: var(--md-sys-color-on-surface);
        border-bottom-color: var(--md-sys-color-outline-variant);
    }

    .mdc-data-table__row:hover {
        background-color: var(--md-sys-color-surface-container-highest);
    }

    .mdc-text-field {
        background-color: var(--md-sys-color-surface-container);
    }

    .mdc-text-field__input {
        color: var(--md-sys-color-on-surface);
    }

    .mdc-notched-outline__leading,
    .mdc-notched-outline__notch,
    .mdc-notched-outline__trailing {
        border-color: var(--md-sys-color-outline);
    }

    .mdc-floating-label {
        color: var(--md-sys-color-on-surface-variant);
    }

    .mdc-text-field--with-leading-icon .mdc-text-field__icon {
        color: var(--md-sys-color-on-surface-variant);
    }

    .mdc-button {
        color: var(--md-sys-color-primary);
    }

    .mdc-button--raised {
        background-color: var(--md-sys-color-primary);
        color: var(--md-sys-color-on-primary);
    }

    .mdc-dialog__surface {
        background-color: var(--md-sys-color-surface-container-high);
        color: var(--md-sys-color-on-surface);
    }

    .mdc-dialog__title {
        color: var(--md-sys-color-on-surface);
    }

    .mdc-dialog__scrim {
        background-color: rgba(0, 0, 0, 0.6);
    }

    .mdc-fab {
        background-color: var(--md-sys-color-primary-container);
        color: var(--md-sys-color-on-primary-container);
    }

    .mdc-fab:hover {
        background-color: var(--md-sys-color-primary);
        color: var(--md-sys-color-on-primary);
    }

    .mdc-select__anchor {
        background-color: var(--md-sys-color-surface-container);
    }

    .mdc-select__selected-text {
        color: var(--md-sys-color-on-surface);
    }

    .mdc-select__dropdown-icon {
        fill: var(--md-sys-color-on-surface-variant);
    }

    .mdc-menu-surface {
        background-color: var(--md-sys-color-surface-container-high);
    }

    .mdc-deprecated-list-item {
        color: var(--md-sys-color-on-surface);
    }

    .mdc-deprecated-list-item:hover {
        background-color: var(--md-sys-color-surface-container-highest);
    }

    .mdc-linear-progress__buffer {
        background-color: var(--md-sys-color-surface-container-highest);
    }

    .mdc-linear-progress__primary-bar .mdc-linear-progress__bar-inner {
        background-color: var(--md-sys-color-primary);
    }
}

/* Explicit dark mode support with data-theme attribute */
:root[data-theme="dark"] {
    /* Apply all dark mode styles when explicitly set */
}

:root[data-theme="dark"] .md-component-border {
    border-color: var(--md-sys-color-outline-variant);
}

:root[data-theme="dark"] .md-subtle-background {
    background: var(--md-sys-color-surface-container-low);
}

:root[data-theme="dark"] .md-interactive-surface:hover {
    background: var(--md-sys-color-surface-container-high);
}

:root[data-theme="dark"] .md-skeleton {
    background: linear-gradient(
        90deg,
        var(--md-sys-color-surface-container) 25%,
        var(--md-sys-color-surface-container-highest) 50%,
        var(--md-sys-color-surface-container) 75%
    );
}

:root[data-theme="dark"] .mdc-card {
    background-color: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
}

:root[data-theme="dark"] .mdc-data-table {
    background-color: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
}

:root[data-theme="dark"] .mdc-data-table__header-row {
    background-color: var(--md-sys-color-surface-container-high);
}

:root[data-theme="dark"] .mdc-data-table__header-cell {
    color: var(--md-sys-color-on-surface);
    border-bottom-color: var(--md-sys-color-outline-variant);
}

:root[data-theme="dark"] .mdc-data-table__cell {
    color: var(--md-sys-color-on-surface);
    border-bottom-color: var(--md-sys-color-outline-variant);
}

:root[data-theme="dark"] .mdc-data-table__row:hover {
    background-color: var(--md-sys-color-surface-container-highest);
}

:root[data-theme="dark"] .mdc-text-field {
    background-color: var(--md-sys-color-surface-container);
}

:root[data-theme="dark"] .mdc-text-field__input {
    color: var(--md-sys-color-on-surface);
}

:root[data-theme="dark"] .mdc-notched-outline__leading,
:root[data-theme="dark"] .mdc-notched-outline__notch,
:root[data-theme="dark"] .mdc-notched-outline__trailing {
    border-color: var(--md-sys-color-outline);
}

:root[data-theme="dark"] .mdc-floating-label {
    color: var(--md-sys-color-on-surface-variant);
}

:root[data-theme="dark"] .mdc-text-field--with-leading-icon .mdc-text-field__icon {
    color: var(--md-sys-color-on-surface-variant);
}

:root[data-theme="dark"] .mdc-button {
    color: var(--md-sys-color-primary);
}

:root[data-theme="dark"] .mdc-button--raised {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

:root[data-theme="dark"] .mdc-dialog__surface {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

:root[data-theme="dark"] .mdc-dialog__title {
    color: var(--md-sys-color-on-surface);
}

:root[data-theme="dark"] .mdc-dialog__scrim {
    background-color: rgba(0, 0, 0, 0.6);
}

:root[data-theme="dark"] .mdc-fab {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

:root[data-theme="dark"] .mdc-fab:hover {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

:root[data-theme="dark"] .mdc-select__anchor {
    background-color: var(--md-sys-color-surface-container);
}

:root[data-theme="dark"] .mdc-select__selected-text {
    color: var(--md-sys-color-on-surface);
}

:root[data-theme="dark"] .mdc-select__dropdown-icon {
    fill: var(--md-sys-color-on-surface-variant);
}

:root[data-theme="dark"] .mdc-menu-surface {
    background-color: var(--md-sys-color-surface-container-high);
}

:root[data-theme="dark"] .mdc-deprecated-list-item {
    color: var(--md-sys-color-on-surface);
}

:root[data-theme="dark"] .mdc-deprecated-list-item:hover {
    background-color: var(--md-sys-color-surface-container-highest);
}

:root[data-theme="dark"] .mdc-linear-progress__buffer {
    background-color: var(--md-sys-color-surface-container-highest);
}

:root[data-theme="dark"] .mdc-linear-progress__primary-bar .mdc-linear-progress__bar-inner {
    background-color: var(--md-sys-color-primary);
}

/* Responsive Breakpoints */
.md-container {
    width: 100%;
    padding: 0 16px;
    margin: 0 auto;
}

/* Mobile (up to 599px) */
@media (max-width: 599px) {
    .md-hide-mobile {
        display: none !important;
    }

    .md-table {
        font-size: 14px;
    }

    .md-table th,
    .md-table td {
        padding: 12px 8px;
    }

    .md-card {
        border-radius: 0;
        margin: 0 -16px;
    }

    .md-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .md-button-group {
        width: 100%;
        flex-direction: column;
    }

    .md-responsive-grid {
        grid-template-columns: 1fr;
    }
}

/* Tablet (600px to 1239px) */
@media (min-width: 600px) and (max-width: 1239px) {
    .md-hide-tablet {
        display: none !important;
    }

    .md-container {
        padding: 0 24px;
    }

    .md-responsive-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* Desktop (1240px and up) */
@media (min-width: 1240px) {
    .md-hide-desktop {
        display: none !important;
    }

    .md-container {
        max-width: 1200px;
        padding: 0 32px;
    }

    .md-container.wide {
        max-width: 1440px;
    }

    .md-container.full {
        max-width: none;
    }
}

/* Extra large screens (1920px and up) */
@media (min-width: 1920px) {
    .md-container {
        max-width: 1600px;
    }

    .md-responsive-grid {
        grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    }
}

/* Responsive */
@media (max-width: 768px) {
    .app-bar-container {
        padding: 8px 16px;
    }

    .search-field {
        display: none;
    }


    .modules-grid {
        grid-template-columns: 1fr;
    }
}
