/* ============================================================
   University PDF — Design System
   Premium · Minimal · Fast · Bilingual (LTR/RTL) · Light/Dark
   ============================================================ */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

  /* Light theme (default) */
  --bg: #f7f8fb;
  --bg-soft: #eef0f6;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --ink: #0c1222;
  --ink-2: #4b5567;
  --ink-3: #8a93a6;
  --line: #e5e8f0;
  --line-strong: #d5dae6;
  --brand: #4353ff;
  --brand-ink: #ffffff;
  --brand-soft: #eceefe;
  --brand-ring: rgba(67, 83, 255, .28);
  --gold: #b98a2f;
  --ok: #178a50;
  --ok-soft: #e5f6ec;
  --warn: #b25e09;
  --warn-soft: #fdf1e3;
  --err: #c0392b;
  --err-soft: #fdeae7;
  --shadow-1: 0 1px 2px rgba(12, 18, 34, .05), 0 8px 24px -12px rgba(12, 18, 34, .12);
  --shadow-2: 0 2px 6px rgba(12, 18, 34, .06), 0 24px 48px -24px rgba(12, 18, 34, .22);
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 64px;
}

[data-theme="dark"] {
  --bg: #0a0e18;
  --bg-soft: #0e1422;
  --surface: #121826;
  --surface-2: #161d2e;
  --ink: #eef1f8;
  --ink-2: #a7b0c2;
  --ink-3: #6b7488;
  --line: #232c40;
  --line-strong: #2e3850;
  --brand: #7c88ff;
  --brand-ink: #0a0e18;
  --brand-soft: #1d2440;
  --brand-ring: rgba(124, 136, 255, .35);
  --gold: #d8b25e;
  --ok: #4ade80;
  --ok-soft: #12271c;
  --warn: #f0a35c;
  --warn-soft: #2b2115;
  --err: #ff7a66;
  --err-soft: #2e1713;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .5);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .45), 0 24px 48px -24px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

/* The hidden attribute must always win over any display rule below
   (dropdown panels, wizard stages, …) */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -moz-osx-font-smoothing: auto; }

/* Phones: never let anything push the page wider than the screen
   (long question lines, wide code, tables) — wrap or clip instead. */
html, body { overflow-x: hidden; }

/* Crisp, high-definition text rendering (works for both Latin and Arabic) */
body, input, textarea, select, button {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
}
html[dir="rtl"] body, html[dir="rtl"] input, html[dir="rtl"] textarea, html[dir="rtl"] select, html[dir="rtl"] button { -webkit-font-smoothing: subpixel-antialiased; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  transition: background-color .25s ease, color .25s ease;
}

[dir="rtl"] body { letter-spacing: 0; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; }
button { font-family: inherit; }

::selection { background: var(--brand); color: var(--brand-ink); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: 20px;
}
.container--narrow { max-width: 860px; }
.container--wide { max-width: 1200px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}

.site-header .inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }

.brand .mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #4353ff 0%, #7a5cff 60%, #9a6bff 100%);
  box-shadow: 0 4px 14px -4px var(--brand-ring);
  flex: none;
}
.brand .mark svg { width: 20px; height: 20px; }

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: 8px;
}
.nav a {
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 550;
  padding: 7px 12px;
  border-radius: 999px;
}
.nav a:hover { color: var(--ink); background: var(--bg-soft); text-decoration: none; }
.nav a.active { color: var(--brand); background: var(--brand-soft); }

/* Home button in the header (inner pages) */
.nav .nav-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 650;
}
.nav .nav-home .nav-home-ic { display: inline-grid; place-items: center; }
.nav .nav-home .nav-home-ic svg { width: 15px; height: 15px; }
.nav .nav-home:hover { color: var(--brand); }

/* "More" dropdown (mobile): About / Contact / Privacy / Terms — hidden on
   desktop where About + Contact are already inline in the bar. */
.nav-more { position: relative; display: none; }
.nav-more-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
  padding: 7px 8px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.3;
}
.nav-more-btn:hover { color: var(--ink); background: var(--bg-soft); }
.nav-more-panel {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-start: 0;
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  padding: 6px;
  z-index: 60;
  display: grid;
  gap: 2px;
}
.nav-more-panel a {
  color: var(--ink);
  font-size: 14px;
  font-weight: 550;
  padding: 9px 12px;
  border-radius: 8px;
  white-space: nowrap;
}
.nav-more-panel a:hover { background: var(--bg-soft); text-decoration: none; }
.nav-more-panel a.active { color: var(--brand); background: var(--brand-soft); }

