/* Al-Raqeem projects platform — platform pages stylesheet (the workflows viewer keeps its own viewer.css)
 * Location on the server: /opt/raqeem/static_root/core/app.css (collected from core/static by collectstatic) */
:root {
  --nav: #1F3864; --nav-ink: #fff; --acc: #2E75B6; --acc-ink: #fff; --ink: #1A2B3C; --mut: #5b6b7a;
  --line: #D8DEE6; --card: #fff; --bg: #f4f6f9; --soft: #eef3fb; --code: #fafbfc;
  --ok: #2e7d32; --ok-bg: #e3f2e5; --bad: #b0413e; --bad-bg: #fdecea; --warn: #8a5800; --warn-bg: #fff4e0;
  --info: #2e5496; --info-bg: #eef3fb; --shadow: 0 2px 10px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --nav: #0f1b33; --nav-ink: #e6ecf3; --acc: #5b9bd5; --acc-ink: #0d131d; --ink: #e6ecf3; --mut: #93a3b5;
    --line: #2b3648; --card: #161e2b; --bg: #0d131d; --soft: #1b2536; --code: #111826;
    --ok: #8fd19e; --ok-bg: #173322; --bad: #f2a29e; --bad-bg: #3a1d1b; --warn: #f0c67a; --warn-bg: #3a2c12;
    --info: #9cc0ef; --info-bg: #1b2536; --shadow: 0 2px 10px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --nav: #0f1b33; --nav-ink: #e6ecf3; --acc: #5b9bd5; --acc-ink: #0d131d; --ink: #e6ecf3; --mut: #93a3b5;
  --line: #2b3648; --card: #161e2b; --bg: #0d131d; --soft: #1b2536; --code: #111826;
  --ok: #8fd19e; --ok-bg: #173322; --bad: #f2a29e; --bad-bg: #3a1d1b; --warn: #f0c67a; --warn-bg: #3a2c12;
  --info: #9cc0ef; --info-bg: #1b2536; --shadow: 0 2px 10px rgba(0, 0, 0, .35); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif; background: var(--bg); color: var(--ink);
       font-size: 14px; line-height: 1.75; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.4; text-wrap: balance; margin: 0 0 8px; }
