:root {
    /* Soft Warm Neutral Palette */
    --bg: #fcfaf7;
    --bg-alt: #f5f2ed;
    --surface: #ffffff;
    --surface-border: #e9e5e0;
    --text: #1a2a33;
    --text-muted: #64748b;
    --brand: #0f4c81; /* Classic Premium Blue */
    --brand-light: #e8f0f6;
    --accent: #b8860b; /* Sophisticated Gold/Ochre */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;

    /* Shadow System (Soft Elevation) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --elevation-glass: 0 8px 32px 0 rgba(15, 23, 42, 0.04);

    /* Radius & Spacing (8px based) */
    --radius-full: 9999px;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    direction: rtl;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Cairo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    text-align: right;
    background-color: var(--bg);
    line-height: 1.625;
    -webkit-font-smoothing: antialiased;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 800;
    line-height: 1.3;
    color: var(--text);
}

h1 { font-size: 1.875rem; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

/* App Shell Layout (RTL Sidebar on the Right) */
.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--surface);
    border-left: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    padding: var(--space-lg) var(--space-md);
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0 0.5rem;
    margin-bottom: var(--space-xl);
}

.brand-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    color: #fff;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(15, 76, 129, 0.2);
}

.brand-mark strong {
    display: block;
    font-size: 1.15rem;
    font-weight: 800;
}

.brand-mark small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.nav-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 700;
}

.nav-link:hover {
    background: var(--bg-alt);
    color: var(--brand);
}

.nav-link.active {
    background: var(--brand-light);
    color: var(--brand);
}

.logout-form button {
    width: 100%;
    text-align: right;
    background: transparent;
    border: 0;
    margin-top: 2rem;
    color: var(--danger);
    font-weight: 700;
}

/* Main Dashboard Area */
.main-layout {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg);
}

.topbar {
    position: sticky;
    top: 0;
    height: 72px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    border-bottom: 1px solid var(--surface-border);
    z-index: 40;
}

.topbar-right, .topbar-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-alt);
    border-radius: var(--radius-full);
}

.user-pill-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
}

.content {
    padding: var(--space-lg);
    flex: 1;
}

/* Global UI Components */
.panel {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.page-intro h1 { margin-bottom: 0.25rem; }
.page-intro p { color: var(--text-muted); margin: 0; }

.eyebrow {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.35rem;
}

/* KPI Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--brand-light);
}

.stat-card span {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.stat-card strong {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--brand);
    line-height: 1;
}

.stat-card small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.725rem;
    color: var(--text-muted);
}

/* Tables Redesign */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 1rem;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    text-align: right;
    border-bottom: 2px solid var(--bg-alt);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--bg-alt);
    font-size: 0.925rem;
}

.data-table tr:hover td {
    background-color: var(--bg-alt);
}

/* Button System */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 0.875rem;
    cursor: pointer;
    border: 1px solid transparent;
}

.button-primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 4px 10px rgba(15, 76, 129, 0.2);
}

.button-primary:hover {
    filter: brightness(1.1);
}

.button-secondary {
    background: var(--surface);
    color: var(--brand);
    border-color: var(--brand-light);
}

.button-secondary:hover {
    background: var(--brand-light);
}

.button-danger {
    background: #fff;
    color: var(--danger);
    border-color: #fee2e2;
}

.button-danger:hover {
    background: #fee2e2;
}

/* Form Styles */
input, select, textarea {
    background: #fff;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.85rem;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-light);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 800;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #075985; }

/* Dashboard layout specific */
.split-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

@media (max-width: 1100px) {
    .split-grid {
        grid-template-columns: 1fr;
    }
}

/* Auth / Login Page Specific Layouts */
.auth-shell {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    min-height: 100vh;
    gap: var(--space-xl);
    padding: var(--space-xl);
    align-items: center;
    background: var(--bg-alt);
}

.auth-hero {
    padding-right: var(--space-lg);
}

.auth-hero h1 {
    font-size: 2.25rem;
    margin-bottom: var(--space-md);
    color: var(--brand);
}

.auth-hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.hero-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.hero-metrics article {
    background: var(--surface);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--surface-border);
}

.hero-metrics strong {
    display: block;
    color: var(--brand);
    margin-bottom: 0.25rem;
}

.hero-metrics span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.auth-card {
    background: var(--surface);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--surface-border);
    max-width: 480px;
    margin: 0 auto;
}

.auth-card h2 {
    font-size: 1.5rem;
    margin-bottom: var(--space-lg);
}

.stacked-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.stacked-form label span {
    display: block;
    font-size: 0.85rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.checkbox-field input {
    width: auto;
}

@media (max-width: 1100px) {
    .auth-shell {
        grid-template-columns: 1fr;
        padding: var(--space-lg);
        gap: var(--space-lg);
    }
    
    .auth-hero {
        padding-right: 0;
        text-align: center;
    }
    
    .auth-card {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        right: 0;
        inset: 0 0 0 auto;
        width: 280px;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    }
}

/* Panel Head (flex header with title + action) */
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

/* Button Block (Full Width) */
.button-block {
    width: 100%;
}

/* Auth Hint */
.auth-hint {
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--surface-border);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
}

