/* ====================================================
   Attendance Management System - Qassim Identity
   Arabic RTL, Professional Light Theme
   ==================================================== */

:root {
    --primary: #1B8354;
    --primary-dark: #104631;
    --primary-light: #54C08A;
    --secondary: #54C08A;
    --success: #079455;
    --warning: #d97706;
    --danger: #D92D20;
    --info: #0284c7;
    --bg: #f0f7f3;
    --bg-card: #ffffff;
    --bg-hover: #e8f3ed;
    --text: #161616;
    --text-muted: #6C737F;
    --border: #D2D6DB;
    --sidebar-w: 272px;
    --radius: 10px;
    --shadow: 0 2px 16px rgba(27, 131, 84, 0.08);
    --shadow-lg: 0 8px 32px rgba(27, 131, 84, 0.12);
    --font: 'Cairo', 'Tajawal', sans-serif;
}

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

body, html {
    font-family: var(--font);
    direction: rtl;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
}

/* ==================== LAYOUT ==================== */
.main-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    display: flex; flex-direction: column;
    position: fixed; top: 0; right: 0; bottom: 0;
    z-index: 100;
    border-left: 1px solid rgba(255,255,255,0.1);
    box-shadow: var(--shadow-lg);
}

.sidebar-brand {
    padding: 20px 16px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.brand-logo {
    width: 48px; height: 48px;
    max-width: 48px; max-height: 48px;
    object-fit: contain;
    border-radius: 50%;
    background: white;
    padding: 3px;
    flex-shrink: 0;
    pointer-events: none;
}
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-name { font-size: 15px; font-weight: 800; color: white; line-height: 1.3; }
.brand-sub { font-size: 10px; color: rgba(255,255,255,0.65); letter-spacing: 0.5px; }

.tenant-switcher { padding: 10px 16px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.tenant-switcher-label { font-size: 11px; color: rgba(255,255,255,0.65); display: block; margin-bottom: 4px; }
.tenant-switcher-select {
    width: 100%; padding: 6px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08); color: white; font-size: 13px;
}
.tenant-switcher-select option { color: #1a202c; }

.nav-links { list-style: none; padding: 12px 0; flex: 1; overflow-y: auto; }
.nav-links li a {
    display: block; padding: 11px 20px;
    color: rgba(255,255,255,0.75); text-decoration: none;
    border-right: 3px solid transparent;
    transition: all 0.2s;
    font-weight: 600; font-size: 14px;
}
.nav-links li a:hover,
.nav-links li a.active {
    color: white;
    background: rgba(0, 174, 239, 0.15);
    border-right-color: var(--primary-light);
}

.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.12); }
.user-info { margin-bottom: 12px; }
.username { font-weight: 700; display: block; color: white; font-size: 14px; }
.user-role { font-size: 12px; color: rgba(255,255,255,0.6); }
.logout-btn {
    width: 100%; padding: 9px;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px; cursor: pointer; font-family: var(--font);
    font-weight: 600; font-size: 13px; transition: all 0.2s;
}
.logout-btn:hover { background: rgba(220, 38, 38, 0.25); border-color: rgba(220,38,38,0.4); color: #fecaca; }

.main-content { margin-right: var(--sidebar-w); flex: 1; min-width: 0; padding: 28px 32px; min-height: 100vh; overflow-x: auto; }

.top-header-bar {
    display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
    background: var(--bg-card); border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius); padding: 10px 18px; margin-bottom: 20px;
    font-size: 14px; font-weight: 600; color: var(--text-primary, #1a202c);
}
.top-header-item { white-space: nowrap; }

/* ===== شريط الإعلانات ===== */
.top-header-announcement {
    color: #D92D20; font-weight: 700; font-size: 13px;
    white-space: nowrap; display: flex; align-items: center; gap: 6px;
    margin-right: auto;
}
.announcement-close {
    background: rgba(217,45,32,0.1); border: 1px solid rgba(217,45,32,0.25);
    color: #D92D20; width: 18px; height: 18px; border-radius: 50%;
    cursor: pointer; font-size: 11px; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.2s; flex-shrink: 0;
}
.announcement-close:hover { background: rgba(217,45,32,0.25); }

/* حقل إدخال الإعلان للأدمن */
.announcement-input-wrap {
    display: flex; align-items: center; gap: 4px;
    background: rgba(217,45,32,0.08); border: 1px solid rgba(217,45,32,0.3);
    border-radius: 8px; padding: 2px 6px; flex-shrink: 0;
}
.announcement-input {
    background: none; border: none; outline: none;
    font-size: 12px; font-family: var(--font); color: var(--text);
    width: 180px; padding: 4px;
}
.announcement-input::placeholder { color: #D92D20; opacity: 0.6; }
.announcement-send-btn {
    background: none; border: none; cursor: pointer;
    font-size: 16px; padding: 2px 4px; transition: transform 0.15s;
}
.announcement-send-btn:hover { transform: scale(1.2); }
/* ===== قائمة قابلة للترتيب ===== */
.nav-sortable-list { list-style: none; padding: 12px 0; }
.nav-sortable-list li { display: flex; align-items: center; }
.nav-sortable-list li a {
    display: block; flex: 1; padding: 11px 16px;
    color: rgba(255,255,255,0.75); text-decoration: none;
    border-right: 3px solid transparent;
    transition: all 0.2s; font-weight: 600; font-size: 14px;
}
.nav-sortable-list li a:hover,
.nav-sortable-list li a.active {
    color: white; background: rgba(0,174,239,0.15);
    border-right-color: var(--primary-light);
}
.drag-handle {
    color: rgba(255,255,255,0.3); cursor: grab;
    padding: 0 8px 0 4px; font-size: 18px; flex-shrink: 0;
    transition: color 0.2s; user-select: none;
}
.drag-handle:hover { color: rgba(255,255,255,0.7); }
.drag-handle:active { cursor: grabbing; }
.nav-drag-ghost { opacity: 0.4; background: rgba(255,255,255,0.1) !important; }
.nav-drag-chosen { background: rgba(255,255,255,0.08); border-radius: 6px; }

.stat-card.mini-stat { transition: transform 0.15s, box-shadow 0.15s; }
.stat-card.mini-stat:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.stat-card.mini-stat.stat-active { outline: 3px solid var(--primary); outline-offset: 2px; transform: translateY(-2px); }
.top-header-help {
    white-space: nowrap; margin-right: auto;
    color: var(--primary); font-weight: 600; font-size: 13px;
    text-decoration: none; padding: 3px 10px;
    border: 1px solid var(--primary); border-radius: 20px;
    transition: all 0.2s;
}
.top-header-help:hover { background: var(--primary); color: white; }

/* ==================== LOGO ==================== */
.logo {
    width: 120px; height: 120px;
    object-fit: contain;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(0,51,153,0.2));
}
.logo-sm { width: 72px; height: 72px; object-fit: contain; }
.logo-login {
    width: 96px; height: 96px;
    object-fit: contain;
    margin: 0 auto 12px;
    display: block;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); box-shadow: var(--shadow);
    padding: 24px;
}

