/* Material Design 3 - Flat Design, Blue Pastel Theme, Zero Borders, No Rounded Corners */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Blue Pastel Material Design Color Palette */
    --md-primary: #90CAF9;
    --md-primary-dark: #64B5F6;
    --md-primary-light: #BBDEFB;
    --md-on-primary: #0D47A1;
    
    --md-secondary: #81D4FA;
    --md-secondary-dark: #4FC3F7;
    --md-on-secondary: #01579B;
    
    --md-tertiary: #A5D6A7;
    --md-on-tertiary: #1B5E20;
    
    --md-error: #EF9A9A;
    --md-on-error: #B71C1C;
    
    --md-success: #81C784;
    --md-on-success: #1B5E20;
    
    /* Surface Colors - Darker background with high contrast dark text */
    --md-surface: #E0E4E8;
    --md-on-surface: #000000;
    --md-surface-variant: #D0D4D8;
    --md-on-surface-variant: #000000;
    
    --md-surface-container: #F0F4F8;
    --md-surface-container-high: #D8DCE0;
    
    /* Outline - No borders */
    --md-outline: transparent;
    --md-outline-variant: transparent;
    
    /* No elevation - Flat design */
    --md-elevation-level0: none;
    --md-elevation-level1: none;
    --md-elevation-level2: none;
    --md-elevation-level3: none;
    --md-elevation-level4: none;
    --md-elevation-level5: none;
    
    /* Shape - No rounded corners */
    --md-shape-corner-none: 0px;
    --md-shape-corner-extra-small: 0px;
    --md-shape-corner-small: 0px;
    --md-shape-corner-medium: 0px;
    --md-shape-corner-large: 0px;
    
    /* Compact Spacing */
    --md-spacing-1: 4px;
    --md-spacing-2: 8px;
    --md-spacing-3: 12px;
    --md-spacing-4: 16px;
    --md-spacing-5: 20px;
    --md-spacing-6: 24px;
    --md-spacing-8: 32px;
    
    /* Transitions */
    --md-transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--md-surface);
    color: var(--md-on-surface);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
.m3-typography--headline-large {
    font-size: 32px;
    font-weight: 600;
    line-height: 40px;
    letter-spacing: 0;
    color: var(--md-on-surface);
}

.m3-typography--title-large {
    font-size: 22px;
    font-weight: 500;
    line-height: 28px;
    letter-spacing: 0;
    color: var(--md-on-surface);
}

.m3-typography--title-medium {
    font-size: 16px;
    font-weight: 500;
    line-height: 24px;
    letter-spacing: 0.15px;
    color: var(--md-on-surface);
}

.m3-typography--body-large {
    font-size: 16px;
    font-weight: 500;
    line-height: 24px;
    letter-spacing: 0.5px;
    color: var(--md-on-surface);
}

.m3-typography--body-medium {
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    letter-spacing: 0.25px;
    color: var(--md-on-surface);
}

.m3-typography--body-small {
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
    letter-spacing: 0.4px;
    color: var(--md-on-surface);
}

/* App Container */
.m3-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header - Flat, Compact */
.m3-header {
    background: var(--md-surface-container);
    border: none;
    padding: 0;
    box-shadow: none;
    width: 100%;
}

.m3-header__content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--md-spacing-3);
    flex-wrap: nowrap;
    margin-bottom: 0;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
    padding: var(--md-spacing-4) var(--md-spacing-4);
}


.m3-header__title-container {
    display: flex;
    align-items: center;
    gap: var(--md-spacing-2);
    white-space: nowrap;
    flex-shrink: 0;
}

.m3-header__logo {
    display: block !important;
    object-fit: contain;
    max-height: 26px;
    height: 32px;
    width: auto;
    min-width: 32px;
    padding-top: 0px;
    padding-bottom: 2px;
    visibility: visible !important;
    opacity: 1 !important;
}

.m3-header__title-container a {
    text-decoration: none;
    display: flex;
    align-items: center;
    line-height: 1;
    flex-shrink: 0;
}

.m3-header__title-container a img {
    display: block;
    max-height: 32px;
    width: auto;
    height: auto;
}

.m3-header__content h1 {
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.m3-header__actions {
    display: flex;
    align-items: center;
    gap: var(--md-spacing-2);
}

.m3-stats-bar {
    display: flex;
    gap: var(--md-spacing-4);
    flex-wrap: nowrap;
    padding: 0;
    border: none;
    margin: 0;
    align-items: center;
    min-width: 0;
    flex-shrink: 1;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Segmented Button Set - Rectangular, No Borders */
.m3-segmented-button-set {
    display: inline-flex;
    background: var(--md-surface-variant);
    border-radius: 0;
    padding: var(--md-spacing-1);
    gap: var(--md-spacing-1);
    border: none;
}

.m3-segmented-button {
    position: relative;
    padding: var(--md-spacing-2) var(--md-spacing-3);
    border: none;
    background: transparent;
    border-radius: 0;
    cursor: pointer;
    transition: var(--md-transition);
    color: var(--md-on-surface-variant);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    letter-spacing: 0.1px;
    overflow: hidden;
    min-height: 44px;
    height: 44px;
}

.m3-segmented-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--md-primary);
    opacity: 0;
    transition: opacity var(--md-transition);
}

.m3-segmented-button:active::before {
    opacity: 0.2;
}

.m3-segmented-button--selected {
    background: var(--md-primary);
    color: var(--md-on-primary);
    box-shadow: none;
}

.m3-segmented-button--selected::before {
    opacity: 0;
}

.m3-segmented-button__label {
    position: relative;
    z-index: 1;
}

/* Fixed width for filter buttons */
#filterAll,
#filterUser,
#filterAdmin {
    width: 83px;
    min-width: 83px;
    max-width: 83px;
}

/* Fixed width for Show Create Form button */
#toggleAdminFormBtn {
    width: 141px;
    min-width: 141px;
    max-width: 141px;
}

/* Button - Rectangular, Flat */
.m3-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--md-spacing-2) var(--md-spacing-3);
    border: none;
    border-radius: 0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    letter-spacing: 0.1px;
    cursor: pointer;
    overflow: hidden;
    transition: var(--md-transition);
    min-height: 44px;
    height: 44px;
    text-transform: none;
}

