:root {
    --primary: #0078d4;
    --primary-light: #00a2ed;
    --primary-dark: #004578;
    --secondary: #e6f5fc;
    --bg: #f0f6fa;
    --surface: #FFFFFF;
    --text-main: #242424;
    --text-muted: #5c5c5c;
    --danger: #E74C3C;
    --success: #27AE60;
    --border: #e1e5eb;
    --radius: 18px;
    --radius-pill: 100px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.06);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --bg-body: var(--bg);
    --bg-card: var(--surface);
    --hover-bg: rgba(0,0,0,0.04);
    --card-shadow: 0 4px 12px rgba(0,0,0,0.03);
    --input-bg: #fcfdfe;
}

/* ==========================================
   DARK MODE
   ========================================== */
[data-theme="dark"] {
    --primary: #4fc3f7;
    --primary-light: #81d4fa;
    --primary-dark: #0288d1;
    --secondary: #1a2a3a;
    --bg: #121212;
    --surface: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #9e9e9e;
    --danger: #ef5350;
    --success: #66bb6a;
    --border: #333333;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.5);
    --bg-body: var(--bg);
    --bg-card: var(--surface);
    --hover-bg: rgba(255,255,255,0.05);
    --card-shadow: 0 4px 12px rgba(0,0,0,0.3);
    --input-bg: #2a2a2a;
}

[data-theme="dark"] .login-card {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255,255,255,0.08);
}

