/* ===== Design Tokens ===== */
:root {
    /* Primary Colors - Copper */
    --primary-color: #C56B2F;
    --primary-hover: #A75423;
    --primary-light: #F5E1D2;
    --primary-disabled: rgba(197, 107, 47, 0.35);

    /* Secondary Accent - Deep Teal */
    --accent-color: #2F7A6D;
    --accent-hover: #256356;
    --accent-light: #D9ECE7;

    /* Text Colors - Ink & Slate */
    --text-primary: #1B1C20;
    --text-secondary: #3E4752;
    --text-tertiary: #6B7582;
    --text-muted: #9AA3AE;
    --text-white: #FDFBF7;

    /* Background Colors - Warm Paper */
    --bg-body: #F6F1E8;
    --bg-input: #FBF7F0;
    --bg-card: #FFFCF7;
    --bg-sidebar: #14171D;
    --bg-hover: #F0E7DA;
    --bg-surface-muted: #F3EBDD;
    --bg-surface-elevated: #FFFCF7;

    /* Background Layers */
    --bg-body-gradient:
        radial-gradient(circle at 12% 12%, rgba(197, 107, 47, 0.12), transparent 45%),
        radial-gradient(circle at 88% 8%, rgba(47, 122, 109, 0.12), transparent 40%),
        linear-gradient(180deg, #F7F1E7 0%, #F2E7D8 100%);

    /* Border Colors - Soft Clay */
    --border-color: #E3D4C1;
    --border-light: #F1E7D7;
    --border-focus: #C56B2F;

    /* Semantic Colors */
    --success-color: #1E8A67;
    --warning-color: #B7791F;
    --error-color: #C2413C;
    --info-color: #2C6FBF;

    --status-success-bg: #E3F3EE;
    --status-warning-bg: #F8EED7;
    --status-critical-bg: #F7E3E0;
    --status-info-bg: #E3ECF7;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;

    /* Border Radius - Softened */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Shadows - Warm, diffused */
    --shadow-xs: 0 1px 2px rgba(27, 28, 32, 0.06);
    --shadow-sm: 0 2px 6px rgba(27, 28, 32, 0.08);
    --shadow-md: 0 8px 20px rgba(27, 28, 32, 0.08);
    --shadow-lg: 0 16px 32px rgba(27, 28, 32, 0.12);
    --shadow-dropdown: 0 16px 32px rgba(27, 28, 32, 0.18);
    --shadow-card: 0 6px 16px rgba(27, 28, 32, 0.08);
    --shadow-card-hover: 0 12px 24px rgba(27, 28, 32, 0.12);

    /* App Bar */
    --appbar-bg: rgba(255, 252, 247, 0.9);
    --appbar-shadow: 0 6px 18px rgba(27, 28, 32, 0.06);
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --error-ui-shadow: 0 -8px 24px rgba(27, 28, 32, 0.12);

    /* Selection */
    --selection-bg: var(--accent-light);
    --selection-text: var(--text-primary);

    /* Tap Highlight */
    --tap-highlight: rgba(197, 107, 47, 0.2);

    /* Focus Rings */
    --focus-ring-primary: rgba(197, 107, 47, 0.18);
    --focus-ring-secondary: rgba(47, 122, 109, 0.18);

    /* Login Surfaces */
    --login-card-bg: rgba(255, 252, 247, 0.94);
    --login-bg-gradient:
        radial-gradient(circle at 18% 22%, rgba(197, 107, 47, 0.16), transparent 42%),
        radial-gradient(circle at 82% 0%, rgba(47, 122, 109, 0.14), transparent 45%),
        var(--bg-body);
    --employee-login-bg-gradient:
        radial-gradient(circle at 18% 22%, rgba(47, 122, 109, 0.16), transparent 42%),
        radial-gradient(circle at 82% 0%, rgba(44, 111, 191, 0.12), transparent 45%),
        var(--bg-body);

    /* Typography */
    --font-family: "Hanken Grotesk", "Helvetica Neue", "Noto Sans", sans-serif;
    --font-family-display: "Fraunces", "Noto Serif", "Iowan Old Style", "Palatino", serif;
    --font-size-xs: 12px;
    --font-size-sm: 13px;
    --font-size-base: 15px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 26px;
    --font-size-3xl: 32px;
    --font-size-4xl: 40px;

    /* Font Weights */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Line Heights */
    --line-height-tight: 1.2;
    --line-height-normal: 1.6;
    --line-height-relaxed: 1.75;

    /* Letter Spacing */
    --tracking-tight: -0.02em;
    --tracking-normal: 0;
    --tracking-wide: 0.03em;
    --tracking-wider: 0.06em;
    --tracking-widest: 0.12em;

    /* Transitions */
    --transition-fast: 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-normal: 240ms cubic-bezier(0.2, 0.8, 0.2, 1);

    /* Z-Index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 300;
    --z-tooltip: 400;
}

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

    /* Primary Colors - Copper */
    --primary-color: #D8874E;
    --primary-hover: #C56B2F;
    --primary-light: #3B2416;
    --primary-disabled: rgba(216, 135, 78, 0.35);

    /* Secondary Accent - Deep Teal */
    --accent-color: #3FA391;
    --accent-hover: #2F7A6D;
    --accent-light: #1C3A34;

    /* Text Colors - Porcelain */
    --text-primary: #F7F3ED;
    --text-secondary: #C6D0DA;
    --text-tertiary: #9AA6B3;
    --text-muted: #7A8696;
    --text-white: #F7F3ED;

    /* Background Colors - Inked Paper */
    --bg-body: #0F1216;
    --bg-input: #171C23;
    --bg-card: #151A22;
    --bg-sidebar: #0E1116;
    --bg-hover: #1E2531;
    --bg-surface-muted: #1A2029;
    --bg-surface-elevated: #1B222C;

    /* Background Layers */
    --bg-body-gradient:
        radial-gradient(circle at 12% 12%, rgba(216, 135, 78, 0.14), transparent 45%),
        radial-gradient(circle at 88% 8%, rgba(63, 163, 145, 0.14), transparent 40%),
        linear-gradient(180deg, #0E1116 0%, #111823 100%);

    /* Border Colors - Graphite */
    --border-color: #2A303A;
    --border-light: #1E242D;
    --border-focus: #D8874E;

    /* Semantic Colors */
    --success-color: #2FB68E;
    --warning-color: #D39A3A;
    --error-color: #E07C76;
    --info-color: #5C9BE4;

    --status-success-bg: #132D25;
    --status-warning-bg: #3A2B16;
    --status-critical-bg: #3A1F1D;
    --status-info-bg: #1B2C46;

    /* Shadows - Deep */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.5);
    --shadow-dropdown: 0 18px 40px rgba(0, 0, 0, 0.55);
    --shadow-card: 0 8px 18px rgba(0, 0, 0, 0.45);
    --shadow-card-hover: 0 14px 28px rgba(0, 0, 0, 0.55);

    /* App Bar */
    --appbar-bg: rgba(15, 18, 22, 0.9);
    --appbar-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --error-ui-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5);

    /* Selection */
    --selection-bg: rgba(63, 163, 145, 0.35);
    --selection-text: #F7F3ED;

    /* Tap Highlight */
    --tap-highlight: rgba(216, 135, 78, 0.35);

    /* Focus Rings */
    --focus-ring-primary: rgba(216, 135, 78, 0.3);
    --focus-ring-secondary: rgba(63, 163, 145, 0.3);

    /* Login Surfaces */
    --login-card-bg: rgba(21, 26, 34, 0.94);
    --login-bg-gradient:
        radial-gradient(circle at 18% 22%, rgba(216, 135, 78, 0.18), transparent 42%),
        radial-gradient(circle at 82% 0%, rgba(63, 163, 145, 0.16), transparent 45%),
        var(--bg-body);
    --employee-login-bg-gradient:
        radial-gradient(circle at 18% 22%, rgba(63, 163, 145, 0.18), transparent 42%),
        radial-gradient(circle at 82% 0%, rgba(92, 149, 221, 0.14), transparent 45%),
        var(--bg-body);
}