.m3-button--filled {
    background: var(--md-primary);
    color: var(--md-on-primary);
    box-shadow: none;
}

.m3-button--filled:active {
    background: var(--md-primary-dark);
}

.m3-button--full-width {
    width: 100%;
}

.m3-button__ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: currentColor;
    opacity: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.m3-button:active .m3-button__ripple {
    animation: ripple 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ripple {
    to {
        width: 200px;
        height: 200px;
        opacity: 0.1;
    }
}

.m3-button__label {
    position: relative;
    z-index: 1;
}

/* Main Layout - Compact */
.m3-main-layout {
    display: flex;
    flex: 1;
    gap: var(--md-spacing-3);
    padding: var(--md-spacing-3);
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* Main Content */
.m3-content {
    flex: 1;
    min-width: 0;
}

.m3-content__toolbar {
    margin-bottom: var(--md-spacing-3);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: var(--md-spacing-2);
}

/* Card - Flat, No Borders */
.m3-card {
    background: var(--md-surface-container);
    border-radius: 0;
    box-shadow: none;
    border: none;
    margin-bottom: var(--md-spacing-3);
    overflow: visible;
}

.m3-card__content {
    padding: var(--md-spacing-4);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Allow dropdowns to overflow card content */
.m3-card__content:has(.m3-multi-filter) {
    overflow-y: visible;
}

.m3-card__description {
    color: var(--md-on-surface);
    margin-bottom: var(--md-spacing-3);
}

/* Form - Compact */
.m3-form {
    display: flex;
    flex-direction: column;
    gap: var(--md-spacing-3);
}

/* Text Field - Flat, No Borders */
.m3-text-field {
    position: relative;
    display: block;
}

.m3-text-field--filled {
    background: var(--md-surface-variant);
    border: none;
    border-radius: 0;
    padding: var(--md-spacing-2) var(--md-spacing-3) var(--md-spacing-1);
    min-height: 44px;
    transition: var(--md-transition);
    outline: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    position: relative;
}

/* Smooth transition for email confirm field */
#emailConfirmContainer {
    opacity: 0;
    transition: opacity 200ms ease-in-out;
}

#emailConfirmContainer[style*="display: block"] {
    opacity: 1;
}

.m3-text-field--with-spinner {
    padding-right: 60px;
}

.m3-text-field--filled:focus-within {
    background: var(--md-surface-container);
    outline: 1px solid rgb(208, 212, 216) !important;
    box-shadow: none;
    border: 1px solid rgb(208, 212, 216) !important;
}

.m3-text-field__input {
    width: 100%;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: 0.5px;
    color: var(--md-on-surface);
    padding: 0;
    margin-top: 0;
    outline: none;
    box-shadow: none;
    resize: none;
    overflow: hidden;
}

.m3-text-field__input[type="textarea"],
.m3-text-field__input[rows] {
    min-height: 24px;
    max-height: 200px;
}

.m3-text-field__input:focus {
    outline: none;
    box-shadow: none;
    border: none;
}

.m3-text-field__input:focus-visible {
    outline: none;
    box-shadow: none;
    border: none;
}

.m3-text-field__input::placeholder {
    color: transparent;
}

.m3-text-field__input:focus::placeholder {
    color: var(--md-on-surface);
    opacity: 0.6;
}

.m3-floating-label {
    position: absolute;
    left: var(--md-spacing-3);
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: 0.5px;
    color: var(--md-on-surface);
    pointer-events: none;
    transition: var(--md-transition);
}

.m3-text-field__input:focus + .m3-floating-label,
.m3-text-field__input:not(:placeholder-shown) + .m3-floating-label,
.m3-text-field__input[value]:not([value=""]) + .m3-floating-label {
    font-size: 12px;
    line-height: 16px;
    letter-spacing: 0.4px;
    top: var(--md-spacing-1);
    transform: translateY(0);
    color: #000000;
}

/* Spinner buttons for number inputs */
.m3-spinner {
    position: absolute;
    right: var(--md-spacing-2);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 1;
}

.m3-spinner__button {
    width: 24px;
    height: 20px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    color: var(--md-on-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--md-transition);
    outline: none;
}

.m3-spinner__button:hover {
    background: var(--md-surface-container-high);
}

.m3-spinner__button:active {
    background: var(--md-surface-variant);
}

.m3-spinner__button svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.m3-select--filled:focus-within .m3-select__label,
.m3-select--filled:has(select:not([value=""])) .m3-select__label {
    font-size: 12px;
    line-height: 16px;
    letter-spacing: 0.4px;
    top: var(--md-spacing-1);
    color: #000000;
}


/* Form Hint */
.m3-form-hint {
    margin: var(--md-spacing-1) 0;
    color: var(--md-on-surface);
}

.m3-form-hint__highlight {
    color: #000000;
    font-weight: 500;
}

/* Multi-Checkbox Filter - Flat, No Borders */
.m3-multi-filter {
    position: relative;
    display: inline-block;
    min-width: 200px;
    overflow: visible;
}

.m3-multi-filter[style*="width: 100%"] {
    width: 100%;
}

.m3-multi-filter__button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    height: 44px;
    padding: var(--md-spacing-2) var(--md-spacing-3);
    background: var(--md-surface-variant);
    color: var(--md-on-surface);
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: var(--md-transition);
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0.25px;
    text-align: left;
}

/* When multi-filter is inside a text-field wrapper, remove button padding to match text field input */
.m3-text-field--filled .m3-multi-filter__button {
    padding: 0;
    margin-top: 0;
    background: transparent;
    min-height: auto;
    height: auto;
    align-items: center;
}

.m3-multi-filter__button:hover {
    background: var(--md-surface-container-high);
}

.m3-multi-filter__button-text {
    flex: 1;
    color: var(--md-on-surface);
}

/* Adjust button text margin when inside text-field wrapper */
.m3-text-field--filled .m3-multi-filter__button-text {
    margin-top: 0;
    font-size: 16px;
    line-height: 24px;
    letter-spacing: 0.5px;
}

