/* النظام المالي — أنظمة التنفيذ المتقدمة */
@font-face { font-family: 'Readex Pro'; src: url(../fonts/readexpro.woff) format('woff'); font-weight: 160 700; font-display: swap; }
@font-face { font-family: 'Alexandria'; src: url(../fonts/alexandria.woff) format('woff'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url(../fonts/manrope.woff) format('woff'); font-weight: 200 800; font-display: swap; }

:root {
  --ink: #16232A; --ink2: #22343D; --ink3: #2C4049;
  --bg: #EEF3F4; --card: #FFFFFF; --line: #D9E3E6; --line2: #E7EEF0; --head: #F5F8F9;
  --teal: #075056; --teal2: #0A6A72; --teal-soft: #E3F0F1;
  --orange: #FF5804; --orange-t: #B23C00; --orange-d: #8F3000; --orange-soft: #FFEFE6;
  --blue: #1D4F91; --blue-soft: #E8EFF8;
  --red: #B42318; --red-d: #8E1B12; --red-soft: #FDECEA;
  --green: #0F7A4A; --green-soft: #E5F4EC;
  --muted: #58696F; --muted2: #3D4F56; --faint: #8A9AA0;
  --r: 14px; --r-sm: 10px;
  --shadow: 0 1px 2px rgba(22, 35, 42, .05), 0 10px 30px -18px rgba(22, 35, 42, .28);
  --side: 252px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.6 'Readex Pro', system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--orange-t); }