/* ===== Base Styles ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

input,
button,
textarea,
select {
    font-family: inherit;
}

html,
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background-color: var(--bg-body);
    margin: 0;
    padding: 0;
    line-height: var(--line-height-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-family-display);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
    margin: 0;
}

body {
    background-color: var(--bg-body);
    background-image: var(--bg-body-gradient);
    background-attachment: fixed;
}

::selection {
    background-color: var(--selection-bg);
    color: var(--selection-text);
}

/* ===== Links ===== */
a,
.btn-link {
    color: var(--accent-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover,
.btn-link:hover {
    color: var(--accent-hover);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    background: transparent;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    color: white;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 6px 14px rgba(197, 107, 47, 0.22);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 10px 20px rgba(197, 107, 47, 0.28);
    transform: translateY(-1px);
}

.btn-secondary {
    color: var(--text-primary);
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-surface-muted);
    border-color: var(--border-focus);
}

.btn-ghost {
    color: var(--text-secondary);
    background-color: transparent;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light), 0 0 0 1px var(--primary-color);
}

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

/* ===== Form Controls ===== */
.form-control {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    font-size: var(--font-size-base);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary-color);
    background-color: var(--bg-card);
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

.form-label {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

/* ===== Date Picker ===== */
.date-control {
    min-width: 180px;
}

.date-control .mud-input-root {
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0 6px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.date-control .mud-input-root:hover {
    border-color: var(--border-focus);
    background: var(--bg-surface-muted);
}

.date-control .mud-input-root.mud-input-root-focused {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--focus-ring-primary);
    background: var(--bg-card);
}

.date-control input {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.02em;
}

.date-control .mud-input-adornment .mud-icon-root {
    color: var(--accent-color);
}

.mud-picker-popover-paper {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-dropdown);
    background: var(--bg-card);
    overflow: hidden;
}