.form-card {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); box-shadow: var(--shadow);
    padding: 24px;
}
.form-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 16px; padding: 20px 0;
}
.form-actions {
    display: flex; gap: 12px; padding-top: 16px;
    border-top: 1px solid var(--border); margin-top: 8px;
}

/* ==================== HOME PAGE ==================== */
.home-container {
    min-height: 100vh; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: linear-gradient(160deg, #f0f7f3 0%, #dcf0e6 50%, #f0f7f3 100%);
    padding: 32px 16px;
}
.home-header { text-align: center; margin-bottom: 48px; }
.system-title { font-size: 32px; font-weight: 900; color: var(--primary); margin-bottom: 8px; }
.system-subtitle { font-size: 14px; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; }
.company-name { font-size: 18px; font-weight: 700; color: var(--primary-light); margin-top: 4px; }

.home-cards { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.home-card {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); padding: 40px 36px;
    text-align: center; cursor: pointer; min-width: 220px;
    transition: all 0.3s; box-shadow: var(--shadow);
}
.home-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.card-icon { font-size: 48px; margin-bottom: 16px; }
.home-card h2 { font-size: 18px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.home-card p { color: var(--text-muted); font-size: 14px; }
.login-card:hover { border-color: var(--primary); }
.attendance-card:hover { border-color: var(--success); }

/* ==================== LOGIN ==================== */
.login-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, #f0f7f3 0%, #dcf0e6 100%);
    padding: 24px;
}
.login-box {
    background: var(--bg-card); border-radius: var(--radius); padding: 40px;
    width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-header h1 { font-size: 22px; font-weight: 800; color: var(--primary); margin-top: 8px; }
.login-company { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--text-muted); font-size: 13px; }
.login-box .form-group .mud-input-root,
.login-box .form-group .rtl-input { width: 100%; }
.login-btn {
    margin-top: 8px; width: 100%; height: 48px;
    font-size: 15px; font-weight: 700; font-family: var(--font) !important;
}
.back-btn { width: 100%; margin-top: 12px; color: var(--text-muted) !important; }

/* ==================== QUICK ATTENDANCE ==================== */
.quick-attendance-wrapper {
    min-height: 100vh; max-width: 640px; margin: 0 auto; padding: 32px 16px;
    display: flex; flex-direction: column; align-items: center; gap: 24px;
}
.qa-header { text-align: center; }
.qa-header h1 { font-size: 26px; font-weight: 900; color: var(--primary); }
.qa-header p { color: var(--text-muted); margin-top: 8px; }

.qa-tenant-picker { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 360px; margin: 0 auto; text-align: center; }
.qa-search-box { display: flex; gap: 12px; align-items: flex-end; width: 100%; }
.employee-number-input { flex: 1; min-width: 0; }
.employee-number-input label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; }
.employee-number-input .mud-input-root,
.employee-number-input .rtl-input { width: 100%; }
.qa-search-box .qa-search-btn {
    min-width: 110px; height: 56px;
    font-size: 16px; font-weight: 700; font-family: var(--font) !important;
    flex-shrink: 0;
}

.employee-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 24px;
    border: 2px solid var(--border); display: flex; gap: 20px;
    width: 100%; transition: border-color 0.3s; box-shadow: var(--shadow);
}
.employee-card.status-present { border-color: var(--success); }
.employee-card.status-late { border-color: var(--warning); }
.employee-card.status-absent { border-color: var(--danger); }

