/* ============================================
   Company & Service Management System
   Global Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&display=swap');

/* ============================================
   CSS Variables
   ============================================ */
:root {
    /* Syrian Identity - Dark Mode */
    --primary: #b9a779;
    --primary-dark: #988561;
    --primary-light: #d1c5a9;
    --secondary: #2c2a27;
    --accent: #b9a779;
    
    /* Muted Status Colors */
    --success: #6fa374;
    --danger: #d16b5a;
    --warning: #d6b863;
    --info: #7da5c1;
    
    /* Structure - Deep warm charcoals */
    --dark: #161513;
    --darker: #100f0e;
    --sidebar-bg: #1c1a18;
    --sidebar-hover: #262421;
    --card-bg: #201e1c;
    --border-color: #36332d;
    
    /* Typography */
    --text-primary: #f2efe9;
    --text-secondary: #a39e93;
    --text-muted: #757168;
    
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --transition: all 0.3s ease;
}

/* ============================================
   Light Mode Theme
   ============================================ */
[data-theme="light"] {
    --primary: #988561;
    /* Syrian Identity Dark Gold */
    --primary-dark: #7a6a4d;
    --primary-light: #b9a779;
    /* Syrian Identity Light Gold */
    --secondary: #edebe0;
    /* Syrian Identity Beige */
    --accent: #988561;
    --success: #5a8a5e;
    --danger: #c45c4a;
    --warning: #c9a84c;
    --info: #6a8fa8;

    /* Structure exactly matching the website */
    --dark: #f6f5f0;
    /* The very light background of the website's main content */
    --darker: #e4e1d3;
    /* A step darker for inputs/focuses */
    --sidebar-bg: #edebe0;
    /* Sidebar takes the exact beige of the website's header */
    --sidebar-hover: #e4e1d3;
    --card-bg: #ffffff;
    /* Pure white for inner content contrast */
    --border-color: #dcd7c9;
    /* Faint elegant separators seen on the website */

    /* Typography matching the website */
    --text-primary: #2d2a24;
    /* Deep dark brown/grey used for standard text and titles */
    --text-secondary: #6e6859;
    /* Muted warm grey for dates and sub-text */
    --text-muted: #988561;
    /* Primary gold for emphasized elements */
    --shadow: 0 4px 20px rgba(152, 133, 97, 0.08);
    /* Very soft elegant shadow */
}

[data-theme="light"] .login-wrapper {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--sidebar-bg) 50%, var(--darker) 100%);
}

[data-theme="light"] .login-card h1 {
    color: var(--primary);
}

[data-theme="light"] .login-card .logo-icon {
    color: var(--primary-light);
}

[data-theme="light"] table tbody tr:hover {
    background: rgba(185, 167, 121, 0.08);
}

[data-theme="light"] .form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(185, 167, 121, 0.2);
}

[data-theme="light"] .stat-icon.blue {
    background: rgba(152, 133, 97, 0.12);
    color: var(--primary);
}

[data-theme="light"] .stat-icon.green {
    background: rgba(90, 138, 94, 0.12);
    color: var(--success);
}

[data-theme="light"] .stat-icon.orange {
    background: rgba(201, 168, 76, 0.12);
    color: var(--warning);
}

[data-theme="light"] .stat-icon.red {
    background: rgba(196, 92, 74, 0.12);
    color: var(--danger);
}

[data-theme="light"] .badge-active {
    background: rgba(90, 138, 94, 0.12);
    color: var(--success);
}

[data-theme="light"] .badge-expired {
    background: rgba(196, 92, 74, 0.12);
    color: var(--danger);
}

[data-theme="light"] .badge-pending {
    background: rgba(201, 168, 76, 0.12);
    color: #9a7d2e;
}

[data-theme="light"] .badge-cancelled {
    background: rgba(152, 133, 97, 0.12);
    color: var(--primary);
}

[data-theme="light"] .alert-success {
    background: rgba(90, 138, 94, 0.12);
    border-color: rgba(90, 138, 94, 0.3);
}

