/* ============================================================
   MY BOOKING SYSTEM - Main Stylesheet
   Design System · Layout · Sidebar · Topbar · Content
   @version 1.0.0
   ============================================================ */

/* ============================================================
   1. FONT FACES
   ============================================================ */

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo/Cairo-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo/Cairo-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo/Cairo-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo/Cairo-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo/Cairo-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter/Inter-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter/Inter-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter/Inter-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter/Inter-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ============================================================
   2. CSS VARIABLES — DESIGN TOKENS
   ============================================================ */

:root {
    /* -------- PRIMARY (Brand Blue) -------- */
    --primary-50:  #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;
    --primary:     var(--primary-600);
    --primary-hover: var(--primary-700);
    --primary-soft: rgba(37, 99, 235, 0.08);

    /* -------- NEUTRALS (Slate) -------- */
    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --gray-950: #020617;

    /* -------- SEMANTIC -------- */
    --success-50:  #ecfdf5;
    --success-100: #d1fae5;
    --success-500: #10b981;
    --success-600: #059669;
    --success:     var(--success-500);
    --success-soft: rgba(16, 185, 129, 0.08);

    --warning-50:  #fffbeb;
    --warning-100: #fef3c7;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning:     var(--warning-500);
    --warning-soft: rgba(245, 158, 11, 0.08);

    --danger-50:  #fef2f2;
    --danger-100: #fee2e2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --danger:     var(--danger-500);
    --danger-soft: rgba(239, 68, 68, 0.08);

    --info-50:  #ecfeff;
    --info-100: #cffafe;
    --info-500: #06b6d4;
    --info-600: #0891b2;
    --info:     var(--info-500);
    --info-soft: rgba(6, 182, 212, 0.08);

    --purple-50:  #f5f3ff;
    --purple-100: #ede9fe;
    --purple-500: #8b5cf6;
    --purple-600: #7c3aed;
    --purple:     var(--purple-500);
    --purple-soft: rgba(139, 92, 246, 0.08);

    /* -------- SIDEBAR (Dark, deep) -------- */
    --sidebar-bg:        #0f172a;
    --sidebar-bg-2:      #1e293b;
    --sidebar-surface:   #1e293b;
    --sidebar-hover:     rgba(255, 255, 255, 0.06);
    --sidebar-active:    rgba(59, 130, 246, 0.15);
    --sidebar-active-border: #3b82f6;
    --sidebar-border:    #1e293b;
    --sidebar-text:      #cbd5e1;
    --sidebar-text-mute: #64748b;
    --sidebar-heading:   #475569;
    --sidebar-width:     260px;

    /* -------- SURFACES -------- */
    --bg-body:      var(--gray-50);
    --bg-surface:   #ffffff;
    --bg-subtle:    var(--gray-100);
    --bg-muted:     var(--gray-200);
    --bg-hover:     var(--gray-100);

    /* -------- BORDERS -------- */
    --border-light:  var(--gray-200);
    --border:        var(--gray-200);
    --border-strong: var(--gray-300);
    --border-focus:  var(--primary-500);

    /* -------- TEXT -------- */
    --text-primary:   var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-tertiary:  var(--gray-500);
    --text-muted:     var(--gray-400);
    --text-inverse:   #ffffff;
    --text-link:      var(--primary-600);

    /* -------- SPACING (4px grid) -------- */
    --space-0:  0;
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  20px;
    --space-6:  24px;
    --space-7:  28px;
    --space-8:  32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;

    /* -------- RADIUS -------- */
    --radius-xs:   4px;
    --radius-sm:   6px;
    --radius:      8px;
    --radius-md:   10px;
    --radius-lg:   12px;
    --radius-xl:   16px;
    --radius-2xl:  20px;
    --radius-full: 9999px;

    /* -------- SHADOWS -------- */
    --shadow-xs:  0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm:  0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow:     0 2px 4px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md:  0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
    --shadow-lg:  0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.03);
    --shadow-xl:  0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(15, 23, 42, 0.20);
    --shadow-inner: inset 0 2px 4px 0 rgba(15, 23, 42, 0.04);

    --ring-primary: 0 0 0 3px rgba(59, 130, 246, 0.15);
    --ring-danger:  0 0 0 3px rgba(239, 68, 68, 0.15);
    --ring-success: 0 0 0 3px rgba(16, 185, 129, 0.15);

    /* -------- TYPOGRAPHY -------- */
    --font-ar:   'Cairo', 'Segoe UI', Tahoma, sans-serif;
    --font-en:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    --font-body: var(--font-ar);

    --fs-display: 30px;
    --fs-h1:      24px;
    --fs-h2:      20px;
    --fs-h3:      18px;
    --fs-h4:      16px;
    --fs-body:    14px;
    --fs-sm:      13px;
    --fs-xs:      12px;
    --fs-2xs:     11px;

    --fw-regular:  400;
    --fw-medium:   500;
    --fw-semibold: 600;
    --fw-bold:     700;
    --fw-extrabold:800;

    --lh-tight:   1.25;
    --lh-snug:    1.4;
    --lh-normal:  1.5;
    --lh-relaxed: 1.6;
    --lh-loose:   1.75;

    --tracking-tight:   -0.02em;
    --tracking-normal:  0;
    --tracking-wide:    0.01em;
    --tracking-wider:   0.05em;

    /* -------- TRANSITIONS -------- */
    --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    --dur-fast:   120ms;
    --dur-base:   200ms;
    --dur-slow:   300ms;
    --dur-slower: 500ms;

    /* -------- LAYOUT -------- */
    --topbar-height:  64px;
    --content-max-w:  1400px;
    --content-pad:    24px;
    --z-dropdown: 100;
    --z-sticky:   200;
    --z-fixed:    300;
    --z-modal:    1000;
    --z-toast:    9999;
}

