/* ════════════════════════════════════════════════════════════════
   HR ART — Design System
   Brand: warm charcoal (#272220) + periwinkle blue (#6D82C1) + cream
   Typography: Inter + Noto Sans Arabic
   Spacing: 4px base unit
════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
    /* Brand — exact tokens from HR ART brand book */
    --brand-ink:    #272220;     /* warm charcoal — primary mark / text on light */
    --brand-blue:   #6D82C1;     /* periwinkle accent */
    --brand-cream:  #FAF8F3;     /* warm off-white surface */

    /* Primary */
    --primary: #272220;
    --primary-dark: #1F1B19;
    --primary-light: #3D3835;
    --accent: #6D82C1;            /* brand blue replaces former white accent */
    --accent-dim: #8FA1D3;
    --accent-dark: #5870AF;

    /* Backgrounds */
    --bg: #f9f9f9;
    --card: #ffffff;
    --elevated: #f4f3f3;
    --sidebar-bg: #0f1117;
    --input-bg: #f4f3f3;

    /* Text */
    --text: #111827;
    --text-secondary: #374151;
    --muted: #6b7280;
    --on-primary: #ffffff;
    --on-accent: #191e00;

    /* Borders */
    --border: #e8e8e8;
    --border-light: #f4f3f3;
    --border-outline: #c2c8c3;

    /* Status — monochrome professional */
    --success: #374151;
    --success-bg: rgba(17, 24, 39, 0.06);
    --warning: #6b7280;
    --warning-bg: rgba(17, 24, 39, 0.04);
    --danger: #111827;
    --danger-bg: rgba(17, 24, 39, 0.06);
    --info: #6b7280;
    --info-bg: rgba(17, 24, 39, 0.04);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(17, 24, 39, 0.04);
    --shadow-md: 0 4px 12px rgba(17, 24, 39, 0.06);
    --shadow-lg: 0 12px 32px rgba(17, 24, 39, 0.08);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.2);
    --shadow-toast: 0 12px 32px rgba(17, 24, 39, 0.2);

    /* Layout */
    --sb-width: 260px;
    --sb-collapsed: 68px;
    --tb-height: 64px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-3xl: 28px;
    --radius-full: 999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes zoomIn { from { transform: scale(0.9); opacity: 0 } to { transform: scale(1); opacity: 1 } }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.3 } }
@keyframes shimmer { from { transform: translateX(-100%) } to { transform: translateX(100%) } }
@keyframes heroFloat { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-16px) } }

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.5;
}
[dir="rtl"] body,
html[dir="rtl"] {
    font-family: 'Noto Sans Arabic', 'Inter', sans-serif;
}
button, input, select, textarea { font: inherit; }
a { text-decoration: none; color: inherit; }

/* ── Custom Scrollbar ── */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--primary); }
::-webkit-scrollbar-thumb { background: var(--accent-dim); border-radius: 8px; border: 2px solid var(--primary); }
html { scrollbar-color: var(--accent-dim) var(--primary); scrollbar-width: thin; }

/* ── App Shell ── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
.sidebar {
    width: var(--sb-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width var(--transition-normal);
    position: relative;
    border-inline-end: 1px solid rgba(255,255,255,.06);
}
.sidebar.collapsed { width: var(--sb-collapsed); }

/* brand */
.sb-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 20px;
    height: var(--tb-height);
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
    overflow: hidden;
    white-space: nowrap;
}
.sb-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #fff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.sb-logo svg { display: block; }
.sb-wordmark {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .5px;
    opacity: 1;
    transition: opacity var(--transition-fast), width var(--transition-fast);
}
.sb-subtitle {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,.35);
}
.sidebar.collapsed .sb-wordmark,
.sidebar.collapsed .sb-subtitle {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* toggle */
.sb-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,.1);
    background: transparent;
    cursor: pointer;
    color: rgba(255,255,255,.45);
    margin: 12px auto 4px;
    flex-shrink: 0;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.sb-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }
.sb-toggle svg { display: block; transition: transform .22s; }
.sidebar.collapsed .sb-toggle svg { transform: scaleX(-1); }

/* nav */
.sb-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.sb-nav::-webkit-scrollbar { width: 0; }

/* nav section label */
.sb-section-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,.22);
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 10px 8px 4px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-fast);
}
.sidebar.collapsed .sb-section-label { opacity: 0; }

/* nav link */
.sb-link {
    display: flex;
    align-items: center;
    gap: 11px;
    height: 40px;
    border-radius: var(--radius-sm);
    padding: 0 12px;
    text-decoration: none;
    color: rgba(255,255,255,.55);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    transition: background var(--transition-fast), color var(--transition-fast);
    position: relative;
}
.sb-link:hover {
    background: rgba(255,255,255,.07);
    color: rgba(255,255,255,.85);
}
.sb-link.active {
    background: rgba(255,255,255,.1);
    color: #fff;
    font-weight: 700;
}