/* Label for multi-filter in form context */
.m3-multi-filter__form-label {
    position: absolute;
    left: var(--md-spacing-3);
    top: var(--md-spacing-2);
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0.25px;
    color: var(--md-on-surface);
    pointer-events: none;
    transition: var(--md-transition);
}

.m3-multi-filter--open .m3-multi-filter__form-label,
.m3-multi-filter:has(.m3-multi-filter__button-text:not(:empty):not([textContent="Select Loan Product"])) .m3-multi-filter__form-label {
    font-size: 12px;
    line-height: 16px;
    letter-spacing: 0.4px;
    top: var(--md-spacing-1);
    color: #000000;
}

.m3-multi-filter__dropdown-icon {
    width: 20px;
    height: 20px;
    transition: transform var(--md-transition);
    margin-top: 0;
}

/* Adjust dropdown icon margin when inside text-field wrapper */
.m3-text-field--filled .m3-multi-filter__dropdown-icon {
    margin-top: 0;
    align-self: center;
}

.m3-multi-filter__dropdown-icon svg {
    width: 100%;
    height: 100%;
    fill: var(--md-on-surface);
}

.m3-multi-filter--open .m3-multi-filter__dropdown-icon {
    transform: rotate(180deg);
}

.m3-multi-filter__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--md-surface-container);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 500px;
    overflow-y: auto;
    display: none;
}

/* Lender filter dropdown - tall enough to show all lenders and reset button without scrolling */
#lenderFilterDropdown {
    max-height: 800px;
    overflow-y: visible;
}

.m3-multi-filter--open .m3-multi-filter__dropdown {
    display: block;
}

.m3-multi-filter__option {
    display: flex;
    align-items: center;
    padding: var(--md-spacing-2) var(--md-spacing-3);
    cursor: pointer;
    transition: background-color var(--md-transition);
}

.m3-multi-filter__option:hover {
    background: var(--md-surface-variant);
}

/* Style checkboxes and radio buttons identically (square with custom styling) */
.m3-multi-filter__checkbox,
.m3-multi-filter__radio {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--md-outline);
    border-radius: 2px;
    background-color: var(--md-surface);
    cursor: pointer;
    position: relative;
    margin-right: var(--md-spacing-2);
    flex-shrink: 0;
}

.m3-multi-filter__checkbox:checked,
.m3-multi-filter__radio:checked {
    background-color: var(--md-primary);
    border-color: var(--md-primary);
}

.m3-multi-filter__checkbox:checked::after,
.m3-multi-filter__radio:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 10px;
    border: solid black;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg);
}

.m3-multi-filter__checkbox:hover,
.m3-multi-filter__radio:hover {
    border-color: var(--md-primary);
}

.m3-multi-filter__checkbox:focus,
.m3-multi-filter__radio:focus {
    outline: none;
}


.m3-multi-filter__label {
    flex: 1;
    font-size: 14px;
    color: var(--md-on-surface);
    user-select: none;
    cursor: pointer;
}

.m3-multi-filter__option label {
    flex: 1;
    font-size: 14px;
    color: var(--md-on-surface);
    user-select: none;
    cursor: pointer;
}

.m3-multi-filter__actions {
    padding: var(--md-spacing-2);
    border-top: 1px solid #D0D0D0;
    display: flex;
    gap: var(--md-spacing-2);
}

.m3-multi-filter__reset {
    flex: 1;
    padding: var(--md-spacing-2);
    background: var(--md-surface-variant);
    color: var(--md-on-surface);
    border: none;
    cursor: pointer;
    font-size: 12px;
    transition: var(--md-transition);
}

.m3-multi-filter__reset:hover {
    background: var(--md-surface-container-high);
}

/* Select - Flat, No Borders */
.m3-select {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 180px;
    min-height: 48px;
}

.m3-select--filled {
    background: var(--md-surface-variant);
    border-radius: 0;
    padding: var(--md-spacing-2) var(--md-spacing-3) var(--md-spacing-1);
    transition: var(--md-transition);
}

.m3-select--filled:focus-within {
    background: var(--md-surface-container);
}