.empty-state h2 {
    font-size: 4rem;
    color: var(--brand-light);
    margin-bottom: var(--space-sm);
}

.empty-state p {
    font-size: 0.95rem;
}

/* Page Description */
.page-description {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.9rem;
}

/* Badge Muted Variant */
.badge-muted {
    background: var(--bg-alt);
    color: var(--text-muted);
}

/* Form Group Label */
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* Mobile Only Utility */
.mobile-only {
    display: none;
}

@media (max-width: 900px) {
    .mobile-only {
        display: inline-flex;
    }
}

/* Confirmation Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    width: min(420px, 90vw);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.is-open .modal-box {
    transform: scale(1) translateY(0);
}

/* Flash Messages Animation */
.flash {
    animation: flashIn 0.3s ease;
}

@keyframes flashIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-alt);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Links in Tables */
.data-table a {
    color: var(--brand);
    font-weight: 700;
}

.data-table a:hover {
    text-decoration: underline;
}

/* Action Buttons Group */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-buttons .button {
    padding: 0.4rem 0.65rem;
    font-size: 0.75rem;
}

/* Morocco production theme overrides */
:root {
    --bg: #f6f0e6;
    --bg-alt: #eee4d5;
    --surface: rgba(255, 251, 245, 0.92);
    --surface-strong: #fffdfa;
    --surface-border: rgba(18, 38, 49, 0.12);
    --text: #122631;
    --text-muted: #5d6c76;
    --brand: #0e4f5c;
    --brand-deep: #083843;
    --brand-light: #d8eaed;
    --accent: #c28b38;
    --accent-soft: #efe0bf;
    --success: #1f7a64;
    --warning: #c97713;
    --danger: #b55342;
    --info: #0c7590;
    --shadow-sm: 0 10px 30px rgba(16, 31, 43, 0.05);
    --shadow-md: 0 18px 44px rgba(16, 31, 43, 0.08);
    --shadow-lg: 0 30px 60px rgba(16, 31, 43, 0.12);
}

body {
    font-family: "Alexandria", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(194, 139, 56, 0.11), transparent 28%),
        radial-gradient(circle at bottom right, rgba(14, 79, 92, 0.14), transparent 26%),
        linear-gradient(180deg, #f8f2e9 0%, #f3ebde 100%);
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(14, 79, 92, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 79, 92, 0.025) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 75%);
}

h1, h2, h3, h4, h5, h6,
.brand-mark strong,
.topbar-title {
    font-family: "El Messiri", "Alexandria", sans-serif;
}

.shell-accent {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 15% 18%, rgba(194, 139, 56, 0.16), transparent 18%),
        radial-gradient(circle at 86% 12%, rgba(14, 79, 92, 0.18), transparent 22%);
    z-index: 0;
}

.app-shell,
.guest-shell {
    position: relative;
    z-index: 1;
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(255, 251, 245, 0.96) 0%, rgba(246, 238, 225, 0.98) 100%);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(18, 38, 49, 0.08);
}

.brand-icon {
    background: linear-gradient(145deg, var(--brand) 0%, var(--brand-deep) 100%);
    box-shadow: 0 12px 24px rgba(14, 79, 92, 0.22);
}

.brand-mark small {
    letter-spacing: 0.04em;
}

.sidebar-meta {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem;
    margin-bottom: 1.2rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(14, 79, 92, 0.08), rgba(194, 139, 56, 0.11));
    border: 1px solid rgba(14, 79, 92, 0.08);
}

.sidebar-meta span,
.sidebar-version span,
.topbar-meta span,
.stack-row span,
.quick-stat-card small,
.status-chip span {
    color: var(--text-muted);
}

.sidebar-meta span,
.sidebar-version span {
    font-size: 0.72rem;
    font-weight: 700;
}

.sidebar-meta strong,
.sidebar-version strong {
    font-size: 0.85rem;
    font-weight: 800;
}

.nav-link {
    position: relative;
    background: transparent;
}

.nav-link.active::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--accent), var(--brand));
}

.sidebar-footer {
    padding-top: 1.2rem;
    border-top: 1px solid rgba(18, 38, 49, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-pill {
    background: rgba(14, 79, 92, 0.08);
    border: 1px solid rgba(14, 79, 92, 0.08);
}

.user-pill-meta {
    min-width: 0;
}

.user-pill-meta p {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-version {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(18, 38, 49, 0.06);
}

.topbar {
    height: 78px;
    background: rgba(255, 251, 245, 0.72);
    backdrop-filter: blur(14px);
}

.topbar-title {
    font-size: 1.2rem;
    margin: 0;
}

.topbar-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    padding: 0.6rem 0.95rem;
    border-radius: 999px;
    background: rgba(14, 79, 92, 0.08);
    border: 1px solid rgba(14, 79, 92, 0.08);
}

.topbar-meta strong {
    font-size: 0.82rem;
}

.topbar-toggle {
    padding: 0.5rem 0.7rem;
}

.content {
    padding: 2rem;
}

.page-head {
    gap: 1.5rem;
    align-items: flex-end;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.panel,
.stat-card,
.auth-card,
.guest-panel {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow-sm);
}

.flash-stack,
.auth-flash-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-flash-stack {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 100;
    width: min(400px, 90vw);
}

.flash-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    border: 1px solid rgba(18, 38, 49, 0.08);
}

.flash-card i {
    width: 18px;
    height: 18px;
}

.guest-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.guest-panel {
    width: min(460px, 100%);
    padding: 2.6rem;
}

.guest-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.guest-brand .brand-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
}

