:root {
    --primary-color: #2563EB;
    --primary-dark: #1E3A8A;
    --secondary-color: #10B981;
    --secondary-light: #D1FAE5;
    --background-color: #F8FAFC;
    --card-bg: #FFFFFF;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --danger: #EF4444;
    --warning: #F59E0B;
}

/* Landing Page SaaS Styles */
.feature-card {
    transition: all 0.3s ease;
    border: 1px solid transparent !important;
}
.feature-card:hover {
    transform: translateY(-5px);
    border-color: rgba(37, 99, 235, 0.2) !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1) !important;
}
.blur-bg {
    filter: blur(60px);
}
.transition-all {
    transition: all 0.3s ease-in-out;
}

/* Bootstrap Overrides for Brand Colors */
.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}
.btn-primary:hover {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
}
.btn-outline-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    position: relative;
}
.btn-outline-primary:hover {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}
.btn-check:checked + .btn-outline-primary,
.btn-check:active + .btn-outline-primary,
.btn-outline-primary.active,
.btn-outline-primary:active {
    color: #FFFFFF !important;
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    opacity: 1 !important;
}
.btn-check:checked + .btn-outline-primary::after {
    content: '\f058';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 10px;
    left: 10px;
    color: #FFFFFF !important;
    font-size: 1.2rem;
}
.btn-check:checked + .btn-outline-primary i,
.btn-check:checked + .btn-outline-primary *,
.btn-outline-primary.active i,
.btn-outline-primary.active * {
    color: #FFFFFF !important;
    opacity: 1 !important;
}
.border-primary { border-color: var(--primary-color) !important; }

/* ─── User-Select: Prevent accidental text highlight ─── */
.patient-item,
.patient-item *,
.stat-box,
.stat-box *,
.p-type,
.p-num,
.p-actions,
.p-actions *,
.badge,
.badge *,
.est-wait,
.est-wait * {
  user-select: none;
  -webkit-user-select: none;
}
input, textarea, select {
  user-select: text;
  -webkit-user-select: text;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-main);
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--card-bg);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    gap: 0.4rem;
    transition: color 0.2s ease;
}
.nav-item i {
    font-size: 1.25rem;
}
.nav-item.active {
    color: var(--primary-color);
}
.nav-item.active i {
    font-weight: 900;
}