.m3-select__native-control {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.m3-select__label {
    position: absolute;
    left: var(--md-spacing-3);
    top: var(--md-spacing-2);
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0.25px;
    color: var(--md-on-surface);
    pointer-events: none;
    transition: var(--md-transition);
}

.m3-select__selected-text {
    margin-top: var(--md-spacing-2);
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0.25px;
    color: var(--md-on-surface);
}

.m3-select__dropdown-icon {
    position: absolute;
    right: var(--md-spacing-3);
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    pointer-events: none;
    transition: transform var(--md-transition);
}

.m3-select--filled:focus-within .m3-select__dropdown-icon {
    transform: translateY(-50%) rotate(180deg);
}

.m3-select__dropdown-icon-graphic {
    width: 100%;
    height: 100%;
    fill: var(--md-on-surface);
}

.m3-select__dropdown-icon-active {
    display: none;
}

.m3-select--filled:focus-within .m3-select__dropdown-icon-active {
    display: block;
}

.m3-select--filled:focus-within .m3-select__dropdown-icon-inactive {
    display: none;
}

/* Snackbar - Flat */
.m3-snackbar {
    position: fixed;
    top: var(--md-spacing-3);
    right: var(--md-spacing-3);
    transform: translateX(100px);
    z-index: 1000;
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.m3-snackbar[style*="display: block"] {
    transform: translateX(0);
}

.m3-snackbar__surface {
    background: #424242;
    color: #ffffff;
    border-radius: 0;
    padding: var(--md-spacing-2) var(--md-spacing-3);
    box-shadow: none;
    min-width: 300px;
    max-width: 600px;
    border: none;
    display: flex;
    align-items: center;
    gap: var(--md-spacing-2);
}

.m3-snackbar__label {
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0.25px;
    flex: 1;
}

.m3-snackbar__close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: var(--md-spacing-1);
    margin: calc(var(--md-spacing-1) * -1);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.m3-snackbar__close:hover {
    opacity: 1;
}

.m3-snackbar__close:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.m3-snackbar.success .m3-snackbar__surface {
    background: var(--md-success);
    color: var(--md-on-success);
}

.m3-snackbar.error .m3-snackbar__surface {
    background: var(--md-error);
    color: var(--md-on-error);
}

/* Loading */
.m3-loading {
    text-align: center;
    padding: var(--md-spacing-6);
}

.m3-circular-progress {
    width: 40px;
    height: 40px;
    margin: 0 auto var(--md-spacing-3);
    position: relative;
    display: inline-block;
}

.m3-circular-progress--indeterminate {
    animation: rotate 1.4s linear infinite;
}

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

.m3-circular-progress__determinate-circle,
.m3-circular-progress__indeterminate-circle-gap {
    fill: none;
    stroke: var(--md-primary);
    stroke-width: 4;
    stroke-linecap: round;
}

.m3-circular-progress__determinate-circle {
    stroke-dasharray: 125.664;
    stroke-dashoffset: 125.664;
}

.m3-circular-progress--indeterminate .m3-circular-progress__determinate-circle {
    stroke-dasharray: 31.416;
    stroke-dashoffset: 31.416;
    animation: circular-progress-rotate 1.4s ease-in-out infinite;
}

@keyframes circular-progress-rotate {
    0% {
        stroke-dashoffset: 31.416;
    }
    50% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: -31.416;
    }
}

.m3-circular-progress__indeterminate-circle-gap {
    stroke-dasharray: 31.416;
    stroke-dashoffset: 31.416;
    opacity: 0.25;
}

/* Error */
.m3-error {
    background: var(--md-error);
    color: var(--md-on-error);
    padding: var(--md-spacing-3);
    text-align: center;
    border-radius: 0;
    border: none;
}

/* Program Sections */
.m3-product-section {
    margin-bottom: var(--md-spacing-4);
    background: var(--md-surface-container);
}

.m3-product-section + .m3-product-section {
    margin-top: var(--md-spacing-4);
}

.m3-product-title {
    margin-bottom: var(--md-spacing-3);
    padding-bottom: var(--md-spacing-2);
}

/* Data Tables - Flat */
.m3-data-table {
    width: 100%;
    min-width: max-content;
    border-collapse: collapse;
    background: transparent;
    border: none;
    table-layout: fixed; /* Use fixed layout for better column control */
}

/* Ensure tables in scroll containers maintain width for Safari */
.m3-rates-table-scroll-container .m3-data-table {
    width: auto;
    min-width: 100%;
    display: table;
}

.m3-data-table thead {
    background: var(--md-surface-variant);
}

.m3-data-table th {
    padding: var(--md-spacing-2) var(--md-spacing-2);
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    letter-spacing: 0.5px;
    color: var(--md-on-surface);
    text-transform: uppercase;
}

/* Column widths for alerts table (9 columns) */
.m3-data-table th:nth-child(1) {
    /* Email */
    width: 22%;
    min-width: 180px;
    max-width: 280px;
}

.m3-data-table th:nth-child(2) {
    /* Loan Product */
    width: 9%;
    min-width: 80px;
}

.m3-data-table th:nth-child(3) {
    /* Your Current Rate */
    width: 9%;
    min-width: 90px;
}

.m3-data-table th:nth-child(4) {
    /* Loan Amount */
    width: 11%;
    min-width: 100px;
}

.m3-data-table th:nth-child(5) {
    /* Loan Type */
    width: 9%;
    min-width: 85px;
}

.m3-data-table th:nth-child(6) {
    /* Status */
    width: 12%;
    min-width: 120px;
}

.m3-data-table th:nth-child(7) {
    /* Created */
    width: 14%;
    min-width: 180px;
}

.m3-data-table th:nth-child(8) {
    /* Last Sent */
    width: 14%;
    min-width: 180px;
}

.m3-data-table th:nth-child(9) {
    /* Actions */
    width: 10%;
    min-width: 140px;
}

.m3-data-table td {
    padding: var(--md-spacing-2) var(--md-spacing-2);
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0.25px;
    color: var(--md-on-surface);
    border-bottom: none;
    vertical-align: middle;
}

/* Cell styling for alerts table */
.m3-data-table td:nth-child(1) {
    /* Email */
    min-width: 180px;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.m3-data-table td:nth-child(2),
.m3-data-table td:nth-child(3),
.m3-data-table td:nth-child(4),
.m3-data-table td:nth-child(5),
.m3-data-table td:nth-child(7),
.m3-data-table td:nth-child(8) {
    /* Loan Product, Your Current Rate, Loan Amount, Loan Type, Created, Last Sent */
    white-space: nowrap;
}

.m3-data-table td:nth-child(6) {
    /* Status - allow wrapping for badges */
    white-space: normal;
}

.m3-data-table td:nth-child(9) {
    /* Actions */
    white-space: nowrap;
}

.m3-data-table td > div {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
}


.m3-data-table tbody tr {
    transition: background-color var(--md-transition);
    border-bottom: 1px solid #D0D0D0;
}

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

/* Hover effect only on individual table rows */
.m3-data-table tbody tr:hover {
    background: var(--md-surface-container-high) !important;
}

.m3-lender-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--md-on-surface);
}

.m3-lender-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.m3-lender-link:hover {
    color: #1976D2;
    text-decoration: underline;
}

.m3-loan-product {
    color: var(--md-on-surface);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.m3-rate {
    font-size: 16px;
    font-weight: 600;
    color: #000000;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-align: left;
    position: relative;
    height: 46.5px;
    line-height: 46.5px;
}

.m3-rate.m3-chart-clickable {
    transition: background-color 0.2s ease;
    user-select: none;
}

.m3-rate.m3-chart-clickable:hover {
    background-color: rgba(0, 0, 0, 0.04);
}


.m3-mini-chart {
    width: 80px;
    height: 30px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    max-width: 100%;
    overflow: hidden;
}

.m3-mini-chart canvas {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
}

/* Clickable row - hover effect on individual rows */
.m3-clickable-row {
    transition: background-color var(--md-transition);
}

.m3-clickable-row:hover {
    background: var(--md-surface-container-high) !important;
}

/* Modal */
.m3-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.m3-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.m3-modal__content {
    position: relative;
    background: var(--md-surface-container);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 0;
}

.m3-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--md-spacing-4);
    background: var(--md-surface-variant);
}