[data-theme="light"] .alert-error {
    background: rgba(196, 92, 74, 0.12);
    border-color: rgba(196, 92, 74, 0.3);
}

[data-theme="light"] .alert-info {
    background: rgba(106, 143, 168, 0.12);
    border-color: rgba(106, 143, 168, 0.3);
}

[data-theme="light"] .glass-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(152, 133, 97, 0.15);
}

[data-theme="light"] ::-webkit-scrollbar-track {
    background: var(--secondary);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

[data-theme="light"] .sidebar-nav a:hover,
[data-theme="light"] .sidebar-nav a.active {
    border-right-color: var(--primary-light);
}

[data-theme="light"] .note-item {
    border-right-color: var(--primary-light);
}

/* ============================================
   Theme Toggle Button
   ============================================ */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
    border-color: var(--primary);
}

.theme-toggle:focus {
    outline: none;
}

/* ============================================
   Notification Bell
   ============================================ */
.notification-bell {
    position: relative;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
    flex-shrink: 0;
    text-decoration: none;
}

.notification-bell:hover {
    background: var(--sidebar-hover);
    color: var(--primary);
    border-color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    animation: bellPulse 2s ease-in-out infinite;
}

@keyframes bellPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ============================================
   Reset & Base
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* Removes native mobile tap highlight */
}

html {
    font-size: 14px;
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--dark);
    color: var(--text-primary);
    direction: rtl;
    min-height: 100vh;
    line-height: 1.6;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   Login Page
   ============================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--darker) 0%, var(--sidebar-bg) 50%, var(--dark) 100%);
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.login-card h1 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: var(--primary-light);
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.login-card .logo-icon {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 16px;
    color: var(--primary);
}

/* ============================================
   Layout - Admin & Customer
   ============================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    transition: transform var(--transition), width var(--transition);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.1rem;
    color: var(--primary-light);
    margin-bottom: 4px;
}

.sidebar-header .user-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: var(--transition);
    border-right: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--sidebar-hover);
    color: var(--text-primary);
    border-right-color: var(--primary);
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--danger);
    font-size: 0.9rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-right: 260px;
    min-height: 100vh;
}

.top-bar {
    background: var(--card-bg);
    /* Safe Area Insets for modern devices with notches */
    padding: max(16px, env(safe-area-inset-top)) max(30px, env(safe-area-inset-right)) 16px max(30px, env(safe-area-inset-left));
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h1 {
    font-size: 1.3rem;
    font-weight: 700;
    flex: 1;
    min-width: 0;
}

.content-area {
    padding: 24px 30px;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.card-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-icon.blue {
    background: rgba(185, 167, 121, 0.15);
    color: var(--primary);
}

.stat-icon.green {
    background: rgba(111, 163, 116, 0.15);
    color: var(--success);
}

.stat-icon.orange {
    background: rgba(214, 184, 99, 0.15);
    color: var(--warning);
}

.stat-icon.red {
    background: rgba(209, 107, 90, 0.15);
    color: var(--danger);
}

.stat-card .stat-info h4 {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
}

.stat-card .stat-info p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* ============================================
   Tables
   ============================================ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead th {
    background: var(--darker);
    padding: 12px 16px;
    text-align: right;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    border-bottom: 2px solid var(--border-color);
}

table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    vertical-align: middle;
}

table tbody tr {
    transition: var(--transition);
}

table tbody tr:hover {
    background: rgba(185, 167, 121, 0.05);
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--darker);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Cairo', sans-serif;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(185, 167, 121, 0.2);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a4a7b5' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 32px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #00a382;
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: var(--dark);
}

.btn-info {
    background: var(--info);
    color: var(--dark);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* ============================================
   Alerts / Flash Messages
   ============================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: rgba(111, 163, 116, 0.12);
    border: 1px solid rgba(111, 163, 116, 0.3);
    color: var(--success);
}

.alert-error {
    background: rgba(209, 107, 90, 0.12);
    border: 1px solid rgba(209, 107, 90, 0.3);
    color: var(--danger);
}