/* Arabic font by default */
html[lang="ar"] { --font-body: var(--font-ar); }
html[lang="en"] { --font-body: var(--font-en); }

/* ============================================================
   3. RESET & BASE
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: var(--fw-regular);
    line-height: var(--lh-normal);
    color: var(--text-primary);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    overflow-x: hidden;
}

img, svg, video, canvas, audio, iframe, embed, object {
    display: block;
    max-width: 100%;
    height: auto;
}

input, button, textarea, select {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
    color: var(--text-primary);
    letter-spacing: var(--tracking-tight);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p {
    line-height: var(--lh-relaxed);
}

/* Remove number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

/* Selection */
::selection {
    background: var(--primary-500);
    color: #fff;
}

/* Focus visible */
:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-body);
}
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ============================================================
   4. LAYOUT
   ============================================================ */

.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-inline-start: var(--sidebar-width);
    transition: margin-inline-start var(--dur-slow) var(--ease-out);
}

.app-content {
    flex: 1;
    padding: var(--content-pad);
    max-width: var(--content-max-w);
    width: 100%;
    margin: 0 auto;
    animation: fadeInUp 0.35s var(--ease-out) both;
}

.app-footer {
    padding: var(--space-5) var(--content-pad);
    border-top: 1px solid var(--border-light);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    font-size: var(--fs-sm);
    color: var(--text-tertiary);
    margin-top: auto;
}

.footer-version {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

/* ============================================================
   5. SIDEBAR
   ============================================================ */

.app-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: var(--z-fixed);
    transition: transform var(--dur-slow) var(--ease-out);
    border-inline-end: 1px solid rgba(255, 255, 255, 0.04);
}

/* Sidebar header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    min-height: var(--topbar-height);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: #fff;
    font-weight: var(--fw-bold);
    font-size: 15px;
    letter-spacing: var(--tracking-tight);
    transition: opacity var(--dur-fast);
    min-width: 0;
}
.sidebar-brand:hover { opacity: 0.9; }

.brand-logo {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: #fff;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    flex-shrink: 0;
}

.brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-close {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text-mute);
    transition: all var(--dur-fast);
    align-items: center;
    justify-content: center;
}
.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

/* Sidebar nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-4) var(--space-3);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    border: none;
}

.nav-group {
    margin-bottom: var(--space-5);
}

.nav-group-title {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    color: var(--sidebar-heading);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1);
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item { width: 100%; }

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-3);
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    line-height: 1.4;
    transition: all var(--dur-fast) var(--ease-out);
    position: relative;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.nav-link:hover .nav-icon {
    color: #ffffff;
    transform: scale(1.05);
}

.nav-link.active {
    background: var(--sidebar-active);
    color: #ffffff;
    font-weight: var(--fw-semibold);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    inset-block: 8px;
    width: 3px;
    background: var(--sidebar-active-border);
    border-radius: var(--radius-full);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    color: var(--sidebar-text-mute);
    transition: all var(--dur-fast) var(--ease-out);
    flex-shrink: 0;
}

.nav-link.active .nav-icon {
    color: var(--primary-400);
}

.nav-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar footer */
.sidebar-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sidebar-version {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--sidebar-heading);
    text-align: center;
}

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: calc(var(--z-fixed) - 1);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dur-base), visibility var(--dur-base);
}