/* Horizontal Quick Actions (Mobile) */
.mobile-quick-actions {
    display: none;
    overflow-x: auto;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
}
.mobile-quick-actions::-webkit-scrollbar {
    display: none;
}
.quick-chip {
    white-space: nowrap;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

/* --- Landing Page --- */
#landing-page {
    background-color: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.landing-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    background: var(--card-bg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.landing-logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hero-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4rem 5%;
    gap: 4rem;
    flex: 1;
    background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero-title {
    font-size: 3rem;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.hero-cta {
    width: auto;
    display: inline-flex;
    padding: 1rem 2.5rem;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
}

.mockup-window {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.mockup-header {
    background: #F1F5F9;
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.mockup-header span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #CBD5E1;
}

.mockup-header span:nth-child(1) { background: #EF4444; }
.mockup-header span:nth-child(2) { background: #F59E0B; }
.mockup-header span:nth-child(3) { background: #10B981; }

.mockup-body {
    padding: 3rem 2rem;
    text-align: center;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.features-section {
    padding: 4rem 5%;
    background: var(--card-bg);
}

.section-title {
    text-align: center;
    font-size: 2rem;
    color: var(--primary-dark);
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--background-color);
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    transition: transform 0.3s;
    border: 1px solid var(--border-color);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    color: var(--text-main);
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-muted);
}

.landing-footer {
    text-align: center;
    padding: 2rem;
    background: var(--primary-dark);
    color: white;
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .hero-section {
        flex-direction: column;
        text-align: center;
        padding: 2rem 5%;
    }
    .hero-title {
        font-size: 2rem;
    }
    .hero-image {
        width: 100%;
    }
}

/* --- Common UI --- */
header {
    background-color: var(--card-bg);
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

button {
    cursor: pointer;
    font-family: inherit;
}

.logout-btn, .settings-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.logout-btn:hover {
    background: #FEF2F2;
    color: var(--danger);
    border-color: #FECACA;
    transform: translateY(-1px);
}

.settings-btn:hover {
    background: var(--background-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.main-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    body {
        overflow-x: hidden;
    }
    .main-layout {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    .header-actions {
        display: none !important;
    }
    .mobile-nav {
        display: flex;
    }
    .screen {
        padding-bottom: 80px; /* Space for bottom nav */
    }
    .mobile-quick-actions {
        display: flex;
    }
    .container {
        padding: 1rem;
    }
    
    /* Mobile Tabs Toggle Class */
    .mobile-tab-hidden {
        display: none !important;
    }
    
    /* Touch friendly sizes */
    .p-btn, button, input, select {
        min-height: 44px;
    }
    
    /* Stats grid */
    .stats-row {
        grid-template-columns: 1fr 1fr !important;
    }
    
    /* Fullscreen Modals */
    #settings-modal .modal-content, #report-modal .modal-content, #archive-modal .modal-content, #patient-history-modal .modal-content {
        max-width: 100% !important;
        width: 100% !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        padding: 0;
    }
    .settings-body, .report-content {
        flex: 1;
        overflow-y: auto;
        padding: 1rem !important;
    }
    .settings-header, .report-header {
        padding: 1rem !important;
    }
    .settings-footer {
        padding: 1rem !important;
    }
    
    /* Responsive Report Table */
    .report-table thead {
        display: none;
    }
    .report-table, .report-table tbody, .report-table tr, .report-table td {
        display: block;
        width: 100%;
    }
    .report-table tr {
        margin-bottom: 1rem;
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 0.5rem;
    }
    .report-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        border: none;
        border-bottom: 1px solid var(--background-color);
    }
    .report-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: 45%;
        font-weight: 600;
        text-align: left;
        color: var(--text-muted);
    }
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.08);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 2px solid var(--background-color);
    padding-bottom: 0.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--background-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}
.card-header h2 {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* --- Forms & Inputs --- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-main);
}

input[type="text"], input[type="password"], input[type="number"], select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: var(--background-color);
}

input:focus, select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-color: var(--card-bg);
}

.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-btn {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.radio-btn input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-btn span {
    display: block;
    text-align: center;
    padding: 0.75rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s;
}

.radio-btn input:checked ~ span {
    background: var(--secondary-light);
    border-color: var(--secondary-color);
    color: var(--primary-dark);
}

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

.btn-add {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-add:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

/* --- Lists --- */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 260px);
    padding-right: 0.5rem; /* for scrollbar */
    padding-bottom: 120px;
}

.patient-item {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-inline-end: 4px solid var(--primary-color);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    height: auto !important;
    min-height: 96px;
    flex-shrink: 0;
    overflow: visible;
}

.patient-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}


.status-waiting  { border-inline-end-color: #F59E0B; }
.status-in_room  { border-inline-end-color: #10B981; background: #F0FDF4; }
.status-completed { border-inline-end-color: #94A3B8; opacity: 0.75; }
.status-booked   { border-inline-end-color: #CBD5E1; }
.status-cancelled { border-inline-end-color: #EF4444; opacity: 0.5; }
.status-no_show  { border-inline-end-color: #6B7280; opacity: 0.5; }
.status-temporarily_away {
    border-inline-end-color: #64748B;
    background: #F3F4F6;
    opacity: 0.95;
}

.badge-away {
    background: #64748B;
    color: #fff;
    font-size: 12px;
    border-radius: 999px;
    padding: 4px 10px;
    margin-inline-start: 6px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ─── Patient Info Area ─── */
.p-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: visible;
}

.p-info-text {
    flex: 1;
    min-width: 0;
    overflow: visible;
}

.p-num {
    background: #1E3A8A;
    color: white;
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 800;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.p-name {
    font-weight: 700;
    font-size: 15px;
    color: #1E293B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.p-type {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.p-type.kashf     { background: #DBEAFE; color: #1E3A8A; }
.p-type.esteshara { background: #D1FAE5; color: #065F46; }
.p-type.ziyara    { background: #FEF3C7; color: #92400E; }

.p-meta {
    font-size: 11px;
    color: #64748B;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Estimated Wait Badge ─── */
.est-wait {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 4px;
    white-space: nowrap;
    max-width: fit-content;
    line-height: 1.2;
}
.wait-green  { background: #D1FAE5; color: #065F46; }
.wait-yellow { background: #FEF3C7; color: #92400E; }
.wait-red    { background: #FEE2E2; color: #991B1B; }

/* ─── Patient Action Buttons ─── */
.p-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
    min-height: auto;
}

.p-btn {
    height: 38px;
    min-width: 38px;
    border: none;
    border-radius: 9px;
    font-weight: 700;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.18s ease;
    padding: 0 10px;
    white-space: nowrap;
    flex-shrink: 0;
}
.p-btn i { font-size: 13px; pointer-events: none; }

.btn-enter   { background: #10B981; color: #fff; min-width: 110px; }
.btn-enter:hover { background: #059669; transform: translateY(-1px); }
.btn-history { background: #EFF6FF; color: #2563EB; }
.btn-history:hover { background: #DBEAFE; transform: translateY(-1px); }
.btn-noshow  { background: #F1F5F9; color: #64748B; }
.btn-noshow:hover { background: #E2E8F0; transform: translateY(-1px); }
.btn-cancel  { background: #FEF2F2; color: #DC2626; }
.btn-cancel:hover { background: #FEE2E2; transform: translateY(-1px); }
.btn-finish  { background: var(--primary-color); color: #fff; min-width: 100px; }
.btn-finish:hover { background: var(--primary-dark); transform: translateY(-1px); }

/* --- Doctor Dashboard --- */
.doctor-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ─── Special Priority Badges ─── */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    margin-top: 3px;
    white-space: nowrap;
}

.priority-reason {
    display: inline-flex;
    align-items: center;
    background: #FFFBEB;
    color: #B45309;
    border: 1px solid #FDE68A;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    margin-right: 4px;
    margin-top: 3px;
    white-space: nowrap;
}

/* ─── Priority Button on Patient Card ─── */
.btn-priority {
    background: #FEF3C7;
    color: #D97706;
    border: 1px solid #FDE68A !important;
}
.btn-priority:hover {
    background: #FDE68A;
    color: #92400E;
    transform: translateY(-1px);
}

/* ─── Priority Modal ─── */
.priority-modal-content {
    background: #fff;
    border-radius: 20px;
    padding: 24px 20px 20px;
    width: 92%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    direction: rtl;
    animation: slideUpFade 0.22s ease;
}

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

.priority-modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.priority-modal-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 14px;
    background: #FEF3C7;
    color: #D97706;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.priority-modal-title {
    font-size: 17px;
    font-weight: 800;
    color: #1E293B;
    margin: 0 0 2px 0;
}

.priority-modal-subtitle {
    font-size: 12px;
    color: #64748B;
    margin: 0;
}

.priority-reasons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.priority-reason-btn {
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}
.priority-reason-btn:hover {
    border-color: #FDE68A;
    background: #FFFBEB;
    color: #92400E;
}
.priority-reason-btn.active {
    background: #FEF3C7;
    border-color: #F59E0B;
    color: #92400E;
    box-shadow: 0 0 0 2px rgba(245,158,11,0.2);
}
.priority-reason-btn--full {
    grid-column: 1 / -1;
}

.priority-other-input {
    width: 100%;
    border: 2px solid #E2E8F0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    margin-bottom: 12px;
    direction: rtl;
    outline: none;
    transition: border-color 0.2s;
}
.priority-other-input:focus {
    border-color: #F59E0B;
    box-shadow: 0 0 0 3px rgba(245,158,11,0.1);
}

.priority-modal-actions {
    display: flex;
    gap: 10px;
}

.btn-priority-confirm {
    flex: 1;
    background: #F59E0B;
    color: #fff;
    border: none;
    border-radius: 12px;
    height: 44px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-priority-confirm:hover { background: #D97706; transform: translateY(-1px); }

.btn-priority-cancel {
    background: #F1F5F9;
    color: #64748B;
    border: none;
    border-radius: 12px;
    height: 44px;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
}
.btn-priority-cancel:hover { background: #E2E8F0; }

/* ─── Priority Badge Variants ─── */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 4px;
    white-space: nowrap;
}

.priority-badge.pending {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #F59E0B;
}

.priority-badge.approved {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #10B981;
}

.priority-badge.rejected {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #EF4444;
}

.priority-badge.postponed {
    background: #E0E7FF;
    color: #3730A3;
    border: 1px solid #6366F1;
}

/* ─── Priority Request Item ─── */
.priority-request-item {
    background: #FFFFFF;
    border: 2px solid #FDE68A;
    border-left: 4px solid #F59E0B;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

.priority-request-info {
    flex: 1;
    min-width: 0;
}

.priority-request-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.pr-num {
    background: #F59E0B;
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.pr-name {
    font-weight: 700;
    font-size: 14px;
    color: #1E293B;
    flex: 1;
    min-width: 0;
}

.priority-request-reason {
    font-size: 12px;
    color: #64748B;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.priority-request-wait {
    font-size: 12px;
    color: #64748B;
    display: flex;
    align-items: center;
    gap: 6px;
}

.priority-request-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.priority-request-actions .btn {
    padding: 5px 10px;
    font-size: 12px;
    height: auto;
    min-width: 70px;
}

@media (max-width: 576px) {
    .priority-request-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .priority-request-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .priority-modal-content { padding: 18px 14px 16px; }
    .priority-reasons-grid  { gap: 6px; }
    .priority-reason-btn    { font-size: 12px; padding: 9px 6px; }
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-box {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--background-color);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.primary-stat .stat-icon {
    background: #DBEAFE;
}

.money-box .stat-icon {
    background: var(--secondary-light);
    color: var(--secondary-color);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

/* ─── Doctor Stats Grid (new) ─── */
.doc-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 0 4px;
}

.doc-stat-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #F1F5F9;
    text-align: center;
    min-height: 110px;
    overflow: hidden;
}

.doc-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.doc-stat-value {
    font-size: 26px;
    font-weight: 800;
    color: #1E293B;
    line-height: 1;
}

.doc-stat-label {
    font-size: 12px;
    color: #64748B;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.3;
}

@media (max-width: 900px) {
    .doc-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .doc-stat-card {
        min-height: 100px;
        padding: 14px 10px;
    }
    .doc-stat-value { font-size: 22px; }
    .doc-stat-label { font-size: 11px; }
}

/* ─── Doctor Mobile Action Buttons ─── */
.doc-action-btn {
    height: 44px;
    font-size: 14px;
    white-space: nowrap;
}

.doc-action-btn-sm {
    height: 36px;
    font-size: 12px;
    white-space: nowrap;
}

/* ─── Current Patient Card (Doctor) ─── */
.doc-current-card {
    border-radius: 20px !important;
    box-shadow: 0 6px 20px rgba(15,23,42,0.07) !important;
}

.doc-current-body {
    background: #F8FAFC;
    min-height: 140px;
}

/* cp-name override — less huge on mobile */
.cp-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

@media (max-width: 900px) {
    .cp-name { font-size: 1.3rem; }
    .cp-num  { font-size: 1.1rem; }
}

.main-doc-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .main-doc-area {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
    }
    .current-patient-card {
        order: -1; /* Always on top */
    }
}

.current-details {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    background: var(--background-color);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--border-color);
}

.current-patient-active {
    text-align: center;
    width: 100%;
    padding: 2rem;
}

.cp-num {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.cp-name {
    font-size: 2.75rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.cp-type {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 2rem;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.cp-timer {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* Actions row inside current patient card */
.cp-actions-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 14px;
}

.cp-action-btn {
    min-width: 140px;
    height: 40px;
    font-size: 13px;
    border-radius: 10px !important;
}

@media (max-width: 900px) {
    .cp-actions-row { gap: 6px; }
    .cp-action-btn  { min-width: 110px; font-size: 12px; }
}

.glow-pulse {
    animation: glowPulseAnim 2s infinite alternate;
    border: 2px solid var(--primary-color);
}

@keyframes glowPulseAnim {
    0% { box-shadow: 0 0 10px 2px rgba(37, 99, 235, 0.2); }
    100% { box-shadow: 0 0 20px 8px rgba(37, 99, 235, 0.4); }
}

.btn-call {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.btn-call:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.next-suggestion {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* --- Modals --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-content h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- Settings Modal Redesign --- */
.settings-content {
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.settings-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card-bg);
    padding: 1.5rem 2rem 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-header h3 {
    margin-bottom: 0;
    font-size: 1.5rem;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    scroll-behavior: smooth;
}

/* Custom scrollbar */
.settings-body::-webkit-scrollbar {
    width: 6px;
}
.settings-body::-webkit-scrollbar-track {
    background: transparent;
}
.settings-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
.settings-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.settings-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--card-bg);
    padding: 1rem 2rem 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
}

/* Section styling */
.settings-section {
    margin-bottom: 1.75rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--background-color);
}

.section-title i {
    color: var(--primary-color);
    font-size: 1rem;
}

.section-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.3s ease;
}

.section-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Responsive settings */
@media (max-width: 600px) {
    .settings-content {
        max-width: 95vw;
        max-height: 95vh;
    }

    .settings-header {
        padding: 1rem 1.25rem 0.75rem 1.25rem;
    }

    .settings-header h3 {
        font-size: 1.25rem;
    }

    .settings-body {
        padding: 1rem 1.25rem;
    }

    .settings-footer {
        padding: 0.75rem 1.25rem 1rem 1.25rem;
    }

    .section-card {
        padding: 1rem;
    }

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

@media (max-width: 400px) {
    .settings-content {
        border-radius: 0.75rem;
    }

    .section-title {
        font-size: 0.95rem;
    }

    .settings-footer {
        flex-direction: column;
    }

    .settings-footer .btn-primary,
    .settings-footer .btn-secondary {
        width: 100%;
    }
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-primary {
    flex: 1;
    padding: 0.8rem;
    border: none;
    border-radius: 12px;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    flex: 1;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--background-color);
    color: var(--text-main);
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #E2E8F0;
    transform: translateY(-1px);
}

.btn-danger {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    background: #FEE2E2;
    color: var(--danger);
    font-weight: 700;
    font-size: 1rem;
    margin-top: 1rem;
}

.danger-zone h4 {
    color: var(--danger);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* End Day button (safe, green) */
.btn-end-day {
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 12px;
    background: var(--secondary-light);
    color: #065F46;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.btn-end-day:hover {
    background: #A7F3D0;
    transform: translateY(-1px);
}

/* Nuke zone — visually distinct from normal danger zone */
.nuke-zone {
    border: 1px solid #FECACA;
    background: #FFF5F5;
    border-radius: 0.5rem;
    padding: 1rem;
}
.nuke-zone h4 {
    color: #B91C1C;
}

/* Archive modal — wide */
.archive-content {
    max-width: 90vw;
    width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.stats-badge {
    background: var(--secondary-light);
    color: var(--secondary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 0.9rem;
}

/* --- Estimated Wait Time --- */
.est-wait {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
}
.wait-green { background: #D1FAE5; color: #065F46; border: 1px solid #10B981; }
.wait-yellow { background: #FEF3C7; color: #92400E; border: 1px solid #F59E0B; }
.wait-red { background: #FEE2E2; color: #B91C1C; border: 1px solid #EF4444; }

/* --- Report Modal --- */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.95rem;
}

.report-table th, .report-table td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: right;
}

.report-table th {
    background-color: var(--background-color);
    font-weight: bold;
    color: var(--text-main);
}

.report-table tr:nth-child(even) {
    background-color: #F9FAFB;
}

@media print {
    body * {
        visibility: hidden;
    }
    #report-modal, #report-modal * {
        visibility: visible;
    }
    #report-modal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white;
    }
    .no-print, .modal-actions {
        display: none !important;
    }
    .report-table th, .report-table td {
        border: 1px solid #000;
        color: #000;
    }
    body {
        background: white;
    }
    .modal-content {
        box-shadow: none;
        max-width: 100%;
        overflow: visible;
    }
    .report-header h3 {
        text-align: center;
        width: 100%;
    }
}

/* --- Loading Overlay --- */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--card-bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}
.loading-overlay i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}
.loading-overlay h2 {
    color: var(--primary-dark);
}

/* Mobile Performance */
@media (max-width: 991.98px) {
  * {
    animation: none !important;
    transition-duration: 0.1s !important;
  }

  .card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
  }

  /* Mobile Reports Full Screen Fix */
  #report-modal .modal-dialog {
      margin: 0 !important;
      max-width: 100% !important;
      height: 100% !important;
  }
  #report-modal .modal-content {
      height: 100vh !important;
      border-radius: 0 !important;
      border: none !important;
      padding-bottom: 70px !important; /* Keep content above mobile nav */
  }
  #report-modal.modal:not(.hidden) {
      background: var(--background-color) !important;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 1030 !important; /* Below the mobile nav (1040) */
      padding: 0 !important;
  }
  #report-modal .modal-header .btn-close {
      display: none !important; /* Hide tiny close button */
  }
  #report-modal .modal-header {
      border-radius: 0 !important;
      padding: 1rem !important;
      justify-content: center;
  }
  #report-modal .modal-title {
      font-size: 1.25rem !important;
      margin: 0 auto;
  }
  #report-modal .modal-body {
      padding-bottom: 100px !important; /* Space for export buttons */
  }
  #report-modal .modal-footer {
      position: absolute;
      bottom: 70px; /* Above bottom nav */
      left: 0;
      width: 100%;
      background: white;
      z-index: 1035;
      box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
      justify-content: center !important;
      padding: 15px !important;
      border-radius: 20px 20px 0 0;
  }
  #report-modal .modal-footer .btn-secondary {
      display: none !important; /* Hide "Close" button from footer */
  }
}

/* Patient Card SaaS Design & Overflow Fixes */
body {
    overflow-x: hidden;
}

.card {
    max-width: 100%;
    overflow: visible;
    height: auto;
    min-height: auto;
}

.main-content,
.app-content,
.assistant-content {
    padding-bottom: 100px;
}

/* ─── Mobile Patient Card ─── */
@media (max-width: 576px) {
    .patient-item {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 10px;
        min-height: 120px !important;
        height: auto !important;
    }
    .p-info {
        flex: 1 1 100%;
    }
    .p-actions {
        flex: 1 1 100%;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .btn-enter {
        flex: 1;
        min-width: 100px;
        max-width: none;
    }
    .p-meta {
        white-space: normal;
        line-height: 1.4;
    }
    .p-name {
        font-size: 14px;
    }
    .list-container {
        max-height: none !important;
        overflow: visible !important;
        padding-bottom: 130px !important;
    }
    .screen {
        padding-bottom: 100px !important;
    }
}

/* --- Splash Screen --- */
.splash-container {
    background-color: #FFFFFF;
}

.splash-content {
    animation: splashFadeIn 0.8s ease-out forwards;
}

.splash-logo {
    animation: splashScaleUp 1s ease-out forwards;
    max-width: 240px;
    width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .splash-logo {
        max-width: 190px;
    }
}

.splash-title, .splash-subtitle, .splash-desc {
    opacity: 0;
    animation: splashTextIn 0.6s ease-out forwards;
    animation-delay: 0.5s;
}

.ekg-container {
    width: 100px;
    height: 30px;
    overflow: hidden;
    position: relative;
    opacity: 0;
    animation: splashTextIn 0.6s ease-out forwards;
    animation-delay: 0.8s;
}

.ekg-svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ekg-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: ekgBeat 2s linear infinite;
}

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

@keyframes splashScaleUp {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

@keyframes ekgBeat {
    0% { stroke-dashoffset: 200; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -200; }
}

/* ─── Priority Request Notification Animations ─── */
@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* ═══════════════════════════════════════════════════════════
   SETTINGS SCREEN SYSTEM - Mobile-First SaaS Design
   ═══════════════════════════════════════════════════════════ */

.settings-screen-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-color);
    z-index: 1031;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.settings-screen-container.hidden {
    display: none !important;
}

.settings-page {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    animation: slideInSettings 0.2s ease-out;
}

.settings-page.active {
    display: flex;
}

@keyframes slideInSettings {
    from {
        transform: translateX(-30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Settings Header */
.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    flex-shrink: 0;
    gap: 1rem;
}

.settings-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    flex: 1;
    text-align: center;
}

.btn-back-settings,
.btn-close-settings {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.btn-back-settings:hover,
.btn-close-settings:hover {
    background-color: var(--background-color);
}

/* Settings Menu (Main Page) */
.settings-menu {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.settings-menu::-webkit-scrollbar {
    width: 6px;
}

.settings-menu::-webkit-scrollbar-track {
    background: transparent;
}

.settings-menu::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.settings-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.15s ease;
    background: var(--card-bg);
}

.settings-menu-item:active {
    background-color: #F1F5F9;
}

.settings-menu-item.logout {
    color: var(--danger);
}

.settings-menu-item.logout .settings-menu-icon {
    color: var(--danger);
}

.settings-menu-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.settings-menu-text {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.settings-menu-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Settings Content */
.settings-content {
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.settings-content::-webkit-scrollbar {
    width: 6px;
}

.settings-content::-webkit-scrollbar-track {
    background: transparent;
}

.settings-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* Settings Form Groups */
.settings-group {
    margin-bottom: 24px;
}

.settings-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.settings-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.settings-input,
.settings-range {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: var(--card-bg);
    font-family: inherit;
}

.settings-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.settings-range {
    padding: 8px;
    height: 44px;
}

.settings-range-value {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
    font-weight: 600;
}

/* Toggle Switch */
.settings-toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.settings-toggle {
    width: 54px;
    height: 32px;
    border: none;
    background: #CBD5E1;
    border-radius: 16px;
    cursor: pointer;
    position: relative;
    appearance: none;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.settings-toggle::before {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: white;
    top: 2px;
    right: 2px;
    transition: right 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.settings-toggle:checked {
    background-color: var(--primary-color);
}

.settings-toggle:checked::before {
    right: 24px;
}

/* Input Group (for password with eye button) */
.settings-input-group {
    display: flex;
    gap: 8px;
}

.settings-input-group .settings-input {
    flex: 1;
}

.settings-input-addon {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--background-color);
    transition: all 0.2s ease;
}

.settings-input-addon:hover {
    background: #EFF6FF;
    color: var(--primary-color);
}

/* ====================================
   Modern Premium SaaS Login Modal
   ==================================== */

.login-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

.login-modal-overlay.hidden {
    display: none !important;
}

.login-modal-card {
    background: #FFFFFF;
    border-radius: 24px;
    box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 420px;
    position: relative;
    animation: slideUp 0.3s ease-out;
}

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

/* Close Button */
.login-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s ease;
    z-index: 10;
}

.login-modal-close:hover {
    background: var(--background-color);
    color: var(--text-main);
}

.login-modal-close:active {
    transform: scale(0.95);
}

/* Logo Section */
.login-modal-logo {
    display: flex;
    justify-content: center;
    padding: 28px 20px 20px;
}

.login-modal-logo-circle {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #2563EB 0%, #1E3A8A 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-size: 1.75rem;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
}

/* Modal Content */
.login-modal-content {
    padding: 0 28px 28px;
}

.login-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    margin: 0 0 8px;
}

.login-modal-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0 0 24px;
}

/* Role Selector */
.login-role-selector {
    margin-bottom: 28px;
}

.login-role-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    position: relative;
}

.login-role-input {
    display: none;
}

.login-role-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    background: #FFFFFF;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.login-role-tab i {
    font-size: 1.1rem;
}

.login-role-tab:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.login-role-input:checked + .login-role-tab {
    background: var(--primary-color);
    color: #FFFFFF;
    border-color: var(--primary-color);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.login-role-input:checked + .login-role-tab::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #FFFFFF;
}

/* Login Form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form-group {
    display: flex;
    flex-direction: column;
}

.login-form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.login-form-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.login-form-input-wrapper i {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

.login-form-input {
    width: 100%;
    height: 48px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 52px 12px 16px;
    font-size: 0.95rem;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    color: var(--text-main);
    background: #FFFFFF;
    transition: all 0.2s ease;
    outline: none;
}

.login-form-input::placeholder {
    color: var(--text-muted);
}

.login-form-input:focus {
    border-color: var(--primary-color);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-form-input:hover:not(:focus) {
    border-color: #CBD5E1;
}

/* Submit Button */
.login-form-submit {
    height: 52px;
    width: 100%;
    background: var(--primary-color);
    color: #FFFFFF;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.login-form-submit:hover {
    background: var(--primary-dark);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
    transform: translateY(-2px);
}

.login-form-submit:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.login-form-submit i {
    font-size: 0.9rem;
}

/* Modal Footer */
.login-modal-footer {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-footer-link {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
}

.login-footer-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .login-modal-overlay {
        padding: 16px;
    }

    .login-modal-card {
        max-width: 92vw;
        border-radius: 20px;
    }

    .login-modal-content {
        padding: 0 20px 20px;
    }

    .login-modal-title {
        font-size: 1.35rem;
    }

    .login-modal-subtitle {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .login-role-tabs {
        gap: 10px;
    }

    .login-role-tab {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .login-form {
        gap: 14px;
    }

    .login-form-input {
        height: 44px;
        font-size: 0.9rem;
    }

    .login-form-submit {
        height: 48px;
        font-size: 0.95rem;
    }

    .login-modal-logo-circle {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
}

.settings-input-addon {
    background: var(--card-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.settings-input-addon:active {
    background-color: var(--background-color);
}

/* Save Button */
.settings-save-btn {
    width: 100%;
    padding: 14px;
    margin-top: 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-save-btn:active {
    background-color: var(--primary-dark);
    transform: scale(0.98);
}

/* Danger Section */
.settings-danger-section {
    padding: 16px;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 10px;
    margin-bottom: 16px;
}

.settings-danger-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--danger);
    margin: 0 0 8px 0;
}

.settings-danger-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.settings-danger-btn.warning {
    background: var(--warning);
    color: #92400E;
}

.settings-danger-btn.warning:active {
    background: #D97706;
}

.settings-danger-btn.danger {
    background: var(--danger);
    color: white;
}

.settings-danger-btn.danger:active {
    background: #DC2626;
}

/* Media Queries */
@media (max-width: 600px) {
    .settings-header {
        padding: 1rem;
    }

    .settings-title {
        font-size: 1.25rem;
    }

    .settings-content {
        padding: 16px;
    }

    .settings-group {
        margin-bottom: 20px;
    }

    .settings-label {
        font-size: 0.95rem;
    }

    .settings-input,
    .settings-range {
        padding: 10px 12px;
        font-size: 1rem;
    }

    .settings-save-btn {
        padding: 12px;
        margin-top: 16px;
    }

    .settings-menu-item {
        padding: 14px 16px;
    }

    .settings-menu-icon {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
    }

    .settings-menu-text {
        font-size: 0.95rem;
    }
}

@media (max-width: 400px) {
    .settings-header {
        padding: 12px;
    }

    .settings-title {
        font-size: 1.1rem;
    }

    .btn-back-settings,
    .btn-close-settings {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
    }

    .settings-content {
        padding: 12px;
    }

    .settings-group {
        margin-bottom: 16px;
    }

    .settings-label {
        font-size: 0.9rem;
    }

    .settings-menu-item {
        padding: 12px 14px;
    }

    .settings-menu-icon {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .settings-danger-section {
        padding: 12px;
    }

    .settings-danger-title {
        font-size: 0.9rem;
    }
}

/* ─── Priority Request Styles ─── */
.priority-request-item {
    background: #FFFBF0;
    border: 1px solid #FCD34D;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(212, 212, 16, 0.1);
}

.priority-request-info {
    flex: 1;
}

.priority-request-header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.pr-num {
    background: #F59E0B;
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
}

.pr-name {
    font-weight: 700;
    color: #1E293B;
}

.priority-request-reason {
    font-size: 0.9rem;
    color: #1E293B;
    margin-bottom: 6px;
}

.priority-request-reason i {
    margin-right: 4px;
    color: #F59E0B;
}

.priority-request-reason strong {
    color: #92400E;
}

.priority-request-wait {
    font-size: 0.85rem;
    color: #64748B;
}

.priority-request-wait i {
    margin-right: 4px;
}

.priority-request-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ─── Priority Toast Animations (Global - works on all screen sizes) ─── */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ─── Priority Mini Panel: visibility controlled by JS via .hidden class ─── */

.priority-request-mini-item {
    background: #FFFBF0 !important;
    border: 1px solid #FCD34D !important;
    transition: all 0.2s ease;
}

.priority-request-mini-item:hover {
    box-shadow: 0 4px 12px rgba(212, 212, 16, 0.15) !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    @keyframes slideInRight {
        from {
            transform: translateX(100vw);
            opacity: 0;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }

    @keyframes slideOutRight {
        from {
            transform: translateX(0);
            opacity: 1;
        }
        to {
            transform: translateX(100vw);
            opacity: 0;
        }
    }

    #priority-toast-notification {
        top: 10px !important;
        right: 10px !important;
        left: 10px !important;
        max-width: calc(100% - 20px) !important;
    }

    .priority-request-actions {
        justify-content: flex-start;
    }
}
