:root {
  --ink: #102625;
  --muted: #5e706f;
  --teal-950: #063f3d;
  --teal-800: #075f5b;
  --teal-700: #08736d;
  --teal-100: #d8f0ed;
  --teal-50: #eff9f7;
  --cream: #fbfaf6;
  --white: #ffffff;
  --amber: #f2b74b;
  --amber-soft: #fff5dc;
  --danger: #a62f3d;
  --danger-soft: #fff0f2;
  --line: #dce5e3;
  --shadow: 0 22px 60px rgba(9, 54, 51, 0.13);
  --radius: 24px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--cream); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 4%, rgba(8, 115, 109, 0.12), transparent 32rem),
    linear-gradient(180deg, #f7fbfa 0%, var(--cream) 42%, #f6f4ee 100%);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

body[dir="rtl"] {
  font-family: "Noto Nastaliq Urdu", Inter, sans-serif;
}

button, input, select, textarea { font: inherit; }
button, select, label, input[type="file"] { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(242, 183, 75, 0.75);
  outline-offset: 3px;
}

.app-shell {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px clamp(16px, 4vw, 44px) 26px;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 18px;
}

.brand {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--teal-950);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px 16px 16px 5px;
  background: var(--teal-800);
  color: white;
  font-family: "Noto Nastaliq Urdu", serif;
  font-size: 1.65rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(7, 95, 91, 0.2);
}

.brand strong { display: block; font-size: 1.12rem; letter-spacing: -0.02em; }
.brand small { display: block; color: var(--muted); font-size: 0.75rem; margin-top: -1px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.language-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.language-select, .quick-exit {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.82);
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 600;
}
.quick-exit { color: var(--danger); border-color: #f0cbd0; }
.quick-exit:hover { background: var(--danger-soft); }

main { flex: 1; display: grid; place-items: start center; width: 100%; }
.screen { width: 100%; animation: rise 260ms ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.home-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(28px, 6vw, 76px);
  align-items: center;
  padding: clamp(34px, 7vh, 78px) 0 56px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 15px;
  color: var(--teal-700);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 24px; height: 3px; border-radius: 2px; background: var(--amber); }

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.4rem, 5.5vw, 4.9rem); line-height: 1.02; letter-spacing: -0.055em; margin-bottom: 20px; }
h2 { font-size: clamp(1.85rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -0.04em; margin-bottom: 14px; }
h3 { font-size: 1rem; margin-bottom: 6px; }
.lede { max-width: 630px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); line-height: 1.7; }

.promise-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 25px; }
.promise { display: inline-flex; align-items: center; gap: 7px; color: var(--teal-950); font-size: 0.88rem; font-weight: 700; }
.promise::before { content: "✓"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--teal-800); background: var(--teal-100); }

.module-panel {
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(7,95,91,0.12);
  border-radius: 30px;
  padding: clamp(18px, 3vw, 28px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.module-panel > p { color: var(--muted); margin-bottom: 18px; }
.module-list { display: grid; gap: 12px; }
.module-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 17px;
  background: var(--white);
  color: var(--ink);
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 13px;
  align-items: center;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.module-card:hover { transform: translateY(-2px); border-color: var(--teal-700); box-shadow: 0 10px 25px rgba(7,95,91,0.1); }
.module-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--teal-50); color: var(--teal-800); font-size: 1.25rem; }
.module-copy strong, .module-copy span { display: block; }
.module-copy strong { font-size: 1rem; }
.module-copy span { color: var(--muted); font-size: 0.82rem; margin-top: 3px; }
.arrow { font-size: 1.2rem; color: var(--teal-700); }