.lockout-help {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(209, 107, 90, 0.2);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.lockout-help i {
    margin-left: 6px;
    color: var(--warning);
}

.alert-info {
    background: rgba(125, 165, 193, 0.12);
    border: 1px solid rgba(125, 165, 193, 0.3);
    color: var(--info);
}

/* ============================================
   Status Badges
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-active {
    background: rgba(111, 163, 116, 0.15);
    color: var(--success);
}

.badge-expired {
    background: rgba(209, 107, 90, 0.15);
    color: var(--danger);
}

.badge-pending {
    background: rgba(214, 184, 99, 0.15);
    color: var(--warning);
}

.badge-cancelled {
    background: rgba(185, 167, 121, 0.15);
    color: var(--primary);
}

/* ============================================
   Checkbox Grid (Staff Permissions)
   ============================================ */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    padding: 12px;
    background: var(--darker);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.checkbox-label:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* 3-column stats grid */
.stats-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

/* ============================================
   Pagination
   ============================================ */
.pagination-nav {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.pagination {
    list-style: none;
    display: flex;
    gap: 6px;
}

.pagination li a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: 8px;
    background: var(--darker);
    color: var(--text-secondary);
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

.pagination li a:hover,
.pagination li.active a {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ============================================
   Company Info Cards
   ============================================ */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--darker);
    border-radius: var(--radius-sm);
}

.info-item i {
    color: var(--primary-light);
    margin-top: 3px;
    width: 18px;
    text-align: center;
}

.info-item .info-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.info-item .info-value {
    font-weight: 600;
    font-size: 0.95rem;
}

.company-logo {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

/* ============================================
   Search Bar
   ============================================ */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar .form-control {
    max-width: 350px;
}

/* ============================================
   Action Buttons in Tables
   ============================================ */
.actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ============================================
   Modal (Simple CSS Modal)
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 550px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 30px;
    border: 1px solid var(--border-color);
}

.modal-content h3 {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* ============================================
   File Upload
   ============================================ */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.file-upload:hover {
    border-color: var(--primary);
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload label {
    cursor: pointer;
    color: var(--text-secondary);
}

/* ============================================
   Responsive — Tablet & Small Desktop (≤1100px)
   ============================================ */
@media (max-width: 1100px) {
    /* Hide sidebar and make it off-canvas */
    .sidebar {
        width: 0;
        min-width: 0;
        overflow: hidden;
        box-shadow: none;
    }

    .sidebar.open {
        width: 280px;
        min-width: 280px;
        right: 0;
        bottom: 0;
        height: 100dvh;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
    }

    /* Prevent text wrap/overlap during sidebar animation */
    .sidebar-header,
    .sidebar-nav,
    .sidebar-footer {
        white-space: nowrap;
        min-width: 280px;
    }

    /* Sidebar overlay backdrop */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 99;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-right: 0;
    }


    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .info-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .content-area {
        padding: 20px;
    }
}

/* ============================================
   Responsive — Mobile (≤768px)
   ============================================ */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    /* Top bar */
    .top-bar {
        padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
        gap: 8px;
    }

    .top-bar h1 {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 50vw;
    }

    /* Content — minimal padding to maximize screen usage */
    .content-area {
        padding: 8px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    /* Cards — edge-to-edge feel */
    .card {
        border-radius: 8px;
        margin-bottom: 10px;
    }

    .card-header {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .card-header h3 {
        font-size: 0.95rem;
    }

    .card-body {
        padding: 8px;
    }

    /* Grids stack to single column */
    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid,
    .stats-grid-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Stat cards compact */
    .stat-card {
        padding: 12px;
    }

    .stat-card .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }

    .stat-card .stat-info h4 {
        font-size: 1.3rem;
    }

    /* Tables: card-style on mobile */
    table thead {
        display: none;
    }

    table tbody tr {
        display: block;
        margin-bottom: 8px;
        border: 1px solid var(--border-color);
        border-radius: 6px;
        background: var(--card-bg);
        overflow: hidden;
    }

    table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 5px 10px;
        border-bottom: 1px solid var(--border-color);
        font-size: 0.85rem;
        text-align: left;
    }

    /* Reverse flex order for LTR cells to maintain visual RTL label-value placement */
    table tbody td.phone-ltr {
        flex-direction: row-reverse;
    }

    table tbody td:first-child {
        background: var(--darker);
        border-bottom: 1px solid var(--border-color);
        padding: 8px 10px;
    }

    table tbody td:last-child {
        border-bottom: none;
    }

    table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--primary);
        margin-left: 8px;
        flex-shrink: 0;
        font-size: 0.8rem;
    }

    /* Actions cell: keep buttons grouped together, not spread */
    table tbody td .actions,
    table tbody td.actions {
        justify-content: flex-start;
        gap: 6px;
    }

    /* Override the td flex for cells containing only actions */
    table tbody td:has(.actions) {
        justify-content: space-between;
    }

    /* Form controls - less bulky on mobile */
    .form-control {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    /* Buttons — compact for mobile */
    .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
        padding: 0;
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    /* Search bar stacks */
    .search-bar {
        flex-wrap: wrap;
        align-items: center;
    }

    .search-bar .form-control {
        max-width: 100%;
        flex: 1;
        min-width: 0;
    }

    /* Login card */
    .login-card {
        padding: 24px 20px;
    }

    .login-card h1 {
        font-size: 1.4rem;
    }

    /* Company logo smaller */
    .company-logo {
        width: 60px;
        height: 60px;
    }

    /* Pagination */
    .pagination li a {
        min-width: 32px;
        height: 32px;
        font-size: 0.78rem;
        padding: 0 6px;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        padding: 20px;
        max-height: 90vh;
    }

    /* Checkbox grid */
    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    /* d-flex utilities wrap on mobile */
    .d-flex {
        flex-wrap: wrap;
    }

    .gap-2 {
        gap: 8px;
    }

    /* Note items */
    .note-item {
        padding: 10px;
    }

    /* File upload */
    .file-upload {
        padding: 12px;
    }
}

