:root {
    color-scheme: light;
    --ink: #172033;
    --muted: #6b7280;
    --line: #e5e9f2;
    --surface: #ffffff;
    --canvas: #f4f7fb;
    --brand: #2563eb;
    --brand-deep: #173b85;
    --sidebar: #0f1e3a;
    --sidebar-muted: #9eb0cf;
    font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
}

button, select { font: inherit; }

.app-shell {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: 100vh;
}

[dir="rtl"] .app-shell { grid-template-columns: minmax(0, 1fr) 250px; }
[dir="rtl"] .sidebar { grid-column: 2; grid-row: 1; }
[dir="rtl"] .app-main { grid-column: 1; grid-row: 1; }

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    color: #fff;
    background: linear-gradient(180deg, var(--sidebar), #132a52);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px 28px;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 14px;
    color: var(--brand-deep);
    background: #fff;
    font-size: 22px;
    font-weight: 800;
}

.brand strong, .brand small { display: block; }
.brand small { margin-top: 4px; color: var(--sidebar-muted); }
.sidebar ul { padding: 0; margin: 0; list-style: none; }
.sidebar li + li { margin-top: 5px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 11px;
    color: var(--sidebar-muted);
    text-decoration: none;
    transition: background .18s ease, color .18s ease;
}

.nav-link:hover, .nav-link.is-active { color: #fff; background: rgba(255, 255, 255, .11); }
.nav-icon { width: 22px; text-align: center; }

.sidebar-note {
    position: absolute;
    inset-inline: 28px;
    bottom: 26px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--sidebar-muted);
    font-size: 13px;
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 5px rgba(52, 211, 153, .12); }

.app-main { min-width: 0; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 106px;
    padding: 22px clamp(22px, 4vw, 54px);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(12px);
}