h1 { font-size: 21px; } h2 { font-size: 17px; color: var(--acc); } h3 { font-size: 14.5px; }
code, .mono { font-family: Consolas, "Cascadia Mono", "DejaVu Sans Mono", monospace; font-size: 12.5px; direction: ltr; unicode-bidi: embed; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- header and navigation */
.top { background: var(--nav); color: var(--nav-ink); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; }
.top-in { display: flex; align-items: center; gap: 12px; padding: 8px 16px; flex-wrap: wrap; max-width: 1280px; margin: 0 auto; }
.brand { color: var(--nav-ink); font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand:hover { text-decoration: none; opacity: .9; }
.brand small { font-weight: 400; opacity: .75; font-size: 11.5px; margin-inline-start: 6px; }
.crumb { color: var(--nav-ink); opacity: .9; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }
.umenu { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.umenu a, .umenu button { color: var(--nav-ink); background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 7px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; font-family: inherit; line-height: 1.6; }
.umenu a:hover, .umenu button:hover { background: rgba(255, 255, 255, .24); text-decoration: none; }
.umenu form { margin: 0; }
.badge-n { background: #c77700; color: #fff; border-radius: 9px; padding: 0 7px; font-size: 11px; font-weight: 700; }
.pnav { background: var(--card); border-bottom: 1px solid var(--line); }
.pnav-in { display: flex; gap: 2px; overflow-x: auto; max-width: 1280px; margin: 0 auto; padding: 0 12px; scrollbar-width: thin; }
.pnav a { padding: 9px 12px; color: var(--ink); white-space: nowrap; font-size: 13px; border-bottom: 3px solid transparent; }
.pnav a:hover { background: var(--soft); text-decoration: none; }
.pnav a.on { border-bottom-color: var(--acc); color: var(--acc); font-weight: 700; }

/* ---------------------------------------------------------------- page frame */
.page { max-width: 1280px; margin: 0 auto; padding-block: 18px 40px; padding-inline: 16px; }
.page.narrow { max-width: 760px; }
.page.embed { padding-block: 10px; }
.phead { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.phead > div { min-width: 0; }
.phead .sub { color: var(--mut); font-size: 12.5px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.hint { color: var(--mut); font-size: 12px; }
.muted { color: var(--mut); }
.empty { color: var(--mut); padding: 14px; text-align: center; border: 1px dashed var(--line); border-radius: 9px; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--mut); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- module cards on the project home */
.mcard { display: flex; flex-direction: column; gap: 6px; }
.mcard h3 { margin: 0; font-size: 15px; }
.mcard .sum { font-size: 12.5px; color: var(--mut); }
.mcard .go { margin-top: auto; }

/* ---------------------------------------------------------------- tables */
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.tbl th { background: var(--soft); font-weight: 700; font-size: 12px; color: var(--mut); white-space: nowrap; position: sticky; top: 0; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: color-mix(in srgb, var(--soft) 55%, transparent); }
.tbl td.nw, .tbl th.nw { white-space: nowrap; }
.tbl .r { text-align: end; }

/* ---------------------------------------------------------------- chips */
.chip { display: inline-block; border-radius: 10px; padding: 0 8px; font-size: 11.5px; font-weight: 700; background: var(--soft); color: var(--info); white-space: nowrap; }
.chip.ok, .chip.st-approved, .chip.s-fixed, .chip.s-confirmed, .chip.f-confirmed, .chip.d-active { background: var(--ok-bg); color: var(--ok); }
.chip.bad, .chip.st-conflict, .chip.sev-urgent, .chip.s-reopened, .chip.f-refuted { background: var(--bad-bg); color: var(--bad); }
.chip.warn, .chip.st-deferred, .chip.sev-high, .chip.f-needs_check, .chip.d-proposed, .chip.s-unchecked { background: var(--warn-bg); color: var(--warn); }
.chip.mut, .chip.st-open, .chip.d-superseded, .chip.s-not_found, .chip.sev-low { background: var(--soft); color: var(--mut); }
.chip.aud-int { background: var(--warn-bg); color: var(--warn); }

/* ---------------------------------------------------------------- buttons and forms */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 13px; font-size: 13px; cursor: pointer; font-family: inherit; line-height: 1.6; white-space: nowrap; }
.btn:hover { border-color: var(--acc); text-decoration: none; }
.btn.pri { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.btn.pri:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.btn.sm { padding: 1px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--acc); cursor: pointer; padding: 0; font: inherit; font-size: 12.5px; }
.linkbtn.danger { color: var(--bad); }
form.inline { display: inline; margin: 0; }
.in, .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea, select.in, textarea.in {
  width: 100%; font: inherit; font-size: 13.5px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--bg); color: var(--ink); }
.in:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid color-mix(in srgb, var(--acc) 40%, transparent); border-color: var(--acc); }
textarea.in, .field textarea { min-height: 70px; resize: vertical; }
.in.auto { width: auto; }
.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 11px; min-width: 0; }
.field > label, .lbl { font-size: 12.5px; font-weight: 700; color: var(--mut); }
.field .help { font-size: 11.5px; color: var(--mut); }
.field .err, .errlist { color: var(--bad); font-size: 12px; margin: 0; padding: 0; list-style: none; }
.fgrid { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.fgrid .wide { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.checks label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 400; color: var(--ink); }
.ltr { direction: ltr; text-align: left; }
input.ltr, textarea.ltr { direction: ltr; text-align: left; }

/* ---------------------------------------------------------------- messages */
.msgs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.msg { border-radius: 8px; padding: 8px 12px; font-size: 13px; border: 1px solid var(--line); background: var(--card); overflow-wrap: anywhere; }
.msg.success { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.msg.error { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.msg.warning { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.msg.info { background: var(--info-bg); color: var(--info); border-color: transparent; }

/* ---------------------------------------------------------------- questions */
.q { border-top: 1px solid var(--line); padding: 12px 0; }
.q:first-of-type { border-top: 0; }
.q-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.q-t { font-weight: 700; flex: 1; min-width: 200px; }
.q-n { color: var(--mut); font-size: 12px; min-width: 26px; }
.q-v { font-size: 12px; color: var(--mut); margin: 2px 0 6px; }
.q-box { background: var(--soft); border-radius: 8px; padding: 8px 12px; margin-top: 8px; font-size: 13px; }
.q-box.appr { background: var(--ok-bg); }
.opts { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.opts label { border: 1px solid var(--line); border-radius: 16px; padding: 2px 12px; font-size: 13px; cursor: pointer; background: var(--card); font-weight: 400; color: var(--ink); }
.opts input { margin-inline-end: 5px; }
.opts label:has(input:checked) { border-color: var(--acc); background: var(--soft); }
.dist { display: grid; grid-template-columns: minmax(80px, max-content) minmax(0, 1fr) 2.5em; gap: 3px 8px; align-items: center; font-size: 12px; margin-top: 6px; }
.dist .b { height: 8px; background: var(--acc); border-radius: 4px; min-width: 2px; }
.other { border-inline-start: 3px solid var(--line); padding: 2px 10px; margin: 6px 0; font-size: 13px; }
.other .who { font-size: 11.5px; color: var(--mut); }
details.more > summary { cursor: pointer; color: var(--acc); font-size: 12.5px; }
details.more[open] > summary { margin-bottom: 6px; }

/* ---------------------------------------------------------------- grants matrix */
.gm .tbl td.c { text-align: center; padding: 3px 4px; }
.gcell { width: 30px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 700; font-size: 13px; line-height: 1; color: var(--mut); }
.gcell.allow { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.gcell.deny { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.gcell .eff { font-size: 9px; }
.gm tr.d0 td:first-child { font-weight: 700; }
.gm tr.d1 td:first-child { padding-inline-start: 18px; font-weight: 700; }
.gm tr.d2 td:first-child { padding-inline-start: 34px; }
.gm tr.d3 td:first-child { padding-inline-start: 50px; font-size: 12.5px; }
.gm tr.d4 td:first-child { padding-inline-start: 66px; font-size: 12px; color: var(--mut); }
.gm tr.hide { display: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--mut); align-items: center; }
.effdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line); vertical-align: middle; }
.effdot.y { background: var(--ok); } .effdot.n { background: var(--bad); opacity: .45; }

/* ---------------------------------------------------------------- wizard */
.steps { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; counter-reset: st; }
.steps a, .steps span { font-size: 12px; padding: 3px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--mut); }
.steps .on { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.steps .done { color: var(--ok); border-color: var(--ok); }

/* ---------------------------------------------------------------- centred cards (login, 2FA, policy) */
.center { min-height: 100%; display: flex; align-items: flex-start; justify-content: center; padding-block: 6vh 40px; padding-inline: 16px; }
.center .card { width: min(460px, 100%); }
.center.wide .card { width: min(860px, 100%); }
.logo-t { font-size: 13px; color: var(--mut); text-align: center; margin-bottom: 10px; }
.logo-t b { display: block; font-size: 18px; color: var(--nav); }
:root[data-theme="dark"] .logo-t b { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-t b { color: var(--ink); } }
.qr svg { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 8px; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; font-family: Consolas, monospace; font-size: 15px; direction: ltr; }
.codes span { background: var(--soft); border-radius: 6px; padding: 4px 8px; text-align: center; }
.policy { font-size: 13.5px; line-height: 1.95; }
.policy h3 { margin-top: 14px; color: var(--acc); }
.policy-box { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 9px; padding: 10px 16px; background: var(--bg); }

/* ---------------------------------------------------------------- footer, banners, dialogs */
.foot { max-width: 1280px; margin: 0 auto; padding-block: 12px 26px; padding-inline: 16px; color: var(--mut); font-size: 12px; display: flex; gap: 6px 16px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.locban { position: fixed; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); inset-inline: 16px; max-width: 640px; margin: 0 auto; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 8px 30px rgba(0, 0, 0, .18); padding: 12px 14px; z-index: 60; font-size: 13px; }
.locban .bar { margin-top: 8px; }
.dlg-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dlg { background: var(--card); color: var(--ink); border-radius: 12px; width: min(460px, 100%); padding: 16px 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.dlg p { margin: 0 0 12px; }
.copyable { display: flex; gap: 6px; align-items: center; }
.copyable input { flex: 1; min-width: 0; }
.prev { border: 1px solid var(--line); border-radius: 9px; background: #fff; overflow: auto; min-height: 260px; max-height: 70vh; padding: 6px; direction: ltr; }
.prev svg { max-width: none; height: auto; display: block; }
.ed-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 1000px) { .ed-wrap { grid-template-columns: minmax(0, 1fr); } }
textarea.json { font-family: Consolas, "Cascadia Mono", "DejaVu Sans Mono", monospace; font-size: 12px; direction: ltr; text-align: left; min-height: 60vh; white-space: pre; tab-size: 2; }
.diffl { font-size: 12px; }
@media print { .top, .pnav, .foot, .locban, .noprint { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }
