/* نظام جودة إيجاز — الهوية: كحلي إيجاز + ذهبي، Cairo للعناوين و Tajawal للنص
   التخطيط: شريط جانبي ثابت (يمين) + شريط علوي للإدارة والشهر + مساحة عمل بجداول كثيفة */
/* الخطوط: Aktiv للحروف اللاتينية والأرقام، Kaff للعربية — كما في موقع إيجاز */
@font-face { font-family: 'Aktiv'; font-weight: 300; font-display: swap; src: url('fonts/aktiv-300.woff2') format('woff2'); }
@font-face { font-family: 'Aktiv'; font-weight: 400; font-display: swap; src: url('fonts/aktiv-400.woff2') format('woff2'); }
@font-face { font-family: 'Aktiv'; font-weight: 700; font-display: swap; src: url('fonts/aktiv-700.woff2') format('woff2'); }
@font-face { font-family: 'Kaff'; font-weight: 300 400; font-display: swap; src: url('fonts/kaff-300.woff2') format('woff2'); }
@font-face { font-family: 'Kaff'; font-weight: 500 700; font-display: swap; src: url('fonts/kaff-500.woff2') format('woff2'); }

:root {
  --navy: #1F3559; --navy-2: #335792; --navy-900: #152849; --gold: #7E6128; --gold-soft: #C7AC74;
  --bg: #F4F5F9; --surface: #FFFFFF; --surface-2: #FBFAF7; --line: #E2E5EA; --line-2: #EDEFF2;
  --ink: #1F3559; --ink-2: #3A4658; --ink-3: #5F6B7C; --on-navy: #FFFFFF; --on-navy-2: #B8C4D8;
  --good: #2F7D5B; --good-bg: #EAF4EE; --warn: #7E6128; --warn-bg: #F8F1E6; --bad: #B42318; --bad-bg: #FDECEA;
  --crit: #8F1D14; --crit-bg: #F9DEDB; --info: #335792; --info-bg: #EEF2F8; --muted-bg: #EEF2F8;
  --accent: var(--gold); --focus: #335792; --gold-line: #E8D9BD;
  --f-head: 'Aktiv', 'Kaff', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif; --f-body: var(--f-head);
  --r: 12px; --r-card: 16px; --r-pill: 24px; --shadow: 0 10px 28px rgba(31, 53, 89, .09);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --navy: #101E38; --navy-2: #22406E; --gold: #D9BC84; --gold-soft: #C7AC74;
  --bg: #0E1830; --surface: #152849; --surface-2: #19305A; --line: #2A4068; --line-2: #223559;
  --ink: #EEF2F8; --ink-2: #B5BDC8; --ink-3: #8A94A2; --on-navy: #F4EFE4; --on-navy-2: #9AA6B4;
  --good: #7DB77E; --good-bg: #1D2F22; --warn: #E0B154; --warn-bg: #33291A; --bad: #E08E80; --bad-bg: #352220;
  --crit: #F08A96; --crit-bg: #3A1D23; --info: #8DB6E2; --info-bg: #1B2B3D; --muted-bg: #1E2A38; --focus: #E0B154;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark; } }
:root[data-theme="dark"] {
  --navy: #101E38; --navy-2: #22406E; --gold: #D9BC84; --gold-soft: #C7AC74;
  --bg: #0E1830; --surface: #152849; --surface-2: #19305A; --line: #2A4068; --line-2: #223559;
  --ink: #EEF2F8; --ink-2: #B5BDC8; --ink-3: #8A94A2; --on-navy: #F4EFE4; --on-navy-2: #9AA6B4;
  --good: #7DB77E; --good-bg: #1D2F22; --warn: #E0B154; --warn-bg: #33291A; --bad: #E08E80; --bad-bg: #352220;
  --crit: #F08A96; --crit-bg: #3A1D23; --info: #8DB6E2; --info-bg: #1B2B3D; --muted-bg: #1E2A38; --focus: #E0B154;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--f-body); direction: rtl; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--f-head); font-weight: 700; line-height: 1.35; margin: 0; text-wrap: balance; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
a { color: var(--gold); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num, td.n, .tabnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; }

/* ---------- الهيكل ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--navy); color: var(--on-navy); display: flex; flex-direction: column; padding-block: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 18px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 38px; height: 38px; border-radius: 9px; background: var(--gold); color: #fff; display: grid; place-items: center; font: 700 1.25rem var(--f-head); }
.brand b { font: 700 1.05rem var(--f-head); display: block; } .brand span { font-size: .78rem; color: var(--on-navy-2); }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; }
.nav-group { font-size: .72rem; letter-spacing: .04em; color: var(--on-navy-2); padding: 12px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--on-navy); text-decoration: none; font-size: .93rem; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .75; }
.nav a:hover { background: rgba(255,255,255,.06); }
.nav a.on { background: rgba(217,169,75,.16); color: #F3D594; } .nav a.on svg { opacity: 1; }
.side-foot { margin-top: auto; padding: 14px 18px 0; font-size: .8rem; color: var(--on-navy-2); border-top: 1px solid rgba(255,255,255,.08); }
.side-foot button { background: none; border: 1px solid rgba(255,255,255,.18); color: var(--on-navy); border-radius: 6px; padding: 4px 10px; cursor: pointer; margin-top: 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.seg { display: inline-flex; background: var(--muted-bg); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 7px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 700; }
.top .grow { flex: 1; }
.month-pick { display: flex; align-items: center; gap: 8px; }
.content { padding-block: 22px 60px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 18px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); font-size: .9rem; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.demo-bar { background: var(--info-bg); color: var(--info); padding: 8px 16px; font-size: .86rem; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.demo-bar button { margin-inline-start: auto; }

/* ---------- عناصر ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel-b { padding: 16px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 7px; cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
:root[data-theme="dark"] .btn.primary { background: var(--gold); border-color: var(--gold); color: #1a1205; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { background: var(--gold); border-color: var(--gold); color: #1a1205; } }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: none; }
.btn.sm { padding: 3px 9px; font-size: .84rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn { border: 0; background: none; cursor: pointer; padding: 4px; border-radius: 5px; color: var(--ink-3); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--muted-bg); color: var(--ink); } .icon-btn svg { width: 17px; height: 17px; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; padding: 1px 9px; border-radius: 99px; white-space: nowrap; background: var(--muted-bg); color: var(--ink-2); }
.chip.good { background: var(--good-bg); color: var(--good); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); } .chip.crit { background: var(--crit-bg); color: var(--crit); }
.chip.info { background: var(--info-bg); color: var(--info); } .chip.gold { background: var(--warn-bg); color: var(--gold); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=month], input[type=number], select, textarea {
  border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 7px 10px; min-width: 0; width: 100%; }
textarea { resize: vertical; min-height: 70px; line-height: 1.6; }
select { cursor: pointer; }
.inline-sel { width: auto; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: .86rem; color: var(--ink-2); font-weight: 500; min-width: 0; }
label.f .err { color: var(--bad); font-size: .8rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span2 { grid-column: span 2; }
.radio-seg { display: flex; gap: 8px; }
.radio-seg label { flex: 1; border: 1px solid var(--line); border-radius: 7px; padding: 8px; text-align: center; cursor: pointer; font-weight: 700; }
.radio-seg input { position: absolute; opacity: 0; pointer-events: none; }
.radio-seg label:has(input:checked) { border-color: var(--navy); background: var(--muted-bg); }
.radio-seg label.err-k:has(input:checked) { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }
.radio-seg label.praise-k:has(input:checked) { border-color: var(--good); color: var(--good); background: var(--good-bg); }

/* ---------- الجداول ---------- */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th { text-align: start; font: 600 .78rem var(--f-head); color: var(--ink-3); padding: 9px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--surface-2); }
table.t td.c, table.t th.c { text-align: center; }
.detail-cell { max-width: 380px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
tr.deleted td { opacity: .6; }
.code { font: 700 .8rem var(--f-head); color: var(--gold); white-space: nowrap; }

/* شبكة الحالات المدققة والأوزان */
table.grid td, table.grid th { padding: 6px; text-align: center; }
table.grid td:first-child, table.grid th:first-child { text-align: start; position: sticky; right: 0; background: var(--surface); z-index: 1; min-width: 170px; }
table.grid th:first-child { background: var(--surface-2); z-index: 2; }
table.grid input[type=number] { width: 64px; text-align: center; padding: 5px 4px; }
table.grid td.off { background: repeating-linear-gradient(-45deg, var(--surface-2), var(--surface-2) 5px, var(--muted-bg) 5px, var(--muted-bg) 10px); }
table.grid input.dirty { border-color: var(--gold); background: var(--warn-bg); }
table.grid input.over { border-color: var(--bad); }
.errs-hint { display: block; font-size: .72rem; color: var(--bad); margin-top: 2px; }
.sum-ok { color: var(--good); font-weight: 700; } .sum-bad { color: var(--bad); font-weight: 700; }

/* خانات الالتزام (خريطة حرارية) */
.heat { display: inline-block; min-width: 46px; padding: 2px 6px; border-radius: 5px; font-weight: 700; font-size: .8rem; text-align: center; }
.heat.h1 { background: var(--good-bg); color: var(--good); } .heat.h2 { background: var(--warn-bg); color: var(--warn); }
.heat.h3 { background: var(--bad-bg); color: var(--bad); } .heat.h0 { color: var(--ink-3); }
.bar { position: relative; height: 8px; border-radius: 4px; background: var(--muted-bg); overflow: hidden; min-width: 60px; }
.bar i { position: absolute; inset-block: 0; right: 0; border-radius: 4px; background: var(--navy-2); }
:root[data-theme="dark"] .bar i:not(.good):not(.warn):not(.bad) { background: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bar i:not(.good):not(.warn):not(.bad) { background: var(--gold); } }
.bar i.good { background: var(--good); } .bar i.warn { background: var(--warn); } .bar i.bad { background: var(--bad); }
.score-cell { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.score-cell b { font: 700 1rem var(--f-head); min-width: 44px; }

/* ---------- اللوحة ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.dcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; }
.dcard.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.dcard-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.dcard-h small { display: block; color: var(--ink-3); font-size: .8rem; }
.big { font: 700 2.3rem/1 var(--f-head); font-variant-numeric: tabular-nums; }
.big small { font-size: .95rem; color: var(--ink-3); font-weight: 600; }
.delta { font-size: .82rem; font-weight: 700; } .delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.dist { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--muted-bg); }
.dist i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .78rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; } .legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; border-top: 1px solid var(--line-2); padding-top: 10px; }
.kpis div { text-align: center; } .kpis b { display: block; font: 700 1.05rem var(--f-head); font-variant-numeric: tabular-nums; } .kpis span { font-size: .72rem; color: var(--ink-3); }
.kpis .alert b { color: var(--bad); }
.two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; }
.rank { display: flex; flex-direction: column; gap: 8px; }
.rank-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 52px auto; gap: 10px; align-items: center; font-size: .9rem; cursor: pointer; padding: 3px 4px; border-radius: 6px; }
.rank-row:hover { background: var(--surface-2); }
.rank-row b { font-family: var(--f-head); text-align: left; font-variant-numeric: tabular-nums; }
svg.chart text { fill: var(--ink-3); font: 11px var(--f-body); }
svg.chart .grid-l { stroke: var(--line-2); } svg.chart .axis { stroke: var(--line); }
.empty { text-align: center; padding: 36px 16px; color: var(--ink-3); }
.empty b { display: block; color: var(--ink-2); font-family: var(--f-head); margin-bottom: 4px; }
.lock-note { display: flex; gap: 10px; align-items: center; background: var(--muted-bg); color: var(--ink-2); border-radius: var(--r); padding: 10px 14px; font-size: .9rem; flex-wrap: wrap; }
.lock-note svg { width: 18px; height: 18px; flex: none; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { width: auto; min-width: 140px; }
.filters input[type=search] { min-width: 200px; flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 7px 10px; }

/* ---------- النوافذ والإشعارات ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 18, 28, .45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 10px; width: min(760px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.sm { width: min(460px, 100%); }
.modal-h { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-b { padding: 18px; overflow-y: auto; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap; }
.help-box { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 10px 12px; font-size: .84rem; color: var(--ink-2); white-space: pre-line; max-height: 190px; overflow-y: auto; }
.help-box b { color: var(--ink); }
.help-box .crit-line { color: var(--crit); display: block; margin-top: 6px; }
.toasts { position: fixed; bottom: max(16px, env(safe-area-inset-bottom, 0px)); left: max(16px, env(safe-area-inset-left, 0px)); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: var(--on-navy); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); font-size: .9rem; max-width: 380px; }
.toast.err { background: var(--bad); color: #fff; }
.issues { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.issues li { padding: 8px 12px; border-radius: 6px; font-size: .9rem; }
.issues li.block { background: var(--bad-bg); color: var(--bad); font-weight: 700; } .issues li.warn { background: var(--warn-bg); color: var(--warn); }
.issues li.ok { background: var(--good-bg); color: var(--good); font-weight: 700; }

/* ---------- الدخول ---------- */
.login { min-height: 100%; display: grid; place-items: center; background: var(--navy); padding: 16px; }
.login-card { background: var(--surface); border-radius: 12px; padding: 30px; width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login-card .brand-mark { margin-bottom: 4px; }
.login-card .err { color: var(--bad); font-size: .9rem; min-height: 1.2em; }

/* ---------- التقرير الفردي (A4) ---------- */
.report-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.report-tools select { width: auto; min-width: 220px; }
.sheet { background: #fff; color: #1F3559; width: 100%; max-width: 210mm; margin: 0 auto; box-shadow: var(--shadow); border: 1px solid var(--line); font-size: 13px; line-height: 1.55;
  --navy: #1F3559; --gold: #7E6128; --ink: #1F3559; --ink-2: #4A5565; --ink-3: #7B8492; --line: #E2DDD2; --line-2: #EEEAE2; --surface-2: #FAF8F4; --muted-bg: #EFEDE8;
  --good: #417843; --good-bg: #E7F0E4; --warn: #8A5D00; --warn-bg: #F7EDD6; --bad: #944B40; --bad-bg: #F5E4E0; --crit: #7A1F2B; --crit-bg: #F1DADD; --info: #2E5A88; --info-bg: #E3ECF5; color-scheme: light; }
.sheet-h { background: #1F3559; color: #F4EFE4; padding: 18px 26px; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.sheet-h .brand-mark { background: #7E6128; }
.sheet-h h1 { font-size: 1.25rem; color: #fff; } .sheet-h small { color: #E8D9BD; font-size: .82rem; }
.sheet-gold { height: 4px; background: linear-gradient(to left, #7E6128, #C7AC74, #7E6128); }
.sheet-b { padding: 20px 26px 26px; display: flex; flex-direction: column; gap: 16px; }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 16px; font-size: 12.5px; }
.info-grid div span { display: block; color: #7B8492; font-size: 11px; } .info-grid div b { font-weight: 700; }
.score-band { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; border: 1px solid #E2DDD2; border-radius: 8px; padding: 14px 18px; background: #FAF8F4; }
.score-band .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.score-band .stats div { text-align: center; } .score-band .stats b { display: block; font: 700 1.25rem var(--f-head); font-variant-numeric: tabular-nums; } .score-band .stats span { font-size: 11px; color: #7B8492; }
.rating-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sec-title { font: 700 13.5px var(--f-head); color: #1F3559; display: flex; align-items: center; gap: 8px; border-bottom: 1.5px solid #7E6128; padding-bottom: 4px; }
.sec-title::before { content: ''; width: 7px; height: 7px; background: #7E6128; transform: rotate(45deg); }
.sheet table.t { font-size: 12px; } .sheet table.t th { font-size: 11px; background: #F4F1EA; color: #4A5565; position: static; }
.sheet table.t td { padding: 6px 8px; } .sheet table.t th { padding: 6px 8px; }
.lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.lists ul { margin: 6px 0 0; padding-inline-start: 18px; } .lists li { margin-bottom: 4px; }
.note-box { border: 1px solid #E2DDD2; border-radius: 6px; padding: 10px 12px; min-height: 54px; white-space: pre-line; }
.signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 8px; }
.signs div { border-top: 1px solid #1F3559; padding-top: 6px; text-align: center; font-size: 12px; color: #4A5565; }
.signs div b { display: block; color: #1F3559; }
.sheet-foot { font-size: 10.5px; color: #7B8492; border-top: 1px solid #EEEAE2; padding-top: 8px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.notes-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- الطباعة: التقرير وحده على A4 ---------- */
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  .side, .top, .demo-bar, .page-head, .report-tools, .no-print, .toasts { display: none !important; }
  .app { display: block; } .content { padding: 0; max-width: none; }
  .sheet { box-shadow: none; border: 0; max-width: none; }
  .sheet table, .sheet .score-band, .sheet .lists > div, .signs { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- الشاشات الصغيرة ---------- */
@media (max-width: 1100px) { .cards, .two { grid-template-columns: minmax(0, 1fr); } }
@media screen and (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side, .main { min-width: 0; }
  .side { position: static; height: auto; flex-direction: column; padding-block: 10px; }
  .nav { flex-direction: row; overflow-x: auto; padding-block: 8px; } .nav-group { display: none; } .nav a { white-space: nowrap; }
  .side-foot { display: none; } .brand { padding-bottom: 10px; }
  .form-grid { grid-template-columns: 1fr; } .form-grid .span2 { grid-column: auto; }
  .info-grid { grid-template-columns: 1fr 1fr; } .score-band { grid-template-columns: 1fr; } .score-band .stats { grid-template-columns: repeat(2, 1fr); }
  .lists, .notes-edit { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, 1fr); }
  .rank-row { grid-template-columns: minmax(0, 1fr) 70px 44px; } .rank-row .chip { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
#ayq-root { min-height: 100%; height: 100%; }
#view:focus { outline: none; }
.brand-mark { font-size: 1.15rem; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* ---------- إضافات إصدار SharePoint ---------- */
.role-badge { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--warn-bg); color: var(--gold); }
.role-badge.sup { background: var(--info-bg); color: var(--info); }
.who { display: flex; flex-direction: column; gap: 2px; }
.who small { color: var(--on-navy-2); font-size: .75rem; word-break: break-all; }
.tabs-inline { display: flex; gap: 6px; flex-wrap: wrap; }
.src-chip { font-size: .72rem; color: var(--info); }
.inbox-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); align-items: start; }
.inbox-card:last-child { border-bottom: 0; }
.inbox-card .meta { font-size: .82rem; color: var(--ink-3); display: flex; gap: 10px; flex-wrap: wrap; }
.task-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1.1fr) auto; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-2); }
.task-row:last-child { border-bottom: 0; }
.task-row .t b { display: block; } .task-row .t small { color: var(--ink-3); }
.gate { max-width: 460px; margin: 12vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.gate.bad h2 { color: var(--bad); }
.progress-log { text-align: start; font-size: .85rem; color: var(--ink-2); max-height: 220px; overflow-y: auto; background: var(--surface-2); border-radius: 7px; padding: 8px 12px; }
@media screen and (max-width: 860px) { .task-row { grid-template-columns: 1fr; } }
#app { min-height: 100%; height: 100%; }
[hidden] { display: none !important; }

/* ---------- شاشات التشغيل ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi span { font-size: .8rem; color: var(--ink-3); } .kpi b { font: 700 1.6rem/1.2 var(--f-head); font-variant-numeric: tabular-nums; } .kpi small { font-size: .78rem; color: var(--ink-3); min-height: 1.1em; }
.kpi.alert { border-color: var(--bad); } .kpi.alert b { color: var(--bad); }
.alert-list { display: flex; flex-direction: column; }
.alert-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line-2); background: none; text-align: start; cursor: pointer; width: 100%; }
.alert-row:last-child { border-bottom: 0; } .alert-row:hover { background: var(--surface-2); }
.hbars { display: flex; flex-direction: column; gap: 7px; }
.hbar { display: grid; grid-template-columns: 130px minmax(0, 1fr) 36px; gap: 10px; align-items: center; font-size: .86rem; }
.hb-l { color: var(--ink-2); } .hb-t { display: flex; height: 12px; background: var(--muted-bg); border-radius: 6px; overflow: hidden; } .hb-t i { display: block; height: 100%; } .hbar b { text-align: left; }
.grp { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.grp h3 { padding: 10px 16px; font-size: .95rem; border-bottom: 1px solid var(--line-2); }
.grp-att h3 { background: var(--bad-bg); color: var(--bad); } .grp-prog h3 { background: var(--info-bg); color: var(--info); } .grp-done h3 { background: var(--good-bg); color: var(--good); }
tr.row-late td { background: color-mix(in srgb, var(--bad-bg) 55%, transparent); } tr.row-urg td { background: color-mix(in srgb, var(--warn-bg) 55%, transparent); }
.fs { border: 1px solid var(--line-2); border-radius: 8px; padding: 12px 14px 14px; margin: 0 0 12px; } .fs legend { font: 700 .9rem var(--f-head); padding: 0 6px; color: var(--gold); }
.calc { margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.calc-row { display: flex; flex-wrap: wrap; gap: 8px 20px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 14px; }
.calc-row div { display: flex; flex-direction: column; } .calc-row span { font-size: .76rem; color: var(--ink-3); } .calc-row b { font-family: var(--f-head); }
.ins { font-size: .86rem; background: var(--info-bg); color: var(--info); border-radius: 7px; padding: 8px 12px; } .ins.warn { background: var(--warn-bg); color: var(--warn); }
.sla-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
#print-area { display: none; }
@media print {
  body.printing #app, body.printing .toasts, body.printing .modal-bg { display: none !important; }
  body.printing #print-area { display: block; }
  .pr { font: 11px/1.5 var(--f-head); color: #1F3559; }
  .pr-h { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #7E6128; padding-bottom: 6px; margin-bottom: 10px; }
  .pr-h b { display: block; font: 700 16px var(--f-head); } .pr-h span { color: #5b6677; }
  .pr h3 { font: 700 13px var(--f-head); margin: 12px 0 4px; padding: 3px 8px; border-radius: 4px; }
  .pr h3.att { background: #F5E4E0; color: #944B40; } .pr h3.prog { background: #E3ECF5; color: #2E5A88; } .pr h3.done { background: #E7F0E4; color: #417843; }
  .pr table { width: 100%; border-collapse: collapse; } .pr th, .pr td { border: 1px solid #D5D0C6; padding: 3px 5px; text-align: right; vertical-align: top; } .pr th { background: #F4F1EA; }
  .pr tr.late td { background: #FBEDEA; } .pr tr.urg td { background: #FFF6DC; } .pr .kv th { width: 28%; }
  .pr-sum { display: flex; gap: 8px; margin: 6px 0; } .pr-sum div { border: 1px solid #D5D0C6; border-radius: 6px; padding: 4px 10px; } .pr-sum b { display: block; font-size: 14px; }
}
@media screen and (max-width: 1100px) { .kpi-grid, .sla-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media screen and (max-width: 520px) { .hbar { grid-template-columns: 90px minmax(0, 1fr) 30px; } }


/* ================= هوية موقع إيجاز (3.4) =================
   الرموز: كحلي #1F3559 · ذهبي #C7AC74 · حبر ذهبي #7E6128 · أزرق #335792 — الخطوط: Aktiv + Kaff
   الأزرار حبّات (24px) والبطاقات 16px والأيقونات خطّية بسماكة 1.75 */
body { font-weight: 400; line-height: 1.7; }
h1, h2, h3, h4 { font-weight: 500; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
a { color: var(--navy-2); }
:root[data-theme="dark"] a { color: var(--gold); }
.side { background: linear-gradient(175deg, #132544 0%, #1A2F55 60%, #1F3559 100%); }
.brand { padding: 2px 18px 16px; gap: 0; flex-direction: column; align-items: flex-start; }
.brand .logo { height: 46px; width: auto; display: block; }
.brand .logo svg { height: 100%; width: auto; display: block; }
.brand .sub { margin-top: 8px; font-size: .78rem; color: var(--gold-soft); letter-spacing: .02em; }
.nav a { border-radius: 12px; padding: 9px 12px; position: relative; }
.nav a svg { stroke-width: 1.75; }
.nav a.on { background: rgba(199,172,116,.16); color: #F3E6C8; }
.nav a.on::before { content: ""; position: absolute; inset-inline-start: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--gold-soft); }
.nav-group { color: var(--gold-soft); opacity: .85; font-weight: 500; }
.side-foot button { border-radius: 999px; padding: 5px 14px; }
.top { box-shadow: 0 4px 18px rgba(31,53,89,.04); }
.page-head h1 { position: relative; padding-inline-start: 14px; }
.page-head h1::before { content: ""; position: absolute; inset-inline-start: 0; top: .28em; bottom: .28em; width: 4px; border-radius: 4px; background: var(--gold-soft); }
.panel { border-radius: var(--r-card); border-color: var(--line); }
.panel-h { padding: 14px 20px; } .panel-b { padding: 20px; }
.panel-h h2, .panel-h h3 { color: var(--ink); }
.btn { border-radius: var(--r-pill); height: 40px; padding: 0 20px; font-weight: 500; border-width: 1.5px; transition: background-color .2s, color .2s, border-color .2s, box-shadow .2s; }
.btn:hover { border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-900); border-color: var(--navy-900); }
.btn.gold { background: var(--gold-soft); border-color: var(--gold-soft); color: #101E38; } .btn.gold:hover { background: #D4BC8A; border-color: #D4BC8A; }
.btn.sm { height: 32px; padding: 0 14px; font-size: .84rem; }
.btn.ghost:hover { background: var(--muted-bg); border-color: transparent; }
.icon-btn { border-radius: 10px; }
.chip { padding: 2px 12px; font-weight: 500; border: 1px solid transparent; }
.chip.gold, .role-badge { background: #F8F1E6; color: #7E6128; border-color: #E8D9BD; }
.chip.good { border-color: #BFDCCB; } .chip.bad, .chip.crit { border-color: #F2C9C4; } .chip.info { border-color: #D3DDEC; } .chip.warn { border-color: #E8D9BD; }
:root[data-theme="dark"] .chip.gold, :root[data-theme="dark"] .role-badge { background: #33291A; border-color: #5a4a2a; color: var(--gold); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=month], input[type=number], select, textarea { border-radius: 12px; padding: 9px 12px; border-color: var(--line); background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy-2); outline-offset: 1px; border-color: var(--navy-2); }
.seg { border-radius: 999px; padding: 4px; } .seg button { border-radius: 999px; padding: 6px 16px; }
.seg button.on { color: var(--navy); }
.radio-seg label { border-radius: 12px; }
table.t th { background: var(--muted-bg); color: var(--ink-2); font-weight: 500; font-size: .8rem; border-bottom-color: var(--line); }
table.t tr.click:hover td { background: var(--surface-2); }
.code { color: var(--gold); font-weight: 700; }
.bar { height: 8px; } .bar i { background: var(--navy-2); }
.demo-bar { background: #F8F1E6; color: #7E6128; border-bottom: 1px solid #E8D9BD; }
/* بوابة الدخول */
.gate { border-radius: var(--r-card); box-shadow: var(--shadow); }
.gate:has(.logo-lg) { background: linear-gradient(170deg, #132544 0%, #1A2F55 55%, #22406E 100%); border-color: transparent; padding: 40px 28px; }
.gate .logo-lg { width: 190px; max-width: 70%; margin: 0 auto 22px; display: block; }
.gate .logo-lg svg { width: 100%; height: auto; display: block; }
.gate:has(.logo-lg) h2 { color: #fff; } .gate:has(.logo-lg) p { color: rgba(255,255,255,.85); }
.gate:has(.logo-lg) .btn.primary { background: var(--gold-soft); border-color: var(--gold-soft); color: #101E38; height: 46px; }
.gate:has(.logo-lg) .btn.primary:hover { background: #D4BC8A; }
/* التقرير المطبوع */
.sheet-h { background: linear-gradient(170deg, #132544, #1F3559); }
.sheet-h .logo { height: 40px; } .sheet-h .logo svg { height: 100%; width: auto; display: block; }
.sheet { border-radius: var(--r-card); overflow: hidden; }

/* 3.7 — الجوال: صفوف الطلبات كبطاقات */
@media screen and (max-width: 700px) {
  .tbl-wrap table.t thead { display: none; }
  .tbl-wrap table.t, .tbl-wrap table.t tbody, .tbl-wrap table.t tr, .tbl-wrap table.t td { display: block; width: 100%; }
  .tbl-wrap table.t tr[data-rq] { border: 1px solid var(--line, #e3e6ee); border-radius: 12px; margin: 8px 0; padding: 8px 12px; }
  .tbl-wrap table.t tr[data-rq] td { border: 0; padding: 3px 0; text-align: start; }
  .btn.sm { min-height: 40px; }
}

/* 3.7 — التقويم */
.cal-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cal-title { min-width: 140px; text-align: center; font-size: 1.05rem; }
.cal-legend { display: flex; gap: 14px; font-size: .88rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line, #e3e6ee); border-top: 1px solid var(--line, #e3e6ee); }
.cal-dow { background: var(--surface-2, #f3f5fa); text-align: center; padding: 6px 2px; font-size: .8rem; font-weight: 600; }
.cal-cell { background: var(--surface, #fff); min-height: 92px; padding: 4px; display: flex; flex-direction: column; gap: 2px; text-align: start; border: 0; cursor: pointer; font: inherit; color: inherit; }
.cal-cell.cal-off { background: var(--surface-2, #f7f8fb); cursor: default; }
.cal-cell b { font-size: .85rem; }
.cal-cell:focus-visible { outline: 2px solid var(--gold, #c9a24b); outline-offset: -2px; }
.cal-today b { background: var(--navy, #14264b); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: inline-grid; place-items: center; }
.cal-sel { box-shadow: inset 0 0 0 2px var(--gold, #c9a24b); }
.cal-chip { font-size: .7rem; line-height: 1.3; padding: 1px 5px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { font-size: .7rem; opacity: .7; }
.cal-ev { background: #e6eefb; color: #14264b; }
.cal-ses { background: #f4ead2; color: #5a4310; }
.cal-dl { background: #eef1f5; color: #333; }
.cal-late { background: #fbe4e1; color: #8c1d12; }
.cal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cal-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; }
.cal-act { display: flex; gap: 6px; flex-wrap: wrap; }
@media screen and (max-width: 700px) { .cal-cell { min-height: 56px; } .cal-chip { display: none; } .cal-cell:has(.cal-chip)::after { content: '●'; font-size: .6rem; color: var(--gold, #c9a24b); } }
.cal-fu { background: #e8f3ea; color: #1d5a2a; }
.fs-alert { border-color: var(--bad, #b3261e); background: #fff6f5; }
.fs-note { margin: 0 0 8px; font-weight: 600; color: var(--bad, #b3261e); }

/* 3.7 — التنبيهات */
.icon-btn.bell { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: inherit; }
.bell-n { position: absolute; top: 0; inset-inline-start: 0; min-width: 18px; height: 18px; border-radius: 9px; background: var(--bad, #b3261e); color: #fff; font-size: .7rem; display: grid; place-items: center; padding: 0 4px; }
.al-item { cursor: pointer; background: var(--surface-2, #f7f8fb); }
.al-new { background: #fff7e3; box-shadow: inset 3px 0 0 var(--gold, #c9a24b); }
.assign-sum { margin: 8px 0; }

/* 3.7 — شريط دورة العمل التشغيلي */
.ops-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.ops-tile { display: grid; gap: 2px; padding: 14px; border-radius: 16px; background: var(--surface, #fff); border: 1px solid var(--line, #e3e6ee); color: inherit; text-decoration: none; }
.ops-tile:hover, .ops-tile:focus-visible { border-color: var(--gold, #c9a24b); }
.ops-tile.alert { border-color: var(--bad, #b3261e); }
.ops-tile .ot-ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2, #f3f5fa); color: var(--navy, #14264b); }
.ops-tile .ot-ic svg { width: 18px; height: 18px; }
.ops-tile .ot-t { font-size: .85rem; opacity: .8; margin-top: 4px; }
.ops-tile b { font-size: 1.5rem; }
.ops-tile small { font-size: .74rem; opacity: .7; line-height: 1.3; }
@media (max-width: 1100px) { .ops-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .ops-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 3.7 — وضع داكن يدوي (زر التبديل) */
 :root[data-theme="dark"] {
  --navy: #101E38; --navy-2: #22406E; --gold: #D9BC84; --gold-soft: #C7AC74;
  --bg: #0E1830; --surface: #152849; --surface-2: #19305A; --line: #2A4068; --line-2: #223559;
  --ink: #EEF2F8; --ink-2: #B5BDC8; --ink-3: #8A94A2; --on-navy: #F4EFE4; --on-navy-2: #9AA6B4;
  --good: #7DB77E; --good-bg: #1D2F22; --warn: #E0B154; --warn-bg: #33291A; --bad: #E08E80; --bad-bg: #352220;
  --crit: #F08A96; --crit-bg: #3A1D23; --info: #8DB6E2; --info-bg: #1B2B3D; --muted-bg: #1E2A38; --focus: #E0B154;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark; } 
 :root[data-theme="dark"] .btn.primary { background: var(--gold); border-color: var(--gold); color: #1a1205; } 
 :root[data-theme="dark"] .bar i:not(.good):not(.warn):not(.bad) { background: var(--gold); } 

/* 3.7 — صلاحية العمل لكل موظف */
.perm-set { display: inline-flex; gap: 4px; }
.perm-ic { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line, #e3e6ee); background: var(--surface, #fff); color: inherit; display: inline-grid; place-items: center; cursor: pointer; }
.perm-ic.on { background: var(--navy, #14264b); color: #fff; border-color: var(--navy, #14264b); }
.perm-ic:disabled { opacity: .45; cursor: not-allowed; }

/* 3.8 — صفحات العمل الشخصية */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kv-grid > div { display: grid; gap: 2px; }
.my-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.my-tiles .ico { color: var(--gold, #c9a24b); } .my-tiles .ico svg { width: 22px; height: 22px; }
.my-tiles .big { font-size: 1.7rem; font-weight: 800; }
.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.work-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.seg .n { opacity: .65; font-size: .8em; }
@media (max-width: 860px) { .my-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .work-grid { grid-template-columns: 1fr; } }
.alert-row, .alert-row:hover { text-decoration: none; color: inherit; }

.qe-box { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line, #e3e6ee); } .qe-box h3 { margin: 0 0 8px; }