.m3-modal__close {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    color: var(--md-on-surface);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--md-transition);
}

.m3-modal__body {
    padding: var(--md-spacing-4);
    overflow-y: auto;
    flex: 1;
}

.m3-history-table-container {
    max-height: 400px;
    overflow-y: auto;
}

/* History table - equal width columns (4 columns: Date, Rate, APR, Change) */
.m3-history-table-container .m3-data-table {
    table-layout: fixed;
}

.m3-history-table-container .m3-data-table th:nth-child(1),
.m3-history-table-container .m3-data-table th:nth-child(2),
.m3-history-table-container .m3-data-table th:nth-child(3),
.m3-history-table-container .m3-data-table th:nth-child(4),
.m3-history-table-container .m3-data-table td:nth-child(1),
.m3-history-table-container .m3-data-table td:nth-child(2),
.m3-history-table-container .m3-data-table td:nth-child(3),
.m3-history-table-container .m3-data-table td:nth-child(4) {
    width: 25%;
}

.m3-rate-link {
    color: #000000;
    text-decoration: none;
    font-weight: 600;
    transition: color var(--md-transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.m3-apr {
    color: var(--md-on-surface);
    font-size: 14px;
    font-weight: 400;
    text-align: left;
    position: relative;
    height: 46.5px;
    line-height: 46.5px;
}

.m3-amount-range {
    color: var(--md-on-surface);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.m3-best-rate {
    background: rgba(76, 175, 80, 0.25) !important;
    border-radius: 4px;
}

.m3-best-cell {
    background: rgba(76, 175, 80, 0.25) !important;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin: 0;
    line-height: inherit;
    vertical-align: baseline;
}

/* Background-only highlight for rate text - doesn't affect text positioning */
.m3-best-rate-text {
    position: relative;
    display: inline-block;
    padding: 0;
    margin: 0;
    line-height: inherit;
}

.m3-best-rate-text::before {
    content: '';
    position: absolute;
    left: -4px;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    background: rgba(76, 175, 80, 0.25);
    border-radius: 4px;
    z-index: -1;
    pointer-events: none;
}

/* Background-only highlight for APR text - doesn't affect text positioning */
.m3-best-apr-text {
    position: relative;
    display: inline-block;
    padding: 0;
    margin: 0;
    line-height: inherit;
}

.m3-best-apr-text::before {
    content: '';
    position: absolute;
    left: -4px;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    background: rgba(76, 175, 80, 0.25);
    border-radius: 4px;
    z-index: -1;
    pointer-events: none;
}

.m3-best-badge {
    display: inline-block;
    background: rgba(76, 175, 80, 0.25);
    color: #000000;
    padding: var(--md-spacing-1) var(--md-spacing-2);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    line-height: 16px;
    letter-spacing: 0.5px;
    margin-left: var(--md-spacing-2);
    text-transform: uppercase;
    border: none;
}

/* Admin Styles */
.admin-banner {
    background: var(--md-primary);
    color: var(--md-on-primary);
    padding: var(--md-spacing-2);
    text-align: center;
    font-weight: 600;
    margin-bottom: var(--md-spacing-3);
    border: none;
    border-radius: 0;
}

.token-input {
    margin-bottom: var(--md-spacing-3);
}

.error-message {
    color: var(--md-error);
    margin-top: var(--md-spacing-2);
    font-size: 14px;
}

/* Legacy classes for admin page compatibility */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--md-spacing-3);
}

header {
    background: var(--md-surface-container);
    padding: var(--md-spacing-3) var(--md-spacing-4);
    margin-bottom: var(--md-spacing-3);
    border-radius: 0;
    box-shadow: none;
    border: none;
}

.loan-type-tabs {
    display: inline-flex;
    background: var(--md-surface-variant);
    border-radius: 0;
    padding: var(--md-spacing-1);
    gap: var(--md-spacing-1);
    margin-bottom: var(--md-spacing-3);
    border: none;
}

.loan-type-tab {
    padding: var(--md-spacing-2) var(--md-spacing-3);
    background: transparent;
    color: var(--md-on-surface-variant);
    text-decoration: none;
    border-radius: 0;
    font-weight: 500;
    font-size: 14px;
    transition: var(--md-transition);
    border: none;
    cursor: pointer;
}

.loan-type-tab.active {
    background: var(--md-primary);
    color: var(--md-on-primary);
    box-shadow: none;
}

.stats-bar {
    display: flex;
    gap: var(--md-spacing-4);
    flex-wrap: wrap;
    padding-top: var(--md-spacing-2);
    border: none;
    margin-top: var(--md-spacing-2);
}

.controls {
    display: flex;
    gap: var(--md-spacing-2);
    margin-bottom: var(--md-spacing-3);
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    padding: var(--md-spacing-2) var(--md-spacing-3);
    border: none;
    border-radius: 0;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--md-transition);
    display: inline-flex;
    align-items: center;
    gap: var(--md-spacing-2);
    min-height: 44px;
}

.btn-primary {
    background: var(--md-primary);
    color: var(--md-on-primary);
    box-shadow: none;
}

select {
    padding: var(--md-spacing-2) var(--md-spacing-3);
    border-radius: 0;
    font-size: 14px;
    background: var(--md-surface-variant);
    color: var(--md-on-surface);
    cursor: pointer;
    min-width: 180px;
    transition: var(--md-transition);
}

select:focus {
    outline: none;
    background: var(--md-surface-container);
}

.loading, .error {
    text-align: center;
    padding: var(--md-spacing-4);
    color: var(--md-on-surface);
    font-size: 14px;
    border-radius: 0;
    border: none;
}

.error {
    background: var(--md-error);
    color: var(--md-on-error);
    margin-bottom: var(--md-spacing-3);
}

.product-section {
    margin-bottom: var(--md-spacing-4);
    background: var(--md-surface-container);
    border-radius: 0;
    padding: var(--md-spacing-3);
    box-shadow: none;
}

.product-section + .product-section {
    margin-top: var(--md-spacing-4);
}