.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* ============================================================
   6. TOPBAR
   ============================================================ */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-inline: var(--content-pad);
    gap: var(--space-4);
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    flex: 1;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.topbar-title {
    min-width: 0;
    overflow: hidden;
}

.page-title {
    font-size: var(--fs-h3);
    font-weight: var(--fw-bold);
    line-height: 1.2;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.page-subtitle {
    font-size: var(--fs-xs);
    color: var(--text-tertiary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Icon button */
.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    color: var(--text-secondary);
    background: transparent;
    transition: all var(--dur-fast) var(--ease-out);
    flex-shrink: 0;
}

.icon-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.icon-btn:active {
    transform: scale(0.96);
}

.sidebar-toggle {
    display: none;
}

/* Topbar search */
.topbar-search {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 0 var(--space-3);
    height: 40px;
    width: 260px;
    max-width: 300px;
    transition: all var(--dur-base) var(--ease-out);
    border: 1px solid transparent;
}

.topbar-search:focus-within {
    background: var(--bg-surface);
    border-color: var(--primary-500);
    box-shadow: var(--ring-primary);
    width: 340px;
}

.topbar-search .search-icon {
    color: var(--text-tertiary);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    pointer-events: none;
}

.topbar-search input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: var(--fs-sm);
    color: var(--text-primary);
    padding-inline-start: var(--space-2);
    min-width: 0;
}

.topbar-search input::placeholder {
    color: var(--text-muted);
}

/* Lang switch */
.lang-switch {
    width: auto;
    padding: 0 var(--space-3);
    gap: var(--space-2);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
}

.lang-label {
    white-space: nowrap;
}

/* Notifications */
.notif-btn .notif-badge {
    position: absolute;
    top: 4px;
    inset-inline-end: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger-500);
    color: #fff;
    font-size: 10px;
    font-weight: var(--fw-bold);
    border-radius: var(--radius-full);
    display: grid;
    place-items: center;
    line-height: 1;
    box-shadow: 0 0 0 2px var(--bg-surface);
    animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.1); }
}

/* User menu */
.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1);
    border-radius: var(--radius);
    transition: background var(--dur-fast);
    height: 44px;
}

.user-menu-toggle:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    letter-spacing: var(--tracking-tight);
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
    min-width: 0;
    max-width: 140px;
}

.user-name {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.user-role {
    font-size: var(--fs-2xs);
    color: var(--text-tertiary);
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.user-caret {
    color: var(--text-muted);
    display: grid;
    place-items: center;
    transition: transform var(--dur-fast);
}

.user-menu-toggle[aria-expanded="true"] .user-caret {
    transform: rotate(180deg);
}

/* User dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    min-width: 220px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all var(--dur-fast) var(--ease-out);
    z-index: var(--z-dropdown);
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    transition: all var(--dur-fast);
    cursor: pointer;
    width: 100%;
    text-align: start;
}

.dropdown-item:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.dropdown-item.danger {
    color: var(--danger-600);
}

.dropdown-item.danger:hover {
    background: var(--danger-50);
    color: var(--danger-600);
}

.dropdown-item svg {
    flex-shrink: 0;
    color: var(--text-tertiary);
}

.dropdown-item:hover svg {
    color: currentColor;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-2) 0;
}

/* ============================================================
   7. BREADCRUMBS
   ============================================================ */

.breadcrumbs {
    margin-bottom: var(--space-5);
}

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-sm);
}

.breadcrumbs li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-tertiary);
}

.breadcrumbs li:not(:last-child)::after {
    content: '›';
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
}

html[dir="rtl"] .breadcrumbs li:not(:last-child)::after {
    content: '‹';
}

.breadcrumbs a {
    color: var(--text-secondary);
    font-weight: var(--fw-medium);
    transition: color var(--dur-fast);
}