.guest-brand h1 {
    margin-bottom: 0.4rem;
}

.hero-banner {
    display: grid;
    grid-template-columns: 1.35fr 0.95fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding: 1.4rem;
    border-radius: 24px;
    background:
        linear-gradient(135deg, rgba(14, 79, 92, 0.92) 0%, rgba(8, 56, 67, 0.96) 100%);
    color: #fdf8f0;
    box-shadow: var(--shadow-md);
}

.hero-copy h2 {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.hero-copy p {
    color: rgba(255, 248, 239, 0.8);
    max-width: 58ch;
}

.hero-banner .eyebrow {
    color: var(--accent-soft);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.2rem;
}

.hero-actions .button-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.16);
}

.hero-actions .button-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
}

.quick-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.quick-stat-card {
    padding: 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.quick-stat-card span {
    display: block;
    font-size: 0.78rem;
    color: rgba(255, 248, 239, 0.75);
}

.quick-stat-card strong {
    display: block;
    margin: 0.4rem 0 0.35rem;
    font-size: 1.35rem;
    color: #fff;
}

.stats-grid {
    margin-bottom: 1.2rem;
}

.stat-card-top {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.success {
    background: rgba(31, 122, 100, 0.12);
    color: var(--success);
}

.stat-icon.info {
    background: rgba(12, 117, 144, 0.12);
    color: var(--info);
}

.stat-icon.accent {
    background: rgba(194, 139, 56, 0.14);
    color: var(--accent);
}

.stat-icon.danger {
    background: rgba(181, 83, 66, 0.12);
    color: var(--danger);
}

.status-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.5rem;
}

.status-chip {
    padding: 1rem;
    border-radius: 18px;
    background: rgba(255, 251, 245, 0.84);
    border: 1px solid rgba(14, 79, 92, 0.08);
    box-shadow: var(--shadow-sm);
}

.status-chip strong,
.status-chip small {
    display: block;
}

.status-chip strong {
    margin: 0.35rem 0;
    color: var(--brand);
}

.status-chip.accent strong {
    color: var(--accent);
}

.status-chip small {
    font-size: 1rem;
    font-weight: 800;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.table-responsive {
    overflow-x: auto;
}

.metric-bars,
.stack-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.metric-row {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.metric-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.metric-label span {
    font-weight: 700;
}

.bar-track {
    height: 10px;
    border-radius: 999px;
    background: rgba(14, 79, 92, 0.08);
    overflow: hidden;
}

.bar-track.accent {
    background: rgba(194, 139, 56, 0.15);
}

.bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), #1f7483);
}

.bar-fill.accent {
    background: linear-gradient(90deg, var(--accent), #d3a25a);
}

/* ============================================
   Charts Grid (Dashboard)
   ============================================ */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.chart-panel {
    min-height: 400px;
}

.chart-container {
    position: relative;
    height: 350px;
    padding: var(--space-sm);
}

/* ============================================
   Dark Mode Support (Preparation)
   ============================================ */

.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    cursor: pointer;
}

.dark-mode-toggle input {
    display: none;
}

.dark-mode-toggle .toggle-slider {
    width: 40px;
    height: 20px;
    background: var(--surface-border);
    border-radius: var(--radius-full);
    position: relative;
    transition: var(--transition);
}

.dark-mode-toggle .toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    top: 2px;
    right: 2px;
    transition: var(--transition);
}

.dark-mode-toggle input:checked + .toggle-slider {
    background: var(--brand);
}

.dark-mode-toggle input:checked + .toggle-slider::before {
    transform: translateX(-20px);
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-panel {
        min-height: 300px;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .language-switcher {
        display: none;
    }
}

/* ============================================
   Language Switcher
   ============================================ */

.language-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: var(--bg-alt);
    border-radius: var(--radius-md);
}

.lang-link {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
}

.lang-link:hover {
    background: var(--surface);
    color: var(--text);
}

.lang-link.active {
    background: var(--brand);
    color: white;
}

/* RTL Support */
[dir="rtl"] .language-switcher {
    direction: ltr;
}

/* LTR Support for French/English */
[dir="ltr"] .language-switcher {
    direction: ltr;
}

/* Responsive language switcher */
@media (max-width: 1024px) {
    .language-switcher {
        display: none;
    }
}

.stack-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    padding: 0.95rem 1rem;
    border-radius: var(--radius-md);
    background: rgba(14, 79, 92, 0.05);
}

.stack-row strong {
    display: block;
}

.align-right {
    text-align: left;
}

.button-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: rgba(18, 38, 49, 0.08);
}

.button-ghost:hover {
    background: rgba(14, 79, 92, 0.06);
}