.header-controls {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Segmented language switcher */
.lang-switch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.3;
}
.lang-switch button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, transform .15s ease;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .sun { display: none; }
.icon-btn .moon { display: block; }
[data-theme="dark"] .icon-btn .sun { display: block; }
[data-theme="dark"] .icon-btn .moon { display: none; }

/* ---------- Mobile header ----------
   Brand shrinks to the logo mark, nav labels compress, and the language
   switcher + theme toggle stay VISIBLE and thumb-sized on phones
   (they must never disappear behind a burger menu). */
@media (max-width: 640px) {
  .site-header .inner { gap: 8px; }
  .brand { font-size: 0; gap: 0; }
  .brand .mark { width: 34px; height: 34px; }
  .nav { margin-inline-start: 0; gap: 0; }
  .nav a { font-size: 13px; padding: 7px 8px; }
  .nav .nav-home { gap: 0; }
  .nav .nav-home .nav-home-ic { display: none; }
  /* About / Contact / Privacy / Terms live in the "More" dropdown on phones —
     every important page stays one tap away without cluttering the bar */
  .nav a.nav-about, .nav a.nav-contact { display: none; }
  .nav-more { display: block; }
  .header-controls { gap: 6px; }
  .lang-switch { padding: 2px; gap: 1px; }
  .lang-switch button { font-size: 11.5px; padding: 6px 9px; }
  .icon-btn { width: 34px; height: 34px; flex: none; }
}
@media (max-width: 360px) {
  .nav a { padding: 7px 6px; }
  .lang-switch button { padding: 6px 7px; }
  .btn-nav-home span { display: none; } /* icon-only Home inside rows */
  .btn-nav-home { padding: 11px 13px; }
}
/* Ultra-narrow phones: compress further — Home becomes icon-only. */
@media (max-width: 380px) {
  .nav .nav-home { font-size: 0; gap: 0; }
  .nav .nav-home .nav-home-ic { display: inline-grid; }
  .nav .nav-home .nav-home-ic svg { width: 16px; height: 16px; }
  .lang-switch button { font-size: 11px; padding: 6px 6px; }
  .icon-btn { width: 32px; height: 32px; }
}