.breadcrumbs a:hover {
    color: var(--primary-600);
}

.breadcrumbs li:last-child span {
    color: var(--text-primary);
    font-weight: var(--fw-semibold);
}

/* ============================================================
   8. FLASH MESSAGES
   ============================================================ */

.flash-container {
    position: fixed;
    top: calc(var(--topbar-height) + 16px);
    inset-inline-end: var(--space-5);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 400px;
    width: calc(100vw - 40px);
    pointer-events: none;
}

.flash {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    border-inline-start: 4px solid var(--gray-400);
    animation: slideInFlash 0.4s var(--ease-spring) both;
    pointer-events: auto;
    transition: all var(--dur-base);
}

@keyframes slideInFlash {
    from {
        opacity: 0;
        transform: translateX(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

html[dir="rtl"] .flash {
    animation-name: slideInFlashRtl;
}

@keyframes slideInFlashRtl {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.flash.dismissing {
    opacity: 0;
    transform: translateX(20px) scale(0.96);
}

.flash-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}

.flash-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.flash-title {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
    line-height: 1.3;
}

.flash-message {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    word-wrap: break-word;
}

.flash-close {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    transition: all var(--dur-fast);
    flex-shrink: 0;
}

.flash-close:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.flash-success { border-inline-start-color: var(--success-500); }
.flash-success .flash-icon { color: var(--success-500); }
.flash-error   { border-inline-start-color: var(--danger-500); }
.flash-error .flash-icon { color: var(--danger-500); }
.flash-warning { border-inline-start-color: var(--warning-500); }
.flash-warning .flash-icon { color: var(--warning-500); }
.flash-info    { border-inline-start-color: var(--info-500); }
.flash-info .flash-icon { color: var(--info-500); }

/* ============================================================
   9. TOASTS
   ============================================================ */

.toast-container {
    position: fixed;
    bottom: var(--space-5);
    inset-inline-end: var(--space-5);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-3);
    max-width: 380px;
    width: calc(100vw - 40px);
    pointer-events: none;
}

.toast {
    position: relative;
    background: var(--gray-900);
    color: #fff;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    animation: toastIn 0.35s var(--ease-spring) both;
    pointer-events: auto;
    overflow: hidden;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.toast.dismissing {
    animation: toastOut 0.25s var(--ease-out) both;
}

@keyframes toastOut {
    to { opacity: 0; transform: translateY(10px) scale(0.95); }
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-msg {
    flex: 1;
    line-height: 1.4;
}

.toast-success { background: var(--success-600); }
.toast-error   { background: var(--danger-600); }
.toast-warning { background: var(--warning-600); }
.toast-info    { background: var(--info-600); }

.toast-progress {
    position: absolute;
    bottom: 0;
    inset-inline-start: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.35);
    animation: toastProgress linear;
    width: 100%;
}

@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

/* ============================================================
   10. LOADING OVERLAY
   ============================================================ */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248, 250, 252, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: grid;
    place-items: center;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   11. ANIMATIONS (shared keyframes)
   ============================================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
    0%   { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

/* Stagger utility */
.stagger > * { animation: fadeInUp 0.4s var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; }
.stagger > *:nth-child(7) { animation-delay: 240ms; }
.stagger > *:nth-child(8) { animation-delay: 280ms; }

/* ============================================================
   12. UTILITY CLASSES
   ============================================================ */

/* Display */
.d-none      { display: none !important; }
.d-block     { display: block !important; }
.d-flex      { display: flex !important; }
.d-inline    { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-grid      { display: grid !important; }

/* Flex */
.flex-row    { flex-direction: row; }
.flex-col    { flex-direction: column; }
.flex-wrap   { flex-wrap: wrap; }
.flex-1      { flex: 1 1 0%; }
.flex-none   { flex: none; }
.items-start { align-items: flex-start; }
.items-center{ align-items: center; }
.items-end   { align-items: flex-end; }
.justify-start  { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }

/* Text */
.text-start    { text-align: start; }
.text-center   { text-align: center; }
.text-end      { text-align: end; }
.text-primary  { color: var(--primary-600); }
.text-success  { color: var(--success-600); }
.text-danger   { color: var(--danger-600); }
.text-warning  { color: var(--warning-600); }
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }
.text-inverse  { color: var(--text-inverse); }
.fw-normal     { font-weight: var(--fw-regular); }
.fw-medium     { font-weight: var(--fw-medium); }
.fw-semibold   { font-weight: var(--fw-semibold); }
.fw-bold       { font-weight: var(--fw-bold); }
.fs-xs { font-size: var(--fs-xs); }
.fs-sm { font-size: var(--fs-sm); }
.fs-body { font-size: var(--fs-body); }
.fs-h3 { font-size: var(--fs-h3); }
.fs-h2 { font-size: var(--fs-h2); }
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Background */
.bg-white    { background: #fff; }
.bg-surface  { background: var(--bg-surface); }
.bg-body     { background: var(--bg-body); }
.bg-subtle   { background: var(--bg-subtle); }
.bg-primary-soft { background: var(--primary-soft); }
.bg-success-soft { background: var(--success-soft); }
.bg-danger-soft  { background: var(--danger-soft); }
.bg-warning-soft { background: var(--warning-soft); }

/* Margins */
.m-0 { margin: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.ms-auto { margin-inline-start: auto; }
.me-auto { margin-inline-end: auto; }
.mx-auto { margin-inline: auto; }

/* Padding */
.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }

/* Width */
.w-100 { width: 100%; }
.w-auto { width: auto; }
.h-100 { height: 100%; }

/* Border */
.rounded     { border-radius: var(--radius); }
.rounded-md  { border-radius: var(--radius-md); }
.rounded-lg  { border-radius: var(--radius-lg); }
.rounded-full{ border-radius: var(--radius-full); }
.border      { border: 1px solid var(--border); }
.border-0    { border: none; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.sticky   { position: sticky; }
.fixed    { position: fixed; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }

/* Visibility */
.invisible { visibility: hidden; }
.hidden    { display: none; }

/* Shadow */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow    { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* ============================================================
   13. RESPONSIVE
   ============================================================ */

@media (max-width: 1280px) {
    :root { --content-pad: 20px; }
    .topbar-search { width: 200px; max-width: 220px; }
    .topbar-search:focus-within { width: 260px; }
}

@media (max-width: 1024px) {
    :root { --sidebar-width: 260px; }

    .app-main {
        margin-inline-start: 0;
    }

    .app-sidebar {
        transform: translateX(-100%);
    }

    html[dir="rtl"] .app-sidebar {
        transform: translateX(100%);
    }

    .app-sidebar.show {
        transform: translateX(0);
        box-shadow: var(--shadow-2xl);
    }

    .sidebar-close { display: flex; }
    .sidebar-toggle { display: grid; }

    .user-info { display: none; }

    .topbar-search {
        width: 40px;
        padding: 0;
        justify-content: center;
        background: transparent;
    }
    .topbar-search:focus-within {
        width: 220px;
        padding: 0 var(--space-3);
        justify-content: flex-start;
        background: var(--bg-surface);
    }
    .topbar-search input { display: none; }
    .topbar-search:focus-within input { display: block; }
}

@media (max-width: 768px) {
    :root {
        --content-pad: 16px;
        --topbar-height: 60px;
        --fs-h1: 20px;
        --fs-h2: 18px;
        --fs-h3: 16px;
    }

    .topbar-right { gap: var(--space-1); }
    .lang-switch .lang-label { display: none; }
    .lang-switch { width: 40px; padding: 0; }

    .flash-container,
    .toast-container {
        inset-inline: var(--space-4);
        max-width: none;
        width: auto;
    }

    .app-footer {
        flex-direction: column;
        gap: var(--space-2);
        text-align: center;
    }
}

@media (max-width: 480px) {
    :root { --content-pad: 12px; }

    .page-subtitle { display: none; }

    .user-avatar { width: 32px; height: 32px; }

    .icon-btn { width: 36px; height: 36px; }
}

/* ============================================================
   14. REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   15. PRINT BASE
   ============================================================ */

@media print {
    .app-sidebar,
    .app-topbar,
    .app-footer,
    .flash-container,
    .toast-container,
    .loading-overlay,
    .sidebar-backdrop {
        display: none !important;
    }

    .app-main {
        margin-inline-start: 0 !important;
    }

    .app-content {
        padding: 0 !important;
        max-width: 100% !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 12pt;
    }
}

/* ============================================================
   END OF main.css
   ============================================================ */