[data-theme="dark"] .login-logo h1 {
    background: linear-gradient(135deg, #4fc3f7, #81d4fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .form-control {
    background: var(--input-bg);
    color: var(--text-main);
    border-color: var(--border);
}

[data-theme="dark"] .form-control:focus {
    background: #333;
    border-color: var(--primary);
}

[data-theme="dark"] .splash-screen {
    background: linear-gradient(135deg, #0d2137 0%, #1a1a2e 100%) !important;
}

[data-theme="dark"] .splash-title {
    background: linear-gradient(135deg, #4fc3f7, #81d4fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

[data-theme="dark"] .btn-auth-submit {
    background: linear-gradient(135deg, #0288d1, #4fc3f7);
    border-color: #01579b;
}

[data-theme="dark"] #login-overlay {
    background: linear-gradient(135deg, #121212 0%, #1a1a2e 100%);
}

[data-theme="dark"] .splash-slogan {
    color: #aaa;
}

[data-theme="dark"] .auth-tab.active {
    box-shadow: 0 4px 12px rgba(79, 195, 247, 0.25);
}
[data-theme="dark"] .auth-form .form-control {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .auth-form .form-control:focus {
    border-color: var(--primary);
    background: rgba(255,255,255,0.08);
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.1);
}
[data-theme="dark"] .btn-auth-submit {
    background: linear-gradient(135deg, #1a8754, #2196F3);
}
[data-theme="dark"] #auth-error {
    background: linear-gradient(135deg, #3e1a1a, #4a1a1a);
    border-color: #6a2a2a;
    color: #ef9a9a;
}

[data-theme="dark"] .btn-primary {
    background: linear-gradient(135deg, #0288d1, #4fc3f7);
    box-shadow: 0 4px 14px rgba(79, 195, 247, 0.2);
}

[data-theme="dark"] .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(79, 195, 247, 0.3);
}

[data-theme="dark"] .btn-outline {
    border-color: #4fc3f7;
    color: #4fc3f7;
}

[data-theme="dark"] .btn-outline:hover {
    background: rgba(79, 195, 247, 0.1);
}

[data-theme="dark"] .btn-secondary {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.15);
    color: var(--text-muted);
}

[data-theme="dark"] .btn-secondary:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.3);
    color: var(--text-main);
}

[data-theme="dark"] .btn-danger {
    background: linear-gradient(135deg, #c62828, #ef5350);
}

[data-theme="dark"] .btn-icon:hover {
    background: rgba(255,255,255,0.1);
}

[data-theme="dark"] .btn-success {
    background: linear-gradient(135deg, #1B5E20, #388E3C);
}

[data-theme="dark"] .btn-danger {
    background: linear-gradient(135deg, #B71C1C, #E53935);
}

[data-theme="dark"] .droplet-toast {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(79, 195, 247, 0.25);
}

[data-theme="dark"] .notification-dropdown {
    background: #1e1e1e;
    border-color: #333;
}

[data-theme="dark"] .notification-item:hover {
    background: rgba(255,255,255,0.03);
}

[data-theme="dark"] .messaging-chat-window {
    background: #1a1a1a;
}

[data-theme="dark"] .message-bubble-wrapper.received .message-bubble {
    background: #2a2a2a;
    border-color: #333;
    color: var(--text-main);
}

[data-theme="dark"] .messaging-chat-input-area,
[data-theme="dark"] .messaging-chat-header,
[data-theme="dark"] .messaging-sidebar {
    background: #1e1e1e;
    border-color: #333;
}

[data-theme="dark"] .csv-upload-zone {
    background: #1a2a3a;
    border-color: #4fc3f7;
}

[data-theme="dark"] .sidebar {
    border-right-color: #333;
    background: #1a1a1a;
}

[data-theme="dark"] header {
    background: #1a1a1a;
    border-bottom-color: #333;
}

[data-theme="dark"] .modal {
    background: #1e1e1e;
}

[data-theme="dark"] .modal-header {
    border-bottom-color: #333;
}

[data-theme="dark"] .table-container {
    background: #1e1e1e;
}

[data-theme="dark"] .order-catalog,
[data-theme="dark"] .order-cart-panel {
    background: #1e1e1e;
}

[data-theme="dark"] .nav-item {
    border-color: rgba(79, 195, 247, 0.08);
    color: #aaa;
}

[data-theme="dark"] .nav-item:hover {
    background: rgba(79, 195, 247, 0.08);
    border-color: var(--primary-light);
    color: var(--primary);
}

[data-theme="dark"] .nav-item.active {
    background: #1a2a3a;
    border-color: var(--primary);
    color: var(--primary);
}

[data-theme="dark"] .skype-avatar-container {
    background: #1a2a3a;
    border-color: rgba(79, 195, 247, 0.2);
}

[data-theme="dark"] .status-indicator {
    border-top-color: #333;
}

[data-theme="dark"] #session-lock-screen > div {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .btn-pin-num {
    background: #2a2a2a !important;
    color: var(--text-main) !important;
    border-color: rgba(255,255,255,0.1) !important;
}

[data-theme="dark"] .welcome-card {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .theme-toggle-btn {
    color: #ffd54f !important;
}

[data-theme="dark"] .welcome-title {
    color: var(--text-main);
}

[data-theme="dark"] .domains-grid {
    background: #1a1a1a !important;
    border-color: #333 !important;
}

[data-theme="dark"] .register-step .form-control {
    background: #2a2a2a;
    color: var(--text-main);
    border-color: #444;
}

[data-theme="dark"] .register-step .form-control:focus {
    background: #333;
    border-color: var(--primary);
}

[data-theme="dark"] .role-radio-group label input[type="radio"] {
    accent-color: var(--primary);
}

/* Theme toggle button */
.theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 50%;
    transition: var(--transition);
    font-size: 20px;
}
.theme-toggle-btn:hover {
    background: var(--hover-bg);
    color: var(--primary);
}

/* ==========================================
   LANDING / HOME PAGE
   ========================================== */
.landing-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(160deg, #eef6fc 0%, #dce8f0 30%, #c8dbe8 60%, #e8f0f8 100%);
    position: relative;
    overflow: hidden;
}

/* Theme toggle — top right of landing wrapper */
.landing-wrapper > .card-theme-btn {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.6);
    color: var(--text-muted);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transition: all 0.25s ease;
}
.landing-wrapper > .card-theme-btn:hover {
    background: white;
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
[data-theme="dark"] .landing-wrapper > .card-theme-btn {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
[data-theme="dark"] .landing-wrapper > .card-theme-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: var(--primary);
}

[data-theme="dark"] .landing-wrapper {
    background: linear-gradient(160deg, #0f0f1a 0%, #16162a 30%, #1a1a30 60%, #12121e 100%);
}

/* Decorative background shapes */
.landing-wrapper::before {
    content: '';
    position: absolute;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0,120,212,0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.landing-wrapper::after {
    content: '';
    position: absolute;
    bottom: -150px;
    left: -150px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0,162,237,0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

[data-theme="dark"] .landing-wrapper::before {
    background: radial-gradient(circle, rgba(79,195,247,0.06) 0%, transparent 70%);
}
[data-theme="dark"] .landing-wrapper::after {
    background: radial-gradient(circle, rgba(79,195,247,0.04) 0%, transparent 70%);
}

/* Hero Section */
.landing-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 60px 60px 80px;
    position: relative;
    min-width: 0;
    z-index: 1;
}

.landing-hero-content {
    max-width: 500px;
    margin: 0 0 0 auto;
    padding-right: 40px;
}

.landing-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
}

.landing-logo-img {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 6px 20px rgba(0, 120, 212, 0.25);
    transition: transform 0.3s ease;
}
.landing-logo-img:hover {
    transform: scale(1.05);
}

.landing-logo h1 {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.landing-tagline {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
    line-height: 1.3;
}

.landing-desc {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.75;
    margin-bottom: 36px;
    max-width: 420px;
}

/* Feature cards */
.landing-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.landing-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-main);
    font-weight: 500;
    padding: 12px 16px;
    background: rgba(255,255,255,0.7);
    border-radius: 14px;
    border: 1px solid rgba(0,120,212,0.08);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(8px);
    animation: fadeInUp 0.5s ease-out backwards;
}

.landing-feature:nth-child(1) { animation-delay: 0.05s; }
.landing-feature:nth-child(2) { animation-delay: 0.10s; }
.landing-feature:nth-child(3) { animation-delay: 0.15s; }
.landing-feature:nth-child(4) { animation-delay: 0.20s; }
.landing-feature:nth-child(5) { animation-delay: 0.25s; }
.landing-feature:nth-child(6) { animation-delay: 0.30s; }

.landing-feature:hover {
    background: rgba(255,255,255,0.95);
    border-color: rgba(0,120,212,0.2);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,120,212,0.12);
}

[data-theme="dark"] .landing-feature {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .landing-feature:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(79,195,247,0.2);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.landing-feature .material-icons-outlined {
    font-size: 22px;
    color: var(--primary);
    flex-shrink: 0;
}

.landing-hero-footer {
    position: absolute;
    bottom: 24px;
    left: 80px;
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.7;
    z-index: 1;
}

/* Mobile scroll hint */
.landing-scroll-hint {
    display: none;
    text-align: center;
    margin-top: 24px;
    animation: bounceDown 2s infinite ease-in-out;
}
.landing-scroll-hint .material-icons-outlined {
    font-size: 32px;
    color: var(--primary);
    opacity: 0.5;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* Auth Section */
.landing-auth {
    width: 480px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 60px 40px 20px;
    position: relative;
    z-index: 1;
}

.landing-auth .login-card {
    width: 100%;
    max-width: 420px;
    margin: 0;
    padding: 32px 30px;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 28px;
    box-shadow: 0 30px 80px -20px rgba(0,0,0,0.25), 0 2px 0 0 rgba(255,255,255,0.6) inset, 0 0 0 1px rgba(255,255,255,0.5);
    text-align: center;
    animation: fadeInUp 0.7s ease-out;
    border: 1px solid rgba(255,255,255,0.3);
    position: relative;
    overflow: hidden;
}

.landing-auth .login-card::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(43,122,120,0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

[data-theme="dark"] .landing-auth .login-card {
    background: rgba(25,25,35,0.88);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 30px 80px -20px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
}

.landing-auth .auth-tabs {
    margin-bottom: 22px;
}

.landing-auth .form-group {
    text-align: left;
}

/* Register form specific */
.landing-auth .register-step {
    text-align: left;
}

.landing-auth .register-step .form-group {
    margin-bottom: 14px;
}

.landing-auth .register-step .form-group label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 5px;
    display: block;
    letter-spacing: 0.2px;
}

.landing-auth .register-step .form-control {
    padding: 10px 14px;
    font-size: 14px;
    border-radius: 12px;
}

.landing-auth .register-step .form-row {
    gap: 10px;
}

.landing-auth .register-step .form-row > .form-group {
    flex: 1;
}

/* Role radio group */
.landing-auth .register-step .role-radio-group {
    display: flex;
    gap: 16px;
    margin-top: 6px;
    margin-bottom: 8px;
}

.landing-auth .register-step .role-radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-main);
    font-size: 13px;
}

.landing-auth .register-step .role-radio-group input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* Domain checkboxes grid */
.landing-auth .register-step .domains-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
    background: var(--bg);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    max-height: none;
    overflow-y: visible;
}

.landing-auth .register-step .domains-grid label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-main);
    cursor: pointer;
    font-weight: 500;
    padding: 4px 0;
}

.landing-auth .register-step .domains-grid input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
}