/* ---------- Hero ---------- */
.hero {
  padding: 72px 0 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: -240px;
  height: 480px;
  background:
    radial-gradient(560px 280px at 30% 40%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%),
    radial-gradient(560px 280px at 70% 45%, color-mix(in srgb, #9a6bff 14%, transparent), transparent 70%);
  pointer-events: none;
}
.hero .container { position: relative; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.12;
  margin: 0 0 16px;
  font-weight: 800;
  letter-spacing: -.025em;
}
.hero .sub {
  font-size: clamp(16px, 2.4vw, 19px);
  color: var(--ink-2);
  max-width: 640px;
  margin: 0 auto 30px;
}
.hero .cta-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 650;
  padding: 11px 20px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  text-decoration: none;
  line-height: 1.3;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn--primary {
  background: linear-gradient(135deg, #4353ff, #6a5cff);
  color: #fff;
  box-shadow: 0 8px 20px -8px var(--brand-ring);
}
.btn--primary:hover { box-shadow: 0 12px 26px -8px var(--brand-ring); }
[data-theme="dark"] .btn--primary { color: #fff; }

.btn--ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn--ghost:hover { border-color: var(--ink-3); }

.btn--soft {
  background: var(--brand-soft);
  color: var(--brand);
}
.btn--sm { padding: 8px 14px; font-size: 13.5px; border-radius: 10px; }
.btn--lg { padding: 14px 26px; font-size: 16px; }

/* ---------- Cards grid ---------- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 28px 0 8px;
}
@media (max-width: 720px) {
  .tools-grid { grid-template-columns: 1fr; }
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--ink);
  box-shadow: var(--shadow-1);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  overflow: hidden;
}
.tool-card::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #4353ff, #9a6bff);
  opacity: 0;
  transition: opacity .2s ease;
}
.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
  border-color: var(--line-strong);
  text-decoration: none;
}
.tool-card:hover::after { opacity: 1; }

.tool-card .icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 2px;
}
.tool-card .icon svg { width: 23px; height: 23px; }
.tool-card h3 { margin: 0; font-size: 18.5px; font-weight: 750; letter-spacing: -.01em; }
.tool-card p { margin: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.65; }
.tool-card .open {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand);
  font-weight: 650;
  font-size: 14.5px;
}
.tool-card .open svg { width: 15px; height: 15px; transition: transform .2s ease; }
[dir="rtl"] .tool-card .open svg { transform: scaleX(-1); }
.tool-card:hover .open svg { transform: translateX(3px); }
[dir="rtl"] .tool-card:hover .open svg { transform: scaleX(-1) translateX(3px); }

/* ---------- Feature strip ---------- */
.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 34px 0 10px;
}
@media (max-width: 720px) { .feature-strip { grid-template-columns: 1fr; } }
.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.feature .icon {
  flex: none;
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--bg-soft);
  color: var(--brand);
}
.feature .icon svg { width: 19px; height: 19px; }
.feature h4 { margin: 2px 0 4px; font-size: 15.5px; }
.feature p { margin: 0; font-size: 13.5px; color: var(--ink-2); }

/* ---------- Tool pages ---------- */
.tool-page { padding: 40px 0 64px; }
.tool-head { margin-bottom: 26px; }
.tool-head .back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.tool-head .back svg { width: 15px; height: 15px; }
[dir="rtl"] .tool-head .back svg { transform: scaleX(-1); }
.tool-head h1 { margin: 0 0 6px; font-size: clamp(26px, 4vw, 34px); font-weight: 800; letter-spacing: -.02em; }
.tool-head .desc { margin: 0; color: var(--ink-2); font-size: 15.5px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-1);
}
.panel + .panel { margin-top: 18px; }
.panel h2 { margin: 0 0 14px; font-size: 17px; font-weight: 750; }
.panel .hint { font-size: 13px; color: var(--ink-3); margin: 6px 0 0; }

.field { margin-bottom: 16px; }
.field > label {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink-2);
  margin-bottom: 7px;
}

input[type="text"], input[type="number"], input[type="email"], textarea, select {
  width: 100%;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 16px; /* ≥16px on mobile prevents iOS auto-zoom on focus */
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
@media (min-width: 641px) {
  input[type="text"], input[type="number"], input[type="email"], textarea, select { font-size: 15px; }
}
/* refined, premium inputs: inner depth + soft resting shadow */
input[type="text"], textarea, select {
  box-shadow:
    inset 0 1px 2px rgba(12, 18, 34, .04),
    0 1px 2px rgba(12, 18, 34, .04);
}
[data-theme="dark"] input[type="text"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, .25),
    0 1px 2px rgba(0, 0, 0, .2);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

/* Brief shake when the student clicks Next with an empty smart box —
   pairs with the error notice scrolling into view. */
.shake {
  animation: shakeX .5s ease;
}
@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
textarea { resize: vertical; line-height: 1.7; }
input[type="number"] { direction: ltr; text-align: start; }
[dir="rtl"] input[type="number"] { text-align: end; }

/* Hide native number spinners everywhere: on narrow cells (GPA table, cost
   fields) the arrows cover the typed digits. Students type with the keyboard
   anyway — the field is wider and the number fully visible now. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* "Home" button inside wizard / action rows — sits between the step
   buttons; icon collapses on tiny screens to keep one tidy row. */
.btn-nav-home {
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.btn-nav-home svg { width: 16px; height: 16px; }
.btn-nav-home:hover { color: var(--brand); border-color: var(--brand); }
[dir="rtl"] .btn-nav-home svg { transform: none; }

/* Title + pages side-by-side row */
.field-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.field-row .grow { flex: 1 1 240px; }
@media (max-width: 560px) {
  .field-row { align-items: stretch; flex-direction: column; }
  .field-row > .field { width: 100% !important; flex: auto !important; }
}

/* AdSense slots (invisible until configured in ads-config.js) */
.ad-slot { display: none; margin: 30px auto; max-width: 760px; text-align: center; }
.ad-slot.ad-active { display: block; min-height: 90px; }

/* FAQ */
.faq-section { margin-top: 40px; text-align: start; }
.faq-section h2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 4px; text-align: center; }
.faq-section > .muted { text-align: center; font-size: 14.5px; margin-bottom: 20px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 18px;
  margin-bottom: 10px;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 15px;
  padding: 14px 0;
  list-style: none;
  position: relative;
  padding-inline-end: 26px;
  color: var(--ink);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  position: absolute;
  inset-inline-end: 4px;
  top: 12px;
  color: var(--brand);
  font-weight: 800;
  font-size: 18px;
}
.faq-item[open] summary::after { content: '\2212'; }
.faq-item p { color: var(--ink-2); font-size: 14px; line-height: 1.75; margin: 0 0 14px; }

/* Segmented control */
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 12px;
}
.seg button {
  flex: 1 1 auto;
  min-width: 64px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-1);
}
.seg--cols { display: grid; grid-template-columns: repeat(2, 1fr); }