h1, h2, h3, h4 { font-family: 'Alexandria', 'Readex Pro', sans-serif; margin: 0; line-height: 1.35; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.n, .num { font-family: 'Manrope', 'Readex Pro', sans-serif; font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ── مراسلات طلبات العملاء ── */
.thread { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.msg { max-width: 86%; padding: 12px 14px; border-radius: 12px; background: var(--head); border: 1px solid var(--line2); display: flex; flex-direction: column; gap: 6px; }
.msg.staff { align-self: flex-end; background: var(--teal-soft); border-color: #CFE3E5; }
.msg .who { font-size: 12px; color: var(--muted); }
.msg .who b { color: var(--ink); }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
@media (max-width: 720px) { .msg { max-width: 100%; } }

/* ── الهيكل ── */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side); flex: none; background: var(--ink); color: #C9D7DA; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; z-index: 40; }
.side::-webkit-scrollbar { width: 6px; }
.side::-webkit-scrollbar-thumb { background: #2C4049; border-radius: 3px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 16px; }
.logo { position: relative; width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--teal); display: grid; place-items: center; font: 800 20px 'Alexandria', sans-serif; color: #fff; }
.logo i { position: absolute; top: -4px; inset-inline-end: -4px; width: 11px; height: 11px; border-radius: 3px; background: var(--orange); }
.brand b { display: block; color: #fff; font: 700 14.5px/1.35 'Alexandria', sans-serif; }
.brand span { font-size: 11.5px; color: #8FA6AC; }
.nav { padding: 6px 10px 20px; display: flex; flex-direction: column; gap: 14px; }
.nav-sec h6 { display: flex; align-items: center; gap: 8px; margin: 0 8px 4px; font: 600 11.5px 'Readex Pro', sans-serif; color: #7F969C; letter-spacing: .02em; }
.nav-sec h6 em { font: 700 10.5px 'Manrope', sans-serif; font-style: normal; color: #5D757C; }
.nav-sec h6 svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 6px 12px; border-radius: 9px; color: #C9D7DA; font-size: 13.5px; border-inline-start: 3px solid transparent; }
.nav a:hover { background: #1D2D35; color: #fff; }
.nav a.on { background: var(--ink2); color: #fff; border-inline-start-color: var(--orange); font-weight: 600; }
.nav a .badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--orange); color: #fff; font: 700 11px/20px 'Manrope', sans-serif; text-align: center; }
.side-foot { margin-top: auto; padding: 14px 18px 18px; border-top: 1px solid #22343D; font-size: 12px; color: #7F969C; display: flex; align-items: center; gap: 8px; }
.side-foot svg { width: 16px; height: 16px; flex: none; stroke: #5FD3A6; fill: none; stroke-width: 1.8; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 24px; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
.top .menu { display: none; }
.top h1 { font-size: 18px; font-weight: 700; }
.top .crumb { font-size: 12px; color: var(--muted); }
.top .grow { flex: 1 1 auto; min-width: 0; }
.search { position: relative; width: min(360px, 32vw); }
.search input { width: 100%; min-height: 40px; padding: 0 38px 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--head); }
.search svg { position: absolute; top: 11px; inset-inline-start: 12px; width: 18px; height: 18px; stroke: var(--faint); fill: none; stroke-width: 1.8; }
.search-res { position: absolute; top: 46px; inset-inline: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 50; max-height: 60vh; overflow: auto; }
.search-res a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink); }
.search-res a:hover, .search-res a.on { background: var(--teal-soft); }
.search-res small { color: var(--muted); }
.chip-2fa { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip-2fa svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.iconbtn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--muted2); cursor: pointer; }
.iconbtn:hover { border-color: var(--teal); color: var(--teal); }
.iconbtn svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn .dot { position: absolute; top: -5px; inset-inline-end: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--orange); color: #fff; font: 700 10.5px/19px 'Manrope', sans-serif; }
.who { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 12px; border: 1px solid transparent; background: none; cursor: pointer; text-align: start; }
.who:hover { border-color: var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; font: 700 15px 'Alexandria', sans-serif; flex: none; }
.who b { display: block; font-size: 13px; line-height: 1.3; }
.who span { font-size: 11.5px; color: var(--muted); }
.menu-pop { position: absolute; top: 58px; inset-inline-end: 24px; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 60; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 0; background: none; color: var(--ink); cursor: pointer; text-align: start; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--head); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line2); margin: 6px 0; }
.content { padding: 24px; width: 100%; max-width: 1440px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

/* ── البطاقات والجداول ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 1px 2px rgba(22, 35, 42, .03); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line2); }
.card-h h3 { font-size: 15px; font-weight: 700; }
.card-h .sub { font-size: 12.5px; color: var(--muted); }
.card-b { padding: 18px; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--line2); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.row { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.row > .grow { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.row > .aside { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi .v { font: 700 24px/1.25 'Manrope', sans-serif; font-variant-numeric: tabular-nums; color: var(--ink); unicode-bidi: isolate; }
.kpi .v small { font: 600 12px 'Readex Pro', sans-serif; color: var(--muted); margin-inline-start: 4px; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.accent::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--orange); }
.kpi.teal::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--teal); }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; background: var(--head); color: var(--muted2); font-size: 12px; font-weight: 600; text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: #F7FAFA; }
.tbl .num, .tbl th.num { text-align: left; font-family: 'Manrope', 'Readex Pro', sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; background: var(--head); border-top: 1px solid var(--line); }
.tbl .code { font: 600 12.5px 'Manrope', sans-serif; color: var(--muted2); }
.tbl .lvl1 td { font-weight: 700; background: #F3F7F8; }
.tbl .lvl2 td { font-weight: 600; }
.tbl tr.dim td { color: var(--faint); }
.tbl-mini td, .tbl-mini th { padding: 7px 10px; }

/* ── الأزرار والحقول ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--teal); background: var(--teal); color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--teal2); color: #fff; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.o { background: #fff; color: var(--teal); border-color: var(--line); }
.btn.o:hover { border-color: var(--teal); color: var(--teal); background: #fff; }
.btn.d { background: var(--red); border-color: var(--red); }
.btn.d:hover { background: var(--red-d); }
.btn.do { background: #fff; color: var(--red); border-color: #F1C9C4; }
.btn.do:hover { border-color: var(--red); }
.btn.g { background: transparent; border-color: transparent; color: var(--teal); padding: 0 10px; }
.btn.g:hover { background: var(--teal-soft); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.ac { background: var(--orange); border-color: var(--orange); }
.btn.ac:hover { background: #E84E00; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: 12.5px; font-weight: 600; color: var(--muted2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12.5px; color: var(--red-d); font-weight: 600; }
.inp { width: 100%; min-height: 42px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid #C7D4D8; background: #fff; color: var(--ink); }
textarea.inp { padding: 10px 12px; min-height: 80px; resize: vertical; }
select.inp { padding-inline-end: 8px; }
.inp:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px rgba(7, 80, 86, .12); }
.inp.bad { border-color: var(--red); }
.inp.n { text-align: left; direction: ltr; }
.inp[readonly] { background: var(--head); }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; }
.form .full { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--teal); flex: none; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .inp { min-height: 38px; width: auto; }
.toolbar .grow { flex: 1 1 auto; }

/* ── الشرائح والحالات ── */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #EEF2F3; color: var(--muted2); }
.chip.ok { background: var(--green-soft); color: var(--green); }
.chip.teal { background: var(--teal-soft); color: var(--teal); }
.chip.warn { background: var(--orange-soft); color: var(--orange-d); }
.chip.bad { background: var(--red-soft); color: var(--red-d); }
.chip.info { background: var(--blue-soft); color: var(--blue); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button, .tabs a { padding: 10px 14px; border: 0; background: none; color: var(--muted); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button.on, .tabs a.on { color: var(--ink); border-bottom-color: var(--orange); }
.tabs .cnt { font: 700 11px 'Manrope', sans-serif; background: #EEF2F3; border-radius: 999px; padding: 1px 7px; color: var(--muted2); }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: #E6EDEF; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted2); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty svg { width: 40px; height: 40px; stroke: #B5C4C8; fill: none; stroke-width: 1.4; }
.note { padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.6; background: var(--blue-soft); color: #173F75; }
.note.warn { background: var(--orange-soft); color: var(--orange-d); }
.note.bad { background: var(--red-soft); color: var(--red-d); }
.note.ok { background: var(--green-soft); color: #0B5C38; }
.dl { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 16px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.big-num { font: 800 30px/1.2 'Manrope', sans-serif; font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line2); font-size: 13.5px; }
.sum-row:last-child { border-bottom: 0; }
.sum-row.total { font-weight: 700; font-size: 15px; border-top: 1px solid var(--line); border-bottom: 0; padding-top: 10px; margin-top: 4px; }

/* ── سلسلة الموافقات ── */
.chain { display: flex; align-items: flex-start; gap: 0; flex-wrap: wrap; }
.chain .st { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 110px; text-align: center; position: relative; flex: 1 1 110px; }
.chain .st::after { content: ''; position: absolute; top: 15px; inset-inline-start: calc(50% + 18px); width: calc(100% - 36px); height: 2px; background: var(--line); }
.chain .st:last-child::after { display: none; }
.chain .st.approved::after { background: var(--teal); }
.chain .dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #EEF2F3; color: var(--faint); border: 2px solid var(--line); font: 700 13px 'Manrope', sans-serif; z-index: 1; }
.chain .dot svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.chain .approved .dot { background: var(--teal); border-color: var(--teal); color: #fff; }
.chain .current .dot { background: #fff; border-color: var(--orange); color: var(--orange-t); box-shadow: 0 0 0 4px var(--orange-soft); }
.chain .rejected .dot { background: var(--red); border-color: var(--red); color: #fff; }
.chain .skipped .dot { background: #fff; border-style: dashed; }
.chain b { font-size: 12.5px; }
.chain small { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

/* ── النوافذ والتنبيهات ── */
.overlay { position: fixed; inset: 0; background: rgba(16, 26, 31, .55); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; }
.dialog { width: 100%; max-width: 560px; background: #fff; border-radius: 16px; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .5); display: flex; flex-direction: column; max-height: 88vh; }
.dialog.wide { max-width: 860px; }
.dialog-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line2); }
.dialog-h h3 { font-size: 16px; }
.dialog-b { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.dialog-f { padding: 14px 20px; border-top: 1px solid var(--line2); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.otp-inp { min-height: 58px; font: 700 28px 'Manrope', sans-serif; letter-spacing: .4em; text-align: center; direction: ltr; }
.toasts { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--shadow); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; animation: tin .18s ease-out; }
.toast.bad { background: var(--red-d); }
.toast.ok { background: #0B5C38; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.loading { padding: 60px 20px; text-align: center; color: var(--muted); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--teal); animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── الرسم البياني ── */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding-top: 10px; }
.bars .m { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; height: 100%; }
.bars .pair { flex: 1 1 auto; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.bars .b { width: min(22px, 40%); border-radius: 5px 5px 0 0; min-height: 2px; }
.bars .b.rev { background: var(--teal); }
.bars .b.cost { background: var(--orange); opacity: .85; }
.bars .lab { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.meter { height: 8px; border-radius: 999px; background: #E6EDEF; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--teal); border-radius: 999px; }

/* ── مصفوفة الصلاحيات ── */
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: start; }
.matrix input { width: 18px; height: 18px; accent-color: var(--teal); }
.matrix .na { color: #C5D0D3; }
.roles { display: flex; gap: 8px; flex-wrap: wrap; }
.roles button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 600; color: var(--muted2); }
.roles button.on { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); }

/* ── الدخول ── */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; background: var(--bg); }
.auth-side { flex: 1 1 420px; background: var(--ink); color: #E4EEF0; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; background-image: linear-gradient(rgba(228, 238, 240, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(228, 238, 240, .04) 1px, transparent 1px); background-size: 28px 28px; }
.auth-side h1 { font-size: 34px; font-weight: 800; color: #fff; }
.auth-side .pt { display: flex; gap: 12px; align-items: flex-start; }
.auth-side .pt svg { width: 22px; height: 22px; flex: none; margin-top: 2px; fill: none; stroke: #5FD3A6; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-main { flex: 1 1 460px; display: flex; align-items: center; justify-content: center; padding: 48px 20px; }
.auth-card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px; box-shadow: 0 30px 60px -36px rgba(22, 35, 42, .45); display: flex; flex-direction: column; gap: 16px; }
.auth-card h2 { font-size: 23px; font-weight: 800; }
.auth-card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.qr-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.qr-box img { width: 168px; height: 168px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; image-rendering: pixelated; }
.secret { font: 700 14px 'Manrope', monospace; direction: ltr; letter-spacing: .08em; background: var(--head); border: 1px dashed var(--line); padding: 8px 10px; border-radius: 8px; word-break: break-all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; direction: ltr; }
.codes span { font: 700 14px 'Manrope', monospace; background: var(--head); border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; }

/* ── المستندات والطباعة ── */
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.doc-head h2 { font-size: 22px; }
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pdf-view { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 12px; background: #F3F6F7; }
.pdf-canvas { max-width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: block; }
.drop { border: 2px dashed #B9C9CD; border-radius: 14px; padding: 34px 20px; text-align: center; background: #F8FBFB; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.drop:hover, .drop.over { border-color: var(--teal); background: var(--teal-soft); }
.drop svg { width: 38px; height: 38px; stroke: var(--teal); fill: none; stroke-width: 1.6; }
.qr-ok { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.qr-ok div { background: var(--head); border-radius: 10px; padding: 10px 12px; }
.qr-ok small { display: block; color: var(--muted); font-size: 11.5px; }
.lines-tbl .inp { min-height: 38px; }
.lines-tbl td { padding: 6px; }
.tree-row td:first-child { white-space: nowrap; }
.tree-tog { border: 0; background: none; cursor: pointer; width: 22px; height: 22px; color: var(--muted); padding: 0; }
.print-only { display: none; }

@media (max-width: 1000px) {
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; transform: translateX(110%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .side.open { transform: none; }
  .top .menu { display: inline-grid; }
  .search { width: auto; flex: 1 1 auto; }
  .chip-2fa .t, .who .t { display: none; }
  .content { padding: 16px; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 35; }
}
@media (max-width: 640px) {
  .top { padding: 10px 12px; gap: 8px; }
  .top h1 { font-size: 16px; }
  .search { display: none; }
  .auth-side { padding: 32px 24px; }
  .auth-side h1 { font-size: 26px; }
  .kpi .v { font-size: 20px; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
}
@media print {
  body { background: #fff; }
  .side, .top, .no-print, .toasts { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
  .print-only { display: block; }
  .tbl th { position: static; }
}

/* العهد: مصروف كبطاقة (يناسب الجوال) */
.cu-line { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: #FBFCFC; }
.cu-line-h { display: flex; align-items: center; gap: 8px; }
.cu-line .form { padding: 0; }

/* الحضور الشهري */
.att-tbl th, .att-tbl td { padding: 4px 2px; text-align: center; }
.att-tbl .att-name { text-align: right; padding: 6px 10px; min-width: 150px; position: sticky; right: 0; background: #fff; z-index: 1; }
.att-wk { background: #F4F7F8; }
.att { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: #fff; font: 600 12px Alexandria, sans-serif; color: var(--muted2); cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-style: normal; }
.att.bad { background: #FDECEC; color: var(--red-d); border-color: #F5C2C2; }
.att.warn { background: #FFF3E6; color: var(--orange-d); border-color: #FFD9B0; }
.att.info { background: #E8F3F5; color: var(--teal); border-color: #BFDDE2; }
.att.chg { box-shadow: 0 0 0 2px var(--orange); }
.att.off { visibility: hidden; }
.att:disabled { cursor: default; }
.att-legend { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.att-legend span { display: inline-flex; gap: 6px; align-items: center; }

/* تنفيذ المشاريع */
.g-track { position: relative; height: 18px; background: #F4F7F8; border-radius: 6px; min-width: 200px; }
.g-bar { position: absolute; top: 3px; height: 12px; background: #CFE3E6; border-radius: 4px; overflow: hidden; }
.g-bar i { display: block; height: 100%; background: var(--teal); }
.g-today { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--orange); }
.gantt tr.late td:first-child b { color: var(--red-d); }
.site-app { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.site-links { display: flex; gap: 8px; flex-wrap: wrap; }
.site-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.site-photos figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.site-photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #F4F7F8; }
.site-task { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; align-items: start; }
/* المساعد الذكي */
.ai-wrap { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.ai-side { display: flex; flex-direction: column; gap: 12px; padding: 14px; position: sticky; top: 84px; max-height: calc(100vh - 110px); }
.ai-list { display: flex; flex-direction: column; gap: 2px; overflow: auto; min-height: 60px; }
.ai-list a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; color: inherit; text-decoration: none; }
.ai-list a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.ai-list a small { color: var(--muted); font-size: 11px; }
.ai-list a:hover, .ai-list a.on { background: #EEF4F5; }
.ai-main { display: flex; flex-direction: column; min-height: calc(100vh - 140px); }
.ai-thread { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 290px); min-height: 280px; }
.ai-msg { display: flex; flex-direction: column; max-width: 86%; }
.ai-me { align-self: flex-start; }
.ai-bot { align-self: flex-end; }
.ai-bubble { padding: 10px 14px; border-radius: 14px; line-height: 1.75; font-size: 14.5px; }
.ai-me .ai-bubble { background: var(--teal, #075056); color: #fff; border-start-start-radius: 4px; }
.ai-me .ai-bubble a { color: #fff; }
.ai-bot .ai-bubble { background: #F2F5F6; border: 1px solid var(--line); border-start-end-radius: 4px; }
.ai-bubble .ai-li { padding-inline-start: 16px; position: relative; }
.ai-bubble .ai-li::before { content: '•'; position: absolute; inset-inline-start: 2px; }
.ai-bubble .ai-h { font-weight: 700; margin-top: 4px; }
.ai-bubble .ai-gap { height: 8px; }
.ai-bubble a { font-weight: 600; }
.ai-meta { font-size: 11px; color: var(--muted); padding: 4px 6px 0; }
.ai-empty { margin: auto; text-align: center; max-width: 520px; color: var(--muted); display: flex; flex-direction: column; gap: 14px; }
.ai-sugg { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ai-input { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: flex-end; }
.ai-input textarea { flex: 1; resize: none; min-height: 48px; padding: 10px 12px; }
@media (max-width: 860px) {
  .ai-wrap { grid-template-columns: 1fr; }
  .ai-side { position: static; max-height: none; order: 2; }
  .ai-list { max-height: 220px; }
  .ai-thread { max-height: none; min-height: 50vh; }
  .ai-msg { max-width: 94%; }
}

/* مستندات للطباعة بترويسة الشركة (قسيمة راتب، خطابات) */
.paper { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 32px 36px; max-width: 820px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; line-height: 1.9; }
.paper-h { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--ink, #16232A); padding-bottom: 12px; gap: 16px; }
.paper-co { font: 700 20px Alexandria, sans-serif; }
.paper-t { text-align: center; margin: 6px 0; font-size: 20px; }
.paper-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.paper-net { font-size: 17px; text-align: center; padding: 10px; background: #F4F7F8; border-radius: 8px; }
.paper-sign { display: flex; justify-content: space-between; margin-top: 40px; padding: 0 20px; }
.paper-f { border-top: 1px solid var(--line); padding-top: 8px; text-align: center; color: var(--muted2); margin-top: auto; }
@media (max-width: 640px) { .paper { padding: 18px; } .paper-cols { grid-template-columns: 1fr; } }
@media print { .paper { border: 0; border-radius: 0; padding: 0; max-width: none; } }
/* الهيكل التنظيمي */
.org { display: flex; flex-direction: column; gap: 6px; }
.org-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.org-dot { width: 16px; color: var(--muted2); text-align: center; }
