/* CSS Variables for Semi-Dark Green and Crisp White Color Scheme */
:root {
    --color-vibrant-blue: #2d6a4f;
    --color-vibrant-blue-rgb: 45, 106, 79;
    --color-vibrant-blue-dark: #1b4332;
    --color-vibrant-blue-hover: #1b4332;
    --color-crisp-white: #FFFFFF;
    --color-crisp-white-rgb: 255, 255, 255;
    --color-dark-text: #1a1a1a;
    --color-light-text: #ffffff;
    --color-subtle-border: rgba(45, 106, 79, 0.1);
    --color-border-light: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--color-dark-text);
    background-color: var(--color-crisp-white);
    /* Prevent pull-to-refresh on iOS */
    overscroll-behavior-y: contain;
    /* Performance optimizations */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* Prevent text size adjustment on mobile */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Safe area insets for iOS notch */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
    /* Fallback background color */
    background-color: var(--color-crisp-white);
    /* Ensure content is above background */
    z-index: 1;
}

.login-container {
    background: var(--color-crisp-white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    color: #333;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #333;
    -webkit-text-fill-color: #333;
}

.login-container label {
    color: #555;
    -webkit-text-fill-color: #555;
}

.login-container input {
    color: #333;
    -webkit-text-fill-color: #333;
    background-color: var(--color-crisp-white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.login-container input::placeholder {
    color: #999;
    opacity: 1;
    -webkit-text-fill-color: #999;
}

.login-container input:hover {
    border-color: var(--color-vibrant-blue);
    box-shadow: 0 2px 8px rgba(45, 106, 79, 0.1);
}

.login-container input:focus {
    border-color: var(--color-vibrant-blue);
    box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.15), 0 4px 12px rgba(45, 106, 79, 0.2);
    transform: translateY(-1px);
    background-color: var(--color-crisp-white);
}

.login-container input:focus::placeholder {
    color: #bbb;
    -webkit-text-fill-color: #bbb;
}

.login-container button {
    color: var(--color-crisp-white);
    -webkit-text-fill-color: var(--color-crisp-white);
}

.login-container .error-message {
    color: #dc3545;
    -webkit-text-fill-color: #dc3545;
}

.navbar {
    background: var(--color-vibrant-blue);
    color: var(--color-crisp-white);
    padding: 1rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
}

.nav-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    justify-content: space-between;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    width: 44px;
    height: 44px;
    justify-content: space-around;
    align-items: center;
    z-index: 1001;
    touch-action: manipulation;
}

.menu-toggle span {
    width: 24px;
    height: 3px;
    background-color: var(--color-crisp-white);
    border-radius: 2px;
    transition: all 0.3s ease;
    display: block;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}


.nav-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.voice-btn-global {
    position: relative;
    z-index: 100;
    background: #ffffff;
    border: 2px solid #e53935;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.voice-btn-global .voice-btn-icon {
    width: 24px;
    height: 24px;
    color: #c62828;
    stroke: #c62828;
}

.voice-btn-global:hover,
.voice-btn-global:active {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.5);
    background: #fff5f5;
}

.voice-btn-global:hover .voice-btn-icon,
.voice-btn-global:active .voice-btn-icon {
    color: #b71c1c;
    stroke: #b71c1c;
}

.voice-btn-global.listening {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    border-color: #1976D2;
    box-shadow: 0 4px 16px rgba(33, 150, 243, 0.5);
    animation: pulse 1.5s ease-in-out infinite;
}

.voice-btn-global.listening .voice-btn-icon {
    color: var(--color-crisp-white);
    stroke: var(--color-crisp-white);
}

.voice-btn-global.error {
    background: #ffebee;
    border-color: #c62828;
}

.voice-btn-global.error .voice-btn-icon {
    color: #b71c1c;
    stroke: #b71c1c;
}

.voice-btn-global.disabled {
    opacity: 0.6;
    border-color: #ef9a9a;
}

.voice-btn-global.disabled .voice-btn-icon {
    color: #e57373;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.45rem;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-menu > li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.nav-group-toggle {
    background: transparent;
    border: none;
    color: var(--color-crisp-white);
    text-decoration: none;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 36px;
    touch-action: manipulation;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.nav-group-toggle:hover,
.nav-group-toggle:active {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--color-crisp-white);
}

.nav-group-toggle[aria-expanded="true"] {
    background-color: rgba(255, 255, 255, 0.22);
    font-weight: 600;
}

.nav-arrow {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    display: inline-block;
}

.nav-group-toggle[aria-expanded="true"] .nav-arrow {
    transform: rotate(180deg);
}

.nav-group-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.nav-group-toggle[aria-expanded="true"] + .nav-group-list {
    max-height: 500px;
    padding-top: 0.5rem;
}

.nav-group[aria-expanded="true"] .nav-group-list {
    max-height: 500px;
    padding-top: 0.5rem;
}

@media (min-width: 769px) {
    .nav-group-toggle[aria-expanded="true"] + .nav-group-list,
    .nav-group[aria-expanded="true"] .nav-group-list {
        max-height: 500px;
        padding: 0.5rem;
        overflow: visible;
    }
    
    .nav-group-list a {
        white-space: nowrap;
        width: 100%;
    }
}

.nav-menu a,
.nav-group-list a {
    color: var(--color-crisp-white);
    text-decoration: none;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    min-height: 36px;
    touch-action: manipulation;
    font-size: 0.875rem;
    font-weight: 500;
}

.nav-menu a:hover,
.nav-menu a:active,
.nav-group-list a:hover,
.nav-group-list a:active {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--color-crisp-white);
}

.nav-menu a.nav-link-active,
.nav-group-list a.nav-link-active {
    background-color: rgba(255, 255, 255, 0.22);
    font-weight: 600;
    color: var(--color-crisp-white);
    position: relative;
}

.nav-menu a.nav-link-active::before,
.nav-group-list a.nav-link-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    height: 60%;
    width: 3px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 0 2px 2px 0;
}

/* Group button: pill style */
.nav-group-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.95);
    padding: 0.5rem 0.85rem;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nav-group-label:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.35);
    color: var(--color-crisp-white);
}

.nav-group-label[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--color-crisp-white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nav-group-label button,
.nav-group-label[type="button"] {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

/* CSS chevron (replaces ▼) */
.nav-group-chevron {
    display: none;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    margin-left: 0.25rem;
    opacity: 0.9;
    transition: transform 0.25s ease;
}

.nav-group-label[aria-expanded="true"] .nav-group-chevron,
.nav-group.is-expanded .nav-group-chevron {
    transform: rotate(180deg);
}

/* Desktop: single-row compact nav, dropdown-style expanded list */
@media (min-width: 769px) {
    .navbar {
        padding: 0.5rem 0;
        box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
    }

    .nav-menu {
        flex-wrap: nowrap;
        gap: 0.35rem 0.5rem;
        align-items: center;
    }

    .nav-group {
        align-items: stretch;
        position: relative;
    }
    
    .nav-group-toggle {
        white-space: nowrap;
    }

    .nav-group-list {
        position: absolute;
        top: 100%;
        left: 0;
        margin-top: 0.35rem;
        background: var(--color-vibrant-blue);
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        padding: 0.4rem;
        min-width: 160px;
        z-index: 1000;
        flex-direction: column;
        gap: 0.2rem;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
        flex-wrap: nowrap;
        padding-top: 0;
        margin-top: 0;
    }

    .nav-group-label[aria-expanded="true"] + .nav-group-list,
    .nav-group.is-expanded .nav-group-list {
        max-height: 480px;
        overflow: visible;
        padding-top: 0.5rem;
        margin-top: 0.25rem;
        padding-left: 0.15rem;
        border-left: 2px solid rgba(255, 255, 255, 0.2);
        margin-left: 0.35rem;
    }
    
    .nav-group-chevron {
        display: block;
    }

    .nav-group-label {
        cursor: pointer;
        padding: 0.5rem 0.9rem;
        min-width: 0;
        white-space: nowrap;
    }

    .nav-group-label:focus-visible {
        outline: 2px solid rgba(255, 255, 255, 0.8);
        outline-offset: 2px;
    }

    .nav-group-toggle {
        padding: 0.4rem 0.65rem;
        min-height: 32px;
        font-size: 0.8125rem;
    }

    .nav-menu a,
    .nav-group-list a {
        padding: 0.35rem 0.6rem;
        min-height: 32px;
        font-size: 0.8125rem;
        border-radius: 6px;
    }
}

.main-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    /* Safe area insets for iOS */
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    animation: fadeInUp 0.4s ease;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.page-header h2 {
    color: #2c3e50;
    font-size: 2rem;
    font-weight: 700;
    background: var(--color-vibrant-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--color-crisp-white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--color-vibrant-blue);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(45, 106, 79, 0.15);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card h3 {
    color: #7f8c8d;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.stat-card h3::before {
    content: '';
    width: 24px;
    height: 24px;
    background: var(--color-vibrant-blue);
    border-radius: 6px;
    opacity: 0.2;
    display: inline-block;
}

.stat-number {
    font-size: 2.25rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.2;
    background: var(--color-vibrant-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-meta {
    font-size: 0.8125rem;
    color: #7f8c8d;
    margin-top: 0.25rem;
    margin-bottom: 0;
}

.muted {
    font-size: 0.9375rem;
    color: #6b7280;
}

.page-header .page-subtitle {
    color: #7f8c8d;
    font-size: 1rem;
    margin-top: 0.25rem;
    margin-bottom: 0;
}

.dashboard-snapshot .stats-grid-snapshot {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.section-heading {
    color: #2c3e50;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

.stat-card-alert {
    background-color: #fff8e6;
    border-color: #f0ad4e;
}

.text-danger {
    color: #dc3545;
}

.text-warning {
    color: #f0ad4e;
}

.text-success {
    color: #28a745;
}

.section {
    background: var(--color-crisp-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.section:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.section h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
}

.section h3::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--color-vibrant-blue);
    border-radius: 2px;
    display: inline-block;
}

.form-card {
    background: var(--color-crisp-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.form-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.form-card h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px; /* Prevents zoom on iOS */
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #fff;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: #b0b0b0;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-vibrant-blue);
    box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.1), 0 2px 8px rgba(45, 106, 79, 0.15);
    transform: translateY(-1px);
}

.form-group input:valid:not(:placeholder-shown),
.form-group select:valid,
.form-group textarea:valid:not(:placeholder-shown) {
    border-color: #28a745;
}

.form-group input:invalid:not(:placeholder-shown):not(:focus),
.form-group select:invalid:not(:focus),
.form-group textarea:invalid:not(:placeholder-shown):not(:focus) {
    border-color: #dc3545;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #7f8c8d;
    font-size: 0.875rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.btn:focus-visible {
    outline: 2px solid var(--color-vibrant-blue);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--color-vibrant-blue);
    color: var(--color-crisp-white);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover:not(:disabled),
.btn-primary:active:not(:disabled) {
    background: var(--color-vibrant-blue-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 106, 79, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: #95a5a6;
}

.btn-primary.loading {
    color: transparent;
    pointer-events: none;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--color-crisp-white);
    animation: spin 0.8s linear infinite;
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: var(--color-crisp-white);
    position: relative;
    overflow: hidden;
}

.btn-secondary:hover:not(:disabled),
.btn-secondary:active:not(:disabled) {
    background: linear-gradient(135deg, #7f8c8d 0%, #6c7a7b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(149, 165, 166, 0.3);
}

.btn-secondary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #bdc3c7;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-height: 36px;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
    font-size: 0.9rem;
    background: var(--color-crisp-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.data-table thead {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.data-table th {
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

.data-table tbody tr:hover {
    background-color: #f0f4ff;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(45, 106, 79, 0.1);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.status-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.status-quote {
    background-color: #fff3cd;
    color: #856404;
}

.status-confirmed {
    background-color: #cfe2ff;
    color: #084298;
}

.status-loaded {
    background-color: #d1ecf1;
    color: #055160;
}

.status-delivered {
    background-color: #d4edda;
    color: #155724;
}

.status-invoiced {
    background-color: #e2e3f5;
    color: #383d41;
}

.status-paid {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-overdue {
    background-color: #f8d7da;
    color: #721c24;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.data-table tbody tr.low-stock {
    background-color: #fff3cd;
}

.data-table tbody tr.low-stock:hover {
    background-color: #ffeaa7;
}

.inventory-display {
    text-align: center;
    padding: 2rem;
    background: var(--color-vibrant-blue);
    color: var(--color-crisp-white);
    border-radius: 8px;
    margin-bottom: 2rem;
}

.inventory-display h3 {
    color: var(--color-crisp-white);
    margin-bottom: 1rem;
}

.inventory-count {
    font-size: 3rem;
    font-weight: bold;
    margin: 1rem 0;
}

.inventory-updated {
    opacity: 0.9;
    font-size: 0.9rem;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.profit-positive {
    color: #155724;
    font-weight: 600;
}

.profit-negative {
    color: #721c24;
    font-weight: 600;
}

/* Profit colors in stat cards */
.stat-card .stat-number.profit-positive {
    color: #155724;
    background: linear-gradient(135deg, #155724 0%, #28a745 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .stat-number.profit-negative {
    color: #721c24;
    background: linear-gradient(135deg, #721c24 0%, #dc3545 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Table footer styling */
.data-table tfoot {
    background-color: #f8f9fa;
    font-weight: 600;
}

.data-table tfoot td {
    border-top: 2px solid #dee2e6;
    padding: 1rem;
}

.export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.export-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    text-align: center;
}

.export-card h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.export-card p {
    color: #7f8c8d;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.login-form {
    margin-top: 1rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form .form-group:last-of-type {
    margin-bottom: 2rem;
}

.login-form .form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #444;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}

.login-form input {
    font-size: 16px;
    line-height: 1.5;
    min-height: 48px;
    padding: 0.875rem 1.25rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--color-crisp-white);
}

.login-form input:focus {
    outline: none;
    border-color: var(--color-vibrant-blue);
    box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.15), 0 4px 12px rgba(45, 106, 79, 0.2);
    transform: translateY(-1px);
}

.login-form input:hover:not(:focus) {
    border-color: #c0c0c0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.login-form input::placeholder {
    color: #999;
    opacity: 1;
    font-weight: 400;
}

.login-form .btn-primary {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    margin-top: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
}

.login-form .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(45, 106, 79, 0.4);
}

.login-form .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(45, 106, 79, 0.3);
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .nav-header {
        width: 100%;
    }
    
    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        gap: 0.25rem;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.25s ease-out;
    }
    
    .nav-menu.active {
        display: flex;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .nav-menu > li {
        width: 100%;
    }
    
    .nav-group {
        width: 100%;
    }
    
    .nav-group-toggle {
        width: 100%;
        justify-content: space-between;
    }
    
    .nav-group-list {
        flex-direction: column;
        width: 100%;
        gap: 0.25rem;
        padding-left: 1rem;
    }
    
    .nav-menu a,
    .nav-group-list a,
    .nav-group-toggle {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 0.7rem 1rem;
        border-radius: 6px;
        font-size: 0.9375rem;
        min-height: 44px;
    }
    
    .nav-title {
        font-size: 1.2rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header h2 {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 0.8rem;
        display: block;
        overflow-x: auto;
        width: 100%;
    }
    
    .data-table thead {
        display: none;
    }
    
    .data-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 4px;
        padding: 0.5rem;
        background: var(--color-crisp-white);
    }
    
    .data-table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem;
        border: none;
        text-align: right;
    }
    
    .data-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        margin-right: 1rem;
        color: #2c3e50;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .export-grid {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        margin: 1rem auto;
        padding: 0 0.75rem;
    }
    
    .section,
    .form-card {
        padding: 1rem;
    }
    
    .modal-content {
        width: 95%;
        max-height: 85vh;
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .voice-message {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
        font-size: 13px;
        padding: 10px 15px;
    }
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
    /* Safe area insets for iOS */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    /* Prevent scrolling on body when modal is open */
    overscroll-behavior: contain;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--color-crisp-white);
    margin: auto;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--color-vibrant-blue);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--color-vibrant-blue-hover);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--color-crisp-white);
    animation: spin 0.8s linear infinite;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.loading-spinner-dark {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: var(--color-vibrant-blue);
    box-shadow: 0 2px 8px rgba(45, 106, 79, 0.2);
}

/* Enhanced skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 4px;
}

.skeleton-title {
    height: 1.75rem;
    width: 60%;
    margin-bottom: 1.25rem;
    border-radius: 4px;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 1.25rem;
    border-radius: 12px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-button {
    height: 48px;
    width: 120px;
    border-radius: 8px;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.loading-overlay .loading-spinner {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
    background: var(--color-vibrant-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-weight: 300;
    line-height: 1;
}

.close-modal:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #dc3545;
    transform: rotate(90deg) scale(1.1);
}

.close-modal:active {
    transform: rotate(90deg) scale(0.95);
}

/* Button groups */
.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: var(--color-crisp-white);
    position: relative;
    overflow: hidden;
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.btn-danger:active:not(:disabled) {
    transform: translateY(0);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    color: #212529;
    position: relative;
    overflow: hidden;
}

.btn-warning:hover:not(:disabled) {
    background: linear-gradient(135deg, #ffb300 0%, #e0a800 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

.btn-warning:active:not(:disabled) {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    color: var(--color-crisp-white);
    position: relative;
    overflow: hidden;
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-success:active:not(:disabled) {
    transform: translateY(0);
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: var(--color-crisp-white);
    position: relative;
    overflow: hidden;
}

.btn-info:hover:not(:disabled) {
    background: linear-gradient(135deg, #138496 0%, #117a8b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

.btn-info:active:not(:disabled) {
    transform: translateY(0);
}

/* Action buttons in tables */
.table-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Icon buttons */
.btn-icon {
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: transparent;
    color: #555;
}

.btn-icon:hover {
    background-color: #f8f9fa;
    transform: scale(1.1);
}

.btn-icon-edit {
    color: #17a2b8;
}

.btn-icon-edit:hover {
    background-color: #d1ecf1;
    color: #138496;
}

.btn-icon-delete {
    color: #dc3545;
}

.btn-icon-delete:hover {
    background-color: #f8d7da;
    color: #c82333;
}

.btn-icon-confirm {
    color: #28a745;
}

.btn-icon-confirm:hover {
    background-color: #d4edda;
    color: #218838;
}

/* Confirmation dialog */
.confirm-dialog {
    background-color: var(--color-crisp-white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.confirm-dialog h3 {
    margin-top: 0;
    color: #2c3e50;
}

.confirm-dialog p {
    margin: 1rem 0;
    color: #555;
}

.confirm-dialog-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Alert styles */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease;
    position: relative;
    overflow: hidden;
}

.alert::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
    opacity: 0.5;
}

.alert-error {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-success {
    background: linear-gradient(135deg, #f0fff4 0%, #e6ffe6 100%);
    color: #155724;
    border-color: #c3e6cb;
}

.alert-info {
    background: linear-gradient(135deg, #f0f9ff 0%, #e6f3ff 100%);
    color: #0c5460;
    border-color: #bee5eb;
}

.alert-warning {
    background: linear-gradient(135deg, #fffbf0 0%, #fff5e6 100%);
    color: #856404;
    border-color: #ffeaa7;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Improved form styling */
.form-card {
    position: relative;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: #7f8c8d;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 2px dashed #dee2e6;
    margin: 2rem 0;
}

.empty-state::before {
    content: '📋';
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.5;
    animation: float 3s ease-in-out infinite;
}

.empty-state p {
    margin-top: 1rem;
    font-size: 1.1rem;
    color: #6c757d;
    font-weight: 500;
}

.empty-state .btn {
    margin-top: 1.5rem;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0 0.5rem;
        margin: 0.5rem auto;
    }
    
    .section,
    .form-card {
        padding: 0.75rem;
    }
    
    .inventory-count {
        font-size: 2rem;
    }
    
    .modal-content {
        padding: 1rem;
        width: 98%;
        max-height: 90vh;
    }
    
    .table-actions {
        flex-direction: row;
        gap: 0.25rem;
        flex-wrap: wrap;
    }
    
    .btn-icon {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 1rem;
    }
    
    .nav-title {
        font-size: 1.1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

/* Voice Recognition Styles */
.voice-btn {
    background: var(--color-vibrant-blue);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    min-width: 44px;
    min-height: 44px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.voice-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.voice-btn.listening {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    box-shadow: 0 4px 16px rgba(33, 150, 243, 0.5);
    color: var(--color-crisp-white);
    animation: pulse 1.5s ease-in-out infinite;
}

.voice-btn.listening .voice-btn-icon,
.voice-btn.listening svg {
    color: var(--color-crisp-white);
    stroke: var(--color-crisp-white);
}

.voice-btn.error {
    background: #dc3545;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.voice-message {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    max-width: 300px;
    font-size: 14px;
    display: none;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.voice-message-success {
    background: #28a745;
    color: var(--color-crisp-white);
}

.voice-message-error {
    background: #dc3545;
    color: var(--color-crisp-white);
}

.voice-message-warning {
    background: #ffc107;
    color: #333;
}

.voice-message-info {
    background: #17a2b8;
    color: var(--color-crisp-white);
}

/* Voice Visualization */
#voice-visualization-canvas {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    padding: 10px;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease;
}

.voice-interim-result {
    position: fixed;
    top: 120px;
    right: 20px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9998;
    max-width: 300px;
    opacity: 0.7;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 0.7;
        transform: translateY(0);
    }
}

/* Voice Training Mode */
.voice-training-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--color-crisp-white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 9997;
    max-width: 400px;
    display: none;
}

.voice-training-panel.active {
    display: block;
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.voice-training-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #2c3e50;
}

.voice-training-phrase {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 16px;
    text-align: center;
    color: #495057;
}

.voice-training-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.voice-training-progress {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.voice-training-progress-bar {
    height: 100%;
    background: var(--color-vibrant-blue);
    transition: width 0.3s ease;
}

.voice-confidence-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 12px;
    font-size: 12px;
    color: #495057;
}

.voice-confidence-indicator.high {
    background: #d4edda;
    color: #155724;
}

.voice-confidence-indicator.medium {
    background: #fff3cd;
    color: #856404;
}

.voice-confidence-indicator.low {
    background: #f8d7da;
    color: #721c24;
}

/* Voice Command Suggestions */
.voice-command-suggestions {
    position: fixed;
    top: 80px;
    left: 20px;
    background: var(--color-crisp-white);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 9996;
    max-width: 350px;
    display: none;
    animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.voice-suggestions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    color: #2c3e50;
}

.voice-suggestions-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.voice-suggestions-close:hover {
    background: #f8f9fa;
}

.voice-suggestions-list {
    padding: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.voice-suggestion-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 4px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #495057;
}

.voice-suggestion-item:hover {
    background: #e9ecef;
    border-color: var(--color-vibrant-blue);
    transform: translateX(4px);
}

.voice-suggestion-item:active {
    transform: translateX(2px);
}

/* Command History Panel */
.voice-history-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-crisp-white);
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    max-width: 700px;
    max-height: 80vh;
    display: none;
    flex-direction: column;
}

.voice-history-panel.active {
    display: flex;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.voice-history-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.voice-history-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
}

.voice-history-search {
    padding: 12px 20px;
    border-bottom: 1px solid #e9ecef;
}

.voice-history-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
}

.voice-history-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.voice-history-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--color-vibrant-blue);
    cursor: pointer;
    transition: all 0.2s;
}

.voice-history-item:hover {
    background: #e9ecef;
    transform: translateX(4px);
}

.voice-history-item.success {
    border-left-color: #28a745;
}

.voice-history-item.failed {
    border-left-color: #dc3545;
}

.voice-history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.voice-history-command {
    font-weight: 500;
    color: #2c3e50;
    flex: 1;
}

.voice-history-time {
    font-size: 12px;
    color: #6c757d;
}

.voice-history-meta {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: #6c757d;
}

/* Quick Actions Panel */
.voice-quick-actions {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: var(--color-crisp-white);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 9995;
    max-width: 300px;
    display: none;
    flex-direction: column;
    animation: slideInUp 0.3s ease;
}

.voice-quick-actions.active {
    display: flex;
}

.voice-quick-actions-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    color: #2c3e50;
}

.voice-quick-actions-list {
    padding: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.voice-quick-action-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 4px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.voice-quick-action-item:hover {
    background: #e9ecef;
}

.voice-quick-action-name {
    font-weight: 500;
    color: #495057;
}

.voice-quick-action-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.voice-quick-action-remove:hover {
    background: #f8d7da;
}

/* Voice Analytics Dashboard */
#voice-analytics-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-crisp-white);
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
    z-index: 10002;
    max-width: 900px;
    max-height: 85vh;
    display: none;
    flex-direction: column;
}

#voice-analytics-panel.active {
    display: flex;
    animation: scaleIn 0.3s ease;
}

/* Macro Management */
.voice-macro-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-crisp-white);
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
    z-index: 10003;
    max-width: 600px;
    max-height: 80vh;
    display: none;
    flex-direction: column;
}

.voice-macro-panel.active {
    display: flex;
    animation: scaleIn 0.3s ease;
}

.voice-macro-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--color-vibrant-blue);
}

.voice-macro-commands {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    padding-left: 10px;
}

/* Favorite Commands */
.voice-favorite-indicator {
    display: inline-block;
    margin-left: 8px;
    color: #ffc107;
    font-size: 14px;
    cursor: pointer;
}

.voice-favorite-indicator.active {
    color: #ffc107;
}

.voice-favorite-indicator:not(.active) {
    color: #dee2e6;
}

/* Command Validation Warnings */
.voice-validation-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px;
    margin: 10px 0;
    border-radius: 6px;
}

.voice-validation-error {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    padding: 12px;
    margin: 10px 0;
    border-radius: 6px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .voice-command-suggestions {
        left: 10px;
        right: 10px;
        max-width: none;
        top: 60px;
    }
    
    .voice-message {
        top: 60px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .voice-interim-result {
        top: 100px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    #voice-visualization-canvas {
        width: 250px !important;
        height: 80px !important;
        bottom: 10px;
        right: 10px;
    }
    
    .voice-training-panel {
        left: 10px;
        right: 10px;
        max-width: none;
        bottom: 10px;
    }
    
    .voice-history-panel {
        left: 10px;
        right: 10px;
        max-width: none;
        top: 10px;
        bottom: 10px;
        transform: none;
    }
    
    .voice-quick-actions {
        left: 10px;
        right: 10px;
        max-width: none;
        bottom: 80px;
    }
    
    .voice-btn-global {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Loading states and skeletons */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--color-crisp-white);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--color-crisp-white);
    animation: spin 0.8s linear infinite;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin: 0.5rem 0;
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-card {
    height: 100px;
    margin-bottom: 1rem;
}

/* Form validation styles */
.form-group {
    position: relative;
}

.form-group input:invalid:not(:focus):not(:placeholder-shown),
.form-group select:invalid:not(:focus),
.form-group textarea:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.form-group input:valid:not(:focus):not(:placeholder-shown),
.form-group select:valid:not(:focus),
.form-group textarea:valid:not(:focus):not(:placeholder-shown) {
    border-color: #28a745;
}

.field-error {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
    min-height: 1.25rem;
}

.field-success {
    color: #28a745;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.form-group input:focus + .field-error,
.form-group input:focus + .field-success {
    display: none;
}

/* Network status indicator - single definition: bottom-centered with safe-area */
.network-status {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #2c3e50;
    color: var(--color-crisp-white);
    padding: 0.875rem 1.25rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    font-weight: 500;
    pointer-events: none;
    margin-bottom: env(safe-area-inset-bottom);
}

.network-status.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.network-status.offline {
    background: #dc3545;
}

.network-status.slow {
    background: #ff9800;
}

/* Toast notifications - moved to enhanced section below */

/* Swipeable actions */
.swipeable {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

.swipeable-content {
    transition: transform 0.3s ease;
}

.swipeable-actions {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
    background-color: #f8f9fa;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.swipeable.swiped .swipeable-actions {
    transform: translateX(0);
}

.swipeable.swiped .swipeable-content {
    transform: translateX(-80px);
}

/* Additional mobile optimizations */
@media (max-width: 768px) {
    .voice-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .voice-message {
        top: 60px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    /* Prevent double-tap zoom */
    button, a, input, select, textarea {
        touch-action: manipulation;
    }
    
    /* Better scrolling */
    /* Note: -webkit-overflow-scrolling is deprecated and removed */
    
    .toast {
        bottom: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
        transform: translateY(100px);
    }
    
    .toast.show {
        transform: translateY(0);
    }
}

/* Voice Enhancements Styles */
.voice-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.suggestion-btn {
    padding: 0.25rem 0.75rem;
    background: var(--color-vibrant-blue);
    color: var(--color-crisp-white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.suggestion-btn:hover {
    background: var(--color-vibrant-blue-hover);
}

.voice-visualization {
    margin: 2rem;
    padding: 1.5rem;
    background: var(--color-crisp-white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chart-placeholder {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #ddd;
    border-radius: 4px;
    color: #7f8c8d;
}

/* Continuous listening indicator */
.voice-btn-global.continuous {
    animation: pulse 1.5s ease-in-out infinite;
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    border-color: #1976D2;
}

.voice-btn-global.continuous .voice-btn-icon {
    color: var(--color-crisp-white);
    stroke: var(--color-crisp-white);
}

/* Confirm dialog */
.confirm-dialog {
    max-width: 500px;
}

.confirm-dialog-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Enhanced Accessibility improvements */
*:focus-visible {
    outline: 3px solid var(--color-vibrant-blue);
    outline-offset: 3px;
    border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--color-vibrant-blue);
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.2);
}

/* Remove default focus for mouse users, keep for keyboard */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Better focus indicators for interactive elements */
.btn:focus-visible,
.nav-menu a:focus-visible,
.nav-group-list a:focus-visible,
.menu-toggle:focus-visible {
    outline: 3px solid var(--color-vibrant-blue);
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.25);
}

/* Skip to main content link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #2c3e50;
    color: var(--color-crisp-white);
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Retry button for errors */
.retry-btn {
    margin-top: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Error boundary styles */
.error-boundary {
    padding: 2rem;
    text-align: center;
    background: var(--color-crisp-white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 2rem auto;
    max-width: 600px;
}

.error-boundary h2 {
    color: #dc3545;
    margin-bottom: 1rem;
}

.error-boundary p {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

/* Pagination - mobile-friendly touch targets */
.pagination {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-item {
    margin: 0;
    padding: 0;
    list-style: none;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    color: var(--color-vibrant-blue);
    background: var(--color-crisp-white);
    border: 2px solid var(--color-vibrant-blue);
    border-radius: 8px;
    text-decoration: none;
    touch-action: manipulation;
    transition: background 0.2s, color 0.2s;
}

.page-link:hover,
.page-link:focus {
    background: var(--color-vibrant-blue);
    color: var(--color-crisp-white);
}

/* Performance: Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .voice-btn-global.listening,
    .voice-btn.listening {
        animation: none;
    }
}

/* Improved button feedback for mobile */
@media (max-width: 768px) {
    .btn:active {
        transform: scale(0.98);
    }
    
    .btn-primary:active {
        background-color: #4a5bc4;
    }
    
    /* Better touch feedback */
    button:active,
    a:active {
        opacity: 0.8;
    }
}

/* Optimize animations for mobile */
@media (max-width: 768px) {
    /* Use transform instead of position changes for better performance */
    .modal.show {
        will-change: transform;
    }
    
    .toast {
        will-change: transform, opacity;
    }
    
    /* Reduce animation complexity on mobile */
    @keyframes pulse {
        0%, 100% {
            transform: scale(1);
            opacity: 1;
        }
        50% {
            transform: scale(1.05);
            opacity: 0.9;
        }
    }
}

/* ============================================
   ENHANCED UI/UX IMPROVEMENTS
   ============================================ */

/* Improved visual hierarchy and spacing */
.page-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 3px solid #f0f0f0;
}

.page-header h2 {
    font-size: 2.25rem;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

/* Enhanced stat cards with better visual appeal */
.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    border-color: rgba(45, 106, 79, 0.3);
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(45, 106, 79, 0.15);
}

.stat-card:active {
    transform: translateY(-2px);
}

/* Better section styling */
.section {
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.section:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* Enhanced form cards */
.form-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Improved input focus states */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--color-vibrant-blue);
    box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.12), 0 4px 12px rgba(45, 106, 79, 0.18);
    transform: translateY(-2px);
    background-color: var(--color-crisp-white);
}

/* Better button hover states */
.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(45, 106, 79, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
}

/* Enhanced table row interactions */
.data-table tbody tr {
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.data-table tbody tr:hover {
    background-color: #f5f7ff;
    transform: scale(1.002);
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.12);
}

.data-table tbody tr:active {
    transform: scale(0.998);
}

/* Better badge styling */
.status-badge {
    font-weight: 600;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Enhanced modal backdrop */
.modal {
    background-color: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.modal-content {
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Better navigation menu */
.nav-menu a {
    position: relative;
    overflow: hidden;
}

.nav-menu a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-vibrant-blue);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.nav-menu a:hover::before,
.nav-menu a:active::before {
    transform: scaleY(1);
}

/* Improved empty state */
.empty-state {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px dashed #dee2e6;
    border-radius: 16px;
    padding: 4rem 2rem;
}

.empty-state::before {
    font-size: 4.5rem;
    opacity: 0.6;
}

/* Better action buttons in tables */
.table-actions {
    gap: 0.75rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.btn-icon:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-icon:active {
    transform: scale(1.05) rotate(0deg);
}

/* Enhanced search and filter sections */
.search-filters {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
}

/* Better alert styling */
.alert {
    border-left-width: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Improved loading spinner */
.loading-spinner {
    border-width: 3px;
    border-top-width: 3px;
}

/* Better skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

/* Enhanced inventory display */
.inventory-display {
    background: var(--color-vibrant-blue);
    box-shadow: 0 8px 24px rgba(45, 106, 79, 0.3);
    border-radius: 16px;
    padding: 2.5rem;
}

.inventory-count {
    font-size: 3.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Better form row spacing */
.form-row {
    gap: 1.25rem;
}

/* Enhanced page header button */
.page-header .btn {
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
}

.page-header .btn:hover {
    box-shadow: 0 6px 16px rgba(45, 106, 79, 0.4);
}

/* Improved confirmation dialog */
.confirm-dialog {
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.confirm-dialog h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.confirm-dialog p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Enhanced toast notifications */
.toast {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border-left-width: 5px;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Better field validation messages */
.field-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.field-success {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

/* Improved stats grid spacing */
.stats-grid {
    gap: 1.75rem;
}

/* Better card hover effects */
.card:hover,
.form-card:hover,
.section:hover {
    transform: translateY(-2px);
}

/* Enhanced button groups */
.btn-group {
    gap: 0.75rem;
}

.btn-group .btn {
    flex: 1 1 auto;
}

/* Better mobile menu toggle animation */
.menu-toggle[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.2);
}


/* Enhanced voice button */
.voice-btn-global {
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.35);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.voice-btn-global:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(229, 57, 53, 0.5);
}

.voice-btn-global:active {
    transform: scale(1.05);
}

/* Better table header */
.data-table thead {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 3px solid #dee2e6;
}

.data-table th {
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.8125rem;
}

/* Improved low stock highlighting */
.data-table tbody tr.low-stock {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left: 4px solid #ffc107;
}

.data-table tbody tr.low-stock:hover {
    background: linear-gradient(135deg, #ffeaa7 0%, #ffd93d 100%);
}

/* Better profit display */
.profit-positive {
    color: #155724;
    font-weight: 700;
}

.profit-negative {
    color: #721c24;
    font-weight: 700;
}

/* Enhanced section headers */
.section h3 {
    font-weight: 700;
    letter-spacing: -0.3px;
}

.section h3::before {
    width: 5px;
    height: 28px;
    border-radius: 3px;
}

/* Better form card headers */
.form-card h3 {
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* Improved modal header */
.modal-header {
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 1.25rem;
    margin-bottom: 1.75rem;
}

.modal-header h3 {
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* Better close button */
.close-modal {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.close-modal:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #dc3545;
    transform: rotate(90deg) scale(1.15);
}

.close-modal:active {
    transform: rotate(90deg) scale(1.0);
}

/* ============================================
   COMPREHENSIVE MOBILE OPTIMIZATIONS
   ============================================ */

/* Mobile-First: Base styles optimized for mobile */
@media (max-width: 768px) {
    /* Prevent horizontal overflow and apply safe-area insets */
    html {
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    body {
        overflow-x: hidden;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    /* Enhanced touch targets - minimum 48x48px for better accessibility */ - minimum 48x48px for better accessibility */
    button, .btn, a.btn, input[type="button"], input[type="submit"], 
    .nav-menu a, .menu-toggle, .voice-btn-global {
        min-height: 48px;
        min-width: 48px;
        padding: 0.875rem 1.25rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(45, 106, 79, 0.2);
    }
    
    /* Improved form inputs for mobile */
    input, select, textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 1rem 1.25rem;
        min-height: 52px;
        border-radius: 12px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border: 2px solid #e0e0e0;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background-color: var(--color-crisp-white);
    }
    
    input:focus, select:focus, textarea:focus {
        border-color: var(--color-vibrant-blue);
        box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.15), 0 4px 12px rgba(45, 106, 79, 0.2);
        transform: translateY(-1px);
    }
    
    /* Better spacing for mobile forms */
    .form-group {
        margin-bottom: 1.75rem;
    }
    
    .form-group label {
        font-size: 1rem;
        margin-bottom: 0.75rem;
        font-weight: 600;
        color: #2c3e50;
        display: block;
    }
    
    textarea {
        min-height: 120px;
        resize: vertical;
        padding: 1rem 1.25rem;
        line-height: 1.6;
    }
    
    /* Improve modal for mobile - full screen on small devices */
    .modal {
        padding: 0;
        align-items: flex-end;
        background-color: rgba(0, 0, 0, 0.75);
    }
    
    .modal-content {
        margin: 0;
        max-height: 92vh;
        border-radius: 24px 24px 0 0;
        overflow-y: auto;
        scroll-behavior: smooth;
        width: 100%;
        max-width: 100%;
        padding: 2rem 1.5rem;
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
        animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    /* Better table handling - card view on mobile */
    .data-table-wrapper {
        overflow-x: auto;
        scroll-behavior: smooth;
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    .data-table {
        min-width: 100%;
        border-collapse: separate;
        border-spacing: 0;
    }
    
    /* Convert tables to card layout on mobile */
    .data-table thead {
        display: none;
    }
    
    .data-table tbody tr {
        display: block;
        background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
        margin-bottom: 1.25rem;
        border-radius: 16px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        padding: 1.25rem;
        border: 2px solid rgba(0, 0, 0, 0.06);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        overflow: hidden;
    }
    
    .data-table tbody tr::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: var(--color-vibrant-blue);
        transform: scaleX(0);
        transform-origin: left;
        transition: transform 0.3s ease;
    }
    
    .data-table tbody tr:hover::before {
        transform: scaleX(1);
    }
    
    .data-table tbody tr:active {
        transform: scale(0.97);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    
    .data-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.875rem 0;
        border: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        text-align: right;
        min-height: 44px;
    }
    
    .data-table tbody td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .data-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #7f8c8d;
        text-align: left;
        flex: 1;
        margin-right: 1rem;
        font-size: 0.875rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        display: flex;
        align-items: center;
    }
    
    .data-table tbody td:first-child::before {
        font-size: 1.125rem;
        font-weight: 700;
        color: #2c3e50;
        text-transform: none;
        letter-spacing: 0;
    }
    
    /* Better action buttons in mobile table cards */
    .data-table tbody td .table-actions {
        flex-direction: row;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }
    
    .data-table tbody td .btn-icon {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 1.2rem;
    }
    
    /* Improve dropdown menus */
    select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23667eea' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 1rem center;
        background-size: 16px;
        padding-right: 3rem;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    
    /* Prevent text selection on buttons */
    button, .btn {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Enhanced focus states for accessibility */
    *:focus-visible {
        outline: 3px solid var(--color-vibrant-blue);
        outline-offset: 3px;
        border-radius: 4px;
    }
    
    /* Better navigation */
    .navbar {
        padding: 0.75rem 1rem;
        padding-top: calc(0.75rem + env(safe-area-inset-top));
    }
    
    .nav-header {
        gap: 0.75rem;
    }
    
    .nav-title {
        font-size: 1.125rem;
        line-height: 1.3;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        scroll-behavior: smooth;
    }
    
    .nav-menu li {
        border-bottom: none;
    }
    
    .nav-group {
        width: 100%;
        padding-right: 0;
        padding-bottom: 0;
        margin-bottom: 0;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .nav-group:last-child {
        margin-bottom: 0;
        border-bottom: none;
    }
    
    .nav-group-label {
        padding: 1rem 1.5rem;
        font-size: 0.75rem;
        min-height: 52px;
        display: flex;
        align-items: center;
    }
    
    .nav-group-chevron {
        display: block;
    }
    
    .nav-group-list {
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }
    
    .nav-group-label[aria-expanded="true"] + .nav-group-list {
        max-height: 1000px;
    }
    
    .nav-group-list li {
        border-bottom: none;
    }
    
    .nav-group-list li + li {
        margin-top: 0.15rem;
    }
    
    .nav-menu a,
    .nav-group-list a {
        min-height: 52px;
        display: flex;
        align-items: center;
        padding: 1rem 1.25rem;
        font-size: 1rem;
        border-radius: 6px;
        position: relative;
        transition: all 0.2s ease;
        font-weight: 500;
    }
    
    .nav-menu a::before,
    .nav-group-list a::before {
        width: 5px;
    }
    
    .nav-menu a:hover,
    .nav-group-list a:hover {
        background-color: rgba(255, 255, 255, 0.12);
        padding-left: 2rem;
    }
    
    .nav-menu a:active,
    .nav-group-list a:active {
        background-color: rgba(255, 255, 255, 0.2);
        transform: scale(0.98);
    }
    
    /* Improve card layouts */
    .card, .form-card, .section {
        margin-bottom: 1.25rem;
        padding: 1.25rem;
        border-radius: 16px;
    }
    
    .stat-card {
        padding: 1.25rem;
        min-height: auto;
    }
    
    .stat-card h3 {
        font-size: 0.8125rem;
        margin-bottom: 0.5rem;
    }
    
    .stat-number {
        font-size: 1.875rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Better button groups */
    .btn-group {
        flex-wrap: wrap;
        gap: 1rem;
        width: 100%;
    }
    
    .btn-group .btn {
        flex: 1 1 auto;
        min-width: calc(50% - 0.5rem);
        padding: 1rem 1.5rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 12px;
    }
    
    /* Enhanced button styles for mobile */
    .btn {
        padding: 1rem 1.75rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 12px;
        min-height: 52px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .btn:active {
        transform: scale(0.97);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    .btn-primary {
        box-shadow: 0 4px 16px rgba(45, 106, 79, 0.35);
    }
    
    .btn-primary:active {
        box-shadow: 0 2px 12px rgba(45, 106, 79, 0.3);
    }
    
    /* Improved page header */
    .page-header {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }
    
    .page-header h2 {
        font-size: 1.5rem;
    }
    
    /* Better main content spacing */
    .main-content {
        margin: 1rem auto;
        padding: 0 1rem;
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    /* Improved section headers */
    .section h3 {
        font-size: 1.375rem;
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
        font-weight: 700;
    }
    
    .section {
        padding: 1.75rem;
    }
    
    /* Better form cards */
    .form-card {
        padding: 1.75rem;
        border-radius: 20px;
    }
    
    .form-card h3 {
        font-size: 1.375rem;
        margin-bottom: 1.5rem;
        font-weight: 700;
    }
    
    /* Better form actions on mobile */
    .form-actions {
        flex-direction: column;
        gap: 1rem;
        margin-top: 2rem;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Enhanced menu toggle */
    .menu-toggle {
        width: 48px;
        height: 48px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 6px;
        background: rgba(255, 255, 255, 0.15);
        border-radius: 12px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    
    .menu-toggle:hover {
        background: rgba(255, 255, 255, 0.25);
        transform: scale(1.05);
    }
    
    .menu-toggle:active {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(0.95);
    }
    
    .menu-toggle[aria-expanded="true"] {
        background: rgba(255, 255, 255, 0.25);
    }
    
    .menu-toggle span {
        width: 26px;
        height: 3px;
        background: var(--color-crisp-white);
        border-radius: 3px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }
    
    /* Toast notifications for mobile */
    #toastContainer {
        top: 80px;
        right: 1rem;
        left: 1rem;
        align-items: stretch;
        gap: 1rem;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
        width: 100%;
        padding: 1.25rem 1.5rem;
        border-radius: 16px;
        font-size: 1rem;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    }
    
    .toast span:first-child {
        font-size: 1.5rem;
    }
    
    /* Network status for mobile */
    .network-status {
        padding: 0.875rem 1.25rem;
        font-size: 0.875rem;
        border-radius: 12px;
        margin: 1rem;
        margin-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
    
    /* Better action buttons in tables */
    .action-buttons {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Improved search and filter sections */
    .search-filters {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-filters input,
    .search-filters select {
        width: 100%;
    }
    
    /* Better loading states */
    .loading-spinner {
        width: 32px;
        height: 32px;
    }
    
    /* Improved empty states */
    .empty-state {
        padding: 2rem 1rem;
        text-align: center;
    }
    
    .empty-state h3 {
        font-size: 1.125rem;
        margin-bottom: 0.5rem;
    }
    
    .empty-state p {
        font-size: 0.9375rem;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari specific styles */
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"] {
        min-height: 44px;
    }
    
    /* Fix iOS input zoom */
    @media screen and (max-width: 768px) {
        input[type="text"],
        input[type="email"],
        input[type="tel"],
        input[type="number"],
        input[type="password"],
        select,
        textarea {
            font-size: 16px !important;
        }
    }
}

/* Android specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select {
        background-image: none;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .icon {
        -webkit-optimize-contrast: optimize;
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges; /* fallback for non-WebKit */
    }
}

/* Very small screens (phones in portrait) */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-number {
        font-size: 1.875rem;
    }
    
    .page-header h2 {
        font-size: 1.5rem;
    }
    
    .section, .form-card {
        padding: 1.25rem;
        border-radius: 16px;
    }
    
    .nav-title {
        font-size: 1rem;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .main-content {
        padding: 0 1rem;
        margin: 1rem auto;
    }
    
    button, .btn {
        font-size: 0.9375rem;
        padding: 0.875rem 1.25rem;
        min-height: 48px;
    }
    
    .data-table tbody tr {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .data-table tbody td {
        padding: 0.75rem 0;
        min-height: 40px;
    }
    
    .modal-content {
        padding: 1.5rem 1.25rem;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }
    
    .inventory-display {
        padding: 2rem 1.5rem;
    }
    
    .inventory-count {
        font-size: 2.5rem;
    }
}

/* Landscape orientation optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .navbar {
        padding: 0.5rem 0;
        padding-top: calc(0.5rem + env(safe-area-inset-top));
    }
    
    .nav-title {
        font-size: 1rem;
    }
    
    .modal-content {
        max-height: calc(100vh - 2rem);
        border-radius: 16px;
        margin: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .main-content {
        margin: 0.75rem auto;
    }
}

/* Enhanced animations for mobile */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Enhanced touch feedback styles */
.touch-active {
    opacity: 0.85 !important;
    transform: scale(0.97) !important;
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Better visual feedback for touch interactions */
@media (max-width: 768px) {
    button:active,
    .btn:active,
    a:active,
    .nav-menu a:active {
        transform: scale(0.96);
        transition: transform 0.1s ease;
    }
    
    .stat-card:active {
        transform: scale(0.97) translateY(-2px);
    }
    
    .data-table tbody tr:active {
        transform: scale(0.98);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
}

/* Smooth transitions for mobile interactions */
@media (max-width: 768px) {
    .stat-card,
    .card,
    .form-card,
    .section {
        animation: fadeInScale 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .data-table tbody tr {
        animation: fadeInScale 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .modal-content {
        animation: slideInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .page-header {
        animation: slideInFromRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .nav-menu.active {
        animation: slideInFromRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* Dark mode support (if user prefers) */
@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles if needed */
    /* For now, keeping light theme for better readability on mobile */
}

/* Enhanced Toast Notifications */
#toastContainer {
    position: fixed;
    top: 80px;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
    padding-top: env(safe-area-inset-top);
}

.toast {
    background: var(--color-crisp-white);
    color: #2c3e50;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    font-size: 0.9375rem;
    line-height: 1.5;
    border-left: 4px solid var(--color-vibrant-blue);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    border-left-color: #28a745;
    background: linear-gradient(135deg, #ffffff 0%, #f0f9f4 100%);
}

.toast.success span:first-child {
    color: #28a745;
    font-weight: bold;
    font-size: 1.125rem;
}

.toast.error {
    border-left-color: #dc3545;
    background: linear-gradient(135deg, #ffffff 0%, #fff5f5 100%);
}

.toast.error span:first-child {
    color: #dc3545;
    font-weight: bold;
    font-size: 1.125rem;
}

.toast.warning {
    border-left-color: #ffc107;
    background: linear-gradient(135deg, #ffffff 0%, #fffbf0 100%);
}

.toast.warning span:first-child {
    color: #ff9800;
    font-weight: bold;
    font-size: 1.125rem;
}

.toast.info {
    border-left-color: var(--color-vibrant-blue);
    background: linear-gradient(135deg, #ffffff 0%, #f5f7ff 100%);
}

.toast.info span:first-child {
    color: var(--color-vibrant-blue);
    font-weight: bold;
    font-size: 1.125rem;
}

/* Enhanced Field Validation Messages */
.field-error {
    color: #dc3545;
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 500;
}

.field-error::before {
    content: '⚠';
    font-size: 0.875rem;
}

.field-success {
    color: #28a745;
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 500;
}

/* Improved Loading States */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-crisp-white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Better Empty States */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #7f8c8d;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px dashed #dee2e6;
    border-radius: 20px;
    margin: 2rem 0;
}

.empty-state::before {
    content: '📋';
    font-size: 5rem;
    display: block;
    margin-bottom: 1.5rem;
    opacity: 0.5;
    animation: float 3s ease-in-out infinite;
}

.empty-state h3 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
    font-size: 1.375rem;
    font-weight: 700;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 2rem;
    color: #6c757d;
    line-height: 1.6;
}

.empty-state .btn {
    margin-top: 1.5rem;
    min-width: 200px;
}

/* Improved Action Buttons in Tables */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-buttons .btn {
    flex: 1 1 auto;
    min-width: 80px;
}

/* Better Search and Filter Sections */
.search-filters {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: flex-end;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: 1.75rem;
    border-radius: 16px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-filters .form-group {
    flex: 1 1 auto;
    min-width: 200px;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .search-filters {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem;
    }
    
    .search-filters .form-group {
        width: 100%;
        min-width: auto;
    }
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: #2c3e50;
    color: var(--color-crisp-white);
    padding: 0.75rem 1rem;
    text-decoration: none;
    z-index: 10001;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .toast,
    .network-status {
        transition: opacity 0.01ms !important;
    }
}