/* Checkbox elegant box */
.opt-box {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 14px 16px;
  margin: 18px 0 4px;
}
.opt-box .check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.opt-box input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
  flex: none;
}
.opt-box .check-row span { font-weight: 650; font-size: 14.5px; }
.opt-box .sub { margin: 2px 0 0 28px; font-size: 12.5px; color: var(--ink-3); }
.opt-box .ref-options {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.opt-box .ref-options.one-col { grid-template-columns: 1fr; }
@media (max-width: 640px) { .opt-box .ref-options { grid-template-columns: 1fr; } }
.opt-box .ref-options[hidden] { display: none; }

/* Wizard */
.wizard-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.wizard-steps .step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.wizard-steps .step .num {
  width: 20px; height: 20px;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  background: var(--bg-soft);
  font-size: 11.5px;
}
.wizard-steps .step.active { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); background: var(--brand-soft); }
.wizard-steps .step.active .num { background: var(--brand); color: var(--brand-ink); }
.wizard-steps .step.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.wizard-steps .step.done .num { background: var(--ok); color: var(--ok-soft); }

.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 640px) { .choice-grid { grid-template-columns: 1fr; } }
.choice {
  position: relative;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.choice:hover { border-color: var(--brand); }
.choice.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.choice .t { font-weight: 700; font-size: 15px; }
.choice .d { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }

/* Chips input */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px;
  min-height: 48px;
  cursor: text;
}
.chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13.5px;
  font-weight: 600;
  padding: 6px 8px 6px 12px;
  border-radius: 8px;
}
[dir="rtl"] .chips .chip { padding: 6px 12px 6px 8px; }
.chips .chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px;
  opacity: .7;
}
.chips .chip button:hover { opacity: 1; }
.chips input {
  flex: 1;
  min-width: 160px;
  border: 0;
  background: transparent;
  outline: none;
  padding: 6px;
  color: var(--ink);
  font-size: 14.5px;
}

/* Progress */
.progress-wrap { max-width: 520px; margin: 0 auto; text-align: center; padding: 30px 0 10px; }
.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  overflow: hidden;
  margin: 18px 0 14px;
}
.progress-bar > div {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4353ff, #9a6bff);
  transition: width .45s ease;
}
.progress-label { font-size: 15px; font-weight: 650; min-height: 24px; }
.progress-sub { font-size: 13px; color: var(--ink-3); margin-top: 6px; min-height: 18px; }