.product-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--md-on-surface);
    margin-bottom: var(--md-spacing-3);
    padding-bottom: var(--md-spacing-2);
}

.rates-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    border-radius: 0;
    border: none;
}

.rates-table thead {
    background: var(--md-surface-variant);
}

.rates-table th {
    padding: var(--md-spacing-2) var(--md-spacing-3);
    text-align: left;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--md-on-surface);
}

.rates-table td {
    padding: var(--md-spacing-3);
    font-size: 14px;
    font-weight: 400;
    border-bottom: 1px solid #D0D0D0;
}

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

.rates-table tbody tr {
    transition: background-color var(--md-transition);
}

/* Hover effect only on individual table rows */
.rates-table tbody tr:hover {
    background: var(--md-surface-container-high) !important;
}


.lender-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--md-on-surface);
}

.loan-product {
    color: var(--md-on-surface);
    font-size: 14px;
}

.rate {
    font-size: 16px;
    font-weight: 600;
    color: #000000;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}


.rate-link {
    color: #000000;
    text-decoration: none;
    font-weight: 500;
    transition: color var(--md-transition);
}

.apr {
    color: var(--md-on-surface);
    font-size: 14px;
    font-weight: 400;
}

.amount-range {
    color: var(--md-on-surface);
    font-size: 14px;
}

.best-rate {
    background: rgba(76, 175, 80, 0.25) !important;
    border-radius: 4px;
}

.best-badge {
    display: inline-block;
    background: rgba(76, 175, 80, 0.25);
    color: #000000;
    padding: var(--md-spacing-1) var(--md-spacing-2);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    margin-left: var(--md-spacing-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
}

/* Responsive */
@media (max-width: 960px) {
    .m3-main-layout {
        flex-direction: column;
        padding: var(--md-spacing-2);
    }
    
    .m3-sidebar {
        width: 100%;
    }
    
    .m3-header {
        padding: var(--md-spacing-2) var(--md-spacing-3);
    }
    
    .m3-header__content {
        align-items: center;
    }
    
    .m3-header__actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .m3-typography--headline-large {
        font-size: 24px;
        line-height: 32px;
    }
    
    .m3-segmented-button-set {
        flex: 1;
        min-width: 0;
    }
    
    .m3-segmented-button {
        flex: 1;
        min-width: 0;
    }
    
    .m3-stats-bar {
        gap: var(--md-spacing-2);
    }
    
    .m3-card__content {
        padding: var(--md-spacing-3);
    }
    
    .m3-data-table {
        font-size: 12px;
    }
    
    .m3-table-scroll-container,
    .m3-rates-table-scroll-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .m3-data-table th,
    .m3-data-table td {
        padding: var(--md-spacing-2);
        white-space: nowrap;
    }
    
    .m3-snackbar {
        top: var(--md-spacing-2);
        right: var(--md-spacing-2);
        left: var(--md-spacing-2);
        transform: translateY(-100px);
    }
    
    .m3-snackbar[style*="display: block"] {
        transform: translateY(0);
    }
    
    .m3-snackbar__surface {
        min-width: auto;
        width: 100%;
    }
}

/* Focus States */
*:focus-visible {
    outline: 2px solid var(--md-primary);
    outline-offset: 2px;
    border-radius: 0;
}

/* Keep grey outline on text field containers when focused */
.m3-text-field--filled:focus-within {
    outline: 1px solid rgb(208, 212, 216) !important;
    border: 1px solid rgb(208, 212, 216) !important;
}

/* Remove focus outline from text field inputs themselves */
.m3-text-field__input:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* ============================================================================
   ALERTS MANAGEMENT STYLING
   ============================================================================ */

/* Status Badges */
.m3-status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 2px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    margin-right: 4px;
    margin-left: 0;
    margin-top: 0;
    margin-bottom: 0;
}

.m3-status-badge--active {
    background-color: var(--md-primary-container);
    color: var(--md-on-primary-container);
}

.m3-status-badge--inactive {
    background-color: #FFF3E0;
    color: #E65100;
}

.m3-status-badge--verified {
    background-color: #E8F5E9;
    color: #2E7D32;
}

.m3-status-badge--unverified {
    background-color: #FFF3E0;
    color: #E65100;
}

/* Small Button Variant */
.m3-button--small {
    padding: 4px 8px;
    font-size: 12px;
    min-width: auto;
    height: auto;
}

.m3-button--small .m3-button__label {
    font-size: 12px;
}

/* Alerts Table Styling */
.m3-table-scroll-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

/* Rates Table Scroll Container */
.m3-rates-table-scroll-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    display: block;
    position: relative;
    /* Safari fix: ensure container can scroll */
    min-width: 0;
    /* Force hardware acceleration for smooth scrolling */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

#alertsContainer .m3-data-table {
    width: 100%;
    min-width: 100%;
    table-layout: auto;
}

#alertsContainer .m3-data-table th {
    text-align: left;
    padding: var(--md-spacing-2) var(--md-spacing-3);
    font-weight: 600;
    border-bottom: 1px solid var(--md-outline-variant);
    white-space: nowrap;
}

#alertsContainer .m3-data-table th:nth-child(1) {
    width: 18%; /* Email */
}

#alertsContainer .m3-data-table th:nth-child(2) {
    width: 8%; /* Loan Product */
}

#alertsContainer .m3-data-table th:nth-child(3) {
    width: 9%; /* Rate Threshold */
}

#alertsContainer .m3-data-table th:nth-child(4) {
    width: 9%; /* Loan Amount */
}

#alertsContainer .m3-data-table th:nth-child(5) {
    width: 8%; /* Loan Type */
}

#alertsContainer .m3-data-table th:nth-child(6) {
    width: 11%; /* Status */
}

#alertsContainer .m3-data-table th:nth-child(7) {
    width: 14%; /* Created */
    min-width: 180px;
}

#alertsContainer .m3-data-table th:nth-child(8) {
    width: 14%; /* Last Sent */
    min-width: 180px;
}

#alertsContainer .m3-data-table th:nth-child(9) {
    width: 14%; /* Last Checked */
    min-width: 180px;
}

