:root {
  --bg: #F5EFE3;
  --surface: #FFFCF6;
  --surface-2: #F0E8D8;
  --ink: #18221E;
  --muted: #5B675F;
  --line: #E2D6C0;
  --brand: #0F5C4C;
  --brand-2: #0A4438;
  --brand-ink: #FFFFFF;
  --accent: #B98222;
  --accent-soft: #F6E7C8;
  --c-state: #0F5C4C;
  --c-conservation: #C9902B;
  --c-notary: #B5523B;
  --c-bank: #2E4FA0;
  --success: #1E7A4F;
  --warn: #A86A12;
  --danger: #B23A2E;
  --info: #2E4FA0;
  --pattern: rgba(15, 92, 76, .07);
  --shadow: 0 1px 2px rgba(24, 34, 30, .05), 0 12px 32px -12px rgba(24, 34, 30, .18);
  --radius: 20px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Fraunces', Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1311; --surface: #131C19; --surface-2: #1A2521; --ink: #EDF2EE; --muted: #97A69D; --line: #25332D;
    --brand: #3DBE99; --brand-2: #0F3A31; --brand-ink: #062019; --accent: #E5B45C; --accent-soft: #3A2E17;
    --c-state: #3DBE99; --c-conservation: #E5B45C; --c-notary: #E27D62; --c-bank: #7C9CEB;
    --success: #4CC38A; --warn: #E5B45C; --danger: #F07A6B; --info: #7C9CEB;
    --pattern: rgba(61, 190, 153, .06);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -16px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1311; --surface: #131C19; --surface-2: #1A2521; --ink: #EDF2EE; --muted: #97A69D; --line: #25332D;
  --brand: #3DBE99; --brand-2: #0F3A31; --brand-ink: #062019; --accent: #E5B45C; --accent-soft: #3A2E17;
  --c-state: #3DBE99; --c-conservation: #E5B45C; --c-notary: #E27D62; --c-bank: #7C9CEB;
  --success: #4CC38A; --warn: #E5B45C; --danger: #F07A6B; --info: #7C9CEB;
  --pattern: rgba(61, 190, 153, .06);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -16px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

:lang(ar) { --font: 'IBM Plex Sans Arabic', 'Manrope', system-ui, sans-serif; --display: 'Noto Kufi Arabic', 'IBM Plex Sans Arabic', serif; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
}
button, input { font: inherit; color: inherit; }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num, .total, .money input, .lines .amt, dd, .big-num { font-variant-numeric: tabular-nums; }

/* Zellige background */
.pattern {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--pattern);
  --tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23000' stroke-width='1.2'%3E%3Crect x='22' y='22' width='36' height='36'/%3E%3Crect x='22' y='22' width='36' height='36' transform='rotate(45 40 40)'/%3E%3Ccircle cx='40' cy='40' r='9'/%3E%3Cpath d='M0 0l14 14M80 0 66 14M0 80l14-14M80 80 66 66'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask: var(--tile) repeat; mask: var(--tile) repeat;
  -webkit-mask-size: 80px; mask-size: 80px;
  mask-image: var(--tile), linear-gradient(#000 0, transparent 70vh);
}

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px max(16px, calc((100vw - 1200px) / 2));
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.logo { width: 36px; height: 36px; stroke: var(--accent); stroke-width: 2.2; }
.logo circle { fill: var(--brand); stroke: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-family: 'Fraunces', serif; font-size: clamp(15px, 2.4vw, 20px); font-weight: 600; letter-spacing: -.01em; }
:lang(ar) .brand-text b { font-family: var(--display); letter-spacing: 0; }
.brand { min-width: 0; }
.brand-text { min-width: 0; }
.brand-text small { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
@media (max-width: 400px) { .brand-text small { display: none; } }
.top-actions { display: flex; gap: 8px; align-items: center; }
.lang { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.lang button {
  border: 0; background: none; cursor: pointer; min-width: 38px; height: 32px; border-radius: 999px;
  font-weight: 700; font-size: 13px; color: var(--muted); transition: .2s;
}
.lang button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.lang button[data-lang="ar"] { font-family: 'IBM Plex Sans Arabic', sans-serif; font-size: 15px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; transition: transform .2s;
}
.icon-btn:hover { transform: rotate(-15deg); }
.icon-btn .i-moon { display: none; }
:root[data-dark="1"] .icon-btn .i-sun { display: none; }
:root[data-dark="1"] .icon-btn .i-moon { display: block; }

/* Hero */
.hero { max-width: 1200px; margin: 0 auto; padding: 56px 16px 32px; text-align: center; }
.kicker {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 6px 14px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.hero h1 {
  font-family: var(--display); font-weight: 600; font-size: clamp(32px, 5.6vw, 64px); line-height: 1.06;
  letter-spacing: -.025em; margin: 0 auto 18px; max-width: 16ch; text-wrap: balance;
}
:lang(ar) .hero h1 { letter-spacing: 0; line-height: 1.35; max-width: 18ch; }
.hero h1 em { font-style: italic; color: var(--brand); position: relative; white-space: nowrap; }
:lang(ar) .hero h1 em { font-style: normal; }
.hero h1 em::after {
  content: ''; position: absolute; inset-inline: 0; bottom: .02em; height: .14em; background: var(--accent);
  opacity: .35; border-radius: 4px; transform-origin: left; animation: draw 1s .4s both cubic-bezier(.2, .8, .2, 1);
}
@keyframes draw { from { transform: scaleX(0); } }
.hero-sub { color: var(--muted); font-size: clamp(16px, 1.8vw, 19px); max-width: 60ch; margin: 0 auto 24px; text-wrap: pretty; }
.badges { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.badges li { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.badges svg { color: var(--brand); }

/* Layout */
.layout {
  max-width: 1200px; margin: 0 auto; padding: 8px 16px 48px;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px; align-items: start;
}
@media (max-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr); } }

.panel, .card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.form { padding: 8px 24px 16px; }
.step { border: 0; margin: 0; padding: 20px 0; border-bottom: 1px dashed var(--line); min-width: 0; }
.step:last-of-type { border-bottom: 0; }
.step[hidden] { display: none; }
legend { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; margin-bottom: 12px; padding: 0; }
legend .n {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 13px;
  background: var(--brand); color: var(--brand-ink);
}

/* Segmented control */
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 14px; padding: 4px; }
.seg button { position: relative; z-index: 1; border: 0; background: none; padding: 11px 8px; font-weight: 700; cursor: pointer; color: var(--muted); border-radius: 10px; transition: color .25s; }
.seg button[aria-checked="true"] { color: var(--ink); }
.seg-thumb {
  position: absolute; top: 4px; bottom: 4px; inset-inline-start: 4px; width: calc((100% - 8px) / var(--count, 2));
  background: var(--surface); border-radius: 10px; box-shadow: var(--shadow);
  transform: translateX(calc(var(--i, 0) * 100% * var(--flip, 1))); transition: transform .35s cubic-bezier(.3, 1.3, .5, 1);
}
[dir="rtl"] .seg-thumb { --flip: -1; }
.seg.sm button { padding: 8px; font-size: 14px; }

/* Money inputs */
.money {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1.5px solid transparent;
  border-radius: 14px; padding: 0 16px; transition: border-color .2s, background .2s;
}
.money:focus-within { border-color: var(--brand); background: var(--surface); }
.money input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 12px 0; font-weight: 700; font-size: 17px; }
.money .unit { color: var(--muted); font-weight: 700; font-size: 14px; }
.money.big input { font-family: var(--display); font-size: clamp(28px, 4vw, 38px); font-weight: 600; padding: 10px 0; letter-spacing: -.01em; }
:lang(ar) .money.big input { font-family: 'Fraunces', serif; }
.money.sm input { font-size: 16px; padding: 10px 0; }

input[type="range"] { width: 100%; margin: 16px 0 6px; accent-color: var(--brand); height: 6px; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips button {
  border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 700; cursor: pointer; transition: .2s; direction: ltr;
}
.chips button:hover { border-color: var(--brand); color: var(--brand); }
.chips button.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* Property types */
.types { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.types button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; text-align: start;
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 16px; cursor: pointer;
  transition: border-color .2s, transform .2s, background .2s;
}
.types button:hover { transform: translateY(-2px); }
.types svg { width: 30px; height: 30px; color: var(--muted); margin-bottom: 6px; stroke-width: 1.6; transition: color .2s; }
.types b { font-size: 15px; }
.types small { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.types button[aria-checked="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.types button[aria-checked="true"] svg { color: var(--brand); }

.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; min-width: 0; }
.field:first-child { margin-top: 0; }
.lbl { font-weight: 600; font-size: 14px; }
.hint { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.row-3 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; margin-top: 14px; }
.row-3 > :last-child { grid-column: 1 / -1; }
.row-3 .field { margin-top: 0; }
.row-3 > :last-child { margin-top: 14px; }
.row-3 input[type="range"] { margin: 8px 0 0; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; cursor: pointer; }
.switch-row:first-of-type { margin-top: 0; }
.switch-row > span { display: flex; flex-direction: column; }
.switch {
  appearance: none; flex: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line);
  position: relative; cursor: pointer; transition: background .25s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .3s cubic-bezier(.3, 1.4, .5, 1);
}
.switch:checked { background: var(--brand); }
.switch:checked::after { transform: translateX(20px); }
[dir="rtl"] .switch:checked::after { transform: translateX(-20px); }
.switch:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.collapse { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 0fr; transition: grid-template-rows .4s cubic-bezier(.2, .8, .2, 1); }
.collapse.open { grid-template-rows: 1fr; }
.collapse-inner { overflow: hidden; min-height: 0; padding-top: 0; }
.collapse.open .collapse-inner { padding-top: 16px; }

.advanced { padding: 16px 0 4px; border-top: 1px dashed var(--line); }
.advanced summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; color: var(--muted); list-style: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced[open] summary { color: var(--ink); margin-bottom: 14px; }

/* Results */
.results { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.total-card {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
  padding: 28px; border-radius: 24px; color: #F5F1E6;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(229, 180, 92, .28), transparent 50%),
    linear-gradient(150deg, #0F5C4C, #08372E 70%);
  box-shadow: 0 24px 48px -20px rgba(8, 55, 46, .55);
}
.total-card::before {
  content: ''; position: absolute; inset: 0; opacity: .09; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23fff' stroke-width='1.5'%3E%3Crect x='22' y='22' width='36' height='36'/%3E%3Crect x='22' y='22' width='36' height='36' transform='rotate(45 40 40)'/%3E%3C/g%3E%3C/svg%3E");
  mask-image: linear-gradient(to left, #000, transparent 70%);
}
[dir="rtl"] .total-card::before { mask-image: linear-gradient(to right, #000, transparent 70%); }
.total-main { position: relative; min-width: 0; }
.eyebrow { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; opacity: .75; }
:lang(ar) .eyebrow { letter-spacing: 0; font-size: 15px; }
.total {
  margin: 4px 0 6px; font-family: 'Fraunces', serif; font-weight: 600; font-size: clamp(38px, 6vw, 58px);
  line-height: 1; letter-spacing: -.02em; white-space: nowrap;
}
.total .cur { font-size: .42em; opacity: .7; margin-inline-start: .25em; font-family: var(--font); font-weight: 700; letter-spacing: 0; }
.total-sub { margin: 0; font-size: 14px; opacity: .85; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: rgba(229, 180, 92, .22); color: #F2CC85; font-weight: 800; }
.legend { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.legend li span:nth-child(2) { opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend li b { margin-inline-start: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-wrap { position: relative; width: 150px; height: 150px; }
.donut { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.donut circle { fill: none; stroke-width: 14; }
.donut .track { stroke: rgba(255, 255, 255, .1); }
.donut .seg-arc { transition: stroke-dasharray .7s cubic-bezier(.2, .8, .2, 1), stroke-dashoffset .7s cubic-bezier(.2, .8, .2, 1); }
.donut-center { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 58px; }
.donut-center b { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 600; }
.donut-center small { font-weight: 700; opacity: .7; }
.total-card .dot-state { background: #6FE0BC; } .total-card .dot-conservation { background: #E5B45C; }
.total-card .dot-notary { background: #F0937A; } .total-card .dot-bank { background: #9DB5F5; }
@media (max-width: 560px) {
  .total-card { grid-template-columns: 1fr; padding: 22px; }
  .donut-wrap { display: none; }
}

.card { padding: 22px 24px; }
.card-title { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 800; }
:lang(ar) .card-title { letter-spacing: 0; font-size: 15px; }

.lines { list-style: none; padding: 0; margin: 0; }
.lines li {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: baseline; padding: 11px 0;
  border-bottom: 1px solid var(--line); animation: rise .45s both cubic-bezier(.2, .8, .2, 1);
}
.lines li:last-child { border-bottom: 0; }
.lines .dot { transform: translateY(1px); }
.lines .name { font-weight: 600; font-size: 15px; }
.lines .meta { grid-column: 2; font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.lines .meta .ref { font-weight: 600; }
.lines .meta .formula { direction: ltr; unicode-bidi: isolate; }
.lines .amt { grid-row: 1; grid-column: 3; font-weight: 800; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.lines .aid .amt { color: var(--success); }
.tag { font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tag.ok { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .duo { grid-template-columns: 1fr; } }
.duo .card:only-child { grid-column: 1 / -1; }
dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: 14.5px; }
dt { color: var(--muted); font-weight: 600; }
dd { margin: 0; font-weight: 700; text-align: end; direction: ltr; unicode-bidi: isolate; }
dt.strong, dd.strong { color: var(--ink); font-size: 16px; padding-top: 10px; border-top: 1px solid var(--line); }
dd.strong { font-weight: 800; }
dd.hl { color: var(--brand); font-family: 'Fraunces', serif; font-size: 22px; font-weight: 600; }
dd.aid { color: var(--success); }
.big-num { font-family: 'Fraunces', serif; font-size: 34px; font-weight: 600; line-height: 1.1; color: var(--brand); direction: ltr; unicode-bidi: isolate; display: inline-block; }
.big-num small { font-family: var(--font); font-size: 14px; color: var(--muted); font-weight: 700; }
.mortgage .sub { color: var(--muted); font-size: 13px; margin: 2px 0 14px; }
.meter { margin-top: 14px; }
.meter-top { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.meter-bar { position: relative; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 99px; background: var(--success); transition: width .6s cubic-bezier(.2, .8, .2, 1), background .3s; }
.meter-bar i.bad { background: var(--danger); }
.meter-bar .limit { position: absolute; inset-block: -2px; width: 2px; background: var(--ink); opacity: .35; inset-inline-start: 40%; }
.empty { color: var(--muted); font-size: 14px; margin: 0; }

.insights ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.insights li {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 14.5px;
  background: color-mix(in srgb, var(--tone) 9%, transparent); border-inline-start: 3px solid var(--tone);
  animation: rise .45s both cubic-bezier(.2, .8, .2, 1);
}
.insights li svg { color: var(--tone); margin-top: 1px; }
.insights b { color: var(--tone); white-space: nowrap; }
.tone-success { --tone: var(--success); } .tone-warn { --tone: var(--warn); } .tone-danger { --tone: var(--danger); } .tone-info { --tone: var(--info); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; text-decoration: none; color: var(--ink);
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.gold { background: #E5B45C; border-color: #E5B45C; color: #1E1608; }
.btn.sm { padding: 9px 14px; font-size: 14px; }
.actions .btn.primary { flex: 1 1 200px; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.disclaimer { margin: 0; color: var(--muted); font-size: 12.5px; text-align: center; }

/* Pro band */
.pro { padding: 0 16px; }
.pro-inner {
  max-width: 1200px; margin: 0 auto; padding: 36px; border-radius: 28px; color: #F1EEE4;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  background: radial-gradient(80% 120% at 0% 100%, rgba(46, 79, 160, .55), transparent 60%), linear-gradient(135deg, #171E2E, #0D1220);
}
.pro-inner > div { max-width: 640px; }
.pro h2 { font-family: var(--display); font-weight: 600; font-size: clamp(24px, 3vw, 34px); margin: 0 0 8px; letter-spacing: -.01em; }
.pro p { margin: 0; opacity: .8; }
.kicker.light { background: rgba(229, 180, 92, .15); color: #E5B45C; margin-bottom: 12px; }

.method { max-width: 860px; margin: 0 auto; padding: 56px 16px 24px; }
.method h2 { font-family: var(--display); font-weight: 600; font-size: 28px; margin: 0 0 8px; }
.method > p { color: var(--muted); }
.method ol { padding-inline-start: 20px; margin: 16px 0; }
.method li { margin: 6px 0; }
.method a { color: var(--brand); font-weight: 600; text-underline-offset: 3px; }
.verified { font-size: 14px; color: var(--muted); }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 16px 16px 110px; }
.footer p { margin: 4px 0; }

/* Mobile sticky bar */
.mobilebar {
  position: fixed; inset-inline: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 30;
  display: none; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 18px;
  border-radius: 18px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px);
  border: 1px solid var(--line); box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .35);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .3s;
}
[dir="rtl"] .mobilebar { padding: 10px 18px 10px 10px; }
.mobilebar div { display: flex; flex-direction: column; line-height: 1.15; }
.mobilebar small { color: var(--muted); font-size: 12px; font-weight: 700; }
.mobilebar b { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 600; direction: ltr; unicode-bidi: isolate; }
.mobilebar.hide { transform: translateY(140%); opacity: 0; }
@media (max-width: 960px) { .mobilebar { display: flex; } }

.toast {
  position: fixed; left: 50%; top: 80px; z-index: 50; transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: 14px;
  transition: .3s cubic-bezier(.2, .8, .2, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.print-head { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

@media print {
  @page { margin: 14mm; }
  :root { --bg: #fff; --surface: #fff; --shadow: none; }
  body { background: #fff; color: #000; }
  .pattern, .topbar, .hero, .form, .actions, .pro, .mobilebar, .toast, .footer, .method ol { display: none !important; }
  .layout { display: block; padding: 0; }
  .print-head { display: block; font-size: 14px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid #0F5C4C; }
  .total-card { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; break-inside: avoid; }
  .card { box-shadow: none; break-inside: avoid; }
  .method { padding: 16px 0 0; }
  .lines li, .insights li { animation: none; }
}

/* Étapes numérotées automatiquement (les étapes masquées ne comptent pas) */
.form { counter-reset: step; }
.step:not([hidden]) { counter-increment: step; }
legend .n::before { content: counter(step); }

/* Honoraires du notaire : choix du taux */
.pct-pick { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pct-value { font-family: 'Fraunces', serif; font-size: clamp(30px, 4vw, 38px); font-weight: 600; color: var(--brand); direction: ltr; unicode-bidi: isolate; }
.pct-amount { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.range-ends { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--muted); margin-top: -2px; }
#notaryChips + .hint { margin-top: 10px; }

/* Financement : 3 options */
.seg.fin button { font-size: 14px; padding: 11px 4px; }

/* Schéma Mourabaha : 2 opérations */
.flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 4px; padding: 14px 10px; border-radius: 16px; background: var(--surface-2); }
.flow-node { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 12.5px; font-weight: 700; min-width: 0; }
.flow-node svg { width: 34px; height: 34px; padding: 7px; border-radius: 12px; background: var(--surface); color: var(--muted); box-shadow: var(--shadow); }
.flow-node.bank svg { color: var(--c-bank); }
.flow-node.you svg { color: var(--brand); }
.flow-arrow { display: flex; flex-direction: column; align-items: center; color: var(--muted); font-size: 11px; font-weight: 700; text-align: center; max-width: 92px; }
.flow-arrow b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #1E1608; font-size: 11px; }
.flow-arrow svg { width: 26px; height: 18px; }
.flow-arrow small { line-height: 1.25; }
#murabahaBox.open + #loanBox.open .collapse-inner { padding-top: 14px; }

/* Résultats regroupés par opération (Mourabaha) */
.lines .op-head { display: flex; align-items: center; gap: 10px; padding: 14px 0 6px; border-bottom: 0; grid-template-columns: none; font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
:lang(ar) .lines .op-head { letter-spacing: 0; font-size: 14px; }
.lines .op-head:first-child { padding-top: 0; }
.lines .op-head b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #1E1608; font-size: 12px; letter-spacing: 0; }
.lines .op-head::after { content: ''; flex: 1; height: 1px; background: var(--line); }
dd.muted, dt.muted { color: var(--muted); font-weight: 600; }

/* ---------- Marque blanche : simulateur d'un professionnel ---------- */
:root[data-pro="1"] { --brand: var(--pro-brand); --c-state: var(--pro-brand); --brand-ink: #FFFFFF; }
:root[data-pro="1"][data-dark="1"] { --brand: var(--pro-brand-dark); --c-state: var(--pro-brand-dark); --brand-ink: #0B0F0E; }
:root[data-pro="1"] .total-card {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, .14), transparent 50%),
    linear-gradient(150deg, var(--pro-card-1), var(--pro-card-2) 70%);
}
:root[data-pro="1"] .pro { display: none; }
.brand .pro-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 10px; background: #fff; padding: 3px; border: 1px solid var(--line); flex: none; }
.brand.has-logo .logo { display: none; }

.pro-contact { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.pro-id { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; min-width: 0; }
.pro-id > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pro-id b { font-size: 18px; }
.pro-id span { color: var(--muted); font-size: 14px; }
.pro-id-logo { width: 64px; height: 64px; border-radius: 16px; object-fit: contain; background: #fff; border: 1px solid var(--line); padding: 6px; flex: none; }
.pro-id-logo.mono { display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-family: 'Fraunces', serif; font-size: 28px; font-weight: 600; border: 0; }
.pro-where { display: flex; align-items: center; gap: 4px; }
.pro-where svg { width: 15px; height: 15px; flex: none; }
.pro-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.pro-actions .btn { padding: 11px 12px; }

.powered { display: none; }
:root[data-pro="1"] .powered { display: block; }
.footer a { color: inherit; font-weight: 700; }

/* Mode intégré (iframe sur le site du professionnel) */
:root[data-embed="1"] body { background: transparent; }
:root[data-embed="1"] .pattern,
:root[data-embed="1"] .hero,
:root[data-embed="1"] .pro,
:root[data-embed="1"] .method,
:root[data-embed="1"] .mobilebar { display: none !important; }
:root[data-embed="1"] .topbar { position: static; }
:root[data-embed="1"] .layout { padding-top: 16px; }
:root[data-embed="1"] .footer { padding-bottom: 16px; }

@media print {
  .print-head { display: flex; flex-direction: column; gap: 6px; }
  .print-head p { margin: 0; }
  .print-brand:empty { display: none; }
  .print-brand { display: flex; align-items: center; gap: 12px; }
  .print-brand img { width: 56px; height: 56px; object-fit: contain; }
  .print-brand div { display: flex; flex-direction: column; }
  .print-brand b { font-size: 18px; }
  .pro-contact .pro-actions { display: none; }
}

/* ---------- Espace professionnels ---------- */
.pro-layout { grid-template-columns: minmax(0, 1fr) 400px; }
@media (max-width: 960px) { .pro-layout { grid-template-columns: minmax(0, 1fr); } }
.pro-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.pro-types button { flex-direction: row; align-items: center; gap: 10px; padding: 12px 14px; }
.pro-types svg { margin: 0; width: 26px; height: 26px; }
.err { color: var(--danger); font-size: 13px; font-weight: 700; min-height: 0; }
.err:empty { display: none; }
.money.invalid { border-color: var(--danger); }
.money input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); font-weight: 500; }
.row-3 .row-hint { grid-column: 1 / -1; margin-top: 6px; }

.drop {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 110px; padding: 16px;
  border: 2px dashed var(--line); border-radius: 16px; background: var(--surface-2); cursor: pointer; text-align: center;
  transition: border-color .2s, background .2s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--surface-2)); }
.drop-text { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 14px; }
.drop-text svg { width: 26px; height: 26px; color: var(--brand); }
.drop img { width: 84px; height: 84px; object-fit: contain; background: #fff; border-radius: 14px; padding: 6px; border: 1px solid var(--line); }
.drop.has-logo .drop-text { align-items: flex-start; text-align: start; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 14px; align-self: flex-start; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.swatches button, .sw-custom {
  width: 38px; height: 38px; border-radius: 12px; border: 2px solid var(--surface); background: var(--sw);
  box-shadow: 0 0 0 1px var(--line); cursor: pointer; transition: transform .15s, box-shadow .2s; position: relative;
}
.swatches button:hover { transform: scale(1.08); }
.swatches button.on { box-shadow: 0 0 0 2px var(--ink); }
.sw-custom { overflow: hidden; background: conic-gradient(from 0deg, #e5484d, #f5a623, #30a46c, #0091ff, #8e4ec6, #e5484d); }
.sw-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

.consent { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; font-size: 14px; color: var(--muted); cursor: pointer; }
.consent input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.big-btn { width: 100%; margin: 8px 0 12px; padding: 16px; font-size: 17px; border-radius: 16px; }
.big-btn:disabled { opacity: .6; cursor: progress; }

.done { padding: 24px; border-color: color-mix(in srgb, var(--success) 40%, var(--line)); animation: rise .5s both cubic-bezier(.2, .8, .2, 1); outline: none; }
.done-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.done-head h2 { font-family: var(--display); font-weight: 600; font-size: 26px; margin: 0 0 4px; }
.done-head p { margin: 0; color: var(--muted); }
.done-check { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--success); color: #fff; flex: none; animation: pop .5s .1s both cubic-bezier(.3, 1.6, .5, 1); }
.done-check svg { width: 26px; height: 26px; stroke-width: 2.6; }
@keyframes pop { from { transform: scale(0); } }
.done h3 { margin: 22px 0 4px; font-size: 16px; }
.link-box { display: flex; gap: 8px; margin: 6px 0 10px; }
.link-box input, .done textarea {
  flex: 1; min-width: 0; border: 1.5px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 10px 12px;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--ink); direction: ltr;
}
.done textarea { width: 100%; resize: vertical; margin: 8px 0; }
.done-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cfg-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; color: var(--muted); }

.preview-col { position: sticky; top: 84px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
@media (max-width: 960px) { .preview-col { position: static; } }
.preview-head { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.preview-head span { color: var(--muted); font-size: 13px; }
.device {
  position: relative; width: 100%; max-width: 380px; height: min(760px, calc(100vh - 160px)); min-height: 560px;
  border-radius: 44px; padding: 12px; background: #111; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .45), inset 0 0 0 2px #2a2a2a;
}
.device-notch { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 110px; height: 24px; background: #111; border-radius: 0 0 16px 16px; z-index: 2; }
.device iframe { width: 100%; height: 100%; border: 0; border-radius: 34px; background: var(--bg); }

/* ---------- Publicité (AdSense) ---------- */
.ad-slot { display: block; min-height: 120px; padding: 10px 12px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--line); overflow: hidden; }
.ad-slot[hidden] { display: none; }
.ad-wide { max-width: 1200px; margin: 32px auto 0; width: calc(100% - 32px); }
.ad-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
:lang(ar) .ad-label { letter-spacing: 0; }
@media print { .ad-slot { display: none !important; } }

/* ---------- Pages SEO par ville ---------- */
.seo-page .lang a {
  display: grid; place-items: center; min-width: 38px; height: 32px; border-radius: 999px; padding: 0 8px;
  font-weight: 700; font-size: 13px; color: var(--muted); text-decoration: none;
}
.seo-page .lang a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seo-page .lang a[lang="ar"] { font-family: 'IBM Plex Sans Arabic', sans-serif; font-size: 15px; }
.seo-hero { padding-bottom: 24px; }
.crumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.crumbs a { color: var(--muted); font-weight: 600; }
.seo { max-width: 1100px; margin: 0 auto; padding: 0 16px 32px; display: flex; flex-direction: column; gap: 20px; }
.seo h2 { font-size: 18px; margin: 0 0 12px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat b { font-family: 'Fraunces', serif; font-size: clamp(20px, 2.6vw, 26px); font-weight: 600; direction: ltr; unicode-bidi: isolate; }
.stat small { color: var(--muted); font-weight: 700; }
.stat.hl { background: linear-gradient(150deg, #0F5C4C, #08372E); color: #F5F1E6; border: 0; }
.stat.hl span, .stat.hl small { color: rgba(245, 241, 230, .8); }
.seo-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; }
@media (max-width: 860px) { .seo-grid { grid-template-columns: minmax(0, 1fr); } }
.breakdown { font-size: 15px; }
.table-wrap { overflow-x: auto; }
.seo table { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.seo th { text-align: start; color: var(--muted); font-size: 12.5px; font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.seo td { padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.seo tr:last-child td { border-bottom: 0; }
.seo td a { color: var(--brand); text-decoration: none; }
.note { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.sim-card iframe { width: 100%; height: 1500px; border: 0; border-radius: 16px; margin: 12px 0; background: var(--bg); }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: '+'; color: var(--brand); font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq summary::-webkit-details-marker { display: none; }
.faq p { color: var(--muted); margin: 8px 0 0; }
.city-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.city-chip { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: border-color .2s, transform .2s; }
.city-chip:hover { border-color: var(--brand); transform: translateY(-2px); }
.city-chip span { color: var(--muted); font-size: 13px; direction: ltr; unicode-bidi: isolate; text-align: start; }
.source a { color: var(--brand); font-weight: 600; }
