@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600&display=swap");

:root {
    --ink: #142033;
    --muted: #5c6b7c;
    --line: #d7e1ea;
    --paper: #e8eef5;
    --white: #ffffff;
    --pine: #0c2340;
    --pine-2: #16375f;
    --brass: #0f766e;
    --accent: #0f766e;
    --focus: rgba(15, 118, 110, 0.22);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    background: var(--paper);
    color: var(--ink);
    font-family: "IBM Plex Sans Arabic", Tahoma, sans-serif;
    line-height: 1.6;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

.frame { min-height: 100vh; display: grid; grid-template-columns: 264px 1fr; }
.side {
    position: sticky; top: 0; height: 100vh;
    background: linear-gradient(185deg, #0e2a4b 0%, #0a1d35 55%, #071629 100%);
    color: #f4f7fb;
    padding: 26px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 26px;
    box-shadow: inset -1px 0 0 rgba(255,255,255,.06);
}
.logo { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; padding: 0 6px; }
.mark { width: 34px; height: 34px; color: #2dd4bf; flex: none; }
.logo span { font-weight: 600; font-size: 1.2rem; letter-spacing: .01em; }
.logo small { display: block; font-weight: 400; color: #9fb3c8; font-size: 0.74rem; }
.nav { display: grid; gap: 4px; }
.nav-label { color: #6f88a3; font-size: 0.7rem; font-weight: 600; letter-spacing: .06em; padding: 12px 12px 4px; }
.nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 12px;
    color: #c9d6e4; text-decoration: none; font-size: 0.93rem;
    transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: rgba(45, 212, 191, .14); color: #fff; box-shadow: inset 3px 0 0 #2dd4bf; }
[dir=rtl] .nav a.on { box-shadow: inset -3px 0 0 #2dd4bf; }
.ico { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-foot { margin-top: auto; display: grid; gap: 6px; border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.me-av { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; font-weight: 600; flex: none; }
.me-who b { display: block; font-weight: 500; font-size: 0.9rem; }
.me-who small { color: #8ea3b8; font-size: 0.76rem; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: #c9d6e4; text-decoration: none; font-size: 0.88rem; }
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }

.canvas { min-height: 100vh; background: var(--paper); }
.canvas-body { padding: 22px 32px 56px; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 32px;
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}
.topbar-title h1 { font-size: 1.4rem; font-weight: 600; letter-spacing: -.005em; }
.topbar-title .crumb { color: var(--accent); font-size: 0.74rem; font-weight: 600; margin: 0 0 1px; }
.topbar-tools { display: flex; align-items: center; gap: 10px; }
.lang {
    display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px;
    border: 1px solid var(--line); border-radius: 14px; background: #fff;
    color: var(--pine); text-decoration: none; font-size: 0.86rem; font-weight: 500;
}
.lang:hover { border-color: var(--accent); color: var(--accent); }
.topbar-title p { margin-top: 2px; color: var(--muted); max-width: 40rem; font-size: 0.92rem; }
.bell { position: relative; }
.bell summary {
    list-style: none;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--pine);
    display: grid;
    place-items: center;
    cursor: pointer;
    position: relative;
}
.bell summary::-webkit-details-marker { display: none; }
.bell summary svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bell[open] summary { border-color: var(--accent); color: var(--accent); background: #f3fbf9; }
.badge {
    position: absolute;
    top: -6px;
    left: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #b42318;
    color: #fff;
    font-style: normal;
    font-size: 0.68rem;
    font-weight: 600;
    display: grid;
    place-items: center;
}
.bell-panel {
    position: absolute;
    top: 52px;
    left: 0;
    width: min(380px, calc(100vw - 32px));
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(12, 35, 64, 0.14);
    padding: 8px;
    max-height: 440px;
    overflow: auto;
}
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 10px; }
.bell-head span, .bell-empty { color: var(--muted); font-size: 0.84rem; }
.bell-empty { padding: 16px 10px 12px; }

.flash { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.flash.ok { background: #e7f2ed; color: #14382f; }
.flash.bad { background: #f8e8e5; color: #7c332d; }

.dossier { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 22px 22px 8px; box-shadow: 0 10px 28px rgba(12, 35, 64, 0.05); }
.dossier + .dossier { margin-top: 18px; }
.identity { display: flex; align-items: center; gap: 16px; padding-bottom: 18px; }
.mono {
    width: 56px; height: 56px; border-radius: 16px;
    display: grid; place-items: center;
    background: var(--pine); color: #f4f7fb; font-size: 1.35rem; font-weight: 600; flex: none;
}
.identity h2 { font-size: 1.45rem; font-weight: 600; }
.file-no { color: var(--brass); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; }
.sub { color: var(--muted); font-size: 0.92rem; }
.dx {
    margin-right: auto;
    background: #e7f3f1;
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 600;
}
.dx small { display: block; font-weight: 400; color: var(--muted); font-size: 0.78rem; }

.rail {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    position: relative;
    padding: 8px 0 20px;
    border-top: 1px solid var(--line);
}
.rail::before {
    content: "";
    position: absolute;
    top: 18px;
    right: 16%;
    left: 16%;
    height: 2px;
    background: #d5e0ea;
}
.rail-step { text-align: center; position: relative; z-index: 1; }
.rail-dot {
    width: 18px; height: 18px; border-radius: 50%;
    margin: 0 auto 10px;
    background: var(--white);
    border: 2px solid #b7c5d4;
}
.rail-step.is-done .rail-dot { background: var(--pine); border-color: var(--pine); }
.rail-step.is-live .rail-dot { background: var(--white); border-color: var(--accent); box-shadow: 0 0 0 4px #d7f3ef; }
.rail-step.is-blocked .rail-dot { background: #8f3d36; border-color: #8f3d36; }
.rail-step b { display: block; font-size: 0.95rem; }
.rail-step em { display: block; margin-top: 2px; font-style: normal; color: var(--muted); font-size: 0.82rem; }
.rail-step small { display: block; margin: 8px 18px 0; color: var(--muted); font-size: 0.82rem; }

.split { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 14px; padding-bottom: 18px; }
.panel { background: #f6f9fc; border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 14px; }
.panel h3 { font-size: 0.95rem; margin-bottom: 8px; }
.panel p { color: var(--muted); }
.panel time { display: block; margin-top: 10px; color: var(--muted); font-size: 0.8rem; }
.arrived { margin: 0 0 18px; padding: 16px; background: #f3fbf9; border: 1px solid #c7ebe4; border-radius: 14px; }
.arrived h3 { font-size: 0.95rem; margin-bottom: 8px; }
.arrived article { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid #d7efe9; }
.arrived article:first-of-type { border-top: 0; }
.arrived b { display: block; }
.arrived span, .arrived time { color: var(--muted); font-size: 0.86rem; }

.log { margin-top: 14px; background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 18px 22px; box-shadow: 0 10px 28px rgba(12, 35, 64, 0.05); }
.log h3 { font-size: 0.95rem; margin-bottom: 8px; }
.log ol { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.log time { color: var(--muted); font-size: 0.86rem; }
.log b { font-weight: 600; }
.log span { color: var(--muted); }

.pill {
    display: inline-flex; align-items: center;
    border-radius: 999px; padding: 3px 10px;
    font-size: 0.78rem; font-weight: 600; white-space: nowrap;
    background: #e7edf3; color: #3d4d60;
}
.s-arrived { background: #e7eef8; color: #1d4e89; }
.s-in_progress, .s-review, .s-submitted { background: #e7f6f4; color: #0f766e; }
.s-done, .s-available { background: #e5f3ee; color: #115e59; }
.s-blocked, .s-rejected { background: #fdecea; color: #b42318; }
.s-needs_files { background: #fff6e8; color: #9a6700; }
.s-locked { background: #e7edf3; color: #3d4d60; }

.notice { border: 0; border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.notice + .notice { border-top: 1px solid var(--line); border-radius: 0; }
.notice.unread { background: #f3fbf9; }
.notice b { font-weight: 600; }
.notice span, .notice time { color: var(--muted); font-size: 0.88rem; }
.report-sheet { padding: 4px 0 16px; }
.report-sheet h3, .reports h3 { font-size: 1rem; margin-bottom: 10px; }
.file-link { display: inline-block; margin-top: 4px; margin-left: 8px; color: var(--pine-2); font-size: 0.86rem; }
.reply { display: grid; gap: 8px; margin-top: 10px; max-width: 28rem; }
.reply input[type=file] { height: auto; padding: 8px 10px; background: #fff; }
.reply input, .reply button { width: 100%; }
.facts div { background: #f6f9fc; border-radius: 12px; padding: 10px 12px; }
.facts span { display: block; color: var(--muted); font-size: 0.78rem; }
.facts b { font-weight: 600; }
.mini-reports { margin: 12px 0 4px; }
.work > form { grid-template-columns: 1.1fr 0.8fr 1fr auto; }

.layout { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
.sheet, .table-wrap { background: var(--white); border: 1px solid var(--line); border-radius: 18px; }
.sheet { padding: 20px; }
.sheet h2, .table-wrap h2 { font-size: 1rem; margin-bottom: 14px; }
label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 0.84rem; }
input, select {
    display: block; width: 100%; height: 42px; margin-top: 6px;
    padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--focus); border-color: var(--accent); }
input[readonly] { background: #eef3f8; color: var(--muted); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
button.primary {
    background: var(--accent); color: #fff; border: 0; border-radius: 10px;
    height: 42px; padding: 0 16px; font-weight: 600; cursor: pointer;
}
button.primary { width: 100%; margin-top: 4px; }
button.primary:hover { background: #115e59; }
button.slim { width: auto; min-width: 92px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: top; font-weight: 400; }
th { color: var(--muted); font-size: 0.78rem; font-weight: 500; border-top: 0; background: #f3f7fb; }
.table-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.table-wrap h2 { padding: 16px 16px 0; }
td b { display: block; font-weight: 600; }
td span { display: block; margin-top: 4px; color: var(--muted); font-size: 0.84rem; line-height: 1.6; }

.work { background: var(--white); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 16px; overflow: hidden; box-shadow: 0 10px 28px rgba(12, 35, 64, 0.05); }
.work-top { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; }
.work-top .grow { flex: 1; }
.work-top h2 { font-size: 1.15rem; }
.work .mini-reports { margin: 16px 20px 0; }
.action {
    margin: 16px 20px 20px;
    padding: 16px;
    background: #f6f9fc;
    border: 1px solid var(--line);
    border-radius: 14px;
}
.action h3 { font-size: 0.95rem; margin-bottom: 12px; }
.action form, .action .claim-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 14px;
    margin: 0;
    padding: 0;
    border: 0;
    align-items: end;
}
.action .wide { grid-column: 1 / -1; }
.action label { margin: 0; }
.action button.primary { width: auto; min-width: 148px; justify-self: start; }
.work > .sub { display: block; margin: 0 20px 18px; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 0 16px; }
.fact { background: #f6f9fc; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.fact span { display: block; color: var(--muted); font-size: 0.78rem; }
.fact strong { display: block; margin-top: 3px; font-weight: 600; }
.reports { margin-top: 4px; }
.reports h3 { font-size: 1rem; margin: 4px 0 10px; }
.await { color: var(--brass); font-weight: 600; font-size: 0.82rem; }
.filed { color: #14382f; font-weight: 600; font-size: 0.82rem; }
.opener { margin-top: 16px; padding: 16px 18px; }
.opener summary { cursor: pointer; font-weight: 600; }
.opener form { margin-top: 14px; }
details.edit { margin-top: 6px; }
details.edit summary { cursor: pointer; color: var(--pine); font-size: 0.82rem; }
details.edit form { margin-top: 8px; }
.switch { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.switch a { text-decoration: none; border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 6px 12px; font-size: 0.88rem; }
.switch a.on { background: var(--pine); color: #fff; border-color: var(--pine); }
.lane { margin: 22px 0 10px; color: var(--muted); font-size: 0.84rem; font-weight: 600; }
.pending {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; margin-bottom: 8px;
    background: transparent; border: 1px dashed var(--line); border-radius: 14px;
}
.pending .grow { flex: 1; }
.empty { padding: 28px 16px; color: var(--muted); }

.gate { min-height: 100vh; display: grid; grid-template-columns: 42% 1fr; background: var(--white); }
.gate-story {
    background: linear-gradient(180deg, #0c2340 0%, #08182c 100%);
    color: #f4f7fb;
    padding: 48px 44px;
    display: flex;
    flex-direction: column;
}
.gate-story .logo { margin-bottom: 48px; }
.gate-story h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 600; max-width: 12em; line-height: 1.35; }
.gate-story .intro { margin-top: 14px; color: #c5d4e4; max-width: 28rem; }
.path { list-style: none; padding: 0; margin: 36px 0 0; }
.path li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid rgba(255,255,255,.12); }
.path b { display: block; }
.path span { color: #b7c6d6; font-size: 0.9rem; }
.path i {
    width: 28px; height: 28px; border-radius: 50%;
    display: grid; place-items: center;
    border: 1px solid rgba(125, 211, 199, .55);
    color: #7dd3c7; font-style: normal; font-size: 0.85rem;
}
.gate-story footer { margin-top: auto; color: #9fb0a8; font-size: 0.82rem; }

.gate-access { display: grid; place-items: center; padding: 32px 24px; background: var(--paper); }
.access { width: min(440px, 100%); }
.access h2 { font-size: 1.45rem; }
.access > p { color: var(--muted); margin: 6px 0 18px; }
.account { margin-bottom: 8px; }
.account button {
    width: 100%;
    display: flex; align-items: center; gap: 12px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 12px;
    cursor: pointer;
    text-align: right;
}
.account button:hover { border-color: #9ec9c3; }
.account .av {
    width: 38px; height: 38px; border-radius: 12px;
    display: grid; place-items: center;
    background: #e7f3f1; color: var(--accent); font-weight: 600; flex: none;
}
.account .who { flex: 1; }
.account .who b { display: block; }
.account .who small { color: var(--muted); }
.account em {
    font-style: normal; color: var(--accent); font-weight: 600; font-size: 0.88rem;
    background: transparent; height: auto; padding: 0;
}
.rule { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; color: var(--muted); font-size: 0.8rem; margin: 16px 0; }
.rule::before, .rule::after { content: ""; height: 1px; background: var(--line); }

@media (max-width: 980px) {
    .frame, .gate, .layout, .split, .action form, .action .claim-row, .facts { grid-template-columns: 1fr; }
    .side { padding: 16px 18px; }
    .side-out { margin-top: 8px; border-top: 0; padding-top: 0; }
    .frame { display: block; }
    .canvas-body, .topbar { padding-right: 16px; padding-left: 16px; }
    .bell-panel { left: 0; right: auto; }
    .identity, .log li { display: block; }
    .dx { margin: 12px 0 0; display: inline-block; }
    .rail::before { display: none; }
    .rail { gap: 8px; }
    .gate-story { padding: 28px 22px; }
    .gate-story .logo { margin-bottom: 24px; }
}

/* ===== لوحة المؤشرات ===== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
    position: relative; overflow: hidden;
    background: var(--white); border: 1px solid var(--line); border-radius: 16px;
    padding: 14px 16px 12px; box-shadow: 0 6px 18px rgba(12, 35, 64, 0.04);
}
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--pine); opacity: .85; }
.kpi span { display: block; color: var(--muted); font-size: 0.8rem; }
.kpi strong { display: block; margin-top: 4px; font-size: 1.7rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.74rem; }
.k-info::before { background: #1d4e89; }
.k-teal::before { background: var(--accent); }
.k-ok::before { background: #15803d; }
.k-bad::before { background: #b42318; }
.k-warn::before { background: #d97706; }
.k-warn strong { color: #9a5b00; }
.k-bad strong { color: #9b1c1c; }

/* ===== البحث والفرز ===== */
.filters {
    display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px;
    background: var(--white); border: 1px solid var(--line); border-radius: 16px;
    padding: 12px 14px; margin-bottom: 16px;
}
.filters label { margin: 0; min-width: 180px; }
.filters .search { flex: 1; min-width: 240px; }
.filters button.primary { margin: 0; }
.filters .clear { color: var(--pine-2); font-size: 0.86rem; align-self: center; }
.filters .count { margin-right: auto; align-self: center; color: var(--muted); font-size: 0.84rem; }

/* ===== مدة الانتظار ===== */
.sla { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.sla::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; }
.sla.late { color: #9a5b00; background: #fff6e8; border-radius: 999px; padding: 3px 10px; font-weight: 600; }
.sla.late::before { background: #d97706; }

/* ===== زر التقرير ===== */
.ghost {
    display: inline-flex; align-items: center; gap: 6px;
    text-decoration: none; white-space: nowrap;
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
    padding: 6px 10px; color: var(--pine); font-size: 0.82rem; font-weight: 500;
}
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.ghost svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.identity .ghost { margin-right: 4px; }

/* ===== مؤشر الاكتمال ===== */
.meter { height: 6px; background: #e3eaf2; border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #14b8a6); border-radius: inherit; }
.identity + .meter { margin: -6px 0 16px; }
.journey { border-top: 1px solid var(--line); padding: 14px 0 16px; }
.journey > div:first-child { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.journey span { color: var(--muted); font-size: 0.84rem; }
.journey b { font-size: 1.15rem; color: var(--accent); }
.journey small { display: block; margin-top: 8px; color: var(--muted); font-size: 0.8rem; }

/* ===== سجل النشاط ===== */
.history { margin: 0 20px 18px; border-top: 1px dashed var(--line); padding-top: 12px; }
.dossier .history { margin: 6px 0 16px; }
.history summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--pine); }
.history summary em { font-style: normal; background: #e7edf3; color: #3d4d60; border-radius: 999px; padding: 1px 8px; font-size: 0.74rem; margin-right: 6px; }
.history > .sub { margin-top: 10px; }
.activity { list-style: none; margin: 12px 0 0; padding: 0; position: relative; }
.activity::before { content: ""; position: absolute; top: 6px; bottom: 6px; right: 5px; width: 2px; background: var(--line); }
.log .activity li, .activity li { display: grid; grid-template-columns: 12px 1fr; gap: 12px; padding: 8px 0; border: 0; position: relative; }
.activity i { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; background: var(--pine); box-shadow: 0 0 0 3px #fff; z-index: 1; }
.activity i.r-hospital { background: #1d4e89; }
.activity i.r-education { background: var(--accent); }
.activity i.r-hr { background: #7c3aed; }
.activity i.r-support { background: #d97706; }
.activity i.r-guardian { background: #15803d; }
.activity b { display: block; font-weight: 600; font-size: 0.92rem; }
.activity span { display: block; color: var(--ink); font-size: 0.86rem; opacity: .8; }
.activity small { display: block; color: var(--muted); font-size: 0.76rem; margin-top: 2px; }
.log h3 small { font-weight: 400; color: var(--muted); font-size: 0.8rem; margin-right: 6px; }

.locked-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 20px 0; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 12px; }
.locked-row span { color: var(--muted); font-size: 0.84rem; }

/* ===== التقرير القابل للطباعة ===== */
.print-body { background: #dfe6ee; padding: 24px 16px 48px; }
.print-tools { max-width: 210mm; margin: 0 auto 14px; display: flex; justify-content: space-between; align-items: center; }
.print-tools a { color: var(--pine); }
.print-tools button.primary { width: auto; margin: 0; }
.paper { max-width: 210mm; margin: 0 auto; background: #fff; padding: 18mm 16mm; border-radius: 6px; box-shadow: 0 20px 50px rgba(12, 35, 64, 0.15); }
.paper-head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 14px; border-bottom: 2px solid var(--pine); }
.paper-head .logo { color: var(--pine); }
.paper-head .logo small { color: var(--muted); }
.paper-head .mark { color: var(--pine); }
.paper-ref { text-align: left; display: grid; gap: 2px; }
.paper-ref b { font-size: 1.05rem; }
.paper-ref span { color: var(--muted); font-size: 0.8rem; }
.paper-id { display: flex; align-items: center; gap: 14px; margin: 18px 0 14px; }
.paper-id h1 { font-size: 1.4rem; font-weight: 600; }
.paper .facts { grid-template-columns: repeat(4, 1fr); }
.paper h2 { font-size: 1rem; margin: 22px 0 8px; color: var(--pine); }
.paper table { border: 1px solid var(--line); font-size: 0.86rem; }
.paper th, .paper td { padding: 8px 10px; }
.signatures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 34px; }
.signatures span { color: var(--muted); font-size: 0.8rem; }
.signatures i { display: block; height: 46px; border-bottom: 1px solid #9aa9b8; }
.paper-foot { display: flex; justify-content: space-between; margin-top: 26px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.74rem; }

@media print {
    @page { size: A4; margin: 12mm; }
    .print-body { background: #fff; padding: 0; }
    .print-tools { display: none; }
    .paper { box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
    .paper table, .paper tr { page-break-inside: avoid; }
    .pill { border: 1px solid currentColor; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 980px) {
    .work-top { flex-wrap: wrap; }
    .paper .facts, .signatures { grid-template-columns: 1fr 1fr; }
    .history { margin: 0 16px 16px; }
}


/* ===================== الإصدار 6: لوحة القيادة والرسوم ===================== */
body { background: #eef2f7; }
.canvas, .gate-access { background: #eef2f7; }
.topbar { padding: 14px 32px; }
.work, .dossier, .log, .kpi, .filters, .sheet, .card { box-shadow: 0 1px 2px rgba(12,35,64,.04), 0 8px 24px rgba(12,35,64,.05); }
tbody tr:hover td { background: #f8fafc; }
.kpi strong { font-size: 1.6rem; }

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px 20px; min-width: 0; }
.card.span-2 { grid-column: span 2; }
.card-head { margin-bottom: 16px; }
.card-head h2 { font-size: 1rem; font-weight: 600; }
.card-head p { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }

.hbars { display: grid; gap: 12px; position: relative; }
.hbar, .stack-row { display: grid; grid-template-columns: 30% 1fr 64px; align-items: center; gap: 12px; }
.hbar-label { color: var(--ink); font-size: 0.86rem; }
.hbar-track { height: 14px; background: #f1f4f8; border-radius: 4px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; background: #2a78d6; border-radius: 0 4px 4px 0; }
[dir=rtl] .hbar-track i { border-radius: 4px 0 0 4px; margin-right: 0; }
.hbar-value { font-weight: 600; font-size: 0.86rem; font-variant-numeric: tabular-nums; text-align: end; }
.hbar:hover .hbar-track i { filter: brightness(1.08); }
.hbar-ref { position: absolute; top: -6px; bottom: -6px; inset-inline-start: calc(30% + 12px + (70% - 88px) * var(--r)); border-inline-start: 1.5px dashed #d97706; pointer-events: none; }
.hbar-ref span { position: absolute; bottom: -18px; inset-inline-start: 4px; font-size: 0.7rem; color: #9a5b00; white-space: nowrap; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 14px; font-size: 0.8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.stacks { display: grid; gap: 14px; }
.stack { display: flex; height: 18px; gap: 2px; background: #f1f4f8; border-radius: 4px; overflow: hidden; }
.stack i { display: block; height: 100%; }
.stack i:hover { filter: brightness(1.1); }
.stack em { font-style: normal; font-size: 0.76rem; color: var(--muted); padding: 0 8px; line-height: 18px; }
.c-good { background: #0ca30c; }
.c-review { background: #2a78d6; }
.c-warn { background: #fab219; }
.c-bad { background: #d03b3b; }

.cols { display: flex; align-items: stretch; gap: 6px; height: 190px; padding-top: 6px; border-bottom: 1px solid #c3c2b7; }
.col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.col-bar { flex: 1; display: flex; align-items: flex-end; }
.col-bar i { display: block; width: 100%; background: #2a78d6; border-radius: 4px 4px 0 0; transition: filter .15s; }
.col:hover .col-bar i { filter: brightness(1.12); }
.col small { font-size: 0.68rem; color: #898781; text-align: center; padding-top: 6px; white-space: nowrap; transform: translateY(100%); margin-bottom: -4px; }
.card .cols { margin-bottom: 22px; }

.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.funnel li { display: grid; grid-template-columns: minmax(130px, 28%) 1fr 40px 44px; gap: 12px; align-items: center; }
.funnel-label { font-size: 0.88rem; }
.funnel-track { height: 26px; background: #f1f4f8; border-radius: 6px; overflow: hidden; }
.funnel-track i { display: block; height: 100%; border-radius: 6px; background: #2a78d6; }
.funnel li:nth-child(2) .funnel-track i { background: #256abf; }
.funnel li:nth-child(3) .funnel-track i { background: #1c5cab; }
.funnel li:nth-child(4) .funnel-track i { background: #184f95; }
.funnel li:nth-child(5) .funnel-track i { background: #104281; }
.funnel b { font-variant-numeric: tabular-nums; text-align: end; }
.funnel small { color: var(--muted); font-size: 0.78rem; }
.funnel li:hover .funnel-track i { filter: brightness(1.12); }

.viz-tip { position: fixed; z-index: 99; pointer-events: none; background: #0b1f38; color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 0.8rem; box-shadow: 0 8px 20px rgba(0,0,0,.18); max-width: 320px; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.mini-stats div { background: #f6f9fc; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.mini-stats span { display: block; color: var(--muted); font-size: 0.78rem; }
.mini-stats b { font-size: 1.5rem; font-weight: 600; }
.wide-link { width: 100%; justify-content: center; padding: 10px; }
.table-wrap.flat { border: 0; border-radius: 0; }
.card .activity { margin-top: 0; }

/* الملفات المرفقة */
.file-chip { display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 0 6px; padding: 3px 10px 3px 4px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--pine-2); text-decoration: none; font-size: 0.78rem; max-width: 100%; }
.file-chip i { font-style: normal; font-size: 0.64rem; font-weight: 700; background: #fdecea; color: #b42318; border-radius: 999px; padding: 2px 6px; }
.file-chip:hover { border-color: var(--accent); }
.drop input[type=file] { height: auto; padding: 10px; border-style: dashed; background: #f8fbff; }
.att-note { display: inline-block; margin-inline-start: 6px; color: var(--accent); font-size: 0.76rem; }

/* الرسائل */
.channels { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; color: var(--muted); font-size: 0.88rem; }
.channels .ico { color: var(--accent); }
.channels b { color: var(--ink); font-weight: 600; }
.chan { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 0.76rem; font-weight: 600; }
.chan-sms { background: #e7eef8; color: #1d4e89; }
.chan-email { background: #e7f6f4; color: #0f766e; }
.sms-bubble { display: block; background: #f1f4f8; border-radius: 14px 14px 14px 4px; padding: 8px 12px; color: var(--ink) !important; max-width: 34rem; }
.mail-preview summary { cursor: pointer; color: var(--pine-2); font-size: 0.82rem; margin-top: 4px; }
.mail-preview iframe { width: 100%; max-width: 560px; height: 300px; border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; background: #eef3f8; }
.messages td:first-child { width: 120px; }

/* QR والتحقق */
.paper-qr { display: grid; justify-items: center; gap: 2px; text-decoration: none; color: var(--muted); }
.paper-qr small { font-size: 0.66rem; }
.paper-head { align-items: center; gap: 16px; }
.paper-head .paper-ref { margin-inline-start: auto; }
.verify-body { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 80% -10%, #d7f3ef 0%, transparent 60%), #eef2f7; padding: 24px 16px; }
.verify { width: min(560px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 26px; box-shadow: 0 20px 50px rgba(12,35,64,.1); }
.verify .logo { color: var(--pine); padding: 0; margin-bottom: 20px; }
.verify .logo small { color: var(--muted); }
.verdict { display: flex; gap: 14px; align-items: center; border-radius: 16px; padding: 16px; margin-bottom: 18px; }
.verdict .ico { width: 42px; height: 42px; stroke-width: 1.5; }
.verdict h1 { font-size: 1.25rem; }
.verdict p { font-size: 0.88rem; opacity: .85; }
.verdict.ok { background: #e5f3ee; color: #115e59; }
.verdict.bad { background: #fdecea; color: #9b1c1c; }
.verify-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 16px; }
.verify-facts div { background: #f6f9fc; border-radius: 12px; padding: 10px 12px; }
.verify-facts dt { color: var(--muted); font-size: 0.76rem; }
.verify-facts dd { margin: 2px 0 0; font-weight: 600; }
.verify-form { display: grid; gap: 4px; }
.verify footer { margin-top: 18px; display: flex; justify-content: center; }

/* الدخول */
.access-top { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.gate-badges { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; }
.gate-badges li { display: flex; align-items: center; gap: 10px; color: #c5d4e4; font-size: 0.9rem; }
.gate-badges .ico { color: #2dd4bf; }
.gate-story { background: radial-gradient(800px 400px at 0% 0%, rgba(45,212,191,.16), transparent 60%), linear-gradient(185deg, #0e2a4b 0%, #071629 100%); }

/* قوائم PDF */
.print-tools.wide, .paper.wide { max-width: 297mm; }
.print-tools span { display: flex; gap: 8px; align-items: center; }
.list-table { font-size: 0.76rem; }
.list-table th, .list-table td { padding: 6px 7px; }

/* ===================== الاتجاه من اليسار لليمين (الإنجليزية) ===================== */
[dir=ltr] th, [dir=ltr] td { text-align: left; }
[dir=ltr] .dx { margin-right: 0; margin-left: auto; }
[dir=ltr] .filters .count { margin-right: 0; margin-left: auto; }
[dir=ltr] .bell-panel { left: auto; right: 0; }
[dir=ltr] .badge { left: auto; right: -6px; }
[dir=ltr] .activity::before { right: auto; left: 5px; }
[dir=ltr] .account button { text-align: left; }
[dir=ltr] .paper-ref { text-align: right; }
[dir=ltr] .file-chip { margin: 6px 6px 0 0; }
[dir=ltr] .sms-bubble { border-radius: 14px 14px 4px 14px; }
[dir=ltr] .hbar-track i { border-radius: 0 4px 4px 0; }
[dir=ltr] .access-top { justify-content: flex-start; }

@media (max-width: 1180px) {
    .board { grid-template-columns: 1fr 1fr; }
    .card.span-2 { grid-column: span 2; }
}
@media (max-width: 980px) {
    .side { position: static; height: auto; }
    .board { grid-template-columns: 1fr; }
    .card.span-2 { grid-column: auto; }
    .funnel li { grid-template-columns: 1fr 1fr 34px 40px; }
    .verify-facts { grid-template-columns: 1fr; }
    .topbar { flex-wrap: wrap; }
}
@media print {
    .paper-qr svg { width: 92px; height: 92px; }
}

/* بيانات الدخول للتجربة */
.gate { grid-template-rows: auto auto; }
.creds { grid-column: 1 / -1; background: var(--paper); padding: 8px 44px 48px; }
.creds-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 14px; flex-wrap: wrap; }
.creds-head h2 { font-size: 1.15rem; }
.creds-head p { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.creds-head b { color: var(--ink); }
.creds-head button.primary { margin: 0; }
.creds code { font-family: ui-monospace, Consolas, monospace; font-size: 0.92rem; background: #eef3f8; border-radius: 6px; padding: 2px 8px; }
@media (max-width: 980px) { .creds { padding: 8px 16px 32px; } .creds td:last-child, .creds th:last-child { display: none; } }