.emp-photo, .emp-photo-placeholder {
    width: 90px; height: 90px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.emp-photo-placeholder {
    background: var(--bg-hover); display: flex; align-items: center;
    justify-content: center; font-size: 40px;
}

.emp-name { font-size: 20px; font-weight: 700; color: var(--primary); margin-bottom: 12px; }
.emp-details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-label { font-size: 11px; color: var(--text-muted); }
.detail-value { font-size: 14px; font-weight: 600; }

.attendance-status-badge {
    display: inline-block; padding: 6px 14px; border-radius: 20px;
    font-weight: 700; font-size: 14px; margin-top: 8px;
}
.badge-present { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.badge-late { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.badge-absent { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.badge-early { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

.action-buttons { display: flex; gap: 16px; width: 100%; }
.action-btn { flex: 1; height: 56px !important; font-size: 16px !important; font-weight: 700 !important; font-family: var(--font) !important; }

.status-message { padding: 16px; border-radius: var(--radius); text-align: center; font-weight: 700; font-size: 16px; width: 100%; }
.success-msg { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.error-msg { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.not-found-message { color: var(--danger); font-weight: 600; font-size: 16px; }
.back-home-btn { align-self: flex-start; }

/* ==================== DASHBOARD ==================== */
.dashboard-wrapper { max-width: 1400px; }
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.dashboard-header h2 { font-size: 24px; font-weight: 900; color: var(--primary); }
.dashboard-date { color: var(--text-muted); font-size: 14px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 24px;
    text-align: center; border: 1px solid var(--border);
    transition: all 0.3s; box-shadow: var(--shadow);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-icon { font-size: 32px; margin-bottom: 8px; }
.stat-value { font-size: 36px; font-weight: 900; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-card.total { border-top: 3px solid var(--primary); }
.stat-card.present { border-top: 3px solid var(--success); }
.stat-card.absent { border-top: 3px solid var(--danger); }
.stat-card.late { border-top: 3px solid var(--warning); }
.stat-card.leave { border-top: 3px solid var(--info); }
.stat-card.hours { border-top: 3px solid var(--primary-light); }

.dashboard-actions-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.attendance-table-section {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 24px; border: 1px solid var(--border); box-shadow: var(--shadow);
}
.attendance-table-section h3 { font-size: 18px; font-weight: 700; color: var(--primary); margin-bottom: 16px; }

/* ==================== TABLES ==================== */
.rtl-table { direction: rtl; }
.status-chip { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.chip-present { background: #d1fae5; color: #065f46; }
.chip-late { background: #fef3c7; color: #92400e; }
.chip-absent { background: #fee2e2; color: #991b1b; }
.chip-early { background: #dbeafe; color: #1e40af; }
.chip-onleave { background: #ede9fe; color: #5b21b6; }

/* ==================== PAGE WRAPPER ==================== */
.page-wrapper { max-width: 1200px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-header h2, .page-header h3 { font-size: 22px; font-weight: 800; color: var(--primary); }
.search-bar { margin-bottom: 20px; }

/* ==================== PROFILE ==================== */
.profile-wrapper { max-width: 900px; }
.profile-header-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius); padding: 32px;
    display: flex; gap: 24px; align-items: center;
    margin-bottom: 24px; box-shadow: var(--shadow-lg);
}
.profile-photo img, .photo-placeholder {
    width: 100px; height: 100px; border-radius: 50%;
    object-fit: cover; border: 4px solid rgba(255,255,255,0.4); flex-shrink: 0;
}
.photo-placeholder { background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-size: 48px; }
.profile-summary h2 { font-size: 26px; font-weight: 900; color: white; }
.job-title { color: rgba(255,255,255,0.85); font-size: 16px; margin: 4px 0; }
.dept-name { color: rgba(255,255,255,0.7); font-size: 14px; }
.emp-number-badge { background: rgba(255,255,255,0.2); padding: 4px 12px; border-radius: 20px; font-size: 13px; margin-top: 8px; display: inline-block; color: white; }

.profile-tabs { margin-top: 8px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px 0; }
.info-row { background: var(--bg-hover); border-radius: 8px; padding: 12px 16px; display: flex; justify-content: space-between; }
.info-label { color: var(--text-muted); font-size: 13px; }
.info-value { font-weight: 600; font-size: 14px; }

.date-filter { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 16px; flex-wrap: wrap; }

/* ==================== STATUS BADGES ==================== */
.status-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.excuse-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; background: #e8f5e9; color: #2e7d32; }
.excuse-dialog-info { margin-bottom: 12px; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-cancelled { background: #e2e8f0; color: #475569; }
.badge-open { background: #dbeafe; color: #1e40af; }
.badge-inprogress { background: #e0e7ff; color: #3730a3; }
.badge-resolved { background: #d1fae5; color: #065f46; }
.badge-closed { background: #e2e8f0; color: #475569; }

/* ==================== LEAVES & TICKETS ==================== */
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-chip {
    padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text-muted); cursor: pointer;
    font-family: var(--font); font-weight: 600; font-size: 13px; transition: all 0.2s;
}
.filter-chip:hover, .filter-chip.active {
    background: var(--primary); color: white; border-color: var(--primary);
}
.data-card {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); box-shadow: var(--shadow);
    padding: 20px; margin-bottom: 20px;
}
.ticket-details p { margin-bottom: 10px; line-height: 1.6; }
.ticket-details strong { color: var(--primary); }
.tickets-page .ticket-stats { grid-template-columns: repeat(4, 1fr); margin-bottom: 24px; }
/* نافذة إنشاء التذكرة — في الوسط، عرض معتدل */
.mud-dialog-container:has(.ticket-form) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.mud-dialog:has(.ticket-form) {
    max-width: 600px !important;
    width: calc(100vw - 32px) !important;
    margin: auto !important;
}
.mud-dialog:has(.ticket-form) .mud-dialog-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 8px 20px 16px !important;
    overflow: visible !important;
}
.mud-dialog:has(.ticket-form) .mud-dialog-title,
.mud-dialog:has(.ticket-form) .mud-dialog-actions {
    padding-right: 20px !important;
    padding-left: 20px !important;
}
/* نافذة محادثة التذكرة */
.mud-dialog-container:has(.ticket-thread-panel) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.mud-dialog:has(.ticket-thread-panel) {
    max-width: 720px !important;
    width: calc(100vw - 32px) !important;
    margin: auto !important;
}
.mud-dialog:has(.ticket-thread-panel) .mud-dialog-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 8px 20px 16px !important;
}
.mud-dialog:has(.ticket-thread-panel) .mud-dialog-title,
.mud-dialog:has(.ticket-thread-panel) .mud-dialog-actions {
    padding-right: 20px !important;
    padding-left: 20px !important;
}
.ticket-thread-panel {
    width: 100%;
}
.ticket-thread-panel .mud-input-control,
.ticket-thread-panel .mud-input-root,
.ticket-thread-panel .mud-input-control-input-container,
.ticket-reply-box .mud-input-control,
.ticket-reply-box .mud-input-root,
.ticket-reply-box .mud-input-control-input-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}
.ticket-thread-panel .mud-input-slot,
.ticket-thread-panel .mud-input-slot-input,
.ticket-reply-box .mud-input-slot,
.ticket-reply-box .mud-input-slot-input,
.ticket-reply-box textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}
.ticket-reply-box .ticket-form-row {
    width: 100%;
    display: block;
}
.ticket-reply-box {
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}
.ticket-reply-input .mud-input-control-input-container {
    min-height: 150px;
}
.ticket-reply-input .mud-input-slot-input,
.ticket-reply-input textarea {
    width: 100% !important;
    font-size: 16px !important;
    line-height: 1.75 !important;
    min-height: 150px !important;
    padding: 12px 14px !important;
}
.mud-popover:has(.mud-list) {
    z-index: 1500 !important;
}
.ticket-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.ticket-form-row {
    width: 100%;
}
.ticket-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.ticket-native-select {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 12px;
    font-size: 16px;
    font-family: var(--font);
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    background: #fff;
    color: var(--text-primary);
    direction: rtl;
    cursor: pointer;
    min-height: 52px;
}
.ticket-native-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(27, 131, 84, 0.15);
}
.ticket-native-select:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
}
.ticket-form .mud-input-control,
.ticket-form .mud-input-root,
.ticket-form .mud-input-control-input-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}
.ticket-form .mud-input-slot,
.ticket-form .mud-input-slot-input {
    width: 100% !important;
}
.ticket-title-input .mud-input-slot-input {
    font-size: 16px !important;
    min-height: 52px;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}
.ticket-body-input .mud-input-control-input-container {
    min-height: 150px;
}
.ticket-body-input .mud-input-slot-input,
.ticket-body-input textarea {
    font-size: 16px !important;
    line-height: 1.75 !important;
    min-height: 150px !important;
    padding: 12px 14px !important;
}
.ticket-upload-section { border: 1px dashed var(--border); border-radius: var(--radius); padding: 14px 16px; background: #f8fafc; width: 100%; box-sizing: border-box; }
.ticket-upload-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.ticket-file-input { font-size: 13px; }
.ticket-file-list { margin: 8px 0 0; padding-right: 20px; font-size: 13px; color: var(--primary); }
.ticket-title-cell { font-weight: 600; }
.ticket-msg-count { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.ticket-thread-meta { color: var(--text-muted); }
.ticket-thread-info { display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 16px; background: #f1f5f9; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.ticket-messages { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px; }
.ticket-message { border-radius: var(--radius); padding: 14px 16px; border: 1px solid var(--border); }
.ticket-message.mine { background: #e3f2fd; border-color: #90caf9; }
.ticket-message.theirs { background: #fff; }
.ticket-message-header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.ticket-message-role { background: #e2e8f0; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.ticket-message-time { color: var(--text-muted); font-size: 12px; margin-right: auto; }
.ticket-message-body { white-space: pre-wrap; line-height: 1.7; font-size: 14px; }
.ticket-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ticket-attachment-btn { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; font-size: 12px; cursor: pointer; font-family: var(--font); }
.ticket-attachment-btn:hover { background: #f1f5f9; border-color: var(--primary); }
.resolution-box {
    background: #d1fae5; border: 1px solid #6ee7b7;
    border-radius: var(--radius); padding: 16px; margin-top: 12px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mud-dialog:has(.leave-form) {
    max-width: 520px !important;
    width: calc(100vw - 32px) !important;
    margin: auto !important;
}
.mud-dialog:has(.leave-form) .mud-dialog-content {
    width: 100% !important;
    padding: 8px 20px 16px !important;
}
.leave-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.leave-form-row {
    width: 100%;
}
.leave-form .mud-input-control,
.leave-form .mud-input-root,
.leave-form .mud-input-control-input-container,
.leave-form .mud-input-slot,
.leave-form .mud-input-slot-input,
.leave-form textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}
.leave-reason-input .mud-input-control-input-container {
    min-height: 160px;
}
.leave-reason-input .mud-input-slot-input,
.leave-reason-input textarea {
    min-height: 160px !important;
    font-size: 16px !important;
    line-height: 1.75 !important;
    padding: 12px 14px !important;
}
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.settings-card h4 { font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.settings-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.settings-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* Shift assignments */
.assignment-page.page-wrapper { max-width: 100%; }
.assignment-page .data-card { padding: 20px 16px; }
.assignment-form-row {
    display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
}
.assignment-field { min-width: 240px; flex: 1; }
.assignment-field-sm { min-width: 180px; }
.assignment-submit-btn {
    min-width: 130px; height: 44px;
    font-weight: 700; font-family: var(--font) !important;
}
.assignment-log-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.assignment-log-header h3 { font-size: 18px; font-weight: 800; color: var(--primary); margin: 0; }
.assignment-log-table { width: 100%; }
.assignment-log-table .col-emp-number { white-space: nowrap; width: 1%; }
.assignment-log-table .col-emp-name { white-space: nowrap; min-width: 130px; }
.assignment-log-table .col-dept { white-space: nowrap; min-width: 110px; }
.assignment-log-table .col-shift { white-space: nowrap; width: 1%; }
.assignment-log-table .col-time { white-space: nowrap; width: 1%; }
.assignment-log-table .col-day-off { white-space: nowrap; width: 1%; }
.assignment-log-table .col-actions { white-space: nowrap; width: 1%; }
.assignment-log-table .time-cell { white-space: nowrap; font-weight: 600; color: var(--primary); }
.assignment-row-editing { background: #e3f2fd !important; }
.assignment-row-editing td { border-bottom: 2px solid var(--primary-light) !important; }
.deduction-cell { color: var(--danger); font-weight: 600; }

/* Payroll page */
.payroll-page-header {
    align-items: flex-start;
    margin-bottom: 16px;
}
.payroll-page-title-block h2 { font-size: 1.5rem; margin-bottom: 4px; }
.payroll-page-title-block .page-subtitle { margin-bottom: 0; }
.payroll-page-header .export-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.payroll-filters { margin-bottom: 20px; padding: 18px 20px; }
.payroll-filters-top {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}
.payroll-mode-chips {
    margin-bottom: 0;
    justify-content: center;
}
.payroll-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center;
    gap: 10px;
    max-width: 640px;
    margin: 0 auto;
}
.payroll-field-month { width: 150px; flex: 0 0 150px; }
.payroll-field-year { width: 120px; flex: 0 0 120px; }
.payroll-field-date { width: 170px; flex: 0 0 170px; }
.payroll-filter-field {
    width: 100%;
    margin: 0 !important;
    flex-shrink: 0;
}
.payroll-page .payroll-filter-field .mud-input-root {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}
.payroll-page .payroll-filter-field .mud-input-control-input-container {
    min-height: 44px;
}
.payroll-action-btn.mud-button-root {
    min-height: 44px;
    min-width: 118px;
    margin: 0;
    font-weight: 600;
    flex-shrink: 0;
}
.payroll-export-btn.mud-button-root {
    min-height: 38px;
    font-weight: 600;
}
.payroll-hint {
    margin-top: 16px;
    padding: 12px 14px;
    background: #f0f7ff;
    border: 1px solid #cfe0f5;
    border-radius: var(--radius);
    font-size: 13px;
    color: #334155;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.payroll-hint a { font-weight: 600; }
.payroll-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.payroll-stat-employees { border-top: 3px solid #6366f1; }
.payroll-stat-gross { border-top: 3px solid #0ea5e9; }
.payroll-stat-deductions { border-top: 3px solid #f59e0b; }
.payroll-stat-net { border-top: 3px solid #10b981; }
.payroll-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 4px 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.payroll-table-head h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--primary);
}
.payroll-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.payroll-badge--stored { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.payroll-badge--preview { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.payroll-filter-row {
    display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
}
.payroll-filter-field { min-width: 160px; flex: 1; max-width: 220px; }
.payroll-print-header { display: none; text-align: center; }
.payroll-print-logo {
    width: 88px; height: 88px; object-fit: contain;
    display: block; margin: 0 auto 8px;
}
.payroll-print-summary {
    display: none;
    justify-content: center; align-items: stretch;
    gap: 20px; flex-wrap: wrap;
    padding: 12px 16px; margin-bottom: 12px;
    text-align: center;
}
.payroll-summary-item {
    min-width: 120px;
    padding: 8px 14px;
    background: #f1f5f9;
    border-radius: var(--radius);
    border: 1px solid #e2e8f0;
}
.payroll-summary-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.payroll-summary-item strong { font-size: 14px; color: var(--primary); }
.payroll-print-signatures {
    display: none;
    justify-content: space-between;
    margin-top: 24px;
    padding: 0 24px;
}
.payroll-signature-block { text-align: center; min-width: 160px; }
.payroll-signature-line { display: block; margin-bottom: 6px; letter-spacing: 2px; color: var(--text-muted); }
.payroll-table-card { overflow-x: auto; }
.payroll-report-table .col-emp-name small { display: inline; margin-right: 6px; color: var(--text-muted); }
.payroll-report-table .payroll-th,
.payroll-report-table .mud-table-head .mud-table-cell {
    background: #1a365d !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}

@media print {
    @page {
        size: A4 landscape;
        margin: 8mm;
    }

    body.printing-payroll .sidebar,
    body.printing-payroll .payroll-no-print,
    body.printing-payroll .page-header { display: none !important; }
    body.printing-payroll .main-content { margin: 0 !important; padding: 0 !important; }
    body.printing-payroll .page-wrapper { padding: 0 !important; }
    body.printing-payroll .payroll-print-area { width: 100%; }
    body.printing-payroll .payroll-print-header {
        display: flex !important; align-items: center; justify-content: flex-start;
        gap: 12px; text-align: right; margin-bottom: 10px;
    }
    body.printing-payroll .payroll-print-logo { width: 50px; height: 50px; margin-bottom: 0; flex-shrink: 0; }
    body.printing-payroll .payroll-print-header-text { text-align: right; }
    body.printing-payroll .payroll-print-header h3 { font-size: 16px; margin: 0 0 2px; }
    body.printing-payroll .payroll-print-header p { font-size: 11px; color: #555; margin: 0; }
    body.printing-payroll .payroll-print-summary {
        display: flex !important;
        justify-content: center !important;
        font-size: 11px;
        background: transparent;
    }
    body.printing-payroll .payroll-summary-item {
        background: #f8fafc;
        border: 1px solid #cbd5e1;
        min-width: 110px;
    }
    body.printing-payroll .payroll-summary-label { font-size: 10px; }
    body.printing-payroll .payroll-summary-item strong { font-size: 11px; }
    body.printing-payroll .data-card { box-shadow: none; border: 1px solid #ccc; overflow: visible !important; }
    body.printing-payroll .payroll-table-card { overflow: visible !important; }
    body.printing-payroll .mud-table-root,
    body.printing-payroll .mud-table,
    body.printing-payroll table { width: 100% !important; table-layout: fixed; }
    body.printing-payroll .mud-table th,
    body.printing-payroll .mud-table td,
    body.printing-payroll table th,
    body.printing-payroll table td {
        font-size: 9px !important;
        padding: 4px 3px !important;
        white-space: normal !important;
        word-break: break-word;
        line-height: 1.3;
    }
    body.printing-payroll .payroll-th,
    body.printing-payroll .payroll-report-table .mud-table-head .mud-table-cell,
    body.printing-payroll .payroll-report-table .mud-table-head .payroll-th {
        background-color: #1a365d !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    body.printing-payroll .assignment-log-table .col-emp-name { white-space: normal !important; }
    body.printing-payroll .assignment-log-table .col-seq { width: 24px !important; }
    body.printing-payroll .payroll-print-signatures {
        display: flex !important;
        margin-top: 30px;
        padding: 0 30px;
    }
    body.printing-payroll .payroll-signature-line { font-size: 13px; }
}
.shift-name-badge {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    font-weight: 700; font-size: 13px;
}
.shift-name-badge.shift-morning { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.shift-name-badge.shift-evening { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.text-muted { color: var(--text-muted); }

.alerts-panel { margin-bottom: 24px; }
.alert-count {
    display: inline-block; background: var(--danger); color: white;
    border-radius: 12px; padding: 2px 8px; font-size: 12px; margin-right: 6px;
}
.alert-item {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; margin-bottom: 12px; background: var(--bg-card);
}
.alert-item.alert-unread { border-color: #fca5a5; background: #fff7f7; }
.alert-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.alert-time { font-size: 12px; color: var(--text-muted); }
.alert-details {
    white-space: pre-wrap; font-family: var(--font); font-size: 13px;
    line-height: 1.7; color: var(--text); margin: 0 0 10px; background: transparent; border: none;
}
.alerts-compact-table .mud-table-cell { font-size: 13px; padding: 8px 10px !important; vertical-align: middle; }
.alerts-compact-table small.alert-sub { display: block; color: var(--text-muted); font-size: 11px; }
.alert-status-chip {
    display: inline-block; padding: 3px 10px; border-radius: 14px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
}
.alert-time-cell { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.alert-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.inquiry-sent-badge { font-size: 11px; color: var(--success); font-weight: 700; white-space: nowrap; }
.mt-3 { margin-top: 12px; }

/* Shifts v2 */
.shifts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.shift-card-v2 {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow); border-top: 3px solid var(--primary-light);
}
.shift-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.shift-card-header h3 { font-size: 18px; font-weight: 800; color: var(--primary); margin: 0; }
.shift-time-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.shift-time-block { flex: 1; background: var(--bg-hover); border-radius: 8px; padding: 12px; text-align: center; }
.shift-time-label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.shift-time-value { display: block; font-size: 18px; font-weight: 800; color: var(--primary); }
.shift-time-arrow { color: var(--text-muted); font-size: 18px; }
.shift-weekdays { margin-bottom: 12px; }
.shift-weekdays-title { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 8px; }
.shift-off-count { font-size: 12px; color: var(--primary-light); display: block; margin-top: 8px; font-weight: 600; }
.shift-meta-row { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--text-muted); }
.shift-supervisor-row { font-size: 13px; color: var(--text-secondary, #4a5568); margin-bottom: 10px; }
.ot-badge { background: #d1fae5; color: #065f46; padding: 2px 8px; border-radius: 12px; font-weight: 700; }
.overnight-badge { background: #e0e7ff; color: #3730a3; padding: 2px 8px; border-radius: 12px; font-weight: 700; }

.weekday-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.weekday-chips.readonly .weekday-chip { cursor: default; }
.weekday-chip {
    padding: 8px 14px; border-radius: 20px; border: 1px solid var(--border);
    font-family: var(--font); font-size: 13px; font-weight: 700; cursor: pointer;
    transition: all 0.2s; background: var(--bg-hover); color: var(--text-muted);
}
.weekday-chip.work { background: var(--primary); color: white; border-color: var(--primary); }
.weekday-chip.off { background: #f1f5f9; color: #94a3b8; border-color: #e2e8f0; }
.workdays-section { background: var(--bg-hover); border-radius: var(--radius); padding: 16px; }
.workdays-label { font-weight: 700; color: var(--primary); display: block; margin-bottom: 4px; }
.workdays-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.workdays-summary { display: flex; gap: 16px; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--primary); }

/* Quick attendance date/time */
.qa-today-date { margin-top: 12px; font-size: 15px; font-weight: 700; color: var(--primary-dark); }
.detail-item.highlight-date .detail-value { color: var(--primary); font-weight: 700; }
.attendance-time { font-weight: 700; color: var(--primary-dark, var(--primary)); }

/* ==================== ATTENDANCE REPORT ==================== */
.report-page .export-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.report-filters { margin-bottom: 20px; }
.report-presets { margin-bottom: 16px; }
.report-filter-row {
    display: grid;
    grid-template-columns: 1.1fr 1.1fr 0.85fr 1fr auto;
    gap: 12px;
    align-items: center;
}
.report-filter-field {
    width: 100%;
    margin: 0 !important;
}
.report-page .report-filter-row .mud-input-root {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}
.report-page .report-filter-row .mud-input-control-input-container {
    min-height: 44px;
}
.report-page .report-filter-row .mud-input-slot-input {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}
.report-page .report-search-btn.mud-button-root {
    min-width: 100px;
    height: 44px;
    margin: 0;
    align-self: center;
}
.report-hijri-row {
    display: flex;
    gap: 24px;
    margin-top: 6px;
    padding-right: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-light);
}
.report-stats { margin-bottom: 20px; }
.emp-cell-name { display: block; font-weight: 700; color: var(--primary); }
.emp-cell-num { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.time-cell { font-weight: 600; color: var(--primary); white-space: nowrap; }
.date-cell { line-height: 1.4; }
.date-greg { display: block; font-weight: 700; color: var(--primary); font-size: 13px; }
.date-hijri { display: block; font-size: 11px; color: var(--text-muted); }
@media (max-width: 1100px) {
    .report-filter-row { grid-template-columns: 1fr 1fr; }
    .report-page .report-search-btn.mud-button-root { width: 100%; }
    .payroll-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .report-filter-row { grid-template-columns: 1fr; }
    .report-stats { grid-template-columns: repeat(2, 1fr) !important; }
    .payroll-toolbar { max-width: 100%; }
    .payroll-field-month,
    .payroll-field-year,
    .payroll-field-date,
    .payroll-action-btn.mud-button-root { width: 100%; flex: 1 1 100%; }
    .payroll-stats { grid-template-columns: 1fr !important; }
    .payroll-table-head { flex-direction: column; align-items: flex-start; }
}
.mini-stat { text-align: center; padding: 16px; }
.mini-stat .value { font-size: 28px; font-weight: 900; color: var(--primary); }
.mini-stat .label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ==================== MISC ==================== */
.loading-container { display: flex; justify-content: center; align-items: center; min-height: 200px; }
.auth-loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    min-height: 100vh;
    color: var(--primary);
    font-weight: 600;
}
.empty-state { text-align: center; color: var(--text-muted); padding: 40px; font-size: 16px; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 600; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.rtl-input input { text-align: right !important; }
.not-found { text-align: center; padding: 80px 24px; }
.number-input input { font-size: 20px !important; font-weight: 700 !important; letter-spacing: 2px; }

/* ==================== MudBlazor overrides ==================== */
.mud-input-root { direction: rtl; width: 100%; }
.mud-icon-root {
    width: 1.5rem; height: 1.5rem;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.mud-icon-root svg,
.mud-svg-icon {
    width: 1em; height: 1em;
    max-width: 24px; max-height: 24px;
}
.mud-input-adornment {
    display: flex; align-items: center;
    flex-shrink: 0;
}
.mud-input-control { display: flex; align-items: center; width: 100%; }
.mud-input-slot { flex: 1; min-width: 0; }
.col-seq { width: 48px; max-width: 56px; text-align: center !important; color: var(--text-muted); font-weight: 700; font-size: 13px; white-space: nowrap; }
.mud-table-cell { text-align: right !important; }
.mud-table-head .mud-table-cell { font-weight: 700 !important; background: var(--bg-hover) !important; }
/* ===== توحيد ألوان الأزرار ===== */

/* جميع الأزرار الممتلئة → خضراء (ما عدا الحذف/الخطأ) */
.mud-button-filled { background: var(--primary) !important; color: #fff !important; }
.mud-button-filled:hover { background: var(--primary-dark) !important; }

/* أزرار الحذف/الخطأ → حمراء */
.mud-button-filled-error,
.mud-button-filled.mud-button-filled-error { background: #D92D20 !important; }
.mud-button-filled-error:hover { background: #b91c1c !important; }

/* جميع الأزرار المحددة (Outlined) → حد أخضر + نص أخضر */
.mud-button-outlined {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}
.mud-button-outlined:hover {
    background: rgba(27, 131, 84, 0.07) !important;
}

/* أزرار Outlined الحذف → تبقى حمراء */
.mud-button-outlined-error {
    border-color: #D92D20 !important;
    color: #D92D20 !important;
}
.mud-button-outlined-error:hover {
    background: rgba(217, 45, 32, 0.07) !important;
}

/* أزرار النص (Text) → أخضر */
.mud-button-text { color: var(--primary) !important; }
.mud-button-text:hover { background: rgba(27, 131, 84, 0.07) !important; }
.mud-button-text.mud-button-text-error { color: #D92D20 !important; }

.mud-tabs .mud-tab-active { color: var(--primary) !important; }
.mud-tabs .mud-tab-slider { background: var(--primary-light) !important; }

/* ==================== EMPLOYEE FORM ==================== */
.employee-form .form-card { padding: 0; overflow: hidden; }
.employee-form .completion-panel {
    padding: 16px 24px; background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
}
.employee-form .completion-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 10px; flex-wrap: wrap;
}
.employee-form .completion-stats { font-size: 14px; color: var(--text-muted); }
.employee-form .completion-stats strong { color: var(--primary); }
.employee-form .tab-status-list {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
}
.employee-form .tab-status-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 20px; font-size: 12px;
    border: 1px solid var(--border); background: var(--bg-card);
    cursor: pointer; transition: all 0.2s;
}
.employee-form .tab-status-chip:hover { border-color: var(--primary-light); }
.employee-form .tab-status-chip.complete { border-color: #a5d6a7; background: #e8f5e9; color: #2e7d32; }
.employee-form .tab-status-chip.incomplete { border-color: #ffcc80; background: #fff8e1; color: #e65100; }
.employee-form .form-section {
    margin-bottom: 8px;
}
.employee-form .form-section-title {
    font-size: 13px; font-weight: 700; color: var(--primary);
    margin-bottom: 12px; padding-bottom: 8px;
    border-bottom: 1px dashed var(--border);
}
.employee-form .form-grid { padding: 16px 0 8px; }
.employee-form .form-actions {
    padding: 16px 24px; margin-top: 0;
    background: var(--bg-hover);
}
.employee-form .validation-summary {
    margin: 0 24px 16px; padding: 12px 16px;
    background: #fff3e0; border: 1px solid #ffcc80;
    border-radius: var(--radius); color: #e65100; font-size: 14px;
}
.employee-form .validation-summary ul {
    margin: 8px 20px 0 0; padding: 0;
}
.employee-form .validation-summary li { margin-bottom: 4px; }
.employee-form .mud-tabs-toolbar { background: var(--bg-card) !important; }
.employee-form .mud-tab { font-weight: 600 !important; color: #000 !important; }
.employee-form .mud-tab.mud-tab-active {
    color: var(--primary) !important;
    background: rgba(26, 54, 93, 0.06) !important;
    border-radius: 8px 8px 0 0;
}
.employee-form .mud-tabs-panels { padding: 0 !important; }

/* ==================== MODERN FORM DESIGN ==================== */

/* تأثير Focus موحد على حقول MudBlazor */
.mud-input-outlined .mud-input-outlined-border {
    border-radius: 10px !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}
.mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(27, 131, 84, 0.14) !important;
}
.mud-select .mud-input-outlined-border { border-radius: 10px !important; }
.mud-datepicker .mud-input-outlined-border { border-radius: 10px !important; }

/* قسم النموذج المودرن */
.ef-tab-content {
    padding: 24px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.ef-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 22px 24px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}
.ef-section:hover { box-shadow: 0 3px 14px rgba(27,131,84,0.08); }

.ef-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.ef-section-accent {
    width: 4px;
    height: 22px;
    background: var(--primary);
    border-radius: 3px;
    flex-shrink: 0;
}
.ef-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.2px;
}

/* نموذج تسجيل دخول مودرن */
.login-wrapper {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, #e8f5ee 0%, #f0f7f3 45%, #e9f0fb 100%);
    padding: 24px;
}
.login-box {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 44px 40px;
    width: 100%; max-width: 440px;
    box-shadow: 0 20px 60px rgba(27,131,84,0.12), 0 4px 16px rgba(0,0,0,0.06);
    border: 1px solid rgba(27,131,84,0.1);
    position: relative;
    overflow: hidden;
}
.login-box::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-header h1 {
    font-size: 24px; font-weight: 800; color: var(--primary);
    margin-top: 10px; margin-bottom: 2px;
}
.login-company { font-size: 13px; color: var(--text-muted); }
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; margin-bottom: 7px;
    font-weight: 600; color: var(--text); font-size: 13.5px;
}
.login-btn {
    margin-top: 10px; width: 100%; height: 50px;
    font-size: 15px; font-weight: 700;
    font-family: var(--font) !important;
    border-radius: 12px !important;
}
.back-btn { width: 100%; margin-top: 10px; color: var(--text-muted) !important; }

/* نماذج الحوار (Dialogs) */
.mud-dialog {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}
.mud-dialog .mud-dialog-content {
    padding: 20px 24px !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}
.mud-dialog .mud-dialog-title {
    padding: 16px 24px 12px !important;
    font-weight: 700 !important;
    border-bottom: 1px solid var(--border);
}
.mud-dialog .mud-dialog-actions {
    padding: 12px 24px 16px !important;
    border-top: 1px solid var(--border);
    gap: 8px;
}

/* حقول النموذج العامة داخل الحوار */
.mud-dialog .mud-input-outlined .mud-input-outlined-border {
    border-radius: 10px !important;
}

/* زر القائمة - مخفي على الشاشات الكبيرة */
/* ===== زر القائمة للجوال ===== */
.mobile-menu-btn {
    display: none;
    flex-direction: column; justify-content: center; align-items: center; gap: 5px;
    background: var(--primary); border: none; cursor: pointer;
    width: 40px; height: 40px; border-radius: 10px;
    flex-shrink: 0; box-shadow: 0 2px 8px rgba(27,131,84,0.3);
    transition: all 0.2s;
}
.mobile-menu-btn span {
    display: block; width: 20px; height: 2.5px;
    background: white; border-radius: 2px; transition: all 0.2s;
}
.mobile-menu-btn:hover { background: var(--primary-dark); transform: scale(1.05); }

.mobile-close-btn {
    display: none;
    position: absolute; top: 14px; left: 14px;
    background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.25);
    color: white; font-size: 16px; cursor: pointer;
    width: 34px; height: 34px; border-radius: 8px;
    line-height: 1; font-weight: 700; transition: background 0.2s;
}
.mobile-close-btn:hover { background: rgba(255,255,255,0.28); }

.mobile-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99;
    backdrop-filter: blur(2px);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .sidebar {
        display: none;
        position: fixed; top: 0; right: -100%; bottom: 0;
        width: 290px; z-index: 100;
        transition: right 0.28s cubic-bezier(.4,0,.2,1);
        box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    }
    .sidebar.sidebar-open { display: flex; right: 0; }
    .mobile-close-btn { display: flex; align-items: center; justify-content: center; }
    .mobile-overlay { display: block; }
    .mobile-menu-btn { display: flex; }

    /* الشريط العلوي */
    .top-header-bar {
        padding: 10px 12px; gap: 8px;
        flex-wrap: nowrap; overflow-x: auto;
        scrollbar-width: none; -ms-overflow-style: none;
        border-radius: 0; position: sticky; top: 0; z-index: 50;
    }
    .top-header-bar::-webkit-scrollbar { display: none; }
    .top-header-item { font-size: 12px; white-space: nowrap; }
    .top-header-help { font-size: 11px; padding: 2px 8px; white-space: nowrap; }

    /* المحتوى */
    .main-content { margin-right: 0; padding: 10px; }
    .page-wrapper { padding: 8px 4px; }
    .page-header { flex-wrap: wrap; gap: 8px; }
    .page-header h2 { font-size: 18px; }

    /* الإحصاءات */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 12px; }
    .stat-value, .value { font-size: 22px; }

    /* الجداول */
    .rtl-table { font-size: 13px; }
    .mud-table-cell { padding: 8px 6px !important; }

    /* البطاقات */
    .data-card { padding: 14px; border-radius: 10px; }
    .info-grid { grid-template-columns: 1fr; }
    .emp-details-grid { grid-template-columns: 1fr; }
    .action-buttons { flex-direction: column; }
    .form-grid { grid-template-columns: 1fr; }
    .home-cards { flex-direction: column; }

    /* الفلاتر */
    .report-filter-row { flex-direction: column; gap: 10px; }
    .filter-chips { flex-wrap: wrap; gap: 6px; }
    .filter-chip { font-size: 12px; padding: 5px 10px; }

    /* نماذج */
    .ef-tab-content { padding: 12px 4px 4px; gap: 14px; }
    .ef-section { padding: 14px 14px 16px; }
    .form-row { flex-direction: column; gap: 10px; }

    /* نافذة تعديل الجهة على الجوال — شاشة كاملة قابلة للتمرير دائماً (بدون الاعتماد على :has() لأن بعض إصدارات Safari القديمة لا تدعمها) */
    .mud-dialog.tenant-form-dialog {
        position: fixed !important;
        inset: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .mud-dialog.tenant-form-dialog .mud-dialog-content {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}