/* Step indicator */
.landing-auth .auth-form .step-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
    padding: 0;
    gap: 8px;
}

.landing-auth .auth-form .step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12.5px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.landing-auth .auth-form .step-dot.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(43, 122, 120, 0.35);
}

.landing-auth .auth-form .step-dot.inactive {
    background: var(--bg-body);
    color: var(--text-muted);
    border: 2px solid var(--border);
}

.landing-auth .auth-form .step-line {
    width: 32px;
    height: 2px;
    background: var(--border);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.landing-auth .auth-form .step-line.active {
    background: var(--primary);
}

/* Register buttons row */
.landing-auth .register-step .register-buttons {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.landing-auth .register-step .register-buttons .btn-auth-submit {
    padding: 12px 16px;
    font-size: 14px;
}

/* Auth card scrollable for long forms */
.landing-auth .login-card {
    max-height: 90vh;
    overflow-y: auto;
}

/* ==========================================
   RESPONSIVE LANDING
   ========================================== */

/* Tablet landscape / small desktop (≤1024px) */
@media (max-width: 1024px) {
    .landing-auth {
        width: 400px;
        padding: 40px 40px 40px 10px;
    }
    .landing-hero-content {
        padding-right: 20px;
    }
    .landing-features {
        gap: 8px;
    }
}

/* Tablet portrait (≤900px) */
@media (max-width: 900px) {
    .landing-wrapper {
        flex-direction: column;
        min-height: 100dvh;
        overflow: visible;
    }
    #login-overlay {
        height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .landing-hero {
        padding: 60px 24px 20px;
        min-height: auto;
    }
    .landing-hero-content {
        max-width: 100%;
        margin: 0 auto;
        padding-right: 0;
    }
    .landing-logo h1 {
        font-size: 32px;
    }
    .landing-logo-img {
        width: 48px;
        height: 48px;
    }
    .landing-tagline {
        font-size: 18px;
    }
    .landing-desc {
        font-size: 14px;
        max-width: 100%;
    }
    .landing-features {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .landing-feature {
        font-size: 12.5px;
        padding: 10px 12px;
    }
    .landing-hero-footer {
        display: none;
    }
    .landing-auth {
        width: 100%;
        min-height: auto;
        padding: 8px 16px 40px;
    }
    .landing-auth .login-card {
        max-width: 460px;
        margin: 0 auto;
        padding: 28px 24px;
        border-radius: 20px;
    }
    .landing-scroll-hint {
        display: block;
    }
    .landing-wrapper > .card-theme-btn {
        width: 34px;
        height: 34px;
        top: 16px;
        right: 16px;
    }
}

@media (max-width: 600px) {
    .landing-hero {
        padding: 50px 16px 16px;
    }
    .landing-logo {
        gap: 10px;
        margin-bottom: 20px;
    }
    .landing-logo h1 {
        font-size: 26px;
    }
    .landing-logo-img {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
    .landing-tagline {
        font-size: 16px;
    }
    .landing-desc {
        font-size: 13px;
        margin-bottom: 24px;
    }
    .landing-features {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .landing-feature {
        font-size: 11.5px;
        padding: 8px 10px;
        gap: 8px;
        border-radius: 10px;
    }
    .landing-feature .material-icons-outlined {
        font-size: 18px;
    }
    .landing-auth {
        padding: 4px 12px 32px;
    }
    .landing-auth .login-card {
        padding: 24px 18px;
        border-radius: 18px;
        max-height: none;
    }
    .landing-wrapper > .card-theme-btn {
        width: 32px;
        height: 32px;
        top: 12px;
        right: 12px;
    }
    .auth-tabs {
        margin-bottom: 18px;
    }
    .auth-tab {
        font-size: 13px;
        padding: 8px 12px;
    }
    .auth-form .form-group {
        margin-bottom: 14px;
    }
    .auth-form .form-control {
        padding: 10px 14px;
        font-size: 14px;
    }
    .btn-auth-submit {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* Small phone (≤480px) */
@media (max-width: 480px) {
    .landing-hero {
        padding: 44px 12px 12px;
    }
    .landing-logo h1 {
        font-size: 22px;
    }
    .landing-logo-img {
        width: 36px;
        height: 36px;
    }
    .landing-tagline {
        font-size: 14px;
    }
    .landing-desc {
        font-size: 12.5px;
        margin-bottom: 18px;
    }
    .landing-features {
        grid-template-columns: 1fr;
    }
    .landing-feature {
        font-size: 12px;
        padding: 10px 12px;
    }
    .landing-auth {
        padding: 0 8px 28px;
    }
    .landing-auth .login-card {
        padding: 20px 14px;
        border-radius: 16px;
    }
    .landing-auth .register-step .role-radio-group {
        flex-direction: column;
        gap: 8px;
    }
    .landing-auth .register-step .domains-grid {
        grid-template-columns: 1fr 1fr;
    }
    .landing-wrapper > .card-theme-btn {
        width: 28px;
        height: 28px;
        top: 10px;
        right: 10px;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

@supports (height: 100dvh) {
    body { height: 100dvh; }
}

#app {
    display: flex;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    z-index: 10;
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px 32px;
    color: var(--primary);
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
}

.logo-icon {
    font-size: 32px;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 17px; /* adjusted slightly to maintain vertical grid height with borders */
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14.5px;
    border: 1px solid rgba(0, 120, 212, 0.08);
    border-radius: var(--radius-pill);
    transition: var(--transition);
}

.nav-item:hover {
    background-color: rgba(0, 120, 212, 0.05);
    border-color: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background-color: var(--secondary);
    border-color: var(--primary);
    color: var(--primary);
}

.status-indicator {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--success);
    font-size: 14px;
    font-weight: 500;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* Skype Avatar Presence Style */
.skype-avatar-container {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--secondary);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 120, 212, 0.15);
}

.skype-presence {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    background-color: var(--success);
    border: 2px solid var(--surface);
    border-radius: 50%;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    height: 80px;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

header h2 {
    font-weight: 600;
    font-size: 24px;
}

.page-container {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    user-select: none;
    white-space: nowrap;
    text-decoration: none;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.2s;
    border-radius: inherit;
}

.btn:hover::after {
    background: rgba(255,255,255,0.1);
}

.btn:active::after {
    background: rgba(0,0,0,0.08);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 14px rgba(0, 120, 212, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(0, 120, 212, 0.3);
    transform: translateY(-1px);
}

.btn-primary:active {
    box-shadow: 0 2px 8px rgba(0, 120, 212, 0.2);
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--secondary);
    box-shadow: 0 2px 8px rgba(0, 120, 212, 0.1);
    transform: translateY(-1px);
}

.btn-outline:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg);
    border: 1.5px solid var(--border);
    color: var(--text-muted);
}

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

.btn-success {
    background: linear-gradient(135deg, #27AE60, #43A047);
    color: white;
    border: none;
    box-shadow: 0 4px 14px rgba(39, 174, 96, 0.2);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.3);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #E74C3C, #EF5350);
    color: white;
    border: none;
    box-shadow: 0 4px 14px rgba(231, 76, 60, 0.2);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
    transform: translateY(-1px);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--hover-bg);
    color: var(--text-main);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12.5px;
    border-radius: calc(var(--radius-pill) - 2px);
    min-height: 32px;
}

/* Table action buttons wrap */
.actions-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.actions-equal > .btn-sm {
    flex: 1 1 0;
    min-width: 72px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 15px;
}

/* Cards */
.card {
    background-color: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-header h3, .card-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.card-header .card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.card-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

/* Grid Layouts */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--secondary);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
}

.stat-info p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Tables */
.table-container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-top: 16px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

th, td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}

th {
    background: #F8FAFC;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 20px;
    border-bottom: 2px solid var(--border);
}

[data-theme="dark"] th {
    background: #2a2a2a;
}

tbody tr {
    transition: background 0.15s;
}

tbody tr:nth-child(even) {
    background: rgba(0,0,0,0.015);
}

[data-theme="dark"] tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

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

tbody tr:hover {
    background: var(--hover-bg);
}

/* Star Ratings */
.star-filled { color: #FFB300; font-size: 14px; }
.star-empty { color: #CFD8DC; font-size: 14px; }
.star-interactive { transition: transform 0.1s, color 0.15s; }
.star-interactive:hover { transform: scale(1.2); }
[data-theme="dark"] .star-empty { color: #455A64; }

/* Badges within tables and elsewhere */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: #E8F5E9; color: #2E7D32; }
.badge-warning { background: #FFF3E0; color: #E65100; }
.badge-danger { background: #FFEBEE; color: #C62828; }
.badge-info { background: #E3F2FD; color: #1565C0; }
.badge-clinic { background: #E3F2FD; color: #1565C0; }
.badge-rural { background: #E8F5E9; color: #2E7D32; }

[data-theme="dark"] .badge-success { background: #1B3D1B; color: #81C784; }
[data-theme="dark"] .badge-warning { background: #3D2B1B; color: #FFB74D; }
[data-theme="dark"] .badge-danger { background: #3D1B1B; color: #EF9A9A; }
[data-theme="dark"] .badge-info { background: #1B2B3D; color: #90CAF9; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(23, 37, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 1;
    transition: var(--transition);
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    background-color: var(--surface);
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 12px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    font-family: inherit;
    font-size: 15px;
    background-color: #fcfdfe;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.12);
}

.form-row {
    display: flex;
    gap: 16px;
}
.form-row > .form-group {
    flex: 1;
}

/* ==========================================
   AUTH PAGES — Login & Registration
   ========================================== */

@keyframes authBgShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

html {
    scroll-behavior: smooth;
}

#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    transition: opacity 0.6s ease;
    display: flex;
    align-items: flex-start;
}

#login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 48px 40px;
    border-radius: 20px;
    box-shadow: 
        0 25px 60px -12px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 440px;
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--primary);
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #2B7A78, #3AAFA9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo .material-icons-outlined {
    font-size: 40px;
    color: var(--primary);
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
    font-weight: 400;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    border-radius: 14px;
    background: var(--bg);
    padding: 4px;
    gap: 4px;
    border: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    border-radius: 11px;
    transition: all 0.3s ease;
    letter-spacing: 0.2px;
    position: relative;
}

.auth-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(43, 122, 120, 0.3);
}

.auth-tab:not(.active):hover {
    background: rgba(43, 122, 120, 0.08);
    color: var(--primary);
}

/* Auth Forms */
.auth-form {
    display: none;
    text-align: left;
}

.auth-form.active {
    display: block;
    animation: fadeInUp 0.4s ease-out;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form .form-group label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 5px;
    display: block;
    letter-spacing: 0.2px;
}

.auth-form .form-control {
    padding: 11px 16px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.25s ease;
    background: var(--bg-card);
    color: var(--text-main);
    width: 100%;
    outline: none;
}

.auth-form .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43, 122, 120, 0.1);
    background: var(--bg);
}

.auth-form .form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.auth-form .form-row {
    display: flex;
    gap: 12px;
}

.auth-form .form-row > .form-group {
    flex: 1;
}

/* Auth Buttons */
.btn-auth-submit {
    width: 100%;
    padding: 13px 20px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #3a9bd5);
    color: white;
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.35s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.btn-auth-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.6s ease;
}

.btn-auth-submit:hover::before {
    left: 100%;
}

.btn-auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -5px rgba(43, 122, 120, 0.45);
}

.btn-auth-submit:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(43, 122, 120, 0.3);
}

.btn-auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-auth-submit .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn-auth-submit.loading .spinner {
    display: inline-block;
}

.btn-auth-submit.loading .btn-text {
    display: none;
}

/* Auth Error */
#auth-error {
    color: #c62828;
    background: linear-gradient(135deg, #fce4ec, #ffebee);
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 13px;
    font-weight: 500;
    display: none;
    text-align: center;
    border: 1px solid #f8bbd0;
    animation: fadeInUp 0.3s ease;
}

#auth-error.visible {
    display: block;
}

/* Auth Success */
.auth-success {
    color: #388E3C;
    background-color: #E8F5E9;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    border: 1px solid #C8E6C9;
    display: none;
}

.auth-success.visible {
    display: block;
    animation: fadeInUp 0.3s ease;
}

/* Auth Footer */
.auth-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-footer a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

/* Version badge */
.auth-version {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 1px;
    opacity: 0.6;
}

/* Print Styles for Invoice */
@media print {
    body {
        background-color: white;
    }
    .sidebar, header, .no-print, .actions, .grid-stats {
        display: none !important;
    }
    .main-content {
        overflow: visible;
        display: block;
    }
    .page-container {
        padding: 0;
        overflow: visible;
    }
    .modal-overlay {
        position: absolute;
        top: 0;
        left: 0;
        background: white;
        backdrop-filter: none;
        width: 100%;
        height: 100%;
        align-items: flex-start;
        justify-content: center;
        padding: 0;
    }
    .modal {
        box-shadow: none;
        max-width: 100%;
        width: 100%;
        border-radius: 0;
    }
    .modal-header {
        display: none;
    }
    .modal-body {
        padding: 0;
        overflow: visible;
    }
}

/* Order Panel Styles */
.order-layout {
    display: flex;
    gap: 24px;
    margin-top: 20px;
    align-items: flex-start;
}

.order-catalog {
    flex: 2;
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.order-cart-panel {
    flex: 1;
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    position: sticky;
    top: 24px;
}

.cart-items-list {
    margin: 16px 0;
    padding: 0;
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item-info {
    flex: 1;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
}

.cart-qty-btn:hover {
    background: var(--bg);
}

/* CSV Upload Drag & Drop Area */
.csv-upload-zone {
    border: 2px dashed var(--primary);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    background: #F4FAF8;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 24px;
}

.csv-upload-zone:hover, .csv-upload-zone.dragover {
    background: #E8F5E9;
    border-color: #388E3C;
}

.csv-upload-icon {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 12px;
}

.csv-preview-table-container {
    max-height: 250px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin: 16px 0;
}

.csv-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.csv-preview-table th, .csv-preview-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.csv-preview-table th {
    background: var(--bg);
    position: sticky;
    top: 0;
    font-weight: 600;
}

/* Supplier product badge or store status */
.badge-order-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-en-attente {
    background-color: #FFF3E0;
    color: #E65100;
}

.status-confirmee {
    background-color: #E8EAF6;
    color: #3F51B5;
}

.status-expediee {
    background-color: #E0F7FA;
    color: #00838F;
}

.status-livree {
    background-color: #E8F5E9;
    color: #2E7D32;
}

.status-annulee {
    background-color: #FFEBEE;
    color: #C62828;
}

/* Product Thumbnails */
.product-thumbnail {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    flex-shrink: 0;
}

.product-thumbnail-fallback {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Badge for Notice Link */
.badge-notice {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(43, 122, 120, 0.08);
    color: var(--primary);
    border: 1px solid rgba(43, 122, 120, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
    font-family: inherit;
}

.badge-notice:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 6px rgba(43, 122, 120, 0.2);
}

/* Medical Leaflet (Notice View) */
.medical-leaflet {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text-main);
    line-height: 1.6;
}

.medical-leaflet-header {
    border-bottom: 2px solid var(--primary);
    padding-bottom: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.medical-leaflet-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--primary);
    font-weight: 700;
}

.medical-leaflet-section {
    margin-bottom: 16px;
}

.medical-leaflet-section h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.medical-leaflet-section p {
    margin: 0;
    font-size: 13.5px;
    color: var(--text-muted);
}

/* ==========================================
   ANIMATIONS & OVERLAYS (Welcome & Thank You)
   ========================================== */

/* Welcome Overlay */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(23, 37, 42, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.5s ease-in-out;
}

.welcome-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.welcome-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 40px 32px;
    width: 90%;
    max-width: 460px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    transform: scale(0.9);
    animation: welcomeCardEnter 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes welcomeCardEnter {
    to {
        transform: scale(1);
    }
}

.welcome-icon-container {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--surface) 100%);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 8px 16px rgba(43, 122, 120, 0.12);
}

.welcome-icon-container .material-icons-outlined {
    font-size: 40px;
    animation: welcomeSunSpin 12s linear infinite;
}

@keyframes welcomeSunSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.welcome-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    opacity: 0;
    animation: welcomeFadeInUp 0.6s ease 0.2s forwards;
}

.welcome-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 28px;
    opacity: 0;
    animation: welcomeFadeInUp 0.6s ease 0.4s forwards;
}

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

.welcome-btn {
    padding: 12px 32px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    font-weight: 700;
    border: 1px solid var(--primary-dark);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(43, 122, 120, 0.3);
    transition: all 0.2s;
    font-size: 15px;
    font-family: inherit;
    opacity: 0;
    animation: welcomeFadeInUp 0.6s ease 0.6s forwards;
}

.welcome-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(43, 122, 120, 0.4);
}

