/* ==========================================================================
   المنظومة الموحدة — التصميم الموحد
   ========================================================================== */
:root {
  --bg: #f3f6f9; --surface: #ffffff; --surface-2: #f7f9fb; --ink: #13253a; --muted: #5b6d80; --line: #dfe6ee; --line-2: #c9d4e0;
  --brand: #0f5e73; --brand-2: #0b4757; --brand-soft: #e3f1f4; --gold: #b8862b; --pos: #1d7a4c; --neg: #b23a35; --warn: #b7791f; --link: #1d5fa8;
  --side: #0f2236; --side-2: #142d45; --side-ink: #d6e2ee; --side-muted: #8aa3bb;
  --s0: #476582; --s1: #1f7a8c; --s2: #6b4fa3; --s3: #2f6fb7; --s4: #c0612b; --s5: #14806b; --s6: #8a6d1f; --s7: #b03a48; --s8: #0f5e73; --s9: #55627a; --s10: #4b5563;
  --r: 12px; --shadow: 0 1px 2px rgba(16, 40, 64, .05), 0 4px 18px rgba(16, 40, 64, .06);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.65 var(--font); direction: rtl; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); }
.num, .n { direction: ltr; unicode-bidi: isolate; }

/* ---------------- الهيكل ---------------- */
#side { position: fixed; inset: 0 0 0 auto; width: 292px; background: linear-gradient(180deg, var(--side), #0a1828); color: var(--side-ink); display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; gap: 11px; align-items: center; padding: 16px 16px 12px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.brand .logo { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, #1d8aa3, #0f5e73 55%, #b8862b); display: grid; place-items: center; font-weight: 700; font-size: 20px; color: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, .25); flex: none; }
.brand b { display: block; font-size: 16.5px; color: #fff; letter-spacing: .2px; }
.brand small { display: block; color: var(--side-muted); font-size: 11.5px; line-height: 1.4; }
.sector-chip { margin: 10px 14px 4px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); display: flex; gap: 8px; align-items: center; cursor: pointer; text-align: right; color: inherit; width: calc(100% - 28px); }
.sector-chip:hover { background: rgba(255, 255, 255, .1); }
.sector-chip .ic { font-size: 19px; }
.sector-chip small { display: block; color: var(--side-muted); font-size: 11px; }
.sector-chip b { display: block; font-size: 12.5px; font-weight: 600; color: #fff; }
#nav { flex: 1; overflow-y: auto; padding: 6px 8px 18px; scrollbar-width: thin; scrollbar-color: #2a4560 transparent; }
.stg { margin-top: 6px; }
.stg > button { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 8px; border-radius: 9px; cursor: pointer; color: #e9f0f7; font-weight: 600; font-size: 13px; }
.stg > button:hover { background: rgba(255, 255, 255, .05); }
.stg > button .no { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; color: #fff; flex: none; }
.stg > button .cnt { margin-inline-start: auto; font-size: 11px; color: var(--side-muted); font-weight: 500; }
.stg > button .car { font-size: 10px; color: var(--side-muted); transition: transform .15s; }
.stg.closed > button .car { transform: rotate(90deg); }
.stg ul { list-style: none; margin: 2px 0 4px; padding: 0 0 0 0; }
.stg.closed ul { display: none; }
.stg li a { display: flex; gap: 7px; align-items: center; padding: 5px 10px 5px 8px; margin-inline-start: 22px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-size: 12.8px; line-height: 1.45; border-inline-start: 2px solid transparent; }
.stg li a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.stg li a.on { background: rgba(29, 138, 163, .22); color: #fff; border-inline-start-color: #3cb7cf; }
.stg li a .tag { font-size: 10px; padding: 0 6px; border-radius: 99px; background: rgba(184, 134, 43, .25); color: #f3d394; margin-inline-start: auto; white-space: nowrap; }
.stg li a .tag.mod { background: rgba(255, 255, 255, .08); color: var(--side-muted); }
.sidefoot { padding: 10px 14px; border-top: 1px solid rgba(255, 255, 255, .07); font-size: 11.5px; color: var(--side-muted); display: flex; justify-content: space-between; gap: 8px; }
.sidefoot .live { color: #46d39a; }

.shell { margin-right: 292px; min-height: 100vh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 9px 20px; min-height: 58px; }
.crumb { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.crumb .st { font-size: 11.5px; padding: 2px 9px; border-radius: 99px; color: #fff; white-space: nowrap; }
.crumb b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb .src { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sel, .btn { border: 1px solid var(--line-2); background: var(--surface); border-radius: 9px; padding: 6px 11px; cursor: pointer; font-size: 13px; }
.sel { max-width: 260px; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.pri { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.pri:hover { background: var(--brand-2); color: #fff; }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--neg); border-color: #e7c3c1; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 5px 11px; border-radius: 99px; border: 1px solid; cursor: pointer; white-space: nowrap; background: none; }
.status.ok { color: var(--pos); border-color: #b9dcc8; background: #eff8f2; }
.status.bad { color: var(--neg); border-color: #edc4c1; background: #fdf1f0; }
.status.busy { color: var(--warn); border-color: #ecd6ad; background: #fdf7ea; }
#menuBtn { display: none; }

#main { flex: 1; min-height: 0; position: relative; }
.page { max-width: 1320px; margin: 0 auto; padding: 22px 24px 60px; }
#frames { position: absolute; inset: 0; display: none; }
/* صفحة ★ معروضة فوق محتوى البرنامج وبجانب قائمته الجانبية (right يُضبط من موضع القائمة) */
body.jm-embed #view { position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow: auto; z-index: 3; background: var(--bg); box-shadow: -1px 0 0 var(--line); }
#frames.on { display: block; }
#frames iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); display: none; }
#frames iframe.on { display: block; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; background: var(--bg); z-index: 2; }
.loading .spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- مكونات ---------------- */
h1 { font-size: 23px; margin: 0 0 4px; letter-spacing: -.2px; }
h2 { font-size: 16.5px; margin: 0 0 10px; }
h3 { font-size: 14.5px; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 18px; max-width: 900px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 14px; }
.card h2 small, .card h3 small { color: var(--muted); font-weight: 500; font-size: 12px; margin-inline-start: 6px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 15px; box-shadow: var(--shadow); cursor: default; position: relative; overflow: hidden; }
.kpi[data-go] { cursor: pointer; }
.kpi[data-go]:hover { border-color: var(--brand); }
.kpi small { display: block; color: var(--muted); font-size: 12px; }
.kpi b { display: block; font-size: 21px; margin: 2px 0 1px; letter-spacing: -.3px; }
.kpi .sub { font-size: 11.5px; color: var(--muted); }
.kpi::after { content: ""; position: absolute; inset: 0 0 auto auto; width: 4px; height: 100%; background: var(--k, var(--brand)); opacity: .85; }
.hero { background: linear-gradient(120deg, #0f2a40, #0f5e73 60%, #157f8f); color: #fff; border-radius: 16px; padding: 22px 24px; position: relative; overflow: hidden; box-shadow: 0 10px 30px rgba(15, 50, 70, .25); }
.hero::after { content: ""; position: absolute; inset: auto -60px -80px auto; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle, rgba(184, 134, 43, .35), transparent 65%); }
.hero .eyebrow { font-size: 12px; color: #9fd3de; letter-spacing: .3px; }
.hero h1 { color: #fff; font-size: 25px; margin: 4px 0; }
.hero p { margin: 0; color: #cfe6ec; }
.hero .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; position: relative; z-index: 1; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 10px; border-radius: 99px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16); color: #fff; }
.pchip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 2px 9px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-2); border: 1px solid #c6e1e7; cursor: pointer; white-space: nowrap; margin: 2px; }
.pchip:hover { background: var(--brand); color: #fff; }
.pchip.owner { background: #fff6e5; border-color: #ecd29b; color: #7a5410; font-weight: 600; }
.badge { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; }
.badge.ok { background: #e7f5ec; color: var(--pos); } .badge.bad { background: #fbeceb; color: var(--neg); } .badge.info { background: #e9f1fb; color: #1d5fa8; } .badge.warn { background: #fdf3e1; color: #8a5a10; }

/* سلسلة المراحل */
.pipe { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.pst { all: unset; box-sizing: border-box; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 11px 10px; position: relative; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pst:hover { border-color: var(--c); transform: translateY(-1px); }
.pst .n { width: 22px; height: 22px; border-radius: 7px; background: var(--c); color: #fff; font-size: 12px; display: grid; place-items: center; }
.pst b { font-size: 12.5px; line-height: 1.35; }
.pst .v { font-size: 17px; font-weight: 700; color: var(--c); direction: ltr; text-align: right; }
.pst small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.pst:not(:last-child)::after { content: "‹"; position: absolute; left: -9px; top: 50%; transform: translateY(-50%); color: var(--line-2); font-size: 18px; font-weight: 700; }

/* الجداول والنماذج */
.tw { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { background: var(--surface-2); color: #3a4f66; font-weight: 600; text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: 7px 10px; border-bottom: 1px solid #edf1f5; vertical-align: middle; }
table.t tr:hover td { background: #fafcfd; }
table.t td.n, table.t th.n { text-align: left; direction: ltr; white-space: nowrap; }
table.t tr.tot td { font-weight: 700; background: var(--surface-2); }
.in { border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; background: #fff; width: 100%; min-width: 0; }
.in:focus { outline: 2px solid #9fd3de; border-color: var(--brand); background: #fff; }
.in.num { direction: ltr; text-align: left; }
.in[readonly], .in:disabled { background: #f1f3f6; color: #4a5568; border-color: #e1e5ea; cursor: default; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12.5px; color: #3a4f66; font-weight: 600; }
.field > small { font-size: 11.5px; color: var(--muted); }
.feeds { margin-top: 10px; font-size: 12px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.note { font-size: 12.5px; color: var(--muted); }
.callout { border: 1px solid #c4d6ee; border-inline-start: 4px solid #2f6fb7; background: #f3f8ff; color: #1c3d6b; border-radius: 10px; padding: 10px 13px; font-size: 13px; }
.callout.warn { border-color: #ecd6ad; border-inline-start-color: var(--warn); background: #fdf8ec; color: #6b4a10; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.sticky { position: sticky; top: 74px; }
.live-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.live-row:last-child { border-bottom: 0; }
.live-row b { direction: ltr; }
.checks li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid #edf1f5; }
.checks { list-style: none; margin: 0; padding: 0; }
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 4px; vertical-align: -1px; }

/* القطاعات */
.sec-card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 15px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.sec-card.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }
.sec-card .ic { font-size: 26px; }
.sec-card h3 { margin: 0; }
.sec-card p { margin: 0; color: var(--muted); font-size: 12.8px; }
.sec-meta { display: flex; flex-wrap: wrap; gap: 4px; }
pre.code { background: #0f2236; color: #d6e2ee; border-radius: 10px; padding: 12px 14px; font-size: 12px; direction: ltr; text-align: left; overflow-x: auto; }

/* خريطة الترابط */
.flow { width: 100%; height: auto; }
.mapgrp td:first-child { font-weight: 600; color: var(--muted); }

dialog { border: 0; border-radius: 16px; padding: 0; box-shadow: 0 30px 80px rgba(10, 30, 50, .35); max-width: 560px; width: 92vw; }
dialog::backdrop { background: rgba(10, 25, 40, .45); }
.dlg { padding: 20px 22px; }
.dlg h2 { margin-bottom: 6px; }
.dlg .acts { display: flex; gap: 8px; justify-content: flex-start; margin-top: 16px; }
.toast { position: fixed; bottom: 18px; left: 18px; background: #0f2236; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; display: none; z-index: 99; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }

.md h1 { font-size: 22px; } .md h2 { font-size: 17px; margin-top: 18px; } .md table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 13px; } .md td, .md th { border: 1px solid var(--line); padding: 6px 9px; text-align: right; } .md th { background: var(--surface-2); }

@media (max-width: 1180px) { .pipe { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g5, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  #side { transform: translateX(100%); transition: transform .2s; box-shadow: -20px 0 40px rgba(0, 0, 0, .3); }
  body.nav-open #side { transform: none; }
  .shell { margin-right: 0; }
  #menuBtn { display: inline-block; }
  .page { padding: 16px 16px 50px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top { flex-wrap: wrap; padding: 8px 16px; }
  .crumb .src { display: none; }
}
@media print { #side, .top { display: none !important; } .shell { margin: 0; } .card, .kpi { box-shadow: none; } }

/* ---------------- تنبيه عائم ---------------- */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #12324f; color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 13.5px; box-shadow: 0 12px 30px rgba(10, 30, 50, .25); z-index: 100; display: none; max-width: calc(100% - 32px); }

/* ---------------- المحاور الثلاثة في القائمة ---------------- */
.axis { margin: 16px 8px 2px; padding: 0 8px 4px; border-inline-start: 3px solid var(--c); }
.axis b { display: block; color: #fff; font-size: 13.5px; letter-spacing: .2px; }
.axis small { display: block; color: var(--side-muted); font-size: 11px; line-height: 1.4; }

/* ---------------- لوحة مؤشرات المشروع ---------------- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.head .eyebrow { font-size: 12.5px; color: var(--muted); }
.head h1 { font-size: 25px; margin: 2px 0; }
.head p { margin: 0; color: var(--muted); }
.head-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.head-acts .btn { padding: 8px 14px; font-size: 13.5px; }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid.g6 + .grid, .grid.g3 + .grid { margin-top: 14px; }
.grid.g6 { margin-bottom: 14px; }
.axcard { position: relative; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 9%, #fff), color-mix(in srgb, var(--c) 3%, #fff)); border: 1.5px solid color-mix(in srgb, var(--c) 45%, #fff); border-radius: 16px; padding: 0 16px 10px; box-shadow: 0 2px 4px rgba(16, 40, 64, .05), 0 10px 26px color-mix(in srgb, var(--c) 16%, transparent); min-width: 0; overflow: hidden; }
.axcard header { display: flex; align-items: center; justify-content: space-between; margin: 0 -16px 8px; padding: 12px 16px; background: var(--c); }
.axcard header b { font-size: 16.5px; color: #fff; letter-spacing: .2px; }
.axcard header .btn { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .45); color: #fff; }
.axcard header .btn:hover { background: #fff; color: var(--c); }
.ax-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid color-mix(in srgb, var(--c) 14%, #fff); color: var(--ink); text-decoration: none; }
.ax-row:last-child { border-bottom: 0; }
.ax-row:hover { background: rgba(255, 255, 255, .7); }
.ax-row b { color: color-mix(in srgb, var(--c) 70%, #13253a); }
.ax-row span { font-size: 13px; }
.ax-row small { display: block; font-size: 11px; color: var(--muted); }
.ax-row b { font-size: 15px; white-space: nowrap; }

/* ---------------- المشاريع والنماذج ---------------- */
.newp { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) auto; gap: 12px; align-items: end; }
.row-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
td.acts { white-space: nowrap; }
.tpl-g { margin: 18px 0 10px; color: var(--muted); font-size: 13.5px; }
.tpl-g:first-of-type { margin-top: 4px; }
.tpl { border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.tpl:hover { border-color: var(--brand); background: #fff; }
.tpl-h { display: flex; gap: 10px; align-items: center; }
.tpl-h .ic { font-size: 26px; }
.tpl-h b { display: block; font-size: 14px; }
.tpl-h small { color: var(--muted); font-size: 11.5px; }
.tpl p { margin: 0; color: var(--muted); font-size: 12.5px; flex: 1; }
.tpl .btn { align-self: flex-start; }
.fieldrow { display: flex; gap: 6px; }
.fieldrow .btn { white-space: nowrap; }
@media (max-width: 1180px) { .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .newp { grid-template-columns: 1fr; } }
.status[hidden] { display: none !important; }

.top { display: block; padding: 0; }
.portal-links:not([hidden]) { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 18px; padding: 4px 20px; border-bottom: 1px solid var(--line); font-size: 13px; }
.portal-links a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.project-bar { display: flex; align-items: center; gap: 12px; padding: 9px 20px; min-height: 58px; }
#menuBtn { display: inline-block; }
#workspaces { display: flex; gap: 8px; overflow-x: auto; padding: 0 20px; }
#workspaces button { flex: 0 0 auto; padding: 10px 12px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 14px; }
#workspaces button[aria-pressed="true"] { border-bottom-color: var(--brand); color: var(--brand); font-weight: 700; }
#workspaces button:hover { color: var(--brand); }
body.module-open #side, body.nav-collapsed #side { display: none; }
body.module-open .shell, body.nav-collapsed .shell { margin-right: 0; }
@media (max-width: 860px) {
  body.nav-collapsed.nav-open:not(.module-open) #side { display: flex; }
  .portal-links:not([hidden]) { padding-inline: 12px; }
  .project-bar { flex-wrap: wrap; padding: 8px 12px; }
  #workspaces { padding-inline: 12px; }
}

#diskStatus:not([hidden]) { color: var(--muted); font-size: 12px; }

.review-steps { display: grid; gap: 10px; }
.review-step { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.review-step:last-child { border-bottom: 0; }
.review-step p { margin: 4px 0 0; color: var(--muted); }
.review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.review-actions label { font-size: 13px; }

#npHospitality[hidden] { display: none; }

/* خانة تحمل تقدير المنظومة (لم يُدخل رقم العميل بعد) */
.in.est{color:#0e7490;font-style:italic}
.in.dept { margin-top: 4px; padding: 3px 8px; font-size: 12px; color: #4a5f77; }

/* ---------- الدراسة المتكاملة (المستند النهائي) ---------- */
.sd-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.sd-theme { text-align: right; background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; color: var(--ink); display: flex; flex-direction: column; gap: 4px; }
.sd-theme:hover { border-color: var(--line-2); }
.sd-theme[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sd-theme b { font-size: 14px; }
.sd-theme small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.sd-sw { display: flex; gap: 0; height: 8px; border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.sd-sw i { flex: 1; }
.sd-pal { max-width: 340px; margin-top: 12px; }
.sd-secs { margin-top: 14px; }
.sd-secs summary { cursor: pointer; font-weight: 600; }
.sd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; margin-top: 10px; }
.sd-sec { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.sd-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.sd-hint { margin: 8px 0 0; font-size: 12px; }
.sd-frame { width: 100%; height: calc(100vh - 140px); min-height: 640px; border: 1px solid var(--line); border-radius: var(--r); background: #e4e9ee; display: block; }
h3.sub { font-size: 14px; margin: 16px 0 8px; color: var(--brand); border-top: 1px solid var(--line); padding-top: 12px; }
h3.sub:first-of-type { border-top: 0; padding-top: 0; }

/* ---------- مكتبة صور المشروع (بطاقة المشروع) ---------- */
.jm-imgs .img-drop { border: 1.5px dashed var(--line-2); border-radius: 10px; background: var(--surface-2); padding: 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; text-align: center; transition: border-color .15s, background .15s; }
.jm-imgs .img-drop.over { border-color: var(--brand); background: var(--brand-soft); }
.jm-imgs .img-drop b { font-size: 14px; color: var(--ink); }
.jm-imgs .img-drop span { color: var(--muted); font-size: 13px; }
.jm-imgs .img-drop small { flex-basis: 100%; color: var(--muted); font-size: 11.5px; }
.img-slots { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 6px; }
.img-slot { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 3px 11px 3px 9px; font-size: 12px; color: var(--muted); }
.img-slot i { font-style: normal; font-size: 11px; }
.img-slot small { color: var(--muted); font-size: 11px; border-inline-start: 1px solid var(--line); padding-inline-start: 6px; }
.img-slot.on { border-color: #b9dcc8; background: #eef8f2; color: var(--pos); }
.img-slot.on i { color: var(--pos); }
#jmImgMsg:empty { display: none; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 10px; align-items: start; }
.img-it { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.img-th { position: relative; aspect-ratio: 16 / 10; background: #e9eef3; display: grid; place-items: center; }
.img-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-it.logo .img-th { background: repeating-conic-gradient(#eef2f6 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.img-it.logo .img-th img { object-fit: contain; padding: 14px; }
.img-th.missing::after { content: 'الملف غير متاح على هذا الجهاز'; font-size: 12px; color: var(--neg); }
.img-role { position: absolute; top: 8px; right: 8px; background: rgba(15, 34, 54, .82); color: #fff; font-size: 11.5px; padding: 2px 9px; border-radius: 99px; }
.img-pend { position: absolute; top: 8px; left: 8px; background: #fdf3e1; color: #8a5a10; font-size: 12px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.img-meta { padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.img-meta label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.img-meta label > span { font-size: 11.5px; color: #3a4f66; font-weight: 600; }
.img-meta .in { padding: 4px 7px; font-size: 12.5px; width: 100%; }
.img-meta .cap { grid-column: 1 / -1; }
.img-fixed { font-size: 12px; color: var(--muted); padding: 5px 0; }
.img-acts { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.img-acts span { display: flex; gap: 4px; }
.img-how { margin-top: 12px; font-size: 12px; }
.sd-imgs { margin-top: 14px; max-width: 620px; }
.sd-imgs .btn { margin-top: 8px; }
.img-preset { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin-bottom: 10px; }
.img-preset label { display: flex; flex-direction: column; gap: 3px; min-width: 220px; flex: 1; }
.img-preset label > span { font-size: 12px; color: #3a4f66; font-weight: 600; }
.img-preset small { flex-basis: 100%; font-size: 11.5px; color: var(--muted); }

/* التقارير والدراسة المتكاملة: اختيار التقرير */
.sd-all { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: right; background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; }
.sd-all b { font-size: 15px; } .sd-all small { color: var(--muted); font-size: 12px; }
.sd-all[aria-pressed="true"], .sd-ax[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: var(--brand-soft); }
.sd-axes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.sd-ax { display: flex; align-items: center; gap: 8px; text-align: right; background: var(--surface); border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 11px; cursor: pointer; font: inherit; color: inherit; }
.sd-ax:hover, .sd-all:hover { border-color: var(--line-2); }
.sd-ax .ax-i { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 14px; flex: none; }
.sd-ax .ax-n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sd-ax b { font-size: 13px; font-weight: 600; }
.sd-panel h3.sub { margin: 14px 0 8px; }
.sd-pv { margin: 18px 0 8px; font-size: 16px; }
.sd-more { margin-top: 16px; }
.sd-more summary { cursor: pointer; } .sd-more summary small { color: var(--muted); margin-inline-start: 6px; }
.sd-more .grid { margin-top: 12px; }
.sd-mo { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.sd-mo h3 { font-size: 14px; margin: 0 0 4px; }
/* الشروح المقالية للفصول */
.sd-notes summary { cursor: pointer; }
.sd-notes .nt-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 8px 0 12px; }
.sd-notes .nt-bar .field { min-width: 240px; margin: 0; }
.sd-notes .nt-item { border: 1px solid var(--line, #dbe3ea); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: var(--card, #fff); }
.sd-notes .nt-row { display: flex; gap: 6px; margin-bottom: 6px; }
.sd-notes .nt-row input { flex: 1; }
.sd-notes .nt-at { width: auto; }
.sd-notes textarea { width: 100%; resize: vertical; line-height: 1.8; font-family: inherit; }
/* نسخة التقرير وملخص المستند */
.sd-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sd-mode { text-align: right; padding: 12px 14px; border: 1.5px solid var(--line, #dbe3ea); border-radius: 12px; background: var(--card, #fff); cursor: pointer; font: inherit; color: inherit; }
.sd-mode b { display: block; margin-bottom: 3px; }
.sd-mode small { color: var(--mute, #64748b); line-height: 1.6; }
.sd-mode[aria-pressed="true"] { border-color: var(--pri, #0f5e73); background: var(--tint, #eef5f8); box-shadow: inset 0 0 0 1px var(--pri, #0f5e73); }
.sd-sum { display: grid; grid-template-columns: 2fr 1.4fr 1fr; gap: 10px; margin: 14px 0 10px; padding: 12px 14px; border-radius: 12px; background: var(--tint, #eef5f8); }
.sd-sum small { display: block; color: var(--mute, #64748b); font-size: 12px; }
.sd-sum b { font-size: 15px; }
@media (max-width: 700px) { .sd-modes, .sd-sum { grid-template-columns: 1fr; } }

/* فصول الدراسة: إضافة وحذف (core/chapters.js) */
.sd-chaps { margin-top: 16px; }
.sd-chaps .nt-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 10px; }
.sd-chaps .ch-list { display: flex; flex-direction: column; gap: 6px; }
.sd-chaps .ch-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line, #dbe3ea); border-radius: 10px; background: var(--card, #fff); }
.sd-chaps .ch-row b { flex: 1; font-size: 14px; }
.sd-chaps .ch-n { min-width: 26px; font-weight: 700; color: var(--pri, #1d62a0); text-align: center; }
.sd-chaps .ch-tag { font-size: 11.5px; color: var(--mut, #6b7785); }
.sd-chaps .ch-row.is-custom { border-color: var(--pri, #1d62a0); border-inline-start-width: 4px; }
.sd-chaps .ch-row.is-off b, .sd-chaps .ch-row.is-idle b { color: var(--mut, #6b7785); text-decoration: line-through; font-weight: 500; }
.sd-chaps .ch-row.is-idle b { text-decoration: none; }
.sd-chaps .ch-edit { border: 1px dashed var(--pri, #1d62a0); border-radius: 10px; padding: 12px; margin: 0 0 6px; }
.sd-chaps .ch-edit textarea { width: 100%; font-family: inherit; line-height: 1.7; }
.sd-chaps .ch-help b { direction: ltr; unicode-bidi: isolate; }
/* المتغيرات الحية في الشروح المقالية والفصول المضافة */
.lv-box { border: 1px dashed var(--line, #c9d5df); border-radius: 10px; padding: 8px 10px; margin: 8px 0 12px; background: var(--card, #fff); }
.lv-box summary { cursor: pointer; }
.lv-box .lv-q { max-width: 320px; margin: 6px 0; }
.lv-box .lv-g { margin: 6px 0; }
.lv-box .lv-g > b { display: block; font-size: 12px; opacity: .75; margin-bottom: 4px; }
.lv-box .lv-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.lv-chip { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line, #dbe3ea); background: var(--bg, #f6f8fa); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; color: inherit; }
.lv-chip:hover { border-color: var(--pri, #0b6e99); }
.lv-chip i { font-style: normal; font-weight: 700; color: var(--pri, #0b6e99); unicode-bidi: isolate; }
.lv-box code { background: var(--bg, #f1f4f7); padding: 0 4px; border-radius: 4px; }
/* مفتاح القراءات التحليلية تحت كل نسخة */
.sd-reads { margin-top: 6px; }
.sd-rd { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px dashed var(--line, #dbe3ea); border-radius: 10px; background: var(--card, #fff); cursor: pointer; font: inherit; font-size: 12.5px; color: var(--mute, #64748b); text-align: right; }
.sd-rd .sw { flex: 0 0 30px; height: 16px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background .2s; }
.sd-rd .sw::after { content: ''; position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: right .2s; }
.sd-rd.on { color: inherit; border-style: solid; }
.sd-rd.on .sw { background: var(--pri, #0f5e73); }
.sd-rd.on .sw::after { right: 16px; }
.sd-rd b { color: var(--pri, #0f5e73); }
.sd-rd:not(.on) b { color: #b45309; }
/* ===== بطاقة المشروع: لوحة الأثر مثبتة أعلى الصفحة + بطاقات بعرض الصفحة مضغوطة ===== */
.live-bar { position: sticky; top: calc(var(--topH, 58px) + 4px); z-index: 15; padding: 8px 12px; margin: 0 0 12px; border-color: #b9c9dc; box-shadow: 0 4px 14px rgba(15, 34, 54, .12); }
.live-bar .lb-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 6px; }
.live-bar h3 { margin: 0; font-size: 14px; }
.live-bar .lb-head small { color: var(--muted); font-size: 11px; }
.live-bar .lb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 4px 6px; }
.live-bar .lb-inv { margin-top: 4px; padding-top: 4px; border-top: 1px dashed var(--line); }
.lb-chip { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 3px 8px; background: #f4f8fc; border: 1px solid transparent; border-radius: 8px; min-width: 0; font: inherit; color: inherit; text-align: right; cursor: pointer; }
.lb-chip:hover, .lb-chip:focus-visible { border-color: var(--brand, #0b6e99); }
.lb-chip span { font-size: 10.5px; color: #4a5f77; line-height: 1.25; }
.lb-chip b { font-size: 12.5px; direction: rtl; unicode-bidi: plaintext; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* صفان فقط: نتائج المشروع في صف، والاستثمار والتمويل في صف */
@media (min-width: 861px) {
  .live-bar .lb-grid { grid-template-columns: repeat(9, minmax(0, 1fr)); }
  .live-bar .lb-grid.lb-inv { grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.6fr); }
  .live-bar .lb-inv .lb-chip.wide { grid-column: auto; }
  .lb-chip { padding: 3px 6px; }
  .lb-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
.lb-chip.inv { background: #eef6ee; }
.lb-chip.tot { background: #e3eefb; border-color: #9ec0e6; }
.lb-chip.wide { grid-column: span 2; }
.core-stack { display: block; }
.core-stack > .card { width: 100%; padding: 10px 14px; }
.core-stack > .card + .card { margin-top: 10px; }
.core-stack .card h2 { font-size: 15px; margin: 0 0 8px; }
.core-stack .card h3.sub { font-size: 13px; margin: 10px 0 6px; }
.core-stack .fields { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 7px 10px; }
/* المجموعات القليلة (حتى 6 مربعات بلا حقل بعرض كامل) تُضم في صف واحد على الشاشات العريضة */
@media (min-width: 1000px) {
  .fields:not(:has(> [style*="grid-column"])):has(> :last-child:nth-child(2)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields:not(:has(> [style*="grid-column"])):has(> :last-child:nth-child(3)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fields:not(:has(> [style*="grid-column"])):has(> :last-child:nth-child(4)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .fields:not(:has(> [style*="grid-column"])):has(> :last-child:nth-child(5)) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .fields:not(:has(> [style*="grid-column"])):has(> :last-child:nth-child(6)) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.core-stack .field { gap: 2px; }
.core-stack .field > span { font-size: 12px; }
.core-stack .field > small { font-size: 10.5px; line-height: 1.25; }
.core-stack .in { padding: 3px 7px; font-size: 13px; }
.core-stack table.t th, .core-stack table.t td { padding: 4px 8px; }
.core-stack .note { margin: 6px 0 0; font-size: 12px; }
/* على الشاشات الصغيرة: اللوحة لا تُثبَّت حتى لا تحجب الحقول */
@media (max-width: 860px) { .live-bar { position: static; } .live-bar .lb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print { .live-bar { position: static; box-shadow: none; } }

/* محور الدراسة الهندسية: عنوان صفحاته أعلى القائمة الجانبية */
.stg .stg-t { margin: 4px 10px 4px; font-size: 12px; font-weight: 700; color: #c9d6e6; }
.eng-stg .stg-t { color: #e6cfa9; }
.eng-stg { border-bottom: 1px solid rgba(255,255,255,.08); padding-bottom: 6px; margin-bottom: 4px; }
/* ===== حزمة 9 ===== */

/* ===== حزمة 9 ===== */
/* شريط علوي أضيق: صف الأزرار وصف المحاور متلاصقان */
.top { min-height: 0 !important; }
.portal-links:not([hidden]) { padding: 0 16px !important; font-size: 12px !important; line-height: 1.5 !important; }
.project-bar { min-height: 0 !important; padding: 2px 16px !important; gap: 6px !important; }
.project-bar .btn, .project-bar .sel { padding-top: 3px !important; padding-bottom: 3px !important; }
#workspaces { padding-top: 0 !important; padding-bottom: 2px !important; }
#workspaces button { padding: 4px 11px !important; }
.crumb .st { display: none !important; }
/* الشريط العلوي يقف قبل القائمة الجانبية، والقائمة من أول الصفحة لآخرها */
body.module-open .top { margin-right: var(--jmside, 272px) !important; }
body.module-open #frames { position: fixed !important; inset: 0 !important; z-index: 10 !important; }
/* بطاقة المشروع داخل القائمة الجانبية */
#secChip.sector-chip {
  background: rgba(255, 255, 255, .04) !important;
  border: 1px solid rgba(255, 255, 255, .10) !important;
  border-radius: 10px !important;
  padding: 6px 10px !important;
  box-shadow: none !important;
}
#secChip .ic {
  background: rgba(60, 183, 207, .16) !important;
  border-radius: 8px !important;
  width: 30px !important; height: 30px !important;
  display: grid !important; place-items: center !important;
}
#secChip .ic svg, #secChip .ic img { width: 18px !important; height: 18px !important; }

/* Native study pages use the same navigation rhythm as embedded financial pages. */
@media screen and (min-width: 901px) {
  body:not(.module-open) #side { width: 272px; }
  body:not(.module-open):not(.nav-collapsed) > .shell { margin-right: 272px; }
}
@media screen {
  #side { background: var(--jm-panel, linear-gradient(180deg, #0f2236, #0a1528)); }
  #side .brand { padding: 22px 20px 16px; min-height: 100px; border: 0; }
  #side .brand b { font-size: 15px; line-height: 1.35; }
  #side .brand small { font-size: 11.5px; line-height: 1.5; }
  #side #nav { padding: 4px 12px 18px; }
  #side .stg > button { padding: 6px 10px; font-size: 11.5px; color: var(--jm-accent, #f3d394); }
  #side .stg > button .no { width: 8px; height: 8px; font-size: 0; border-radius: 50%; }
  #side .stg li a { margin-inline-start: 0; min-height: 31px; padding: 6px 10px; font-size: 12.8px; line-height: 1.5; font-weight: 600; }
  #side .stg li a.on { background: color-mix(in srgb, var(--jm-accent, #3cb7cf) 16%, transparent); border: 0; box-shadow: inset -3px 0 0 var(--jm-accent, #3cb7cf); }
}

/* Three stable rows: portal links/status, project controls, then workspaces. */
.top .portal-links:not([hidden]) { flex-wrap: nowrap; overflow-x: auto; gap: 16px; align-items: center; }
.top .portal-links > a { flex: 0 0 auto; white-space: nowrap; }
.top .portal-links #diskStatus:not([hidden]) { margin-inline-start: auto; flex: 0 0 auto; white-space: nowrap; font-size: 11px; }
.top .project-bar { flex-wrap: nowrap !important; overflow-x: auto; align-items: center; }
.top .project-bar > :is(button,select) { flex: 0 0 auto; white-space: nowrap; }
.top .project-bar #projSel { width: clamp(160px, 19vw, 240px); min-width: 160px; }
.top .project-bar .crumb { flex: 1 1 140px; min-width: 70px; overflow: hidden; white-space: nowrap; flex-wrap: nowrap; }
.top .project-bar .crumb :is(b,.src) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .project-bar .tools { flex: 0 0 auto; flex-wrap: nowrap; gap: 6px; }
.top .project-bar .tools > * { flex: 0 0 auto; white-space: nowrap; }
.top #workspaces { flex-wrap: nowrap; }
@media (max-width: 600px) { .top .project-bar .crumb { display: none; } }

/* Match the gap above dashboard KPIs to the 14px gap before the axis cards. */
.page.project-dashboard { padding-top: 14px !important; }
.page.project-dashboard > .grid:first-child { margin-top: 0; }

/* Project-card labels and their controls share one line. */
.project-core .core-stack .fields { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px 12px; align-items: start; }
.project-core .core-stack .field {
  display: grid; grid-template-columns: fit-content(140px) minmax(0,1fr);
  align-items: center; align-content: start; gap: 3px 6px; min-width: 0;
}
.project-core .core-stack .field > span:first-child { margin: 0; line-height: 1.4; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.project-core .core-stack .field > :is(input,select,textarea,.fieldrow) { grid-column: 2; width: 100%; min-width: 0; }
.project-core .core-stack .field > small { display: none; }

/* Location controls form one RTL row, including the optional detail field. */
.project-core .core-stack .fields.project-location-fields {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 8px;
  overflow-x: auto; padding-block: 2px 5px;
}
.project-core .core-stack .project-location-fields > .field {
  flex: 1 1 0; min-width: 145px;
  grid-template-columns: max-content minmax(0,1fr); grid-column: auto !important;
}
.project-core .core-stack .project-location-fields > .field:has([data-loc="details"]) {
  flex-grow: 1.4; min-width: 190px;
}
.project-core .core-stack .project-location-fields > .field > span:first-child {
  max-width: 90px; white-space: nowrap;
}
.office-selector .fieldrow select { flex: 1; }
.office-identity { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.office-identity img { width: 65px; height: 50px; object-fit: contain; }
.office-identity :is(b,span,small) { display: block; }
.office-identity b { font-size: 13px; }
.office-identity :is(span,small) { font-size: 11.5px; color: var(--muted); }
dialog.office-editor { width: min(760px,94vw); max-height: 90vh; overflow: auto; padding: 22px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.office-dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.office-dialog-head h2 { margin: 0; font-size: 20px; }
.office-editor .fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
.office-editor .field { min-width: 0; }
.office-editor .office-logo-preview img { max-width: 160px; max-height: 90px; object-fit: contain; }
#officeFormError { color: var(--neg); }
@media(max-width:600px){.office-editor .fields{grid-template-columns:1fr}.office-selector .fieldrow{flex-wrap:wrap}}
.project-core .core-stack .fieldrow { display: flex; align-items: center; gap: 5px; }
.project-core .core-stack .fieldrow .in { flex: 1; min-width: 0; }
.project-core .core-stack .fieldrow .btn { flex: 0 0 auto; }
.project-core .core-stack .field :is(input,select) { min-height: 32px; padding-block: 4px; }
.project-core .core-stack .project-identity-fields { grid-template-columns: repeat(var(--identity-cols,4),minmax(0,1fr)); }
.project-core .project-identity-fields #sector-description { display: none; }
.project-core .project-identity-fields.identity-wide-product .core-field-product { grid-column: span 2; }
@media (max-width: 1050px) {
  .project-core .core-stack .fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .project-core .core-stack .project-identity-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .project-core .project-identity-fields.identity-wide-product .core-field-product { grid-column: auto; }
}
@media (max-width: 600px) {
  .project-core .core-stack .fields { grid-template-columns: minmax(0,1fr); }
  .project-core .core-stack .field { grid-template-columns: minmax(100px,32%) minmax(0,1fr); }
}

/* Report identity is one compact RTL row for every project. */
@media screen {
.project-core .core-stack .fields.project-report-fields {
  display:flex; flex-wrap:nowrap; align-items:center; gap:8px;
  overflow-x:auto; padding-block:2px 5px;
}
.project-core .core-stack .project-report-fields > .field {
  flex:1 1 0; min-width:155px; grid-column:auto!important;
  grid-template-columns:max-content minmax(0,1fr);
}
.project-core .core-stack .project-report-fields > .office-selector {flex:1.4 1 0;min-width:220px;}
.project-core .core-stack .project-report-fields > .field > span:first-child {max-width:95px;white-space:nowrap;}
}

.project-readiness {display:inline-flex;align-items:center;flex:0 0 auto;white-space:nowrap;padding:2px 8px;border:1px solid;border-radius:5px;font-size:11px;line-height:1.5;}
.project-readiness.pending {background:#fff7db;color:#795900;border-color:#e6d398;}
.project-readiness.complete {background:#e4f5ec;color:#116740;border-color:#9bd0b5;}
@media print {#projectReadiness {display:none!important;}}
