/* Sajjel Citizen Demo — "التأسيس عبر الإنترنت"
   Brand: paper #FBF9F3 · ink #23201A · seal green #1A5632 · tint #E9F1EA · brass #B08B2E (≤1/view) */

:root {
  --ink: #23201A;
  --ink-muted: #6E675B;
  --paper: #FBF9F3;
  --raised: #FFFFFF;
  --line: #E4DFD2;
  --primary: #1A5632;
  --primary-deep: #0F3D23;
  --tint: #E9F1EA;
  --accent: #B08B2E;
  --danger: #96342B;
  --warning: #8A5A0B;
  --info: #2C5A78;
  --gray: #a5a196;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.8;
  font-size: 15px;
}
.mono { font-family: "IBM Plex Sans", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
h1 { font-size: 26px; font-weight: 700; margin: 0; line-height: 1.45; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }

/* ---------- ribbon + header (shared grammar with /2/ and /3/) ---------- */
.demo-ribbon {
  background: var(--ink);
  color: var(--paper);
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 4px 12px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 32px;
  background: var(--raised);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 16px; }
.brand::before {
  content: "";
  width: 14px; height: 14px;
  border: 2.5px solid var(--primary);
  border-radius: 50%;
  display: inline-block;
  flex: none;
}
.wordmark { font-size: 30px; font-weight: 700; line-height: 1; color: var(--ink); }
.brand-rule { width: 1px; height: 36px; background: var(--line); }
.ministry-name { font-weight: 600; font-size: 14px; }
.console-name { font-size: 12.5px; color: var(--ink-muted); }
.topbar-side { display: flex; align-items: center; gap: 16px; }
.lang-toggle {
  font-family: var(--font);
  font-size: 13px; font-weight: 600;
  padding: 5px 14px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.lang-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- stepper ---------- */
#stepperWrap { background: var(--raised); border-bottom: 1px solid var(--line); }
.stepper {
  list-style: none;
  display: flex;
  gap: 0;
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 24px;
  overflow-x: auto;
}
.stepper li {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px;
  color: var(--ink-muted);
  white-space: nowrap;
  padding-inline-end: 18px;
  position: relative;
}
.stepper li:not(:last-child)::after {
  content: "";
  width: 10px; height: 1px;
  background: var(--line);
  margin-inline-start: 8px;
}
.stepper .snum {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 600;
  background: var(--raised);
  flex: none;
  font-variant-numeric: tabular-nums;
}
.stepper li.cur { color: var(--primary-deep); font-weight: 600; }
.stepper li.cur .snum { border-color: var(--primary); background: var(--tint); color: var(--primary-deep); }
.stepper li.done { color: var(--ink); }
.stepper li.done .snum { border-color: var(--primary); background: var(--primary); color: #fff; }
@media (max-width: 720px) {
  .stepper li:not(.cur) .slabel { display: none; }
  .stepper li { padding-inline-end: 10px; }
}

/* ---------- layout ---------- */
#app { max-width: 980px; margin: 0 auto; padding: 24px 24px 56px; }
@media (max-width: 720px) { #app { padding: 16px 14px 44px; } }
.page-sub { margin: 4px 0 0; color: var(--ink-muted); font-size: 14px; }

.card {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-note { font-size: 12.5px; color: var(--ink-muted); }
.fineprint { font-size: 12px; color: var(--ink-muted); margin: 10px 0 0; }

/* ---------- landing ---------- */
.hero { text-align: center; padding: 34px 12px 8px; }
.hero h1 { font-size: clamp(26px, 4.6vw, 38px); }
.hero .promise { color: var(--ink-muted); font-size: 16px; max-width: 620px; margin: 8px auto 0; }
.hero .four-facts { font-size: 13.5px; color: var(--ink-muted); margin-top: 14px; }
.hero .four-facts b { color: var(--primary-deep); font-weight: 600; }

.form-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin: 26px 0 8px;
}
.form-card {
  background: var(--raised);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  cursor: pointer;
  text-align: start;
  font-family: var(--font);
  transition: border-color 0.15s;
  position: relative;
}
.form-card:hover:not(.soon) { border-color: var(--primary); }
.form-card.sel { border-color: var(--primary); background: var(--tint); }
.form-card.sel::after {
  content: "✓";
  position: absolute; top: 12px; inset-inline-end: 14px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.form-card.soon { cursor: default; opacity: 0.62; }
.fc-name { font-weight: 700; font-size: 15.5px; }
.fc-sub { font-size: 12.5px; color: var(--ink-muted); margin-top: 3px; line-height: 1.7; }
.fc-soon {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0 10px;
  color: var(--ink-muted);
  margin-top: 8px;
  background: var(--paper);
}
.start-row { text-align: center; margin: 22px 0 34px; }

/* لماذا سجّل strip */
.why-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 26px;
  margin-top: 10px;
}
.why-item { font-size: 13.5px; }
.why-item .wi-t { font-weight: 700; font-size: 14.5px; margin-bottom: 2px; }
.why-item .wi-t .brass { color: var(--accent); }
.why-item .wi-d { color: var(--ink-muted); line-height: 1.75; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; }
.field .hint { font-size: 12px; color: var(--ink-muted); font-weight: 400; }
.input, .select, .textarea {
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus, .form-card:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.textarea { min-height: 92px; resize: vertical; line-height: 1.8; }
.grid-2f { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid-2f { grid-template-columns: 1fr; } }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip {
  font-family: var(--font);
  font-size: 12.5px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 20px;
  padding: 3px 13px;
  cursor: pointer;
  color: var(--ink);
}
.chip:hover { border-color: var(--primary); color: var(--primary-deep); }

/* ---------- name check ---------- */
.name-check-row { display: flex; gap: 10px; align-items: stretch; }
.name-check-row .input { flex: 1; font-size: 16px; }
.name-result { margin-top: 14px; border-radius: var(--radius-md); padding: 13px 16px; font-size: 13.5px; }
.name-result.taken { background: #F9F2E4; border: 1px solid #EAD9B8; color: var(--warning); }
.name-result.free { background: var(--tint); border: 1px solid #CBDECF; color: var(--primary-deep); }
.name-result .nr-title { font-weight: 700; font-size: 14px; }
.name-result .nr-similar { color: var(--ink-muted); margin-top: 3px; }
.reserved-note {
  display: flex; gap: 10px; align-items: center;
  background: var(--tint); border: 1px solid #CBDECF;
  border-radius: var(--radius-md); padding: 11px 15px;
  margin-top: 14px; font-size: 13.5px; color: var(--primary-deep);
}
.reserved-note .rn-badge {
  background: var(--primary); color: #fff;
  border-radius: 4px; font-size: 11.5px; font-weight: 700;
  padding: 1px 9px; flex: none;
}

/* ---------- partners ---------- */
.partner-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  margin-bottom: 10px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--raised);
}
.partner-main { flex: 1; min-width: 180px; }
.partner-name { font-weight: 700; font-size: 14.5px; }
.partner-meta { font-size: 12.5px; color: var(--ink-muted); }
.kyc-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600;
  border-radius: 4px;
  padding: 2px 10px;
  white-space: nowrap;
}
.kyc-badge.ok { background: var(--tint); color: var(--primary-deep); }
.kyc-badge.pending { background: #F9F2E4; color: var(--warning); }
.kyc-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.kyc-badge.pending .dot { animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: 0.35; } to { opacity: 1; } }
.partner-remove {
  font-family: var(--font);
  background: none; border: none; cursor: pointer;
  color: var(--ink-muted); font-size: 12.5px;
  text-decoration: underline;
}
.partner-remove:hover { color: var(--danger); }
.add-partner-box { border: 1px dashed var(--line); border-radius: var(--radius-md); padding: 16px 18px; margin-top: 8px; background: var(--paper); }

/* ---------- ownership / quotas ---------- */
.quota-math {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 11px 16px;
  font-size: 13.5px;
  display: flex; gap: 22px; flex-wrap: wrap;
  margin: 6px 0 16px;
}
.quota-math b { font-variant-numeric: tabular-nums; }
.own-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.own-table th { text-align: start; font-size: 12px; color: var(--ink-muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.own-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.own-table tr:last-child td { border-bottom: none; }
.own-table .input { width: 86px; text-align: center; padding: 5px 8px; }
.own-total { font-size: 13.5px; margin-top: 10px; font-weight: 600; }
.own-total.ok { color: var(--primary-deep); }
.own-total.bad { color: var(--danger); }

/* ---------- articles / e-sign ---------- */
.articles-doc {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  max-height: 380px;
  overflow-y: auto;
  padding: 26px 30px;
  font-size: 13.5px;
  line-height: 2.05;
  position: relative;
}
.articles-doc h3 { text-align: center; font-size: 16px; margin: 0 0 4px; }
.articles-doc .doc-sub { text-align: center; font-size: 12px; color: var(--ink-muted); margin-bottom: 16px; }
.articles-doc h4 { font-size: 13.5px; margin: 16px 0 2px; color: var(--primary-deep); }
.articles-doc p { margin: 0 0 6px; }
.articles-doc .merged { font-weight: 700; }
.sign-row { display: flex; gap: 14px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.sign-note { font-size: 12.5px; color: var(--ink-muted); }
.signed-list { margin-top: 14px; }
.signed-item {
  display: flex; gap: 9px; align-items: center;
  font-size: 13px; padding: 6px 0;
  border-bottom: 1px dotted var(--line);
}
.signed-item:last-child { border-bottom: none; }
.signed-item .sig-ok {
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--tint); color: var(--primary-deep);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; flex: none;
}
.doc-seal-stamp {
  position: sticky;
  bottom: 8px;
  inset-inline-start: 100%;
  width: 92px; height: 92px;
  margin-top: -60px;
  transform: rotate(-8deg);
  opacity: 0;
  pointer-events: none;
}
.doc-seal-stamp.stamped { animation: stamp-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) forwards; }
@keyframes stamp-in {
  0% { opacity: 0; transform: rotate(-8deg) scale(1.8); }
  100% { opacity: 0.92; transform: rotate(-8deg) scale(1); }
}

/* ---------- summary + fees ---------- */
.sum-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.sum-table td { padding: 8px 4px; border-bottom: 1px dotted var(--line); vertical-align: top; }
.sum-table td.k { width: 36%; color: var(--ink-muted); font-weight: 500; }
.sum-table td.v { font-weight: 600; }
.sum-table tr:last-child td { border-bottom: none; }
.fee-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fee-table td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.fee-table td:last-child { text-align: end; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.fee-table tr.total td { border-bottom: none; font-weight: 700; font-size: 14.5px; color: var(--primary-deep); }
.paid-tag {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--tint); color: var(--primary-deep);
  border-radius: 4px; font-size: 12.5px; font-weight: 700;
  padding: 3px 12px;
}

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font);
  font-size: 14px; font-weight: 600;
  border-radius: var(--radius-md);
  padding: 9px 22px;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-deep); }
.btn-ghost { background: var(--raised); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink-muted); }
.btn-lg { font-size: 15.5px; padding: 11px 30px; }
.wizard-nav {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 6px;
}

/* ---------- tracking ---------- */
.track-head { margin-bottom: 20px; }
.track-ref { font-size: 13px; color: var(--ink-muted); }
.track-ref b { color: var(--ink); }
.stage-list { list-style: none; margin: 0; padding: 0; position: relative; }
.stage-list li { position: relative; padding-inline-start: 34px; padding-bottom: 22px; }
.stage-list li::before {
  content: ""; position: absolute; inset-inline-start: 7px; top: 7px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--raised); border: 2px solid var(--gray);
}
.stage-list li::after {
  content: ""; position: absolute; inset-inline-start: 12.5px; top: 24px; bottom: -2px;
  width: 1px; background: var(--line);
}
.stage-list li:last-child::after { display: none; }
.stage-list li.done::before { background: var(--primary); border-color: var(--primary); }
.stage-list li.active::before { border-color: var(--primary); animation: pulse 0.9s infinite alternate; }
.stage-list li.skipped { opacity: 0.55; }
.stage-list li.skipped::before { border-style: dashed; }
.stg-name { font-weight: 700; font-size: 14.5px; }
.stg-detail { font-size: 12.5px; color: var(--ink-muted); }
.stg-time { font-size: 11.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.stg-tag {
  display: inline-block; font-size: 11px; font-weight: 700;
  border-radius: 4px; padding: 1px 9px; margin-inline-start: 8px;
  vertical-align: 2px;
}
.stg-tag.g { background: var(--tint); color: var(--primary-deep); }
.stg-tag.b { background: #E3ECF2; color: var(--info); }

.alive-banner {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  text-align: center;
  margin-bottom: 18px;
  animation: rise-in 0.5s ease;
}
.alive-banner .ab-t { font-size: 22px; font-weight: 700; }
.alive-banner .ab-d { font-size: 13.5px; opacity: 0.9; margin-top: 3px; }
.alive-banner .ab-reg { font-size: 14px; margin-top: 8px; }
.alive-banner .ab-reg b { color: #E8D9AE; font-variant-numeric: tabular-nums; }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.agency-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.agency-chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  background: var(--raised);
  border-radius: 20px;
  font-size: 12.5px;
  padding: 4px 15px;
}
.agency-chip .st { font-weight: 700; }
.agency-chip.on { border-color: #CBDECF; background: var(--tint); color: var(--primary-deep); }
.agency-chip.wait { color: var(--ink-muted); }

.next-task {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  border: 1px solid #EAD9B8; background: #F9F2E4;
  border-radius: var(--radius-md); padding: 13px 17px;
  font-size: 13.5px; color: var(--warning);
}
.next-task.done-task { border-color: #CBDECF; background: var(--tint); color: var(--primary-deep); }
.next-task .nt-main { flex: 1; min-width: 220px; }
.next-task b { font-weight: 700; }

/* ---------- certificate (mirrors /3/ extract) ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(35, 32, 26, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 30px 16px; z-index: 100; overflow-y: auto;
}
.extract-shell { max-width: 760px; width: 100%; }
.extract-toolbar { display: flex; gap: 10px; justify-content: flex-end; margin-bottom: 12px; }
.extract-toolbar .btn { background: var(--paper); }
.certificate {
  background: var(--raised);
  border: 1px solid var(--line);
  outline: 2px solid var(--primary);
  outline-offset: -10px;
  padding: 52px 58px 44px;
  position: relative;
  box-shadow: 0 18px 50px rgba(35,32,26,0.28);
  animation: cert-in 0.45s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes cert-in { from { opacity: 0; transform: translateY(26px) scale(0.98); } to { opacity: 1; transform: none; } }
.cert-head { text-align: center; border-bottom: 3px double var(--ink); padding-bottom: 18px; margin-bottom: 22px; }
.cert-head .state { font-size: 13px; font-weight: 600; letter-spacing: 1px; }
.cert-head .ministry { font-size: 15px; font-weight: 700; margin-top: 2px; }
.cert-head .office { font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; }
.cert-title { text-align: center; margin: 20px 0 6px; }
.cert-title h2 { font-size: 26px; font-weight: 700; letter-spacing: 0.5px; }
.cert-title .sub { font-size: 12.5px; color: var(--ink-muted); }
.cert-serial { text-align: center; font-size: 12px; color: var(--ink-muted); margin-bottom: 24px; }
.cert-serial strong { color: var(--ink); }
.cert-body table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cert-body td { padding: 8px 4px; border-bottom: 1px dotted var(--line); vertical-align: top; }
.cert-body td.k { width: 38%; color: var(--ink-muted); font-weight: 500; }
.cert-body td.v { font-weight: 600; }
.cert-clause { margin-top: 24px; font-size: 13px; line-height: 2; text-align: justify; color: var(--ink); }
.cert-footer { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 36px; gap: 20px; }
.cert-qr { text-align: center; }
.cert-qr svg { display: block; margin: 0 auto 6px; }
.cert-qr .vc { font-size: 11px; color: var(--ink-muted); letter-spacing: 0.5px; }
.cert-sign { text-align: center; flex: 1; }
.cert-sign .role { font-size: 12.5px; font-weight: 600; }
.cert-sign .sig-line { border-top: 1px solid var(--ink); width: 200px; margin: 34px auto 0; padding-top: 4px; font-size: 11px; color: var(--ink-muted); }
.cert-seal { position: relative; width: 118px; text-align: center; }
.cert-seal svg { width: 108px; height: 108px; transform: rotate(-7deg); opacity: 0.92; }
.cert-note { margin-top: 28px; font-size: 10.5px; color: var(--ink-muted); text-align: center; border-top: 1px solid var(--line); padding-top: 10px; }

/* ---------- toast ---------- */
#toastRoot { position: fixed; bottom: 22px; inset-inline-start: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  box-shadow: 0 6px 18px rgba(35,32,26,.25);
  display: flex; gap: 10px; align-items: center;
  animation: toast-in .35s ease;
  max-width: 340px;
}
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: #1E7B45; flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--line);
  padding: 18px 32px 26px;
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
}

/* ---------- print: certificate only ---------- */
@media print {
  body * { visibility: hidden; }
  .certificate, .certificate * { visibility: visible; }
  .certificate { position: absolute; inset: 0; box-shadow: none; }
  .extract-toolbar { display: none; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .toast, .certificate, .alive-banner { animation: none; }
  .doc-seal-stamp.stamped { animation: none; opacity: 0.92; }
  .kyc-badge.pending .dot, .stage-list li.active::before { animation: none; }
}

@media (max-width: 640px) {
  .certificate { padding: 30px 22px; }
  .topbar { padding: 12px 16px; }
  .wordmark { font-size: 25px; }
}