/* ============================================
   Responsive — Small Mobile (≤480px)
   ============================================ */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }

    .top-bar h1 {
        font-size: 0.9rem;
        max-width: 40vw;
    }

    .content-area {
        padding: 6px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }

    .card {
        border-radius: 6px;
        margin-bottom: 8px;
    }

    .card-header {
        padding: 8px 10px;
    }

    .card-body {
        padding: 6px;
    }

    .stat-card {
        padding: 10px;
        gap: 10px;
    }

    .stat-card .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        border-radius: 8px;
    }

    .stat-card .stat-info h4 {
        font-size: 1.1rem;
    }

    .stat-card .stat-info p {
        font-size: 0.78rem;
    }

    .info-item {
        padding: 8px;
        gap: 8px;
    }

    .pagination {
        gap: 3px;
    }

    .pagination li a {
        min-width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .login-card {
        padding: 20px 16px;
    }
}

/* ============================================
   Phone Numbers (LTR)
   ============================================ */
.phone-ltr,
input[type="tel"] {
    direction: ltr;
    text-align: right;
    unicode-bidi: embed;
}

/* ============================================
   Utilities
   ============================================ */
.text-center {
    text-align: center;
}

.text-start {
    text-align: right;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-muted {
    color: var(--text-muted);
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.d-flex {
    display: flex;
}

.gap-2 {
    gap: 16px;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* ============================================
   Menu Toggle (mobile)
   ============================================ */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

@media (max-width: 1100px) {
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ============================================
   Glassmorphism Effects
   ============================================ */
.glass-card {
    background: rgba(34, 37, 45, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px; /* For horizontal scrollbars inside tables */
}

::-webkit-scrollbar-track {
    background: var(--darker);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Notes Section
   ============================================ */
.note-item {
    background: var(--darker);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 10px;
    border-right: 3px solid var(--primary);
}

.note-item .note-date {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.note-item .note-text {
    font-size: 0.9rem;
    line-height: 1.7;
}