.topbar h1 { margin: 3px 0 0; font-size: clamp(24px, 3vw, 34px); }
.eyebrow { margin: 0; color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.language-switch { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.language-switch select { padding: 9px 30px 9px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; }
.language-switch > button { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--brand); background: #fff; font-weight: 750; cursor: pointer; }

.admin-menu { display: flex; align-items: center; gap: 10px; margin-inline-start: 12px; }
.admin-menu > span { font-size: 14px; font-weight: 700; }
.admin-menu button { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; cursor: pointer; }

.auth-page { min-height: 100vh; background: #eef3fb; }
.auth-shell { display: grid; grid-template-columns: minmax(320px, .85fr) minmax(420px, 1.15fr); min-height: 100vh; }
.auth-brand-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(40px, 7vw, 100px); color: #fff; background: radial-gradient(circle at 20% 15%, rgba(96,165,250,.45), transparent 25%), linear-gradient(145deg, #0f1e3a, #173b85); }
.auth-brand-panel .brand-mark { margin-bottom: 42px; }
.auth-brand-panel .eyebrow { color: #93c5fd; }
.auth-brand-panel h1 { max-width: 560px; margin: 16px 0; font-size: clamp(34px, 5vw, 64px); line-height: 1.05; }
.auth-brand-panel > p:last-child { max-width: 560px; color: #cbd5e1; line-height: 1.7; }
.auth-form-panel { display: grid; place-items: center; padding: 28px; }
.login-card { width: min(100%, 470px); padding: clamp(28px, 5vw, 46px); border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: 0 24px 70px rgba(15,30,58,.11); }
.login-card__heading h2 { margin: 0; font-size: 30px; }
.login-card__heading p { margin: 9px 0 26px; color: var(--muted); line-height: 1.55; }
.field { display: grid; gap: 8px; margin-top: 18px; font-size: 14px; font-weight: 700; }
.field input { width: 100%; padding: 13px 14px; border: 1px solid #d7ddea; border-radius: 11px; outline: none; }
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(37,99,235,.11); }
.primary-button { width: 100%; margin-top: 24px; padding: 14px; border: 0; border-radius: 11px; color: #fff; background: var(--brand); font-weight: 800; cursor: pointer; }
.primary-button:hover { background: #1d4ed8; }
.security-note { margin: 18px 0 0; color: #7b8495; font-size: 12px; line-height: 1.55; text-align: center; }
.auth-language-switch { width: min(100%, 470px); margin-top: 14px; text-align: center; }
.auth-language-switch button { border: 0; color: var(--brand); background: transparent; font-weight: 750; cursor: pointer; }
.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.alert--error { color: #991b1b; border: 1px solid #fecaca; background: #fef2f2; }
.error-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: var(--canvas); }
.error-card { width: min(100%, 520px); padding: 46px; border: 1px solid var(--line); border-radius: 22px; background: #fff; text-align: center; box-shadow: 0 24px 70px rgba(15,30,58,.09); }
.error-card > span { color: var(--brand); font-size: 60px; font-weight: 900; }
.error-card h1 { margin: 10px 0; }
.error-card p { color: var(--muted); }

.dashboard-content { padding: 32px clamp(22px, 4vw, 54px) 54px; }
.filter-bar { display: flex; align-items: end; gap: 12px; margin-bottom: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.filter-bar label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.filter-bar input, .filter-bar select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; }
.filter-bar button { padding: 10px 15px; border: 0; border-radius: 9px; color: #fff; background: var(--brand); font-weight: 750; cursor: pointer; }
.filter-bar a { padding: 10px; color: var(--muted); text-decoration: none; }

.welcome-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    padding: clamp(26px, 4vw, 42px);
    border-radius: 22px;
    color: #fff;
    background: radial-gradient(circle at 80% 20%, rgba(96, 165, 250, .55), transparent 27%), linear-gradient(125deg, #173b85, #2563eb);
    box-shadow: 0 18px 45px rgba(37, 99, 235, .18);
}

.welcome-panel h2 { max-width: 720px; margin: 16px 0 10px; font-size: clamp(25px, 3vw, 40px); line-height: 1.15; }
.welcome-panel p { max-width: 720px; margin: 0; color: #dbeafe; line-height: 1.7; }
.pill { display: inline-flex; padding: 7px 11px; border: 1px solid rgba(255,255,255,.24); border-radius: 999px; background: rgba(255,255,255,.12); font-size: 12px; font-weight: 700; }
.preview-symbol { display: grid; flex: 0 0 96px; height: 96px; margin-inline-start: 30px; place-items: center; border: 1px solid rgba(255,255,255,.22); border-radius: 30px; background: rgba(255,255,255,.1); font-size: 45px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.stat-card, .panel { border: 1px solid var(--line); background: var(--surface); box-shadow: 0 8px 30px rgba(31, 41, 55, .04); }
.stat-card { position: relative; overflow: hidden; padding: 22px; border-radius: 17px; }
.stat-card p { min-height: 38px; margin: 0 0 15px; color: var(--muted); font-size: 14px; font-weight: 650; }
.stat-card strong { display: block; font-size: 29px; }
.stat-card small { display: block; margin-top: 9px; color: #9ca3af; }
.stat-icon { position: absolute; inset-inline-end: -14px; top: -20px; width: 82px; height: 82px; border-radius: 50%; opacity: .16; }
.stat-card--blue .stat-icon { background: #2563eb; }
.stat-card--green .stat-icon { background: #10b981; }
.stat-card--amber .stat-icon { background: #f59e0b; }
.stat-card--violet .stat-icon { background: #8b5cf6; }

.work-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .8fr); gap: 18px; margin-top: 24px; }
.panel { padding: 26px; border-radius: 17px; }
.data-panel .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.pill--muted { color: #475569; border-color: var(--line); background: #f1f5f9; }
.table-wrap { overflow-x: auto; margin-top: 22px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: start; white-space: nowrap; }
th { color: #64748b; background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tbody tr:hover { background: #f8fbff; }
.empty-cell { padding: 46px; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; padding-top: 22px; }
.pagination a { padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--brand); text-decoration: none; }
.pagination span { color: var(--muted); font-size: 13px; }
.panel h2 { margin: 0; font-size: 19px; }
.panel-heading p { margin: 8px 0 0; color: var(--muted); line-height: 1.55; }
.empty-state { display: grid; min-height: 230px; place-items: center; align-content: center; padding: 30px; text-align: center; }
.empty-state > span { display: grid; width: 50px; height: 50px; place-items: center; border-radius: 16px; color: #047857; background: #d1fae5; font-size: 22px; }
.empty-state strong { margin-top: 15px; }
.empty-state p { max-width: 470px; margin: 8px 0 0; color: var(--muted); line-height: 1.6; }
.check-list { display: grid; gap: 14px; padding: 0; margin: 24px 0 0; list-style: none; }
.check-list li { position: relative; padding-inline-start: 28px; color: #445066; line-height: 1.45; }
.check-list li::before { content: "✓"; position: absolute; inset-inline-start: 0; color: #059669; font-weight: 900; }

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

@media (max-width: 760px) {
    .app-shell, [dir="rtl"] .app-shell { display: block; }
    .sidebar, [dir="rtl"] .sidebar { position: static; width: auto; height: auto; padding: 16px; }
    .brand { padding-bottom: 14px; }
    .sidebar nav { overflow-x: auto; }
    .sidebar ul { display: flex; gap: 6px; }
    .sidebar li + li { margin: 0; }
    .nav-link { white-space: nowrap; }
    .sidebar-note { display: none; }
    .topbar { align-items: flex-start; gap: 18px; }
    .language-switch { align-items: flex-start; flex-direction: column; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand-panel { min-height: 330px; padding: 38px 28px; }
    .auth-brand-panel .brand-mark { margin-bottom: 28px; }
    .auth-brand-panel h1 { font-size: 38px; }
    .welcome-panel { align-items: flex-start; }
    .preview-symbol { display: none; }
}

@media (max-width: 540px) {
    .stats-grid { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; }
    .language-switch { width: 100%; }
    .language-switch select { width: 100%; }
    .filter-bar { align-items: stretch; flex-direction: column; }
}