.mud-picker-datepicker-toolbar {
    background: linear-gradient(135deg, rgba(197, 107, 47, 0.92), rgba(47, 122, 109, 0.9));
    color: #fff;
}

.mud-picker-datepicker-toolbar .mud-button-root {
    color: #fff;
}

.mud-picker-calendar {
    padding: 8px 12px 12px;
}

.mud-picker-calendar-week {
    color: var(--text-tertiary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.08em;
}

.mud-picker-calendar .mud-day {
    border-radius: 12px;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.mud-picker-calendar .mud-day:hover {
    background: var(--bg-hover);
}

.mud-picker-calendar .mud-day.mud-current {
    border: 1px solid var(--accent-color);
}

.mud-picker-calendar .mud-day.mud-selected {
    background: var(--primary-color);
    color: #fff;
}

/* ===== Content Area ===== */
.content {
    padding: var(--spacing-lg);
}

/* ===== Focus States ===== */
h1:focus {
    outline: none;
}

/* ===== Form Validation ===== */
.valid.modified:not([type=checkbox]) {
    outline: none;
    border-color: var(--success-color);
}

.invalid {
    outline: none;
    border-color: var(--error-color);
}

.validation-message {
    color: var(--error-color);
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-xs);
}

/* ===== Error Boundary ===== */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, var(--error-color);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: var(--radius-md);
}

.blazor-error-boundary::after {
    content: var(--error-boundary-text, "An error has occurred.");
}

/* ===== Checkbox Styles ===== */
.darker-border-checkbox.form-check-input {
    border-color: var(--border-light);
}

/* ===== Floating Labels ===== */
.form-floating>.form-control-plaintext::placeholder,
.form-floating>.form-control::placeholder {
    color: var(--text-tertiary);
    text-align: end;
}

.form-floating>.form-control-plaintext:focus::placeholder,
.form-floating>.form-control:focus::placeholder {
    text-align: start;
}

/* ===== Card Styles ===== */
/* ===== Card Styles ===== */
.card-professional {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    /* Minimal shadow */
    transition: box-shadow var(--transition-fast);
}

.card-professional:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-focus);
}

/* ===== Tables ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-card);
}

.table th,
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
    text-align: left;
    vertical-align: middle;
}

.table thead th {
    background-color: transparent;
    color: var(--text-tertiary);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    border-bottom: 1px solid var(--border-color);
}

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

.table tbody tr:hover {
    background-color: var(--bg-surface-muted);
}

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

/* ===== MudBlazor Table Overrides ===== */
/* Prevent vertical scroll on expandable tables */
.table-card .mud-table-container {
    overflow-y: visible !important;
    max-height: none !important;
}

.table-card .mud-table-root {
    overflow: visible !important;
}

@media (hover: hover) and (pointer: fine) {
    .mud-table-hover .mud-table-container .mud-table-root .mud-table-body .mud-table-row:hover {
        background-color: transparent !important;
    }
}