.spinner {
  width: 26px; height: 26px;
  margin: 0 auto 4px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Dhikr line — appears above the spinner while AI works, then fades away.
   Quiet, respectful, never in the way (subtle color, small text). */
.dhikr-line {
  min-height: 20px;
  margin-bottom: 10px;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
  opacity: 0;
  transition: opacity 1.1s ease;
  pointer-events: none;
}
.dhikr-line.show { opacity: 1; }

/* Approximate time-remaining readout under the progress bar. */
.progress-eta {
  min-height: 18px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Gentle one-line dhikr shown after results (GPA / cost) — fades in, then out */
.reward-line {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}
.reward-line.show { opacity: 1; }

/* Post-generation tips panel (replaces the old collected-sources list) */
.after-tips { margin-top: 12px; display: grid; gap: 10px; }
.after-tips .tip {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.6;
}
.after-tips .tip-ico { color: var(--brand); flex: none; font-size: 12px; }

/* Sources list */
.sources-list { margin: 10px 0 0; padding: 0; list-style: none; }
.sources-list li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}
.sources-list li:last-child { border-bottom: 0; }
.sources-list .src-tag {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 2px 7px;
  letter-spacing: .02em;
}
.sources-list a { word-break: break-word; }

/* Notice blocks */
.notice {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  margin: 12px 0;
  border: 1px solid transparent;
}
.notice--warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.notice--err { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.notice--ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }

/* Editable preview */
.preview-stage { display: grid; grid-template-columns: 1fr; gap: 18px; }
.doc-preview {
  background: #ffffff;
  color: #16181d;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 34px 38px;
  min-height: 320px;
  max-height: 640px;
  overflow: auto;
  box-shadow: var(--shadow-1);
  line-height: 1.8;
  font-size: 15px;
}
.doc-preview h2 { font-size: 19px; margin: 22px 0 8px; }
.doc-preview h3 { font-size: 16px; margin: 18px 0 6px; }
.doc-preview p { margin: 0 0 12px; }
.doc-preview .muted { color: #6b7280; font-size: 13px; }
.doc-preview label { display: block; }
.doc-preview textarea {
  width: 100%;
  border: 1px dashed #cfd4e0;
  border-radius: 8px;
  background: #fcfcfe;
  padding: 8px 10px;
  font-size: 14px;
  color: #16181d;
  margin: 2px 0 6px;
}
.doc-preview textarea:focus { border-color: var(--brand); }

.pdf-viewer {
  width: 100%;
  height: 640px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.action-bar .spacer { flex: 1; }

/* Tables (GPA) */
.table-wrap { overflow-x: auto; }
table.plain {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
table.plain th, table.plain td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: start;
  vertical-align: middle;
}
table.plain th {
  font-size: 12.5px;
  color: var(--ink-3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
table.plain input, table.plain select {
  padding: 8px 10px;
  font-size: 14px;
  width: 100%;
  min-width: 64px;
}
table.plain .row-del {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 17px;
  padding: 4px 8px;
  border-radius: 8px;
}
table.plain .row-del:hover { color: var(--err); background: var(--err-soft); }

/* Result cards */
.result-box {
  border: 1.5px solid color-mix(in srgb, var(--brand) 35%, transparent);
  background: var(--brand-soft);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
}
.result-box .label { font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.result-box .value {
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -.02em;
  line-height: 1.15;
  direction: ltr;
}
.result-box .value small { font-size: 16px; font-weight: 650; color: var(--ink-2); }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
@media (max-width: 640px) { .result-grid { grid-template-columns: 1fr; } }
.result-grid .mini {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.result-grid .mini .label { font-size: 12.5px; color: var(--ink-3); font-weight: 650; }
.result-grid .mini .value { font-size: 21px; font-weight: 750; direction: ltr; }

.breakdown { margin: 14px 0 0; font-size: 14px; color: var(--ink-2); }
.breakdown .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}
.breakdown .row:last-child { border-bottom: 0; }
.breakdown .row b { color: var(--ink); direction: ltr; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 56px;
  padding: 34px 0 40px;
  background: var(--surface);
}
.site-footer .cols {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: space-between;
  align-items: flex-start;
}
.site-footer .brandline { display: flex; flex-direction: column; gap: 6px; max-width: 300px; }
.site-footer .brandline .brand { font-size: 15px; }
.site-footer .tagline { color: var(--ink-3); font-size: 13.5px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.site-footer nav a { color: var(--ink-2); font-size: 14px; }
.site-footer nav a:hover { color: var(--ink); }
.site-footer .fine {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12.5px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
}

/* Toast */
.toast-wrap {
  position: fixed;
  bottom: 22px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(480px, calc(100vw - 40px));
}
[dir="rtl"] .toast-wrap { transform: translateX(50%); }
/* lift toasts above the floating home button on phones */
@media (max-width: 640px) { .toast-wrap { bottom: 140px; } }
.toast {
  background: var(--ink);
  color: var(--bg);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 550;
  box-shadow: var(--shadow-2);
  animation: toast-in .25s ease;
}
.toast--err { background: var(--err); color: #fff; }
.toast--ok { background: var(--ok); color: #fff; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Static pages */
.prose { max-width: 760px; }
.prose h2 { font-size: 20px; margin: 28px 0 10px; }
.prose p, .prose li { color: var(--ink-2); font-size: 15px; }
.prose ul { padding-inline-start: 22px; }

/* Utility */
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

.skeleton-note { font-size: 13px; color: var(--ink-3); }

/* ---------- Phone readability & comfort ---------- */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .hero { padding: 44px 0 28px; }
  .hero h1 { letter-spacing: -.018em; }
  .container { padding-inline: 16px; }
  .panel { padding: 18px 16px; }
  .doc-preview { padding: 20px 16px; }
  .tool-page { padding: 26px 0 48px; }
  .site-footer { padding: 26px 0 34px; }
  .site-footer .cols { gap: 20px; }
}
/* Amiri on screen: slightly larger line-height keeps Arabic crisp & readable */
html[lang="ar"] body { line-height: 1.75; }

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

/* ---------------- Upload zone (Solve PDF File) ----------------
   A dashed drop target with a native <input type="file"> stretched over it
   (opacity 0), so mouse, keyboard and touch all open the file picker while
   the visible label stays fully localised. */
.file-drop {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 78px;
  padding: 18px 16px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
}
.file-drop:hover { border-color: var(--brand); }
.file-drop:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.file-drop.over { border-color: var(--brand); background: var(--brand-soft); }
.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.file-drop .file-pick {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 650;
  font-size: 14px;
  pointer-events: none;
}.file-status { min-height: 0; font-weight: 650; color: var(--brand); }
.file-status:empty { display: none; }
.file-status.is-err { color: var(--err); }

/* ── Exam Chapters Summarizer ───────────────────────────── */
.file-list { list-style: none; margin: 10px 0 0; padding: 0; }
.file-list .file-empty { padding: 10px 2px; font-size: 13.5px; color: var(--ink-3); }
.file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-top: 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2); font-size: 14px;
}
.file-item .fi-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 650; direction: ltr; text-align: start;
}
.file-item .fi-status { font-size: 12.5px; color: var(--ink-3); flex: none; }
.file-item.stat-ready .fi-status { color: var(--ok, #1d9a52); font-weight: 650; }
.file-item.stat-failed .fi-status { color: var(--err); font-weight: 650; }
.file-item.stat-reading .fi-status { color: var(--brand); }
.fi-remove {
  flex: none; width: 26px; height: 26px; line-height: 24px; text-align: center;
  border: none; border-radius: 999px; background: transparent;
  color: var(--ink-3); font-size: 16px; cursor: pointer;
}
.fi-remove:hover { background: var(--err-soft, rgba(220, 60, 60, .1)); color: var(--err); }

.ex-card {
  margin-top: 18px; padding: 18px 18px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2);
}
.ex-card > h3 { margin: 0; font-size: 17px; }
.ex-subhead {
  margin: 14px 0 6px; font-size: 12.5px; font-weight: 750;
  text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3);
}
.ex-points { margin: 0; padding-inline-start: 20px; line-height: 1.85; font-size: 14.5px; }
.ex-points li + li { margin-top: 5px; }
.ex-score { margin: 4px 0 10px; font-size: 13px; font-weight: 700; color: var(--brand); }
.ex-q { padding: 10px 0 2px; border-top: 1px solid var(--line); }
.ex-q-title { font-weight: 650; font-size: 14.5px; margin-bottom: 8px; line-height: 1.6; }
.ex-opts { display: grid; gap: 7px; }
.ex-opt {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 12px; text-align: start;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px; cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.ex-opt:hover { border-color: var(--brand); }
.ex-opt-letter {
  flex: none; width: 22px; height: 22px; line-height: 20px; text-align: center;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: 12px; font-weight: 700; color: var(--ink-2);
}
.ex-q.locked .ex-opt { cursor: default; }
.ex-q.locked .ex-opt:hover { border-color: var(--line-strong); }
.ex-opt.is-correct {
  border-color: #1d9a52; background: rgba(29, 154, 82, .08); font-weight: 700;
}
.ex-opt.is-correct .ex-opt-letter {
  border-color: #1d9a52; background: #1d9a52; color: #fff;
}
.ex-opt.is-wrong {
  border-color: var(--err); background: var(--err-soft, rgba(220, 60, 60, .07));
}
.ex-opt.is-wrong .ex-opt-letter {
  border-color: var(--err); background: var(--err); color: #fff;
}
.ex-card .btn--sm { margin-top: 12px; }