.button-small {
    padding: 0.45rem 0.8rem;
    font-size: 0.78rem;
}

.filters-grid,
.filters-grid-wide {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filters-grid label,
.filters-grid-wide label {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.filters-grid span,
.filters-grid-wide span {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-muted);
}

.filter-actions,
.form-actions,
.table-actions,
.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.actions-col {
    white-space: nowrap;
}

.form-panel {
    padding: 1.5rem;
}

.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-span {
    grid-column: 1 / -1;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 17, 22, 0.48);
    opacity: 0;
    visibility: hidden;
    transition: 0.2s ease;
    z-index: 45;
}

.sidebar-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    text-align: center;
}

.modal-icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: rgba(181, 83, 66, 0.12);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon i {
    width: 28px;
    height: 28px;
}

@media (max-width: 1100px) {
    .hero-banner,
    .info-grid {
        grid-template-columns: 1fr;
    }

    .quick-stat-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .content {
        padding: 1.2rem;
    }

    .page-head {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar {
        padding: 0 1rem;
    }

    .topbar-left {
        gap: 0.6rem;
    }

    .topbar-meta {
        display: none;
    }

    .sidebar {
        z-index: 100;
    }

    .sidebar.is-open + .main-layout {
        filter: blur(0);
    }
}

@media (max-width: 640px) {
    .two-columns {
        grid-template-columns: 1fr;
    }

    .hero-copy h2 {
        font-size: 1.55rem;
    }

    .stats-grid,
    .status-strip {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Document Upload Cards (Booking Form)
   ============================================ */

.doc-upload-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    border-radius: var(--radius-lg);
    border: 2px dashed rgba(14, 79, 92, 0.18);
    background: rgba(14, 79, 92, 0.03);
    text-align: center;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.doc-upload-card:hover {
    border-color: var(--brand);
    background: rgba(14, 79, 92, 0.06);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(14, 79, 92, 0.08);
}

.doc-upload-card.drag-over {
    border-color: var(--accent);
    background: rgba(194, 139, 56, 0.08);
    border-style: solid;
    transform: scale(1.02);
}

.doc-upload-card.has-file {
    border-color: var(--success);
    border-style: solid;
    background: rgba(31, 122, 100, 0.06);
}

.doc-upload-card.has-file .doc-upload-icon {
    background: rgba(31, 122, 100, 0.12);
    color: var(--success);
}

.doc-upload-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(14, 79, 92, 0.08);
    color: var(--brand);
    transition: all 0.25s ease;
}

.doc-upload-card strong {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text);
}

.doc-upload-card small {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.03em;
}

.doc-upload-card input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.doc-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius-md);
    background: var(--brand);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.25rem;
}

.doc-upload-btn:hover {
    background: var(--brand-deep);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(14, 79, 92, 0.2);
}

.doc-upload-filename {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--success);
    word-break: break-all;
    max-width: 100%;
    min-height: 1.2em;
}

/* ============================================
   Existing Document Cards (Booking Edit / Files)
   ============================================ */

.existing-doc-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    background: rgba(14, 79, 92, 0.04);
    border: 1px solid rgba(14, 79, 92, 0.08);
    transition: all 0.2s ease;
}

.existing-doc-card:hover {
    background: rgba(14, 79, 92, 0.07);
    border-color: rgba(14, 79, 92, 0.14);
    box-shadow: 0 2px 8px rgba(14, 79, 92, 0.06);
}

.existing-doc-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(14, 79, 92, 0.08);
    color: var(--brand);
}

.existing-doc-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.existing-doc-info strong {
    font-size: 0.85rem;
    font-weight: 800;
}

.existing-doc-info small {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.existing-doc-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

/* ============================================
   Client Document Profile Cards
   ============================================ */

.client-doc-card {
    position: relative;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
}

.client-doc-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(14, 79, 92, 0.1);
    border-color: rgba(14, 79, 92, 0.15);
}

.client-doc-type-strip {
    height: 4px;
    width: 100%;
    background: var(--brand);
}