#alertsContainer .m3-data-table th:nth-child(10) {
    width: 19%; /* Actions */
}

#alertsContainer .m3-data-table td {
    padding: var(--md-spacing-3);
    border-bottom: none;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

/* Add horizontal rule between alerts like the all lenders page - border below notes row */
#alertsContainer .m3-data-table tbody tr:not(.m3-alert-notes-row) {
    border-bottom: none;
}

#alertsContainer .m3-data-table tbody tr.m3-alert-notes-row {
    border-bottom: 1px solid #D0D0D0;
}

#alertsContainer .m3-data-table tbody tr:last-child {
    border-bottom: none;
}

/* Ensure Status and Actions columns align properly - remove left padding from badges/buttons so text aligns with header */
#alertsContainer .m3-data-table td:nth-child(6) .m3-status-badge {
    padding-left: 0;
    margin-left: 0;
    margin-right: 4px;
}

#alertsContainer .m3-data-table td:nth-child(6) .m3-status-badge:first-child {
    margin-left: 0;
}

#alertsContainer .m3-data-table td:nth-child(9) {
    /* Last Checked - keep on one line */
    white-space: nowrap;
    min-width: 180px;
}

#alertsContainer .m3-data-table td:nth-child(10) {
    /* Actions - keep buttons on one line */
    white-space: nowrap;
}

#alertsContainer .m3-data-table td:nth-child(10) .m3-button {
    padding-left: 0;
    margin-left: 0;
    margin-right: 4px;
}

#alertsContainer .m3-data-table td:nth-child(10) .m3-button:first-child {
    margin-left: 0;
}

#alertsContainer .m3-data-table td:nth-child(10) .m3-button:last-child {
    margin-right: 0;
}

/* Column widths for rates table (5 columns: Lender, Loan Product, Amount Range, Rate, APR) */
#ratesContainer .m3-data-table th:nth-child(1),
#ratesContainer .m3-data-table td:nth-child(1) {
    /* Lender */
    width: 25%;
    min-width: 200px;
    padding-left: var(--md-spacing-3);
    padding-right: var(--md-spacing-3);
}

#ratesContainer .m3-data-table th:nth-child(2),
#ratesContainer .m3-data-table td:nth-child(2) {
    /* Loan Product */
    width: 25%;
    min-width: 180px;
    padding-left: var(--md-spacing-3);
    padding-right: var(--md-spacing-3);
}

#ratesContainer .m3-data-table th:nth-child(3),
#ratesContainer .m3-data-table td:nth-child(3) {
    /* Amount Range */
    width: 20%;
    min-width: 140px;
    padding-left: var(--md-spacing-3);
    padding-right: var(--md-spacing-3);
}

#ratesContainer .m3-data-table th:nth-child(4),
#ratesContainer .m3-data-table td:nth-child(4) {
    /* Rate */
    width: 10%;
    min-width: 120px;
    padding-left: var(--md-spacing-2);
    padding-right: var(--md-spacing-2);
}

#ratesContainer .m3-data-table th:nth-child(5),
#ratesContainer .m3-data-table td:nth-child(5) {
    /* APR */
    width: 10%;
    min-width: 100px;
    padding-left: var(--md-spacing-2);
    padding-right: var(--md-spacing-2);
}

#ratesContainer .m3-data-table th:nth-child(6),
#ratesContainer .m3-data-table td:nth-child(6) {
    /* Chart */
    width: 10%;
    min-width: 90px;
    padding-left: var(--md-spacing-2);
    padding-right: var(--md-spacing-2);
    overflow: hidden;
}

/* Ensure text doesn't overflow in rates table */
#ratesContainer .m3-data-table td:nth-child(1),
#ratesContainer .m3-data-table td:nth-child(2),
#ratesContainer .m3-data-table td:nth-child(3) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#ratesContainer .m3-data-table td:nth-child(4),
#ratesContainer .m3-data-table td:nth-child(5),
#ratesContainer .m3-data-table td:nth-child(6) {
    white-space: nowrap;
    height: 46.5px;
    vertical-align: middle;
}

/* Change summary row styling - displayed between alert row and notes row */
#alertsContainer .m3-alert-change-summary-row {
    border-bottom: none;
}

#alertsContainer .m3-alert-change-summary-cell {
    padding: var(--md-spacing-2) var(--md-spacing-3);
    border-top: none;
    border-bottom: none;
    background-color: transparent;
}

#alertsContainer .m3-alert-change-summary-content {
    font-size: 12px;
    line-height: 1.4;
    color: var(--md-on-surface-variant);
    padding-left: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}

#alertsContainer .m3-alert-change-summary-text {
    color: var(--md-on-surface-variant);
}

#alertsContainer .m3-alert-failures-text {
    color: rgba(183, 28, 28, 0.87); /* Error color for failures */
    font-size: 12px;
    line-height: 1.4;
    flex-shrink: 0;
}

#alertsContainer .m3-alert-failures-text strong {
    color: rgba(183, 28, 28, 0.87);
    font-weight: 500;
}

/* Notes row styling - displayed underneath each alert row */
#alertsContainer .m3-alert-notes-cell {
    padding: var(--md-spacing-2) var(--md-spacing-3);
    border-top: none;
    border-bottom: none;
}

#alertsContainer .m3-alert-notes-content {
    font-size: 13px;
    line-height: 1.5;
    color: var(--md-on-surface-variant);
    padding-left: var(--md-spacing-2);
    border-left: 3px solid var(--md-primary);
    display: flex;
    align-items: center;
    gap: var(--md-spacing-1);
}

#alertsContainer .m3-alert-notes-content strong {
    color: var(--md-on-surface);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

#alertsContainer .m3-alert-notes-textarea {
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    overflow: hidden;
    border: 1px solid var(--md-outline-variant);
    border-radius: 4px;
    padding: var(--md-spacing-2);
    flex: 1;
    min-height: 20px;
    max-height: 200px;
    background-color: var(--md-surface);
    color: var(--md-on-surface);
    transition: border-color 0.2s ease;
}

#alertsContainer .m3-alert-notes-textarea:focus {
    outline: none;
    border-color: var(--md-primary);
    border-width: 2px;
}