.sb-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: .7;
    transition: opacity var(--transition-fast);
}
.sb-link:hover .sb-icon,
.sb-link.active .sb-icon { opacity: 1; }

.sb-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--transition-fast), width var(--transition-fast);
}
.sidebar.collapsed .sb-label {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

/* bottom user block */
.sb-footer {
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 12px 10px;
    flex-shrink: 0;
    overflow: hidden;
}
.sb-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-decoration: none;
}
.sb-user:hover { background: rgba(255,255,255,.07); }
.sb-user-av {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,.15);
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.sb-user-info { flex: 1; overflow: hidden; }
.sb-user-name {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,.85);
    overflow: hidden;
    text-overflow: ellipsis;
}
.sb-user-role {
    font-size: 10px;
    color: rgba(255,255,255,.35);
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar.collapsed .sb-user-info { display: none; }
.sidebar.collapsed .sb-user { justify-content: center; padding: 8px; }

/* tooltip on collapsed */
.sidebar.collapsed .sb-link { justify-content: center; padding: 0; }
.sidebar.collapsed .sb-link::after {
    content: attr(data-label);
    position: absolute;
    inset-inline-end: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 7px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    border: 1px solid rgba(255,255,255,.1);
    z-index: 200;
}
.sidebar.collapsed .sb-link:hover::after { opacity: 1; }

/* ══════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════ */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ══════════════════════════════════════
   TOPBAR
══════════════════════════════════════ */
.topbar {
    height: var(--tb-height);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid #eaeaea;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.topbar-page-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* icon button */
.tb-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
    position: relative;
    flex-shrink: 0;
}
.tb-icon-btn:hover {
    background: #f2f2f2;
    color: var(--text);
    border-color: var(--border-outline);
}
.tb-icon-btn svg { display: block; }

/* notification dot */
.tb-notif-dot {
    position: absolute;
    top: 7px;
    inset-inline-end: 7px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--danger);
    border: 1.5px solid #fff;
}

/* divider */
.tb-divider {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 2px;
    flex-shrink: 0;
}

/* search */
.tb-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #f5f5f5;
    padding: 0 12px;
    max-width: 360px;
    width: 220px;
    transition: border-color var(--transition-fast), background var(--transition-fast), width .22s;
}
.tb-search:focus-within {
    border-color: var(--primary);
    background: #fff;
    width: 280px;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.1);
}
.tb-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    color: var(--text);
    flex: 1;
    min-width: 0;
}
.tb-search input::placeholder { color: var(--muted); }
.tb-search svg { color: var(--muted); flex-shrink: 0; }

/* user block */
.tb-user {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 36px;
    padding: 0 10px 0 4px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--transition-fast), border-color var(--transition-fast);
    text-decoration: none;
}
.tb-user:hover { background: var(--elevated); border-color: var(--border); }
.tb-user-av {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.tb-user-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}
.tb-user-arrow {
    color: var(--muted);
    flex-shrink: 0;
}

/* ══════════════════════════════════════
   PAGE BODY
══════════════════════════════════════ */
.page-body {
    padding: 24px;
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
}

/* ══════════════════════════════════════
   SHARED UI COMPONENTS
══════════════════════════════════════ */

/* Page layout */
.page-section { margin-bottom: 24px; }
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.page-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
}
.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-normal);
}
.card:hover {
    box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--card);
    padding: 0 20px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    transition: background var(--transition-fast), transform .1s, border-color var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { background: var(--elevated); transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 28px; font-size: 15px; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 700;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-accent {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
    font-weight: 700;
}
.btn-accent:hover { background: var(--accent-dark); }

.btn-dark {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
}
.btn-dark:hover { background: var(--primary-dark); }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover { background: #dc2626; }

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.btn-warning {
    background: var(--warning);
    color: var(--text);
    border-color: var(--warning);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}
.btn-ghost:hover { background: rgba(0,0,0,0.04); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-outline);
}
.btn-outline:hover { background: rgba(17, 24, 39, 0.05); }

/* Badges / Status Pills */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: rgba(0,0,0,0.06); color: var(--muted); }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-normal);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-sub { font-size: 11px; color: var(--muted); font-weight: 500; }

/* Toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.select-wrap {
    height: 38px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    padding: 0 14px;
}
.select-wrap select {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
}

.search-wrap {
    height: 38px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 8px;
    min-width: 360px;
}
.search-wrap input {
    border: none;
    outline: none;
    background: transparent;
    flex: 1;
    font-size: 13px;
    color: var(--text);
}

/* Form Inputs */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-input,
.form-select {
    width: 100%;
    height: 42px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.form-input:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.1);
    background: #fff;
}
.form-input.error { border-color: var(--danger); }
.form-hint { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

textarea.form-input {
    height: auto;
    min-height: 80px;
    resize: vertical;
}

/* Tables */
.table-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.table-scroll { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 1100px; }
.data-table thead th {
    background: var(--elevated);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    text-align: start;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    white-space: nowrap;
}
.data-table tbody td {
    border-bottom: 1px solid var(--border-light);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg); }