.client-doc-type-strip.client-doc-type-passport {
    background: linear-gradient(90deg, #0e4f5c, #1f7483);
}

.client-doc-type-strip.client-doc-type-cin {
    background: linear-gradient(90deg, #c28b38, #d3a25a);
}

.client-doc-type-strip.client-doc-type-bonne {
    background: linear-gradient(90deg, #1f7a64, #2ba882);
}

.client-doc-type-strip.client-doc-type-visa {
    background: linear-gradient(90deg, #6c5ce7, #a29bfe);
}

.client-doc-type-strip.client-doc-type-ticket_pdf {
    background: linear-gradient(90deg, #e17055, #fab1a0);
}

.client-doc-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1rem 0.5rem;
}

.client-doc-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(14, 79, 92, 0.07);
    color: var(--brand);
}

.client-doc-body {
    padding: 0.5rem 1rem;
    flex: 1;
}

.client-doc-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(14, 79, 92, 0.06);
    background: rgba(14, 79, 92, 0.02);
}

/* ============================================
   Document Type Badges
   ============================================ */

.doc-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.doc-type-badge.doc-type-passport {
    background: rgba(14, 79, 92, 0.1);
    color: var(--brand);
}

.doc-type-badge.doc-type-cin {
    background: rgba(194, 139, 56, 0.12);
    color: #a67720;
}

.doc-type-badge.doc-type-bonne {
    background: rgba(31, 122, 100, 0.1);
    color: var(--success);
}

.doc-type-badge.doc-type-visa {
    background: rgba(108, 92, 231, 0.1);
    color: #6c5ce7;
}

.doc-type-badge.doc-type-ticket_pdf {
    background: rgba(225, 112, 85, 0.1);
    color: #e17055;
}

.doc-type-badge.doc-type-client_document {
    background: rgba(12, 117, 144, 0.1);
    color: var(--info);
}

.doc-type-badge.doc-type-other {
    background: rgba(18, 38, 49, 0.07);
    color: var(--text-muted);
}

/* ============================================
   Responsive: Document Cards
   ============================================ */

@media (max-width: 640px) {
    .doc-upload-card {
        padding: 1rem 0.75rem;
    }

    .doc-upload-icon {
        width: 44px;
        height: 44px;
    }

    .existing-doc-card {
        flex-wrap: wrap;
    }

    .client-doc-footer {
        flex-direction: column;
    }
}

/* ═══════════════════════════════════════════════════════════════
   نظام إشعارات Toast — الترقية الاحترافية 2026
   ═══════════════════════════════════════════════════════════════ */

.toast-container {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 420px;
    width: 100%;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--surface-strong, #fff);
    border: 1px solid var(--surface-border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    pointer-events: all;
    transform: translateX(-120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.toast-visible {
    transform: translateX(0);
    opacity: 1;
}

.toast-hiding {
    transform: translateX(-120%);
    opacity: 0;
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    opacity: 0.5;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.06);
}

.toast-progress-bar {
    display: block;
    height: 100%;
    border-radius: 0 3px 3px 0;
    animation: toastProgress linear forwards;
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* أنواع Toast */
.toast-success { border-right: 4px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }
.toast-success .toast-progress-bar { background: var(--success); }

.toast-danger { border-right: 4px solid var(--danger); }
.toast-danger .toast-icon { color: var(--danger); }
.toast-danger .toast-progress-bar { background: var(--danger); }

.toast-warning { border-right: 4px solid var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-warning .toast-progress-bar { background: var(--warning); }

.toast-info { border-right: 4px solid var(--info); }
.toast-info .toast-icon { color: var(--info); }
.toast-info .toast-progress-bar { background: var(--info); }

/* ═══════════════════════════════════════════════════════════════
   اختصارات لوحة المفاتيح
   ═══════════════════════════════════════════════════════════════ */

.keyboard-help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s;
}

.keyboard-help-overlay.visible {
    opacity: 1;
}

.keyboard-help-modal {
    background: var(--surface-strong, #fff);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
    width: min(440px, 90vw);
    overflow: hidden;
}

.keyboard-help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--surface-border);
}

.keyboard-help-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.keyboard-help-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    color: var(--text-muted);
    line-height: 1;
}

.keyboard-help-body {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.shortcut-row kbd {
    background: var(--bg-alt);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--brand);
    font-family: monospace;
    min-width: 100px;
    text-align: center;
}

.shortcut-row span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   مؤشرات النمو — Growth Indicators
   ═══════════════════════════════════════════════════════════════ */

.growth-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
}

.growth-up {
    color: var(--success);
    background: rgba(31, 122, 100, 0.1);
}

.growth-down {
    color: var(--danger);
    background: rgba(181, 83, 66, 0.1);
}

.growth-neutral {
    color: var(--text-muted);
    background: var(--bg-alt);
}

/* الرسوم البيانية */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.chart-panel {
    min-height: 320px;
}

.chart-container {
    height: 260px;
    position: relative;
}

@media (max-width: 900px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .toast-container {
        left: 0.5rem;
        right: 0.5rem;
        max-width: none;
    }
}

/* مؤشر الصلاحيات في القائمة */
.nav-link.disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

/* زر اختصارات لوحة المفاتيح */
.keyboard-shortcut-hint {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-full);
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 50;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.keyboard-shortcut-hint:hover {
    box-shadow: var(--shadow-md);
    color: var(--brand);
}

/* ═══════════════════════════════════════════════════════════════
   Design Refresh 2026
   ═══════════════════════════════════════════════════════════════ */

:root {
    --focus-ring: rgba(194, 139, 56, 0.22);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.button {
    min-height: 44px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

.main-layout {
    background:
        linear-gradient(180deg, rgba(255, 251, 245, 0.4) 0%, rgba(243, 235, 222, 0) 22%),
        transparent;
}

.topbar {
    height: auto;
    min-height: 78px;
    padding: 1rem 1.5rem;
    gap: 1rem;
    background: rgba(255, 251, 245, 0.78);
    border-bottom: 1px solid rgba(18, 38, 49, 0.08);
}

.topbar-right,
.topbar-left {
    gap: 0.9rem;
}

.topbar-context {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.topbar-kicker {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.topbar-context strong {
    font-family: "El Messiri", "Alexandria", sans-serif;
    font-size: 1.05rem;
    color: var(--text);
}

.toolbar-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 44px;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(18, 38, 49, 0.08);
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.toolbar-chip:hover {
    background: rgba(255, 255, 255, 0.95);
    color: var(--brand);
}

.toolbar-chip i {
    width: 16px;
    height: 16px;
}

.topbar-meta {
    min-height: 44px;
    justify-content: center;
}

.content {
    padding: 1.5rem 1.5rem 2.5rem;
}

.content-shell {
    max-width: 1480px;
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.page-head {
    margin-bottom: 0;
    align-items: flex-end;
}

.page-intro {
    max-width: 60rem;
}

.page-intro h1 {
    font-size: 2.1rem;
    margin-bottom: 0.35rem;
}

.page-intro p {
    max-width: 54rem;
    font-size: 0.98rem;
}

.page-actions {
    justify-content: flex-end;
}

.flash-stack {
    margin-top: 0.15rem;
}

.hero-banner {
    position: relative;
    overflow: hidden;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
    gap: 1.4rem;
    padding: 1.8rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
}

.hero-banner::before {
    content: "";
    position: absolute;
    inset: auto auto -20% -8%;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(194, 139, 56, 0.28) 0%, rgba(194, 139, 56, 0) 72%);
    pointer-events: none;
}

.hero-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.05) 0%, transparent 35%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
    pointer-events: none;
}

.hero-copy,
.quick-stat-grid {
    position: relative;
    z-index: 1;
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 248, 239, 0.86);
    font-size: 0.8rem;
    font-weight: 700;
}

.hero-badge i {
    width: 15px;
    height: 15px;
}

.hero-badge-primary {
    background: rgba(194, 139, 56, 0.18);
    color: #fff5df;
    border-color: rgba(194, 139, 56, 0.25);
}

.hero-copy h2 {
    font-size: 2.1rem;
    max-width: 14ch;
}

.hero-copy p {
    font-size: 1rem;
    max-width: 60ch;
}

.hero-actions .button {
    min-width: 154px;
}

.quick-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quick-stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    justify-content: space-between;
    min-height: 148px;
    padding: 1.1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.quick-stat-card[data-tone="danger"] {
    background: rgba(181, 83, 66, 0.14);
}

.quick-stat-card[data-tone="accent"] {
    background: rgba(194, 139, 56, 0.16);
}

.quick-stat-card[data-tone="success"] {
    background: rgba(31, 122, 100, 0.15);
}

.quick-stat-card[data-tone="info"] {
    background: rgba(12, 117, 144, 0.15);
}

.quick-stat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.quick-stat-icon {
    width: 18px;
    height: 18px;
    color: #fffdfa;
    opacity: 0.9;
}

.quick-stat-card strong {
    font-size: 1.55rem;
    line-height: 1.1;
}

.quick-stat-card small {
    min-height: 2.3em;
    line-height: 1.45;
}

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

.stat-card {
    min-height: 178px;
    padding: 1.3rem;
}

.stat-card strong {
    font-size: 1.95rem;
}

.status-strip {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.status-chip {
    min-height: 112px;
}

.filter-panel {
    padding: 1.4rem 1.5rem;
    margin-bottom: 0.4rem;
}

.page-filter-panel {
    margin-bottom: 0.2rem;
}

.filter-panel-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-panel-head h3 {
    font-size: 1.1rem;
}

.period-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    background: rgba(14, 79, 92, 0.08);
    border: 1px solid rgba(14, 79, 92, 0.1);
    color: var(--brand);
    font-weight: 800;
    white-space: nowrap;
}

.filters-grid-period {
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
}

.filters-grid-search {
    grid-template-columns: minmax(320px, 1fr) auto;
}

.filters-grid-bookings {
    grid-template-columns: minmax(320px, 1.4fr) minmax(180px, 0.75fr) auto;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-field.wide-field {
    min-width: 0;
}

.search-control {
    position: relative;
}

.search-control-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    width: 17px;
    height: 17px;
    color: var(--text-muted);
    transform: translateY(-50%);
}

.search-control-input {
    padding-right: 3rem;
}

[dir="ltr"] .search-control-icon {
    right: auto;
    left: 1rem;
}

[dir="ltr"] .search-control-input {
    padding-right: 0.85rem;
    padding-left: 3rem;
}

.table-panel {
    padding: 0;
    overflow: hidden;
}

.entity-table {
    min-width: 760px;
}

.data-table thead th {
    padding: 1rem 1.1rem;
    background: rgba(14, 79, 92, 0.04);
    border-bottom: 1px solid rgba(14, 79, 92, 0.08);
}

.data-table td {
    padding: 1rem 1.1rem;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover td {
    background: rgba(14, 79, 92, 0.03);
}

.entity-cell {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.entity-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--brand-light);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.entity-meta {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}

.entity-meta strong,
.table-primary-text {
    font-weight: 800;
    color: var(--text);
}

.table-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.mono-code {
    font-family: "Segoe UI", monospace;
    font-weight: 800;
    color: var(--brand);
    letter-spacing: 0.02em;
}

.mono-code-strong {
    font-size: 0.96rem;
}

.table-inline-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.table-inline-icon {
    width: 15px;
    height: 15px;
    color: var(--text-muted);
}

.accent-icon {
    color: var(--accent);
}

.table-service-type {
    font-weight: 700;
}

.icon-button {
    min-width: 42px;
    min-height: 42px;
    padding: 0.5rem;
}

.icon-button i {
    width: 16px;
    height: 16px;
}

.button-wide {
    padding-inline: 2rem;
}

.inline-form {
    margin: 0;
}

.col-wide {
    width: 25%;
}

.col-code {
    width: 12%;
}

.col-actions {
    width: 1%;
}

.actions-row {
    gap: 0.45rem;
}

.table-empty {
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--text-muted);
}

.table-empty i {
    width: 54px;
    height: 54px;
    margin-bottom: 1rem;
    opacity: 0.18;
}

.table-empty p {
    margin: 0 0 0.45rem;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}

.table-empty small {
    font-size: 0.84rem;
}

.stack-row {
    border: 1px solid rgba(14, 79, 92, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(14, 79, 92, 0.03));
}

.metric-bars {
    gap: 0.9rem;
}

.bar-track {
    height: 12px;
}

.auth-shell {
    background:
        radial-gradient(circle at top right, rgba(14, 79, 92, 0.08), transparent 26%),
        radial-gradient(circle at bottom left, rgba(194, 139, 56, 0.1), transparent 24%),
        rgba(245, 240, 231, 0.72);
    border-radius: 36px;
    border: 1px solid rgba(18, 38, 49, 0.08);
    box-shadow: var(--shadow-lg);
}

.auth-hero {
    max-width: 58rem;
}

.auth-card {
    background: rgba(255, 253, 250, 0.94);
}

.hero-metrics article {
    background: rgba(255, 255, 255, 0.78);
}

@media (max-width: 1100px) {
    .filters-grid-period,
    .filters-grid-search,
    .filters-grid-bookings {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        width: 100%;
    }

    .filter-actions .button {
        flex: 1 1 100%;
    }
}

@media (max-width: 900px) {
    .topbar {
        padding: 0.95rem 1rem;
    }

    .topbar-left {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .content {
        padding: 1rem 1rem 1.8rem;
    }

    .content-shell {
        gap: 1rem;
    }

    .page-head {
        gap: 1rem;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .button {
        flex: 1 1 100%;
    }

    .hero-banner {
        grid-template-columns: 1fr;
        padding: 1.35rem;
    }

    .hero-copy h2 {
        max-width: none;
        font-size: 1.7rem;
    }

    .quick-stat-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .entity-table {
        min-width: 680px;
    }
}

@media (max-width: 640px) {
    .toolbar-chip span,
    .topbar-kicker {
        display: none;
    }

    .topbar-context strong {
        font-size: 0.95rem;
    }

    .page-intro h1 {
        font-size: 1.75rem;
    }

    .hero-badges {
        flex-direction: column;
    }

    .period-pill {
        width: 100%;
    }
}

/* Final polish: invoices, reports, files */
.filters-grid-invoices {
    grid-template-columns: minmax(320px, 1.5fr) minmax(200px, 0.9fr) auto;
}

.filters-grid-reports {
    grid-template-columns:
        minmax(170px, 0.95fr)
        minmax(170px, 0.95fr)
        minmax(220px, 1.15fr)
        minmax(240px, 1.2fr)
        minmax(180px, 0.95fr)
        auto;
}

.filters-grid-files {
    grid-template-columns: minmax(220px, 1.1fr) minmax(220px, 1fr) auto;
}

.section-panel-head {
    padding: 1.35rem 1.4rem 0;
    align-items: flex-end;
}

.table-caption {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.invoice-table,
.document-table,
.report-bookings-table {
    min-width: 760px;
}

.invoice-amount-cell strong {
    font-size: 0.96rem;
}

.invoice-balance-due {
    color: var(--danger);
}

.invoice-balance-clear {
    color: var(--success);
}

.report-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
}

.report-summary-grid {
    margin-bottom: 0.2rem;
}

.report-stat-card {
    min-height: 168px;
}

.report-price {
    color: var(--brand);
    font-weight: 800;
}

.document-library-panel {
    margin-bottom: 0.4rem;
}

.document-library-title {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.05rem;
}

.document-library-title i {
    width: 18px;
    height: 18px;
    color: var(--brand);
}

.document-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.existing-doc-card {
    align-items: flex-start;
    gap: 1rem;
    min-height: 158px;
    padding: 1.05rem;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(14, 79, 92, 0.04));
    box-shadow: var(--shadow-sm);
}

.existing-doc-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.existing-doc-icon {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(14, 79, 92, 0.12), rgba(194, 139, 56, 0.14));
    color: var(--brand);
}

.existing-doc-icon i {
    width: 24px;
    height: 24px;
}

.existing-doc-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.document-filename {
    display: block;
    line-height: 1.5;
    word-break: break-word;
}

.document-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.document-card-meta .table-inline-meta {
    gap: 0.4rem;
}

.existing-doc-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    align-self: flex-end;
}

.existing-doc-actions .button {
    min-width: 42px;
}

.document-table .table-actions,
.invoice-table .table-actions {
    justify-content: flex-end;
}

.document-table td:first-child,
.invoice-table td:first-child {
    white-space: nowrap;
}

.table-panel .table-responsive {
    padding: 0 0.2rem 0.2rem;
}

@media (max-width: 1100px) {
    .filters-grid-invoices,
    .filters-grid-reports,
    .filters-grid-files {
        grid-template-columns: 1fr;
    }

    .report-actions {
        width: 100%;
        justify-content: stretch;
    }

    .report-actions .button {
        flex: 1 1 100%;
    }
}

@media (max-width: 900px) {
    .section-panel-head {
        padding: 1.1rem 1rem 0;
    }

    .table-caption {
        width: 100%;
    }

    .document-preview-grid {
        grid-template-columns: 1fr;
    }

    .existing-doc-card {
        min-height: auto;
    }

    .existing-doc-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .existing-doc-card {
        flex-wrap: wrap;
    }

    .existing-doc-actions {
        justify-content: stretch;
    }

    .existing-doc-actions .button,
    .existing-doc-actions .inline-form {
        flex: 1 1 auto;
    }

    .existing-doc-actions .inline-form .button {
        width: 100%;
    }
}

/* Locale-safe responsive shell */
html[dir="ltr"] {
    direction: ltr;
}

body {
    text-align: start;
}

html[dir="rtl"] body {
    text-align: right;
}

html[dir="ltr"] body {
    text-align: left;
}

.app-shell {
    grid-template-areas: "sidebar main";
    grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
    grid-area: sidebar;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.main-layout {
    grid-area: main;
    min-width: 0;
}

/* CSS grid follows writing direction, so in RTL the first track is rendered on the right.
   Keeping the sidebar in the first track places it on the right edge for Arabic layouts. */
html[dir="rtl"] .app-shell {
    grid-template-areas: "sidebar main";
    grid-template-columns: 280px minmax(0, 1fr);
}

html[dir="rtl"] .sidebar,
html[dir="rtl"] .topbar,
html[dir="rtl"] .public-header,
html[dir="rtl"] .public-nav {
    direction: rtl;
}

html[dir="ltr"] .sidebar,
html[dir="ltr"] .topbar,
html[dir="ltr"] .public-header,
html[dir="ltr"] .public-nav {
    direction: ltr;
}

html[dir="rtl"] .sidebar {
    border-left: 1px solid rgba(18, 38, 49, 0.08);
    border-right: 0;
}

html[dir="ltr"] .sidebar {
    border-right: 1px solid rgba(18, 38, 49, 0.08);
    border-left: 0;
}

html[dir="rtl"] .nav-link.active::before {
    inset: 0 auto 0 0;
}

html[dir="ltr"] .nav-link.active::before {
    inset: 0 0 0 auto;
}

.topbar,
.public-header {
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 10px 30px rgba(16, 31, 43, 0.06);
}

.topbar-right,
.topbar-left,
.page-head,
.filter-panel-head,
.stack-row,
.action-buttons,
.actions-row {
    min-width: 0;
}

.topbar-left {
    justify-content: flex-end;
    flex-wrap: wrap;
}

html[dir="ltr"] .topbar-meta {
    align-items: flex-start;
}

.language-switcher {
    display: inline-flex;
    flex-wrap: wrap;
    max-width: 100%;
}

.lang-link {
    text-align: center;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.align-right {
    text-align: end;
}

html[dir="ltr"] .public-nav {
    justify-content: flex-start;
}

.public-toolbar,
.public-lang-switcher {
    flex-wrap: wrap;
}

@media (max-width: 1024px) {
    .language-switcher {
        display: inline-flex;
    }
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-areas: "main";
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        gap: 0.85rem;
    }

    .topbar-right,
    .topbar-left {
        width: 100%;
    }

    .topbar-left {
        justify-content: flex-start;
    }

    .topbar-left form {
        margin-inline-start: auto;
    }

    html[dir="rtl"] .sidebar {
        right: 0;
        left: auto;
        transform: translateX(100%);
    }

    html[dir="ltr"] .sidebar {
        left: 0;
        right: auto;
        transform: translateX(-100%);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    html[dir="ltr"] .sidebar.is-open {
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.12);
    }

    html[dir="rtl"] .sidebar.is-open {
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.12);
    }

    .page-actions .button,
    .filter-actions .button,
    .report-actions .button,
    .existing-doc-actions .button {
        width: 100%;
    }

    .public-header {
        grid-template-columns: 1fr auto;
        align-items: start;
    }

    .public-toolbar {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 640px) {
    .topbar {
        padding: 0.85rem;
    }

    .language-switcher {
        width: 100%;
        justify-content: flex-start;
    }

    .toolbar-chip,
    .topbar-left form,
    .public-toolbar .button {
        width: 100%;
    }

    .public-lang-switcher {
        width: 100%;
        justify-content: flex-start;
    }
}