/* ===== Utility Classes ===== */
.text-primary-blue {
    color: var(--primary-color);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-tertiary);
}

.bg-light-blue {
    background-color: var(--primary-light);
}

.bg-surface {
    background-color: var(--bg-body);
}

.rounded-md {
    border-radius: var(--radius-md);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

/* ===== Page Title Styles ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.page-title {
    font-family: var(--font-family-display);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
    margin: 0;
    line-height: var(--line-height-tight);
}

.page-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    margin-top: 4px;
}

.page-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.page-container,
.manager-dashboard {
    animation: page-enter 400ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes page-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

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

    .page-container,
    .manager-dashboard {
        animation: none;
    }
}

/* ===== Section Headers ===== */
.section-header {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-md);
}

/* ===== Status Badges ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    gap: 6px;
}

.status-success {
    background-color: var(--status-success-bg);
    color: var(--success-color);
}

.status-warning {
    background-color: var(--status-warning-bg);
    color: var(--warning-color);
}

.status-error {
    background-color: var(--status-critical-bg);
    color: var(--error-color);
}

.status-info {
    background-color: var(--status-info-bg);
    color: var(--info-color);
}

/* ===== Avatar Styles ===== */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
}

.avatar-sm {
    width: 32px;
    height: 32px;
}

.avatar-md {
    width: 40px;
    height: 40px;
}

.avatar-lg {
    width: 48px;
    height: 48px;
}

/* ===== KPI Card Icon Styles ===== */
.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon-primary {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.kpi-icon-success {
    background-color: var(--status-success-bg);
    color: var(--success-color);
}

.kpi-icon-warning {
    background-color: var(--status-warning-bg);
    color: var(--warning-color);
}

.kpi-icon-error {
    background-color: var(--status-critical-bg);
    color: var(--error-color);
}

.kpi-icon-info {
    background-color: var(--status-info-bg);
    color: var(--info-color);
}

.kpi-icon-accent {
    background-color: var(--accent-light);
    color: var(--accent-color);
}

/* ===== Layout & Sidebar ===== */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
}

.sidebar {
    background-color: var(--bg-sidebar);
    color: var(--text-white);
}

.top-row {
    background-color: var(--bg-surface-elevated);
    border-bottom: 1px solid var(--border-color);
    justify-content: flex-end;
    height: 3.5rem;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

.logo-icon {
    overflow: hidden;
}

.logo-icon img {
    width: 100%;
    height: 100%;
}

@media (min-width: 641px) {
    .page {
        flex-direction: row;
        height: 100vh;
    }

    .sidebar {
        width: 260px;
        /* Match MainLayout */
        height: 100vh;
        position: sticky;
        top: 0;
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
    }

    .top-row {
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    main {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }

    .content {
        padding-top: 1.1rem;
    }
}

/* ===== NavMenu ===== */
.sidebar-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: .75rem 0;
    font-weight: 600;
    color: white;
    font-size: 1.1rem;
}

.nav-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    display: block;
    padding: 0 1.5rem 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.5rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.02);
}

.nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
    border-left-color: var(--accent-light);
    /* Minimal marker */
}