#alertsContainer .m3-alert-notes-textarea::placeholder {
    color: var(--md-on-surface-variant);
    font-style: italic;
}


/* Keep all content on single line */
#alertsContainer .m3-data-table td:nth-child(1) {
    /* Email - keep on one line with ellipsis */
    white-space: nowrap;
}

#alertsContainer .m3-data-table td:nth-child(2) {
    /* Loan Product - keep on one line */
    white-space: nowrap;
}

#alertsContainer .m3-data-table td:nth-child(3) {
    /* Rate Threshold - keep on one line */
    white-space: nowrap;
}

#alertsContainer .m3-data-table td:nth-child(4) {
    /* Loan Amount - keep on one line */
    white-space: nowrap;
}

#alertsContainer .m3-data-table td:nth-child(5) {
    /* Loan Type - keep on one line */
    white-space: nowrap;
}

#alertsContainer .m3-data-table td:nth-child(6) {
    /* Status - keep on one line */
    white-space: nowrap;
}

#alertsContainer .m3-data-table td:nth-child(7) {
    /* Created - keep on one line */
    white-space: nowrap;
    min-width: 180px;
}

#alertsContainer .m3-data-table td:nth-child(8) {
    /* Last Alert Sent - keep on one line */
    white-space: nowrap;
    min-width: 180px;
}

#alertsContainer .m3-data-table td:nth-child(9) {
    /* Last Checked - keep on one line */
    white-space: nowrap;
    min-width: 180px;
}

#alertsContainer .m3-data-table td:nth-child(10) {
    /* Actions - keep buttons on one line */
    white-space: nowrap;
}

/* Override general row hover for alerts table - remove row hover */
#alertsContainer .m3-data-table tbody tr:hover {
    background: transparent !important;
}

/* Inline editing styles */
#alertsContainer .m3-editable-cell {
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease;
}

#alertsContainer .m3-editable-cell.m3-editing {
    padding: 0 !important;
    border-left: none;
    overflow: visible; /* Changed from hidden to visible for dropdown */
    position: relative;
    max-width: 100%;
    min-width: 0; /* Allow cell to shrink if needed */
}

/* Ensure multi-filter in inline editing maintains width */
#alertsContainer .m3-editable-cell.m3-editing .m3-multi-filter {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

#alertsContainer .m3-inline-edit-input {
    width: 100%;
    max-width: 100%;
    border: 2px solid var(--md-primary);
    border-radius: 4px;
    padding: var(--md-spacing-1) var(--md-spacing-2);
    font-family: inherit;
    font-size: 14px;
    background-color: var(--md-surface);
    color: var(--md-on-surface);
    outline: none;
    box-sizing: border-box;
    display: block;
    margin: 0;
    min-width: 0;
}

#alertsContainer .m3-inline-edit-input:focus {
    outline: none;
    border-color: var(--md-primary);
    border-width: 2px;
}

/* Link hover effects for admin page - match main and all lenders pages */
#alertsContainer .m3-data-table a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

#alertsContainer .m3-data-table a:hover {
    color: #1976D2;
    text-decoration: underline;
}

/* Button hover effects for admin page Actions column - match link hover effects */
#alertsContainer .m3-data-table .m3-button--text {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
    background: transparent;
    border: none;
}

#alertsContainer .m3-data-table .m3-button--text:hover {
    color: #1976D2 !important;
    text-decoration: underline;
    background: transparent;
}

/* Alerts Stats Bar */
#alertsStatsBar {
    display: flex;
    gap: var(--md-spacing-3);
    flex-wrap: wrap;
    padding: var(--md-spacing-2);
    background-color: var(--md-surface);
    border-radius: 8px;
    border: 1px solid var(--md-outline-variant);
}



/* Responsive adjustments for alerts table */
@media (max-width: 960px) {
    #alertsContainer .m3-data-table {
        font-size: 14px;
    }
    
    #alertsContainer .m3-data-table th,
    #alertsContainer .m3-data-table td {
        padding: 8px;
    }
    
    #alertsContainer .m3-data-table td:last-child {
        white-space: normal;
    }
    
    .m3-status-badge {
        font-size: 11px;
        padding: 3px 6px;
    }
}

/* Alert Logs Modal */
.m3-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
}

.m3-dialog__container {
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    margin: 16px;
}

.m3-dialog__surface {
    background: var(--md-surface);
    border-radius: 4px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.m3-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--md-outline-variant);
}

.m3-dialog__header h2 {
    margin: 0;
    color: var(--md-on-surface);
}

.m3-dialog__content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

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

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

.m3-icon-button:hover {
    background: var(--md-surface-variant);
}

/* ============================================================================
   FOOTER STYLING
   ============================================================================ */

.m3-footer {
    background: var(--md-surface-container);
    color: var(--md-on-surface);
    padding: var(--md-spacing-3) var(--md-spacing-4);
    text-align: center;
    flex: 0 0 auto;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.m3-footer__content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--md-spacing-2);
    flex-wrap: wrap;
}

.m3-footer__copyright {
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
    letter-spacing: 0.4px;
    color: var(--md-on-surface);
}

.m3-footer__separator {
    font-size: 12px;
    color: var(--md-on-surface);
    opacity: 0.6;
}

.m3-footer__link {
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
    letter-spacing: 0.4px;
    color: var(--md-on-surface);
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
}

.m3-footer__link:hover {
    color: #1976D2;
    text-decoration: underline;
}

/* Disclaimer Snackbar - Larger width for comprehensive text */
.m3-snackbar--disclaimer {
    max-width: 800px;
}

.m3-snackbar--disclaimer .m3-snackbar__surface {
    max-height: 400px;
    overflow-y: auto;
}

.m3-snackbar--disclaimer .m3-snackbar__label {
    white-space: normal;
    line-height: 1.5;
}

/* Responsive footer */
@media (max-width: 960px) {
    .m3-footer {
        padding: var(--md-spacing-2) var(--md-spacing-3);
    }
    
    .m3-snackbar--disclaimer {
        max-width: calc(100% - 32px);
        left: var(--md-spacing-2);
        right: var(--md-spacing-2);
    }
}
