/* ==========================================================================
   MOE Oman · Virtual Labs Portal
   One stylesheet for every portal page. Uses logical properties so the same
   rules work for Arabic (RTL) and English (LTR).
   ========================================================================== */

:root {
    --ink: #17212b;
    --ink-2: #3d4854;
    --muted: #6a7480;
    --line: #e2e5e1;
    --line-2: #eef0ec;
    --bg: #f4f5f1;
    --surface: #ffffff;
    --surface-2: #fafbf8;

    --primary: #0d6b4f;          /* Omani green */
    --primary-700: #0a563f;
    --primary-800: #083f2f;
    --primary-50: #e9f4ef;
    --primary-100: #d3eadf;
    --accent: #b8232f;           /* emblem red */
    --accent-50: #fbecec;
    --gold: #a97a1e;
    --gold-50: #f8f0de;

    --good: #0d6b4f;   --good-bg: #e6f3ec;
    --ok: #2d5f8a;     --ok-bg: #e8f0f7;
    --warn: #8a5a00;   --warn-bg: #fbf1dc;
    --low: #a12a2a;    --low-bg: #fbeaea;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(23, 33, 43, .05), 0 1px 3px rgba(23, 33, 43, .04);
    --shadow-lg: 0 12px 32px rgba(23, 33, 43, .12);
    --sidebar-w: 268px;

    --font: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
html[lang="ar"] { --font: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, Tahoma, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
html[lang="ar"] body { font-size: 15.5px; line-height: 1.7; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 600; letter-spacing: -.005em; }
p { margin: 0; }
img { max-width: 100%; display: block; }
code, .mono { font-family: var(--font-mono); }
.icon { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip-link:focus { inset-inline-start: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App shell ---------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-inline-end: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 14px; }
.brand-logo { width: 52px; height: 52px; border-radius: 10px; background: #fff; border: 1px solid var(--line); padding: 4px; flex-shrink: 0; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 700; color: var(--ink); }
.brand-text span { font-size: 12px; color: var(--muted); }
.portal-tag {
    margin: 4px 20px 14px;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--primary-50);
    color: var(--primary-700);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
}
.nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 12px; overflow-y: auto; flex: 1; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-weight: 500;
    font-size: 14.5px;
    position: relative;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-link .icon { color: var(--muted); }
.nav-link.active { background: var(--primary); color: #fff; }
.nav-link.active .icon { color: #fff; }
.nav-badge { margin-inline-start: auto; font-style: normal; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); border-radius: 999px; padding: 1px 8px; }
.nav-link.active .nav-badge { background: rgba(255,255,255,.2); color: #fff; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }
.sidebar-foot .nav-link:hover { color: var(--accent); }
.sidebar-foot .nav-link:hover .icon { color: var(--accent); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 32px;
    background: rgba(244, 245, 241, .9);
    backdrop-filter: saturate(1.2) blur(6px);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 30;
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 21px; font-weight: 700; }
.topbar-title p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.topbar-end { display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
[dir="rtl"] .user-chip { padding: 4px 4px 4px 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 14px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 13px; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { font-size: 11.5px; color: var(--muted); }
.icon-btn.menu-btn { display: none; }

.content { padding: 28px 32px 40px; flex: 1; width: 100%; max-width: 1440px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-bottom: 18px; }
.app-footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 32px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); }
.app-footer a { color: var(--muted); }

/* ---------- Language switch ----------------------------------------------- */
.lang-switch { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.lang-switch .icon { margin-inline: 6px 2px; }
.lang-switch a { padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.lang-switch a:hover { text-decoration: none; background: var(--line-2); }
.lang-switch a.active { background: var(--primary); color: #fff; }
.lang-switch a[lang="ar"] { font-family: "IBM Plex Sans Arabic", sans-serif; }
.lang-switch a[lang="en"] { font-family: "IBM Plex Sans", sans-serif; }

/* ---------- Buttons & forms ----------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 14px;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-700); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); border-color: #cfd4cd; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-danger { background: var(--surface); color: var(--accent); border-color: #ecc8cb; }
.btn-danger:hover { background: var(--accent-50); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input, .select {
    width: 100%;
    padding: 11px 14px;
    font: inherit; font-size: 14.5px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid #d5d9d3;
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.input[type="file"] { padding: 8px; background: var(--surface-2); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-inline-start: 40px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236a7480' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-inline-end: 38px; }
[dir="rtl"] .select { background-position: left 14px center; }
.checklist { list-style: none; padding: 0; margin: 6px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 12.5px; color: var(--muted); }
.checklist li { display: flex; align-items: center; gap: 6px; }
.checklist li.ok { color: var(--good); }

/* ---------- Alerts --------------------------------------------------------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.alert .icon { margin-top: 2px; }
.alert-error { background: var(--low-bg); color: var(--low); border-color: #f0cccc; }
.alert-success { background: var(--good-bg); color: var(--good); border-color: #c4e3d3; }
.alert-info { background: var(--ok-bg); color: var(--ok); border-color: #cfdeec; }

/* ---------- Cards & grids --------------------------------------------------- */
.grid { display: grid; gap: 20px; }
.grid-kpi { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid + .grid, .grid + .card, .card + .card, .card + .grid, .alert + .card, .grid + .alert { margin-top: 20px; }
.grid > .card { margin-top: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-head h2 { font-size: 15.5px; font-weight: 600; }
.card-head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

.kpi { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex-shrink: 0; }
.kpi.gold .kpi-icon { background: var(--gold-50); color: var(--gold); }
.kpi.red .kpi-icon { background: var(--accent-50); color: var(--accent); }
.kpi.blue .kpi-icon { background: var(--ok-bg); color: var(--ok); }
.kpi-body { display: flex; flex-direction: column; min-width: 0; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Tables --------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 16px; text-align: start; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
html[lang="ar"] .table th { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: end; font-variant-numeric: tabular-nums; }
.table .muted { color: var(--muted); font-size: 13px; }
.table .strong { font-weight: 600; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable::after { content: " ↕"; opacity: .35; }
.table th.sort-asc::after { content: " ↑"; opacity: .8; }
.table th.sort-desc::after { content: " ↓"; opacity: .8; }
.row-link { cursor: pointer; }
.table-toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.table-toolbar .input-icon { flex: 1; max-width: 360px; min-width: 200px; }
.table-toolbar .input { padding-top: 9px; padding-bottom: 9px; }
.count-note { font-size: 13px; color: var(--muted); }

.pill { display: inline-block; min-width: 46px; text-align: center; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--line-2); color: var(--ink-2); }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-low { background: var(--low-bg); color: var(--low); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--line-2); color: var(--ink-2); }
.tag-green { background: var(--primary-50); color: var(--primary-700); }
.code-chip { font-family: var(--font-mono); font-weight: 600; font-size: 13.5px; letter-spacing: .06em; background: var(--surface-2); border: 1px dashed #c9cfc7; color: var(--ink); padding: 3px 8px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; display: inline-flex; align-items: center; gap: 6px; }
.copy-btn { border: 0; background: none; padding: 2px; color: var(--muted); cursor: pointer; display: inline-grid; }
.copy-btn:hover { color: var(--primary); }

.pager { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 14px; border-top: 1px solid var(--line-2); font-size: 13.5px; }
.pager a, .pager span.disabled { padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); }
.pager span.disabled { color: #b5bcb3; }
.pager-info { color: var(--muted); padding-inline: 8px; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 20px; text-align: center; color: var(--muted); }
.empty .icon { color: #b5bcb3; }
.empty p { max-width: 420px; font-size: 14px; }

/* ---------- Charts --------------------------------------------------------- */
.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bar-list li { position: relative; outline-offset: 4px; }
.bar-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; margin-bottom: 6px; }
.bar-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.bar-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.bar-list li:hover .bar-fill, .bar-list li:focus .bar-fill { background: var(--primary-800); }

.col-chart { display: flex; align-items: stretch; gap: 10px; height: 220px; padding-top: 6px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; position: relative; outline-offset: 2px; }
.col-value { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.col-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); }
.col-bar { display: block; width: 100%; max-width: 56px; margin-inline: auto; background: var(--primary); border-radius: 4px 4px 0 0; transition: background .15s; }
.col:hover .col-bar, .col:focus .col-bar { background: var(--primary-800); }
.col-label { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; direction: ltr; }

.ring { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ring svg { display: block; }
.ring-bg { fill: none; stroke: var(--line-2); stroke-width: 12; }
.ring-fg { fill: none; stroke: var(--primary); stroke-width: 12; stroke-linecap: round; }
.ring-center { position: absolute; top: 0; height: 140px; display: grid; place-items: center; width: 140px; }
.ring-center strong { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ring-caption { font-size: 13px; color: var(--muted); text-align: center; max-width: 220px; }

.line-wrap { width: 100%; }
.line-chart { width: 100%; height: 220px; display: block; overflow: visible; }
.line-chart .grid { stroke: var(--line-2); stroke-width: 1; }
.line-chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.line-chart .line { fill: none; stroke: var(--primary); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.line-chart .area { fill: var(--primary); opacity: .08; }
.line-chart .dot { fill: var(--primary); stroke: #fff; stroke-width: 2; opacity: 0; transition: opacity .1s; cursor: default; }
.line-chart .dot:hover, .line-chart .dot:focus { opacity: 1; }

.vl-tip { position: fixed; z-index: 200; pointer-events: none; background: var(--ink); color: #fff; font-size: 12.5px; padding: 6px 10px; border-radius: 6px; box-shadow: var(--shadow-lg); max-width: 280px; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }

.legend-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.stat-mini { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.stat-mini span { display: block; font-size: 12px; color: var(--muted); }
.stat-mini strong { font-size: 18px; font-variant-numeric: tabular-nums; }

/* ---------- Task code (professor) ---------------------------------------- */
.code-hero { background: linear-gradient(135deg, var(--primary-800), var(--primary)); color: #fff; border-radius: var(--radius); padding: 28px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.code-hero::after { content: ""; position: absolute; inset-inline-end: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 36px solid rgba(255,255,255,.06); }
.code-hero h2 { font-size: 20px; }
.code-hero p { color: rgba(255,255,255,.82); margin-top: 6px; font-size: 14px; }
.code-box { background: #fff; color: var(--ink); border-radius: 12px; padding: 14px 18px; display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.code-box .code { font-family: var(--font-mono); font-size: 30px; font-weight: 600; letter-spacing: .14em; direction: ltr; }
.steps { counter-reset: s; list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; font-size: 14px; color: var(--ink-2); }
.steps li::before { counter-increment: s; content: counter(s); width: 30px; height: 30px; border-radius: 50%; background: var(--primary-50); color: var(--primary-700); font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.steps strong { color: var(--ink); display: block; }

/* ---------- Modal ---------------------------------------------------------- */
.modal { position: fixed; inset: 0; background: rgba(23, 33, 43, .45); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal.open { display: flex; }
.modal-dialog { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: min(960px, 100%); max-height: 88vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; overflow: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.notes-text { white-space: pre-wrap; font-family: var(--font); font-size: 14.5px; margin: 0; line-height: 1.7; }
.data-table { border-collapse: collapse; font-size: 13px; width: 100%; direction: ltr; }
.data-table th, .data-table td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.data-table th { background: var(--surface-2); font-weight: 600; }

/* ---------- Profile list --------------------------------------------------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Auth (login) ---------------------------------------------------- */
body.auth { background: var(--surface); }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-aside { background: var(--primary-800); color: #fff; position: relative; overflow: hidden; display: flex; align-items: center; padding: 56px; }
.auth-aside::before {
    content: ""; position: absolute; inset: 0; opacity: .09;
    background-image:
        linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%),
        linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%);
    background-size: 28px 28px; background-position: 0 0, 14px 14px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), transparent 75%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), transparent 75%);
}
.auth-aside::after { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 6px; background: linear-gradient(var(--accent) 0 33%, #fff 33% 66%, var(--primary) 66%); }
.auth-aside-inner { position: relative; max-width: 460px; }
.auth-logo { width: 116px; height: 116px; background: #fff; border-radius: 18px; padding: 10px; margin-bottom: 28px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.auth-logo img { width: 100%; height: 100%; object-fit: contain; }
.auth-aside h2 { font-size: 30px; font-weight: 700; }
.auth-aside > div > p { color: rgba(255,255,255,.8); font-size: 15.5px; margin-top: 12px; }
.auth-points { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.auth-points li { display: flex; gap: 12px; align-items: center; color: rgba(255,255,255,.92); font-size: 14.5px; }
.auth-points .icon { width: 34px; height: 34px; padding: 8px; background: rgba(255,255,255,.1); border-radius: 8px; }
.auth-main { display: flex; flex-direction: column; padding: 28px 48px; }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; }
.back-link .icon { transform: scaleX(-1); }
[dir="rtl"] .back-link .icon { transform: none; }
.auth-card { width: 100%; max-width: 420px; margin: auto; padding: 32px 0; }
.auth-card .eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--primary-700); background: var(--primary-50); padding: 5px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 600; margin-bottom: 14px; }
.auth-card h1 { font-size: 26px; font-weight: 700; }
.auth-card .lead { color: var(--muted); margin: 6px 0 26px; font-size: 14.5px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12.5px; }
.form-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 6px 0 16px; }
.form-divider::before, .form-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Landing ------------------------------------------------------- */
body.landing { background: var(--bg); }
.landing-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 40px; background: var(--surface); border-bottom: 1px solid var(--line); }
.landing-brand { display: flex; align-items: center; gap: 14px; }
.landing-brand img { width: 52px; height: 52px; object-fit: contain; }
.landing-brand strong { display: block; font-size: 16px; }
.landing-brand span { font-size: 12.5px; color: var(--muted); }
.hero { background: var(--primary-800); color: #fff; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; opacity: .07; background-image: radial-gradient(#fff 1.2px, transparent 1.2px); background-size: 22px 22px; }
.hero-inner { position: relative; max-width: 1120px; margin: 0 auto; padding: 72px 40px 120px; }
.hero h1 { font-size: 40px; font-weight: 700; max-width: 720px; }
.hero p { font-size: 17px; color: rgba(255,255,255,.82); max-width: 620px; margin-top: 14px; }
.roles { max-width: 1120px; margin: -76px auto 0; padding: 0 40px 60px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; position: relative; }
.role-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 26px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 10px; color: var(--ink); transition: transform .15s, border-color .15s; }
.role-card:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--primary); }
.role-card .kpi-icon { width: 48px; height: 48px; border-radius: 12px; }
.role-card h2 { font-size: 18px; margin-top: 6px; }
.role-card p { color: var(--muted); font-size: 14px; flex: 1; }
.role-card .go { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 600; font-size: 14px; }
[dir="rtl"] .role-card .go .icon, [dir="rtl"] .btn .icon-flip { transform: scaleX(-1); }
.landing-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1120px; margin: 0 auto; padding: 22px 40px 36px; color: var(--muted); font-size: 13px; }
.landing-foot a { color: var(--muted); }

/* ---------- Responsive ---------------------------------------------------- */
@media (max-width: 1180px) {
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
    .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    body.nav-open .sidebar { transform: none; }
    .scrim { display: none; }
    body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(23,33,43,.35); z-index: 35; }
    .icon-btn.menu-btn { display: inline-grid; }
    .topbar, .content, .app-footer { padding-inline: 18px; }
    .user-meta { display: none; }
    .user-chip { padding: 2px !important; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-main { padding: 20px; }
    .roles { grid-template-columns: 1fr; }
    .hero h1 { font-size: 30px; }
    .code-hero { grid-template-columns: 1fr; }
    .code-box .code { font-size: 24px; }
}
@media (max-width: 560px) {
    .topbar-title h1 { font-size: 18px; }
    .topbar-title p { display: none; }
    .lang-switch .icon { display: none; }
    .grid-kpi { grid-template-columns: 1fr 1fr; }
    .kpi { padding: 12px; gap: 10px; }
    .kpi-icon { display: none; }
    .kpi-value { font-size: 21px; }
    .landing-top, .hero-inner, .roles, .landing-foot { padding-inline: 18px; }
    .stat-row { grid-template-columns: 1fr; }
    .checklist { grid-template-columns: 1fr; }
}
@media print {
    .sidebar, .topbar .topbar-end, .menu-btn, .page-actions, .app-footer, .table-toolbar, .pager { display: none !important; }
    .content { padding: 0; }
    .card { box-shadow: none; break-inside: avoid; }
    body { background: #fff; }
}