.nav-icon {
    margin-right: 0.75rem;
    width: 20px;
    display: flex;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    opacity: 1;
    color: var(--accent-light);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.logout-button {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.6rem 0.5rem;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.logout-button:hover {
    color: var(--error-color);
    background-color: rgba(239, 68, 68, 0.1);
}

/* =====================================================
   MOBILE RESPONSIVE STYLES
   ===================================================== */

/* ===== Mobile Base Adjustments ===== */
@media (max-width: 640px) {
    /* Root font size for mobile */
    html {
        font-size: 14px;
    }

    /* Body background simplified for mobile performance */
    body {
        background-attachment: scroll;
    }

    /* ===== Layout - Mobile Stack ===== */
    .page {
        flex-direction: column;
        min-height: 100dvh;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: var(--z-modal);
        height: auto;
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    main {
        margin-top: 70px; /* Account for collapsed sidebar header */
        min-height: calc(100dvh - 70px);
    }

    /* ===== Content Area - Mobile ===== */
    .content {
        padding: var(--spacing-md);
        padding-bottom: var(--spacing-xl);
    }

    /* ===== Page Headers - Mobile ===== */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
    }

    .page-title {
        font-size: var(--font-size-xl);
        line-height: 1.3;
    }

    .page-subtitle {
        font-size: var(--font-size-xs);
    }

    .page-container {
        padding: 0;
    }

    /* ===== Buttons - Mobile Touch Targets ===== */
    .btn {
        padding: 12px 18px;
        min-height: 44px; /* iOS touch target */
        font-size: var(--font-size-sm);
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    /* ===== Forms - Mobile ===== */
    .form-control {
        padding: 12px 14px;
        font-size: 16px; /* Prevent iOS zoom */
        min-height: 44px;
    }

    .form-label {
        font-size: var(--font-size-sm);
    }

    /* ===== Cards - Mobile ===== */
    .card-professional {
        border-radius: var(--radius-md);
        margin: 0 calc(-1 * var(--spacing-md));
        border-left: none;
        border-right: none;
        border-radius: 0;
    }

    /* ===== Tables - Mobile Responsive ===== */
    .table {
        display: block;
        width: 100%;
    }

    .table thead {
        display: none; /* Hide headers on mobile */
    }

    .table tbody {
        display: block;
    }

    .table tbody tr {
        display: flex;
        flex-direction: column;
        padding: var(--spacing-md);
        border-bottom: 1px solid var(--border-color);
        gap: var(--spacing-sm);
    }

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

    .table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 6px 0;
        border-bottom: none;
        font-size: var(--font-size-sm);
    }

    .table td::before {
        content: attr(data-label);
        font-weight: var(--font-weight-medium);
        color: var(--text-tertiary);
        font-size: var(--font-size-xs);
        text-transform: uppercase;
        letter-spacing: var(--tracking-wide);
        flex-shrink: 0;
        margin-right: var(--spacing-md);
    }

    /* ===== Status Badges - Mobile ===== */
    .status-badge {
        padding: 3px 8px;
        font-size: 11px;
    }

    /* ===== Avatar - Mobile ===== */
    .avatar-sm {
        width: 28px;
        height: 28px;
    }

    .avatar-md {
        width: 36px;
        height: 36px;
    }

    /* ===== KPI Icons - Mobile ===== */
    .kpi-icon {
        width: 36px;
        height: 36px;
    }

    /* ===== Section Headers - Mobile ===== */
    .section-header {
        font-size: 11px;
        margin-bottom: var(--spacing-sm);
    }
}

/* ===== Tablet Breakpoint ===== */
@media (min-width: 641px) and (max-width: 1024px) {
    .content {
        padding: var(--spacing-lg);
    }

    .page-title {
        font-size: var(--font-size-2xl);
    }

    /* Grid adjustments for tablet */
    .page-container {
        max-width: 100%;
    }
}

/* =====================================================
   MUDBLAZOR MOBILE OVERRIDES
   ===================================================== */

@media (max-width: 640px) {
    /* ===== MudGrid - Mobile ===== */
    .mud-grid {
        margin: 0 !important;
    }

    .mud-grid > .mud-grid-item {
        padding: var(--spacing-sm) 0 !important;
    }

    /* ===== MudPaper - Mobile ===== */
    .mud-paper {
        border-radius: var(--radius-md);
    }

    /* ===== MudButton - Mobile Touch Targets ===== */
    .mud-button {
        min-height: 44px;
    }

    .mud-button-root.mud-button-filled {
        padding: 10px 16px;
    }

    .mud-icon-button {
        min-width: 44px;
        min-height: 44px;
    }

    /* ===== MudTable - Mobile Card Layout ===== */
    .mud-table {
        background: transparent;
    }

    .mud-table .mud-table-container {
        overflow-x: visible;
    }

    .mud-table-root {
        display: block;
    }

    .mud-table-head {
        display: none;
    }

    .mud-table-body {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .mud-table-body .mud-table-row {
        display: flex;
        flex-direction: column;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: var(--spacing-md);
        margin: 0;
    }

    .mud-table-body .mud-table-row td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-light);
        background: transparent !important;
    }

    .mud-table-body .mud-table-row td:last-child {
        border-bottom: none;
        padding-top: var(--spacing-md);
    }

    .mud-table-body .mud-table-row td::before {
        content: attr(data-label);
        font-weight: var(--font-weight-medium);
        color: var(--text-tertiary);
        font-size: var(--font-size-xs);
        text-transform: uppercase;
        letter-spacing: var(--tracking-wide);
        flex: 0 0 40%;
    }

    /* Hide expand buttons on mobile for cleaner look */
    .mud-table-body .mud-table-row td:first-child {
        display: none;
    }

    /* ===== MudDialog - Mobile Fullscreen ===== */
    .mud-dialog {
        margin: 0;
        max-height: 100dvh;
        max-width: 100vw !important;
        width: 100vw;
        border-radius: 0;
    }

    .mud-dialog-content {
        padding: var(--spacing-md);
    }

    .mud-dialog-actions {
        padding: var(--spacing-md);
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .mud-dialog-actions .mud-button {
        width: 100%;
    }

    /* ===== MudTextField - Mobile ===== */
    .mud-input-control {
        margin-bottom: var(--spacing-md);
    }

    .mud-input {
        font-size: 16px !important; /* Prevent iOS zoom */
    }

    .mud-input-slot {
        min-height: 44px;
    }

    /* ===== MudSelect - Mobile ===== */
    .mud-select {
        font-size: 16px !important;
    }

    /* ===== MudChip - Mobile ===== */
    .mud-chip {
        font-size: 11px;
        height: auto;
        min-height: 24px;
        padding: 4px 8px;
    }

    .mud-chip .mud-chip-content {
        padding: 0;
    }

    /* ===== MudCard - Mobile ===== */
    .mud-card {
        border-radius: var(--radius-md);
    }

    .mud-card-header {
        padding: var(--spacing-md);
    }

    .mud-card-content {
        padding: var(--spacing-md);
    }

    /* ===== MudAvatar - Mobile ===== */
    .mud-avatar {
        font-size: 12px;
    }

    /* ===== MudProgressLinear - Mobile ===== */
    .mud-progress-linear {
        height: 4px;
        border-radius: var(--radius-full);
    }

    /* ===== MudSnackbar - Mobile ===== */
    .mud-snackbar {
        bottom: var(--spacing-md) !important;
        left: var(--spacing-md) !important;
        right: var(--spacing-md) !important;
        max-width: none;
    }

    /* ===== MudTooltip - Disable on Mobile ===== */
    .mud-tooltip {
        display: none !important;
    }

    /* ===== MudChart - Mobile ===== */
    .mud-chart {
        max-width: 100%;
        overflow: hidden;
    }

    .mud-chart svg {
        max-width: 100%;
        height: auto !important;
    }
}

/* =====================================================
   PAGE-SPECIFIC MOBILE STYLES
   ===================================================== */

@media (max-width: 640px) {
    /* ===== Dashboard Page - Mobile ===== */
    .manager-dashboard {
        padding: 0;
    }

    .header-section {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
    }

    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-sm);
    }

    .brand-title {
        font-size: 22px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .kpi-card {
        padding: var(--spacing-md);
        flex-direction: row;
        align-items: center;
    }

    .kpi-icon {
        width: 44px;
        height: 44px;
    }

    .kpi-value {
        font-size: 22px;
    }

    .kpi-label {
        font-size: 10px;
    }

    .kpi-description {
        font-size: var(--font-size-xs);
    }

    .section-title {
        font-size: var(--font-size-md);
        margin: var(--spacing-lg) 0 var(--spacing-md);
    }

    /* ===== Alert Cards - Mobile ===== */
    .alert-card {
        padding: var(--spacing-md);
        border-radius: var(--radius-md);
    }

    /* ===== Team Cards - Mobile ===== */
    .team-card {
        border-radius: var(--radius-md);
    }

    /* ===== Table Card - Mobile ===== */
    .table-card {
        border-radius: var(--radius-md);
        margin: 0 calc(-1 * var(--spacing-md));
        border-left: none;
        border-right: none;
        border-radius: 0;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
        padding: var(--spacing-md);
        gap: var(--spacing-sm);
    }

    .table-filters {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .table-filters .mud-button {
        flex: 1;
        min-width: 80px;
    }

    /* ===== Employee Cell - Mobile ===== */
    .employee-cell {
        flex-direction: row;
        gap: var(--spacing-sm);
    }

    .employee-meta {
        min-width: 0;
        flex: 1;
    }

    /* ===== Report Cell - Mobile ===== */
    .report-cell,
    .code-cell {
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }

    /* ===== Integrity Cell - Mobile ===== */
    .integrity-cell {
        min-width: 100px;
        width: 100%;
        max-width: 150px;
    }

    /* ===== Detail Row - Mobile ===== */
    .detail-row {
        padding: var(--spacing-md);
    }

    .detail-row .mud-grid {
        flex-direction: column;
    }

    .detail-row .mud-grid-item {
        width: 100% !important;
        max-width: 100% !important;
        flex-basis: 100% !important;
    }

    .detail-card {
        padding: var(--spacing-sm);
    }

    .detail-metrics {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .activity-item {
        padding: var(--spacing-sm);
    }

    /* ===== Analytics Page - Mobile ===== */
    .stat-card {
        padding: var(--spacing-md);
    }

    .stat-icon {
        width: 44px;
        height: 44px;
    }

    .chart-card {
        border-radius: var(--radius-md);
    }

    .chart-header {
        flex-direction: column;
        align-items: stretch;
        padding: var(--spacing-md);
        gap: var(--spacing-sm);
    }

    .chart-content {
        padding: var(--spacing-md);
        overflow-x: auto;
    }

    .pie-chart {
        min-height: 220px;
    }

    .insight-card {
        border-radius: var(--radius-md);
    }

    .card-header {
        padding: var(--spacing-md);
    }

    .insight-content {
        padding: var(--spacing-md);
    }

    .insight-item {
        gap: var(--spacing-sm);
    }

    .reports-card {
        border-radius: var(--radius-md);
        margin: 0 calc(-1 * var(--spacing-md));
        border-left: none;
        border-right: none;
        border-radius: 0;
    }

    .summary-text {
        max-width: 200px;
        font-size: var(--font-size-xs);
    }

    /* ===== No Data State - Mobile ===== */
    .no-data {
        padding: var(--spacing-xl);
    }

    .no-records {
        padding: var(--spacing-xl) var(--spacing-md);
    }

    .empty-state {
        padding: var(--spacing-lg);
    }

    /* ===== Employees Page - Mobile ===== */
    .phone-cell {
        font-size: var(--font-size-xs);
    }

    .name-cell {
        flex-direction: row;
    }

    .integration-cell {
        gap: 4px;
    }

    .integration-item {
        gap: 4px;
    }

    .action-buttons {
        justify-content: flex-end;
        gap: var(--spacing-xs);
    }

    .action-buttons .mud-icon-button {
        min-width: 40px;
        min-height: 40px;
    }
}

/* =====================================================
   TOUCH DEVICE OPTIMIZATIONS
   ===================================================== */

@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .btn:hover,
    .card-professional:hover,
    .kpi-card:hover,
    .table tbody tr:hover,
    .nav-link:hover {
        transform: none;
    }

    /* Larger touch targets */
    .nav-link {
        padding: 14px 16px;
        min-height: 48px;
    }

    .logout-button {
        padding: 14px 16px;
        min-height: 48px;
    }

    /* Tap highlight for feedback */
    .btn,
    .nav-link,
    .mud-button,
    .mud-icon-button {
    -webkit-tap-highlight-color: var(--tap-highlight);
    }
}

/* =====================================================
   LANDSCAPE MOBILE
   ===================================================== */

@media (max-width: 896px) and (orientation: landscape) {
    .sidebar {
        height: auto;
        max-height: 60px;
    }

    main {
        margin-top: 60px;
    }

    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .mud-dialog {
        max-height: 100dvh;
        overflow-y: auto;
    }
}

/* =====================================================
   SAFE AREA INSETS (iPhone X and later)
   ===================================================== */

@supports (padding: max(0px)) {
    .sidebar {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    .content {
        padding-left: max(var(--spacing-md), env(safe-area-inset-left));
        padding-right: max(var(--spacing-md), env(safe-area-inset-right));
        padding-bottom: max(var(--spacing-xl), env(safe-area-inset-bottom));
    }

    .mud-dialog {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mud-snackbar {
        bottom: max(var(--spacing-md), env(safe-area-inset-bottom)) !important;
    }
}

/* =====================================================
   PRINT STYLES (for completeness)
   ===================================================== */

@media print {
    .sidebar,
    .top-row,
    .navbar-toggler,
    .mud-snackbar,
    .action-buttons {
        display: none !important;
    }

    .page {
        flex-direction: column;
    }

    main {
        margin-top: 0;
    }

    .content {
        padding: 0;
    }

    .card-professional,
    .table-card,
    .chart-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