.flow-wrap { width: min(700px, 100%); padding: 24px 0 46px; }
.flow-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; margin-bottom: 22px; }
.back-button, .icon-button {
  width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,0.85); color: var(--ink); display: grid; place-items: center; font-weight: 800;
}
.progress-track { height: 7px; background: #e6edeb; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--teal-700), #12a69c); border-radius: inherit; transition: width 240ms ease; }
.step-count { color: var(--muted); font-size: 0.8rem; font-weight: 700; white-space: nowrap; }

.flow-card {
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(7,95,91,0.12);
  border-radius: var(--radius);
  padding: clamp(23px, 5vw, 40px);
  box-shadow: var(--shadow);
}
.flow-card > p { color: var(--muted); font-size: 1rem; line-height: 1.7; }
.question { display: block; margin: 24px 0 12px; font-size: 0.95rem; font-weight: 800; color: var(--teal-950); }

.choice-list { display: grid; gap: 10px; }
.choice, .primary, .secondary, .danger-action {
  width: 100%; min-height: 52px; border-radius: 15px; padding: 13px 16px; font-weight: 700; transition: transform 150ms ease, background 150ms ease, border-color 150ms ease; text-align: left;
}
.choice { border: 1px solid var(--line); background: var(--white); color: var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.choice::after { content: "›"; color: var(--teal-700); font-size: 1.3rem; }
.choice:hover { border-color: var(--teal-700); background: var(--teal-50); transform: translateY(-1px); }
.choice.selected { border-color: var(--teal-700); background: var(--teal-50); box-shadow: inset 0 0 0 1px var(--teal-700); }
.choice.selected::after { content: "✓"; }

.button-row { display: flex; gap: 10px; margin-top: 22px; }
.primary, .secondary, .danger-action { text-align: center; border: 0; }
.primary { background: var(--teal-800); color: white; }
.primary:hover { background: var(--teal-950); transform: translateY(-1px); }
.secondary { background: var(--teal-50); color: var(--teal-950); border: 1px solid var(--teal-100); }
.danger-action { background: var(--danger); color: white; }
.button-row > * { flex: 1; }
.primary[disabled] { opacity: .48; cursor: not-allowed; transform: none; }

.info-box, .warning-box, .success-box {
  margin: 18px 0; border-radius: 16px; padding: 16px 17px; font-size: 0.93rem;
}
.info-box { background: var(--teal-50); border-left: 4px solid var(--teal-700); }
.warning-box { background: var(--amber-soft); border-left: 4px solid var(--amber); }
.success-box { background: #edf8f0; border-left: 4px solid #39915c; }
.info-box p:last-child, .warning-box p:last-child, .success-box p:last-child { margin-bottom: 0; }

.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-option { position: relative; }
.check-option input { position: absolute; opacity: 0; pointer-events: none; }
.check-option span { min-height: 78px; height: 100%; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 15px; padding: 13px 14px; background: white; font-weight: 650; }
.check-option input:checked + span { border-color: var(--teal-700); background: var(--teal-50); box-shadow: inset 0 0 0 1px var(--teal-700); }
.check-option input:focus-visible + span { outline: 3px solid rgba(242,183,75,.75); outline-offset: 3px; }

.field { display: grid; gap: 7px; margin-top: 16px; }
.field label { font-weight: 750; font-size: 0.9rem; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid #cdd9d7; border-radius: 13px; background: white; color: var(--ink); padding: 13px 14px; min-height: 49px;
}
.field textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.file-drop { border: 1.5px dashed #86aaa7; border-radius: 17px; padding: 20px; background: var(--teal-50); text-align: center; }
.file-drop input { max-width: 100%; }

.result-list { display: grid; gap: 11px; margin: 20px 0; }
.result-item { border: 1px solid var(--line); border-radius: 16px; padding: 15px 16px; background: white; }
.result-item-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status { border-radius: 999px; padding: 5px 10px; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.status.found { background: #e9f7ed; color: #267044; }
.status.review { background: var(--amber-soft); color: #855b08; }
.result-item p { color: var(--muted); font-size: .88rem; margin: 6px 0 0; }

.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 20px; }
.action-card { border: 1px solid var(--line); border-radius: 17px; padding: 17px; background: white; }
.action-card p { color: var(--muted); font-size: .86rem; margin-bottom: 12px; }
.action-card a { color: var(--teal-800); font-weight: 800; text-decoration-thickness: 2px; text-underline-offset: 3px; }

.draft-box { width: 100%; min-height: 320px; border: 1px solid #cdd9d7; border-radius: 15px; padding: 16px; background: #fff; color: var(--ink); line-height: 1.65; resize: vertical; }
.small-note { margin-top: 17px; color: var(--muted); font-size: .8rem; }
.inline-link { color: var(--teal-800); font-weight: 700; }

.modal-layer { position: fixed; inset: 0; z-index: 20; background: rgba(5,32,31,.66); display: grid; place-items: center; padding: 20px; }
.modal { width: min(620px,100%); max-height: 84vh; overflow-y: auto; background: white; border-radius: 24px; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.26); }
.modal-head { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.source-list { padding-left: 20px; }
.source-list li { margin: 12px 0; }
.source-list a { color: var(--teal-800); font-weight: 700; overflow-wrap: anywhere; }

.footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .74rem; padding: 18px 0 0; text-align: center; }
.text-button { appearance: none; border: 0; background: transparent; color: var(--teal-800); padding: 0; font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 30; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--teal-950); color: white; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

body[dir="rtl"] .brand { text-align: right; }
body[dir="rtl"] .module-card, body[dir="rtl"] .choice { text-align: right; }
body[dir="rtl"] .info-box, body[dir="rtl"] .warning-box, body[dir="rtl"] .success-box { border-left: 0; border-right: 4px solid var(--teal-700); }
body[dir="rtl"] .source-list { padding-left: 0; padding-right: 20px; }

@media (max-width: 800px) {
  .home-layout { grid-template-columns: 1fr; padding-top: 28px; gap: 28px; }
  .home-copy { text-align: center; }
  .lede { margin-left: auto; margin-right: auto; }
  .promise-row { justify-content: center; }
  h1 { font-size: clamp(2.55rem, 13vw, 4rem); }
}

@media (max-width: 560px) {
  .app-shell { padding: 11px 13px 22px; }
  .topbar { align-items: flex-start; }
  .brand-mark { width: 43px; height: 43px; border-radius: 14px 14px 14px 5px; }
  .brand small { display: none; }
  .topbar-actions { gap: 7px; }
  .language-select, .quick-exit { min-height: 41px; padding: 7px 9px; font-size: .78rem; }
  .flow-wrap { padding-top: 13px; }
  .flow-card { padding: 23px 18px; border-radius: 21px; }
  .check-grid, .action-grid { grid-template-columns: 1fr; }
  .check-option span { min-height: 60px; }
  .button-row { flex-direction: column-reverse; }
  .module-panel { border-radius: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