/* Thank You & Confetti Overlay */
.thankyou-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(23, 37, 42, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    transition: opacity 0.4s ease-in-out;
}

.thankyou-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.thankyou-modal {
    background: var(--surface);
    border-radius: 24px;
    padding: 40px 32px;
    width: 90%;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    animation: thankyouEnter 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
    position: relative;
}

@keyframes thankyouEnter {
    to {
        transform: scale(1);
    }
}

/* SVG Success Checkmark Animation */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.success-checkmark .check-icon {
    width: 80px;
    height: 80px;
    position: relative;
    border-radius: 50%;
    box-sizing: content-box;
    border: 4px solid rgba(39, 174, 96, .2);
}

.success-checkmark .check-icon::after {
    top: 4px;
    left: 4px;
    width: 72px;
    height: 72px;
    position: absolute;
    border-radius: 50%;
    content: "";
}

.success-checkmark .check-icon .icon-line {
    height: 5px;
    background-color: var(--success);
    display: block;
    border-radius: 2px;
    position: absolute;
    z-index: 10;
}

.success-checkmark .check-icon .icon-line.line-tip {
    top: 46px;
    left: 14px;
    width: 25px;
    transform: rotate(45deg);
    animation: icon-line-tip 0.75s;
}

.success-checkmark .check-icon .icon-line.line-long {
    top: 38px;
    right: 8px;
    width: 47px;
    transform: rotate(-45deg);
    animation: icon-line-long 0.75s;
}