/* Name cell */
.name-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.name-meta, .manager-info { line-height: 1.3; }
.name-main { font-weight: 700; font-size: 13px; color: var(--text); }
.name-sub, .manager-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.manager-cell { display: flex; align-items: center; gap: 8px; }

/* Circle avatar */
.circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(17, 24, 39, 0.08);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--primary);
    font-size: 12px;
    flex-shrink: 0;
}

/* Checkbox */
.fake-check {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--border-outline);
}

/* Misc */
.muted { color: var(--muted); }

/* Modals / Dialogs */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--transition-normal);
}
.modal-content {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 520px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: slideUp var(--transition-normal);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-title { font-size: 18px; font-weight: 600; }
.modal-subtitle { font-size: 13px; color: var(--text-secondary); }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Toasts */
.toast {
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-toast);
    font-size: 14px;
    font-weight: 500;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.toast-success { background: #1a8a4a; }
.toast-danger { background: #ba1a1a; }
.toast-action { color: var(--accent); font-weight: 700; cursor: pointer; }

/* Progress Bars */
.progress-track {
    height: 6px;
    background: var(--elevated);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width var(--transition-slow);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
}
.page-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--card);
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Loading States */
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.skeleton {
    background: #e8e8e8;
    border-radius: var(--radius-md);
    animation: pulse 2s infinite;
}

/* Notification Panel */
.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-start: 0;
    width: 380px;
    max-height: 480px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    display: none;
    overflow: hidden;
    animation: slideUp var(--transition-normal);
}
.notif-panel.show { display: block; }
.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--elevated);
}
.notif-title { font-size: 15px; font-weight: 700; color: var(--text); }
.notif-count {
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}
.notif-list { overflow-y: auto; max-height: 380px; }
.notif-empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.notif-item {
    display: flex;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
    position: relative;
}
.notif-item:hover { background: var(--bg); }
.notif-item:last-child { border-bottom: none; }
.notif-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-lg);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.notif-icon.green { background: var(--success-bg); color: var(--success); }
.notif-icon.red { background: var(--danger-bg); color: var(--danger); }
.notif-icon.yellow { background: var(--warning-bg); color: var(--warning); }
.notif-icon.blue { background: var(--info-bg); color: var(--info); }
.notif-body { flex: 1; min-width: 0; }
.notif-body-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.notif-body-text { font-size: 12px; color: var(--muted); line-height: 1.4; }
.notif-body-time { font-size: 10px; color: var(--muted); margin-top: 4px; }
.notif-remove {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--border-outline);
    display: grid;
    place-items: center;
    opacity: 0;
    transition: opacity var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}
.notif-item:hover .notif-remove { opacity: 1; }
.notif-remove:hover { background: var(--danger-bg); color: var(--danger); }

/* ══════════════════════════════════════
   RESPONSIVE BREAKPOINTS
══════════════════════════════════════ */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 980px) {
    .app-shell { flex-direction: column-reverse; }
    .sidebar, .sidebar.expanded, .sidebar.collapsed {
        width: 100%;
        min-height: auto;
        border-inline-end: none;
        border-bottom: 1px solid rgba(255,255,255,.06);
        flex-direction: row;
    }
    .sb-brand { display: none; }
    .sb-toggle { display: none; }
    .sb-section-label { display: none; }
    .sb-nav {
        flex-direction: row;
        padding: 8px;
        gap: 4px;
        overflow-x: auto;
        overflow-y: hidden;
        flex: 1;
    }
    .sb-link {
        flex-direction: column;
        height: auto;
        padding: 8px 12px;
        gap: 4px;
        font-size: 10px;
    }
    .sidebar.collapsed .sb-label { opacity: 1; width: auto; }
    .sidebar.collapsed .sb-link { justify-content: center; padding: 8px 12px; }
    .sidebar.collapsed .sb-link::after { display: none; }
    .sb-footer { display: none; }

    .main-content { min-height: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .search-wrap { min-width: 260px; }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .page-body { padding: 16px; }
    .topbar { padding: 0 14px; }
    .stats-grid { grid-template-columns: 1fr; }
    .tb-search { display: none; }
    .topbar-page-title { font-size: 16px; }
}

@media (max-width: 480px) {
    .page-body { padding: 12px; }
    .page-title { font-size: 20px; }
}

/* ══════════════════════════════════════
   RTL SUPPORT
══════════════════════════════════════ */
/* When the active rail indicator was originally pinned with `right: 0`,
   convert it to logical so it sits on the inline-start edge in both modes. */
.sb-link.active::before {
    inset-inline-start: 0 !important;
    inset-inline-end: auto !important;
}
.modal-footer { justify-content: flex-end; }
[dir="rtl"] .modal-footer { justify-content: flex-start; }

/* Language toggle button in topbar — keep monospace alignment */
.tb-lang-btn { font-family: 'Inter', system-ui, sans-serif; }
