@font-face { font-family: "IktifaSans"; src: url("fonts/NotoSansArabic-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IktifaSans"; src: url("fonts/NotoSansArabic-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
	--bg: #f4f6f5; --surface: #ffffff; --surface-2: #f7faf9; --text: #1c2321; --muted: #5d6a66; --line: #dbe3e0;
	--brand: #0f5c52; --brand-2: #e3f0ed; --accent: #b7791f; --danger: #b42318; --danger-bg: #fdecea;
	--ok: #1e7a3c; --ok-bg: #e7f5ec; --warn: #8a5a00; --warn-bg: #fff4dc; --proposal: #eef0f0; --decision: #fff7dd;
	--radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 22, .06), 0 2px 8px rgba(16, 24, 22, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "IktifaSans", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }
[hidden] { display: none !important; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .6em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; white-space: nowrap; }
.error { color: var(--danger); min-height: 1.4em; }

/* buttons and inputs */
.btn { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: .45em 1em; border-radius: 8px; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: .2em .7em; font-size: .85rem; }
input, select, textarea { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .4em .6em; width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
.decision-input { background: var(--decision); }
textarea { min-height: 5em; resize: vertical; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2em; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--surface); padding: 32px; border-radius: 14px; box-shadow: var(--shadow); width: min(420px, 100%); display: grid; gap: 10px; }
.login-card h1 { font-size: 1.3rem; color: var(--brand); margin: 0; }

/* layout */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--brand); }
.spacer { flex: 1; }
.save-status { font-size: .85rem; padding: .15em .7em; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.save-status.ok { background: var(--ok-bg); color: var(--ok); }
.save-status.pending { background: var(--warn-bg); color: var(--warn); }
.save-status.error { background: var(--danger-bg); color: var(--danger); }
.banner { padding: 10px 16px; background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid #f0d9a8; }
.banner.ok { background: var(--ok-bg); color: var(--ok); border-color: #bfe3cb; }
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 56px); }
.steps { background: var(--surface); border-inline-start: 1px solid var(--line); padding: 12px 8px; position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px); overflow: auto; }
.steps button { display: flex; width: 100%; align-items: center; gap: 8px; text-align: start; font: inherit; background: none; border: 0; padding: 9px 12px; border-radius: 8px; cursor: pointer; color: var(--text); }
.steps button:hover { background: var(--surface-2); }
.steps button.active { background: var(--brand-2); color: var(--brand); font-weight: 700; }
.steps .idx { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-size: .8rem; border: 1px solid var(--line); }
.steps .done .idx { background: var(--ok); color: #fff; border-color: var(--ok); }
.steps .badge { margin-inline-start: auto; font-size: .75rem; background: var(--warn-bg); color: var(--warn); border-radius: 999px; padding: 0 .55em; }
.view { padding: 20px 24px 80px; max-width: 1200px; width: 100%; }
.menu-toggle { display: none; }

/* cards and tables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card.decided { border-inline-start: 4px solid var(--ok); }
.card.review { border-inline-start: 4px solid var(--accent); }
.card.blocked { border-inline-start: 4px solid var(--danger); }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin-bottom: 8px; }
.card-head .title { font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .78rem; border-radius: 999px; padding: .05em .65em; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: #f0d9a8; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: #bfe3cb; }
.chip.danger { background: var(--danger-bg); color: var(--danger); border-color: #f5c2bd; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; background: var(--proposal); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.facts div span { display: block; font-size: .75rem; color: var(--muted); }
.facts div b { font-weight: 700; }
.computed { background: var(--ok-bg); }
.notes { font-size: .88rem; color: var(--muted); margin: 6px 0; }
.notes li { margin-bottom: 2px; }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.links a { font-size: .8rem; text-decoration: none; border: 1px solid var(--brand-2); background: var(--surface-2); border-radius: 6px; padding: .1em .55em; direction: ltr; unicode-bidi: isolate; }
.links a:hover { border-color: var(--brand); }
.decide { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.decide .wide { grid-column: 1 / -1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { font: inherit; border: 0; background: none; padding: .35em .9em; cursor: pointer; border-inline-start: 1px solid var(--line); color: var(--text); }
.seg button:first-child { border-inline-start: 0; }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.seg button[aria-pressed="true"].neg { background: var(--danger); }
.seg button[aria-pressed="true"].mid { background: var(--accent); }
.seg button:disabled { cursor: not-allowed; opacity: .6; }
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.grid th, table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; font-size: .9rem; }
table.grid th { background: var(--surface-2); color: var(--muted); font-weight: 700; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 12px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.toolbar > * { width: auto; }
.toolbar input[type=search] { min-width: 220px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .95rem; color: var(--text); margin: 0; cursor: pointer; }
.check input { width: auto; flex: none; width: 18px; height: 18px; }
.toolbar .check { font-size: .9rem; }
.stack { display: grid; gap: 16px; }
.table-wrap { overflow-x: auto; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 14px 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tabs button { font: inherit; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .3em .9em; cursor: pointer; }
.tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.callout { background: var(--brand-2); border-radius: var(--radius); padding: 12px 16px; margin: 10px 0; }
.callout.warn { background: var(--warn-bg); }
.callout.danger { background: var(--danger-bg); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; }
.legend span::before { content: ""; display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-inline-end: 6px; vertical-align: -2px; border: 1px solid var(--line); }
.legend .p::before { background: var(--proposal); }
.legend .d::before { background: var(--decision); }
.legend .c::before { background: var(--ok-bg); }
.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress div { height: 100%; background: var(--ok); width: 0; }
.downloads { display: flex; flex-wrap: wrap; gap: 10px; }
.downloads a { text-decoration: none; }
.findings { background: var(--surface); padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); }
.findings table { border-collapse: collapse; width: 100%; margin: 8px 0 16px; font-size: .88rem; display: block; overflow-x: auto; }
.findings th, .findings td { border: 1px solid var(--line); padding: 5px 8px; text-align: start; }
.findings th { background: var(--surface-2); }
.findings blockquote { border-inline-start: 3px solid var(--brand); margin: 8px 0; padding: 4px 14px; background: var(--surface-2); }
.blocker-list { max-height: 360px; overflow: auto; }
.blocker-list button { display: block; width: 100%; text-align: start; font: inherit; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 6px 4px; cursor: pointer; color: var(--danger); }
.blocker-list button.warn { color: var(--warn); }
.blocker-list button:hover { background: var(--surface-2); }
.row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.final-amount { font-weight: 700; color: var(--brand); }
.question { margin-bottom: 14px; }
.question p { margin: 0 0 6px; }

@media (max-width: 860px) {
	.layout { grid-template-columns: 1fr; }
	.steps { position: fixed; inset: 56px 0 0 auto; width: 280px; z-index: 30; box-shadow: var(--shadow); transform: translateX(100%); transition: transform .2s; }
	.steps.open { transform: none; }
	.menu-toggle { display: inline-block; }
	.view { padding: 16px; }
	.brand { display: none; }
	.save-status { font-size: .75rem; white-space: nowrap; }
}
@media print { .topbar, .steps, .toolbar, .pager { display: none; } .layout { display: block; } }