.success-checkmark .check-icon .icon-circle {
    top: -4px;
    left: -4px;
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid var(--success);
    box-sizing: content-box;
    z-index: 2;
}

@keyframes icon-line-tip {
    0% {
        width: 0;
        left: 1px;
        top: 19px;
    }
    54% {
        width: 0;
        left: 1px;
        top: 19px;
    }
    70% {
        width: 50px;
        left: -8px;
        top: 37px;
    }
    84% {
        width: 17px;
        left: 21px;
        top: 48px;
    }
    100% {
        width: 25px;
        left: 14px;
        top: 46px;
    }
}

@keyframes icon-line-long {
    0% {
        width: 0;
        right: 46px;
        top: 54px;
    }
    65% {
        width: 0;
        right: 46px;
        top: 54px;
    }
    84% {
        width: 55px;
        right: 0px;
        top: 35px;
    }
    100% {
        width: 47px;
        right: 8px;
        top: 38px;
    }
}

.thankyou-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
}

.thankyou-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
}

.thankyou-badge {
    display: inline-block;
    padding: 6px 16px;
    background: #E8F5E9;
    color: var(--success);
    border-radius: 30px;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 24px;
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.thankyou-btn {
    padding: 10px 24px;
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text-main);
    font-weight: 600;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-family: inherit;
}

.thankyou-btn:hover {
    background: var(--border);
}

/* Confetti CSS Explosion */
.confetti-particle {
    position: fixed;
    z-index: 2600;
    pointer-events: none;
    opacity: 0;
    animation: confetti-explode 2.5s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes confetti-explode {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate3d(var(--x), var(--y), 0) rotate(var(--r));
    }
}

/* ==========================================
   FLOATING DROPLET TOAST NOTIFICATIONS
   ========================================== */

.droplet-toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none;
}

.droplet-toast {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(43, 122, 120, 0.25);
    border-radius: 20px;
    padding: 16px 20px 16px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 
        0 10px 30px rgba(43, 122, 120, 0.12),
        inset 0 0 12px rgba(255, 255, 255, 0.6);
    max-width: 360px;
    animation: 
        droplet-pop-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards,
        droplet-float 4s ease-in-out infinite 0.6s;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.droplet-toast:hover {
    transform: scale(1.02) translateY(-3px);
    box-shadow: 0 15px 35px rgba(43, 122, 120, 0.2);
    background: rgba(255, 255, 255, 0.95);
}

/* Liquid droplet shape */
.droplet-shape {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 10px rgba(43, 122, 120, 0.25);
    flex-shrink: 0;
    position: relative;
}

/* Droplet shiny specular highlight */
.droplet-shape::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 10px;
    width: 8px;
    height: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    transform: rotate(-15deg);
}

.droplet-shape .material-icons-outlined {
    font-size: 22px;
}

.droplet-info {
    flex: 1;
}

.droplet-title {
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.droplet-desc {
    font-size: 13px;
    color: var(--text-main);
    font-weight: 600;
    line-height: 1.4;
}

.droplet-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.droplet-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
    align-self: flex-start;
    margin-top: -4px;
    margin-right: -8px;
}

.droplet-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

@keyframes droplet-pop-in {
    0% {
        transform: scale(0.5) translateY(100px);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes droplet-float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* Sidebar navigation badge */
.sidebar-badge {
    background-color: var(--danger);
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    margin-left: auto;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(231, 76, 60, 0.3);
}

/* Splash Screen Styles */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #e6f5fc 0%, #ffffff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    animation: splashFadeIn 1s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

.splash-logo {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    box-shadow: 0 8px 24px rgba(0, 120, 212, 0.15);
    margin-bottom: 20px;
    object-fit: cover;
    animation: pulseLogo 2s infinite ease-in-out;
}

.splash-title {
    font-size: 38px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.splash-slogan {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 30px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.4;
}

.splash-loader {
    display: flex;
    justify-content: center;
    align-items: center;
}

.splash-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 120, 212, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spinLoader 0.8s linear infinite;
}

@keyframes splashFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pulseLogo {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 24px rgba(0, 120, 212, 0.15);
    }
    50% {
        transform: scale(1.04);
        box-shadow: 0 12px 30px rgba(0, 120, 212, 0.25);
    }
}

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

/* Messaging Layout Skype Theme */
.messaging-container {
    display: flex;
    height: calc(100vh - 120px);
    background-color: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.messaging-sidebar {
    width: 300px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background-color: var(--surface);
    flex-shrink: 0;
}

.messaging-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
}

.messaging-search-wrapper {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}

.messaging-contact-list {
    flex: 1;
    overflow-y: auto;
}

.messaging-contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.02);
    transition: var(--transition);
}

.messaging-contact-item:hover {
    background-color: rgba(0, 120, 212, 0.03);
}

.messaging-contact-item.active {
    background-color: var(--secondary);
}

.messaging-contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: white;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.messaging-contact-info {
    flex: 1;
    min-width: 0;
}

.messaging-contact-name {
    font-weight: 700;
    font-size: 14.5px;
    color: var(--text-main);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messaging-contact-lastmsg {
    font-size: 12.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messaging-contact-badge {
    background-color: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    padding: 2px 7px;
    min-width: 18px;
    text-align: center;
    margin-left: auto;
}

.messaging-chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #f7f9fb;
}

.messaging-chat-header {
    padding: 16px 24px;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.messaging-chat-header-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-main);
}

.messaging-chat-header-status {
    font-size: 12px;
    color: var(--success);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.messaging-chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.messaging-chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 12px;
}

.messaging-chat-empty span {
    font-size: 48px;
    color: rgba(0, 120, 212, 0.2);
}

.message-bubble-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.message-bubble-wrapper.sent {
    align-self: flex-end;
    align-items: flex-end;
}

.message-bubble-wrapper.received {
    align-self: flex-start;
    align-items: flex-start;
}

.message-bubble {
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.4;
    word-break: break-word;
}

.message-bubble-wrapper.sent .message-bubble {
    background-color: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 120, 212, 0.15);
}

.message-bubble-wrapper.received .message-bubble {
    background-color: var(--surface);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border);
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.messaging-chat-input-area {
    padding: 16px 24px;
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.messaging-chat-input-wrapper {
    flex: 1;
    position: relative;
}

.messaging-chat-btn-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(0, 120, 212, 0.15);
}

.messaging-chat-btn-send:hover {
    background-color: var(--primary-light);
    transform: scale(1.05);
}

.messaging-chat-btn-send:active {
    transform: scale(0.95);
}

/* === Notification Bell System === */
.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notification-bell:hover {
    background: var(--bg-hover, rgba(0,0,0,0.05));
    transform: scale(1.1);
}
.notification-bell .material-icons-outlined {
    font-size: 26px;
    color: var(--text-main);
}
.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #EF4444;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 1px 4px rgba(239,68,68,0.4);
    animation: notif-pulse 2s infinite;
}
@keyframes notif-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--card-bg, #fff);
    border-radius: var(--radius, 12px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    z-index: 1000;
    border: 1px solid var(--border);
    padding: 0;
}
.notification-dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 14px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.notification-item:last-child {
    border-bottom: none;
}
.notification-item:hover {
    background: var(--bg-hover, rgba(0,0,0,0.03));
}
.notification-item .notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #FEF3C7;
    color: #D97706;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.notification-item .notif-icon .material-icons-outlined {
    font-size: 20px;
}
.notification-item .notif-content {
    flex: 1;
}
.notification-item .notif-content .notif-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
    margin-bottom: 2px;
}
.notification-item .notif-content .notif-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}
.notification-item .notif-action {
    flex-shrink: 0;
    align-self: center;
}
.notification-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

@keyframes pulse-alert {
    0% {
        box-shadow: 0 4px 12px rgba(230, 81, 0, 0.15);
    }
    50% {
        box-shadow: 0 4px 20px rgba(230, 81, 0, 0.3);
    }
    100% {
        box-shadow: 0 4px 12px rgba(230, 81, 0, 0.15);
    }
}

@keyframes key-bounce {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-4px);
    }
}

/* ==========================================
   SIDEBAR TOGGLE BUTTON
   ========================================== */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: var(--transition);
}
.sidebar-toggle:hover {
    background: var(--hover-bg);
    color: var(--primary);
}
.sidebar-overlay {
    display: none;
}

/* Sidebar collapsed (desktop) */
#app.sidebar-hidden .sidebar {
    width: 0;
    padding: 0;
    overflow: hidden;
    border: none;
    min-width: 0;
    flex: 0 0 0;
}

.sidebar {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border 0.3s ease;
}

/* ==========================================
   RESPONSIVE — Tablet (max-width: 1024px)
   ========================================== */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    .page-container {
        padding: 24px;
    }
    header {
        padding: 0 24px;
    }
    .form-row {
        gap: 12px;
    }
    th, td {
        padding: 12px 16px;
    }
    .modal {
        max-width: 85vw;
    }
}

/* ==========================================
   RESPONSIVE — Mobile (max-width: 768px)
   ========================================== */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    /* Sidebar becomes an overlay panel */
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 20px rgba(0,0,0,0.1);
        overflow-y: auto;
    }
    .sidebar.open {
        left: 0;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.4);
        z-index: 999;
    }
    .sidebar-overlay.visible {
        display: block;
    }

    /* Header */
    header {
        height: auto;
        min-height: 60px;
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    header h2 {
        font-size: 18px;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    header .actions {
        gap: 8px;
        flex-wrap: wrap;
    }
    header .actions .btn {
        font-size: 12px;
        padding: 6px 12px;
        white-space: nowrap;
    }
    header .actions .btn .material-icons-outlined {
        font-size: 16px;
    }

    .page-container {
        padding: 16px;
    }

    /* Cards */
    .card {
        padding: 16px;
    }

    /* Stats grid — 2 columns on mobile */
    .grid-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 20px;
    }
    .stat-value {
        font-size: 22px;
    }

    /* Forms */
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .form-control {
        font-size: 14px;
        padding: 10px 14px;
    }
    .auth-form .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Tables — horizontal scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-container table {
        min-width: 600px;
    }
    th, td {
        padding: 10px 12px;
        font-size: 13px;
    }

    /* Modals — full width */
    .modal {
        max-width: 95vw;
        max-height: 85vh;
        margin: 0 10px;
    }
    .modal-body {
        padding: 16px;
    }
    .modal-header {
        padding: 16px;
    }
    .modal-header h3 {
        font-size: 16px;
    }

    /* Order layout — stack */
    .order-layout {
        flex-direction: column;
    }
    .order-catalog, .order-cart-panel {
        flex: none;
        width: 100%;
    }
    .order-cart-panel {
        position: static;
    }

    /* Messaging layout */
    .messaging-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 80px);
        border-radius: 0;
        border: none;
    }
    .messaging-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 200px;
    }
    .messaging-chat-window {
        min-height: 400px;
    }
    .messaging-chat-header {
        padding: 12px 16px;
    }
    .messaging-chat-messages {
        padding: 12px 16px;
    }
    .message-bubble-wrapper {
        max-width: 85%;
    }

    /* Login card on mobile */
    .login-card {
        padding: 28px 20px;
        border-radius: 16px;
        max-width: 100%;
        margin: 0 8px;
    }
    .login-logo h1 {
        font-size: 24px;
    }
    .auth-tab {
        font-size: 12px;
        padding: 8px 10px;
    }

    /* Notification dropdown moves to center */
    .notification-dropdown {
        position: fixed;
        top: auto;
        left: 10px;
        right: 10px;
        width: auto;
        max-height: 50vh;
        box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    }

    /* Splash screen */
    .splash-title {
        font-size: 28px;
    }
    .splash-slogan {
        font-size: 14px;
        max-width: 260px;
    }

    /* Admin stats inline grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* Make all flex children in cards stack vertically on mobile */
    .page-container > div[style*="display:flex"] {
        flex-direction: column !important;
    }
    .page-container > div[style*="display:flex"] > .card,
    .page-container > div[style*="display:flex"] > [style*="flex:"] {
        min-width: 100% !important;
        width: 100% !important;
        flex: none !important;
    }
    /* Header flex row */
    header[style*="display:flex"] {
        flex-direction: row !important;
    }
    header[style*="display:flex"] > [style*="flex:"] {
        min-width: initial !important;
        width: auto !important;
        flex: 1 !important;
    }

    /* Fixed-column grids → single column */
    div[style*="grid-template-columns:1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    div[style*="grid-template-columns:1fr 1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    div[style*="repeat(5, 1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    div[style*="repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
    }
    /* Dashboard upcoming cards max-height removal */
    div[style*="max-height:380px"][style*="overflow-y:auto"] {
        max-height: none !important;
    }

    /* Lock screen PIN */
    #session-lock-screen > div {
        width: 300px !important;
        padding: 24px !important;
    }
    #session-lock-screen .btn-pin-num {
        width: 48px !important;
        height: 48px !important;
        font-size: 18px !important;
    }
    #session-lock-screen .grid-container {
        gap: 12px !important;
    }
}

/* ==========================================
   RESPONSIVE — Very Small Phones (max-width: 480px)
   ========================================== */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    .stat-card {
        padding: 12px;
    }
    .stat-value {
        font-size: 20px !important;
    }
    .stat-label {
        font-size: 11px !important;
    }

    header h2 {
        font-size: 16px;
    }
    header .actions .btn {
        font-size: 11px;
        padding: 4px 10px;
    }

    .page-container {
        padding: 12px;
    }

    .card {
        padding: 12px;
    }

    .login-card {
        padding: 20px 16px;
    }
    .login-logo h1 {
        font-size: 20px;
    }
    .login-subtitle {
        font-size: 12px;
    }
    .btn-auth-submit {
        font-size: 14px;
        padding: 12px 16px;
    }

    th, td {
        padding: 8px 8px;
        font-size: 12px;
    }

    .message-bubble-wrapper {
        max-width: 95%;
    }

    .sidebar {
        width: 260px;
        left: -260px;
    }
}

/* ==========================================
   RESPONSIVE — Landscape mobile fixes
   ========================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        padding: 8px 0;
    }
    .sidebar .logo {
        padding-bottom: 12px;
    }
    .nav-item {
        padding: 6px 14px;
        font-size: 13px;
    }
    header {
        min-height: 48px;
        padding: 8px 16px;
    }
    header h2 {
        font-size: 16px;
    }
    .page-container {
        padding: 12px;
    }
    .messaging-container {
        min-height: auto;
        height: calc(100vh - 60px);
    }
    .messaging-sidebar {
        max-height: 120px;
    }
}

/* ==========================================
   RESPONSIVE — Extra small (max-width: 360px)
   ========================================== */
@media (max-width: 360px) {
    .landing-hero {
        padding: 40px 10px 10px;
    }
    .landing-logo {
        gap: 8px;
        margin-bottom: 14px;
    }
    .landing-logo-img {
        width: 32px;
        height: 32px;
    }
    .landing-logo h1 {
        font-size: 20px;
    }
    .landing-tagline {
        font-size: 13px;
    }
    .landing-desc {
        font-size: 12px;
        margin-bottom: 14px;
    }
    .landing-feature {
        font-size: 11px;
        padding: 8px 10px;
        gap: 6px;
    }
    .landing-feature .material-icons-outlined {
        font-size: 16px;
    }
    .landing-auth .login-card {
        padding: 16px 10px;
        border-radius: 14px;
    }
    .auth-tab {
        font-size: 12px;
        padding: 6px 8px;
    }
    .auth-form .form-control {
        padding: 9px 12px;
        font-size: 13px;
    }
    .btn-auth-submit {
        padding: 10px 14px;
        font-size: 13px;
    }
    .splash-logo {
        width: 64px;
        height: 64px;
    }
    .splash-title {
        font-size: 24px;
    }
    .splash-slogan {
        font-size: 12px;
        max-width: 220px;
    }
}

/* ==========================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================== */
@media (hover: none) and (pointer: coarse) {
    .nav-item, .btn, button, .auth-tab, .landing-feature {
        cursor: default;
    }
    .nav-item:hover, .btn:hover, .card:hover, tr:hover td {
        transform: none !important;
        box-shadow: none !important;
    }
    .btn, .auth-tab, .nav-item, .form-control, select {
        min-height: 44px;
    }
    .btn-icon {
        min-height: 36px;
        min-width: 36px;
    }
}

/* ==========================================
   SAFE AREA & NOTCH SUPPORT
   ========================================== */
@supports (padding: env(safe-area-inset-bottom)) {
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
    #login-overlay {
        padding-top: env(safe-area-inset-top);
    }
    .modal-body {
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }
}

/* ==========================================
   SMOOTH SCROLLBAR (Webkit)
   ========================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.25);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
}

/* ==========================================
   RESPONSIVE IMPROVEMENTS — Medium screens
   ========================================== */
@media (max-width: 1024px) and (min-width: 769px) {
    .landing-auth {
        width: 380px;
    }
    .landing-panel {
        padding: 32px 24px;
    }
}

/* ==========================================
   RESPONSIVE IMPROVEMENTS — Small tablets (≤820px)
   ========================================== */
@media (max-width: 820px) {
    .table-container table {
        min-width: 520px;
    }
    .sidebar {
        width: 250px;
        left: -250px;
    }
    .messaging-container {
        min-height: calc(100vh - 70px);
    }
}

/* ==========================================
   RESPONSIVE IMPROVEMENTS — Mobile landscape (≤640px)
   ========================================== */
@media (max-width: 640px) {
    .table-container table {
        min-width: 480px;
        font-size: 12.5px;
    }
    th, td {
        padding: 8px 10px;
    }
    .modal {
        max-width: 98vw;
        margin: 0 6px;
        max-height: 90vh;
    }
    .modal-body {
        padding: 12px;
    }
    .modal-header {
        padding: 12px 14px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
}

/* ==========================================
   RESPONSIVE IMPROVEMENTS — Extra small phones (≤400px)
   ========================================== */
@media (max-width: 400px) {
    .landing-auth .login-card {
        padding: 14px 8px;
    }
    .auth-tab {
        font-size: 11px;
        padding: 6px 6px;
    }
    .auth-form .form-group {
        margin-bottom: 10px;
    }
    .auth-form .form-control {
        padding: 8px 10px;
        font-size: 13px;
    }
    .btn-auth-submit {
        padding: 10px 12px;
        font-size: 13px;
    }
    .landing-hero {
        padding: 32px 8px 8px;
    }
    .landing-logo h1 {
        font-size: 18px;
    }
    .landing-logo-img {
        width: 32px;
        height: 32px;
    }
    .landing-tagline {
        font-size: 13px;
    }
    .landing-features {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .page-container {
        padding: 8px;
    }
    header {
        padding: 8px 10px;
        min-height: 50px;
    }
    header h2 {
        font-size: 14px;
    }
    header .actions .btn {
        font-size: 10px;
        padding: 4px 8px;
    }
    .card {
        padding: 10px;
    }
    .sidebar {
        width: 240px;
        left: -240px;
    }
    #session-lock-screen > div {
        width: 260px !important;
        padding: 20px !important;
    }
    #session-lock-screen .btn-pin-num {
        width: 44px !important;
        height: 44px !important;
        font-size: 16px !important;
    }
}


