/* حاسبها — التصميم الأساسي (Mobile-first, RTL) */
:root {
  --c-primary: #1d3557;
  --c-primary-2: #274b7a;
  --c-primary-soft: #e8eef7;
  --c-accent: #f2b43a;
  --c-accent-soft: #fdf3df;
  --c-bg: #f6f7fb;
  --c-surface: #ffffff;
  --c-text: #1b2230;
  --c-muted: #5b6475;
  --c-border: #dde2ec;
  --c-ok: #1f7a4d;
  --c-ok-soft: #e4f4ec;
  --c-warn: #9a5b00;
  --c-warn-soft: #fff1d6;
  --c-err: #b42318;
  --c-err-soft: #fdecea;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, 'Noto Sans Arabic', 'Geeza Pro', Arial, sans-serif;
  --container: 1160px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.8; color: var(--c-text); background: var(--c-bg); overflow-wrap: break-word; }
img, svg { max-width: 100%; }
a { color: var(--c-primary-2); text-underline-offset: 3px; }
a:hover { color: var(--c-primary); }
h1, h2, h3 { line-height: 1.45; color: var(--c-primary); margin: 0 0 .6em; }
h1 { font-size: clamp(1.55rem, 4.5vw, 2.25rem); font-weight: 700; }
h2 { font-size: clamp(1.2rem, 3vw, 1.5rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 1em; }
ul, ol { padding-inline-start: 1.4em; margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 1rem; top: -100px; background: var(--c-primary); color: #fff; padding: .5rem 1rem; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { top: 1rem; }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 1rem; }
.narrow-top { padding-top: 1rem; }
.muted { color: var(--c-muted); }
.small { font-size: .875rem; }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; flex-shrink: 0; }
.logo-mark { width: 38px; height: 38px; color: var(--c-primary); stroke: none; }

/* Header */
.site-header { background: var(--c-surface); border-bottom: 1px solid var(--c-border); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 64px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--c-primary); }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-ar { font-weight: 700; font-size: 1.35rem; }
.logo-en { font-size: .72rem; letter-spacing: .12em; color: var(--c-muted); direction: ltr; text-align: end; }
.nav-toggle { margin-inline-start: auto; background: none; border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: .45rem .55rem; color: var(--c-primary); cursor: pointer; }
.nav-toggle svg { width: 1.5rem; height: 1.5rem; }
.site-nav { display: none; width: 100%; padding-bottom: .75rem; }
.js .site-nav.open, .no-js .site-nav { display: block; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.site-nav li a { display: block; padding: .6rem .25rem; text-decoration: none; color: var(--c-text); font-weight: 500; border-bottom: 1px solid var(--c-border); }
.site-nav a[aria-current] { color: var(--c-primary); font-weight: 700; }
.nav-cta { display: inline-flex; align-items: center; gap: .4rem; margin-top: .75rem; padding: .5rem 1rem; background: var(--c-primary); color: #fff !important; border-radius: 999px; text-decoration: none; font-weight: 600; }
@media (min-width: 960px) {
  .nav-toggle { display: none; }
  .site-nav, .js .site-nav { display: flex; align-items: center; width: auto; margin-inline-start: auto; padding: 0; gap: 1rem; }
  .site-nav ul { flex-direction: row; gap: .25rem; }
  .site-nav li a { border: 0; padding: .4rem .7rem; border-radius: var(--radius-sm); }
  .site-nav li a:hover { background: var(--c-primary-soft); }
  .nav-cta { margin-top: 0; }
}

/* Breadcrumbs */
.breadcrumbs ol { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .25rem; font-size: .875rem; color: var(--c-muted); }
.breadcrumbs li:not(:last-child)::after { content: '‹'; margin-inline-start: .4rem; color: var(--c-border); }
.breadcrumbs a { color: var(--c-muted); }

/* Hero */
.hero { background: linear-gradient(160deg, var(--c-primary) 0%, var(--c-primary-2) 100%); color: #fff; padding: 2.5rem 0 2.75rem; }
.hero h1 { color: #fff; max-width: 22ch; }
.hero-kicker { display: inline-block; background: rgba(255,255,255,.12); padding: .2rem .8rem; border-radius: 999px; font-size: .85rem; margin-bottom: 1rem; }
.hero-lead { font-size: 1.05rem; opacity: .92; max-width: 60ch; }
.hero-note { display: flex; gap: .5rem; align-items: flex-start; font-size: .875rem; opacity: .9; margin-top: 1rem; }
.hero-note svg { color: var(--c-accent); margin-top: .2rem; }

/* Search */
.search { position: relative; display: flex; align-items: center; gap: .5rem; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 999px; padding: .3rem .3rem .3rem .3rem; padding-inline-start: .9rem; max-width: 640px; box-shadow: var(--shadow); }
.search-icon { color: var(--c-muted); display: flex; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; font-size: 1rem; padding: .55rem 0; background: transparent; color: var(--c-text); }
.search .btn { border-radius: 999px; }
.search-results { position: absolute; top: calc(100% + .4rem); inset-inline: 0; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow); list-style: none; margin: 0; padding: .4rem; z-index: 30; max-height: 360px; overflow-y: auto; }
.search-results a { display: block; padding: .55rem .75rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--c-text); }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--c-primary-soft); }
.search-results .k { font-size: .75rem; color: var(--c-muted); margin-inline-end: .4rem; }
.search-results .empty { padding: .6rem .75rem; color: var(--c-muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font: inherit; font-weight: 600; padding: .65rem 1.4rem; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s; min-height: 44px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-2); color: #fff; }
.btn-ghost { background: transparent; color: var(--c-primary); border-color: var(--c-border); }
.btn-ghost:hover { background: var(--c-primary-soft); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .7; cursor: progress; }
.spinner { display: none; width: 1.1em; height: 1.1em; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Sections & cards */
.section { margin: 2.25rem 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-title { font-size: 1.3rem; }
.section-title a { text-decoration: none; color: inherit; }
.more { display: inline-flex; align-items: center; gap: .2rem; font-weight: 600; text-decoration: none; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: var(--c-primary-2); box-shadow: var(--shadow); }
.card > a { display: flex; gap: .9rem; padding: 1.1rem; text-decoration: none; color: inherit; height: 100%; }
.guide-card > a { flex-direction: column; gap: .35rem; }
.card-icon { flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px; background: var(--c-primary-soft); color: var(--c-primary); display: flex; align-items: center; justify-content: center; }
.card-icon svg { width: 1.5rem; height: 1.5rem; }
.card-body { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.card-title { font-weight: 700; color: var(--c-primary); line-height: 1.5; }
.card-desc { font-size: .9rem; color: var(--c-muted); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: .8rem; color: var(--c-muted); margin-top: auto; }
.card-kicker { display: inline-flex; gap: .3rem; align-items: center; font-size: .8rem; font-weight: 600; color: var(--c-warn); }

.about-strip { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 1.5rem; }
.features { list-style: none; padding: 0; display: grid; gap: .75rem; }
@media (min-width: 760px) { .features { grid-template-columns: 1fr 1fr; } }
.features li { padding-inline-start: 1.2rem; position: relative; }
.features li::before { content: ''; position: absolute; inset-inline-start: 0; top: .7em; width: .5rem; height: .5rem; border-radius: 2px; background: var(--c-accent); }

/* Notices */
.notice { background: var(--c-primary-soft); border: 1px solid #c9d6ea; border-inline-start: 4px solid var(--c-primary); border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin: 1rem 0 1.5rem; font-size: .95rem; }
.notice p:last-child { margin-bottom: 0; }
.notice-gov { background: var(--c-accent-soft); border-color: #f1dcae; border-inline-start-color: var(--c-accent); }
.notice-title { display: flex; align-items: center; gap: .45rem; margin-bottom: .35rem; color: var(--c-primary); }
.notice-big { margin: 2rem 0; }
.calc-disclaimer { display: flex; gap: .5rem; font-size: .85rem; color: var(--c-muted); margin: 1rem 0 2rem; }
.calc-disclaimer svg { margin-top: .3rem; }

/* Page head & prose */
.page-head { margin-bottom: 1.25rem; }
.lead { font-size: 1.07rem; color: var(--c-muted); }
.meta { font-size: .85rem; color: var(--c-muted); }
.prose { max-width: 820px; }
.prose h2 { margin-top: 1.8rem; }
.prose h3 { margin-top: 1.3rem; }
.prose li { margin-bottom: .35rem; }
.formula { background: var(--c-surface); border: 1px dashed var(--c-border); border-radius: var(--radius-sm); padding: .7rem 1rem; font-weight: 600; color: var(--c-primary); }
.content-section { margin-bottom: 1.5rem; }
.tool-box { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.5rem; }
.tool-box-title { display: flex; gap: .4rem; align-items: center; margin-bottom: .4rem; color: var(--c-primary); }
.tool-box ul { margin: 0; }
.sources a { word-break: break-word; }
.center-box { margin: 2rem auto; text-align: center; }
.center-box .search { margin: 1.5rem auto; text-align: start; }
.center-box .btn { margin: .25rem; }
.big-404 { font-size: 4.5rem; font-weight: 700; color: var(--c-accent); margin: 0; line-height: 1; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-surface); margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .6rem .75rem; text-align: start; border-bottom: 1px solid var(--c-border); vertical-align: top; }
thead th { background: var(--c-primary-soft); color: var(--c-primary); font-weight: 600; white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.fees-table th[scope="row"] { font-weight: 500; min-width: 14rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.badge-ok { background: var(--c-ok-soft); color: var(--c-ok); }
.badge-mid { background: var(--c-primary-soft); color: var(--c-primary-2); }
.badge-warn { background: var(--c-warn-soft); color: var(--c-warn); }

/* Calculator */
.calc-box { display: grid; gap: 1.25rem; margin-bottom: 1rem; }
@media (min-width: 960px) { .calc-box { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; } .results { position: sticky; top: 80px; } }
.calc-form, .results, .contact-box { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.fields { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .fields { grid-template-columns: 1fr 1fr; } .field-check, .field:has(textarea) { grid-column: 1 / -1; } }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.req { color: var(--c-err); margin-inline-start: .2rem; }
.input-wrap { position: relative; display: flex; align-items: stretch; }
.field input[type="text"], .field input[type="email"], .field input[type="date"], .field input[type="number"], .field select, .field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--c-text); background: #fbfcfe; border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: .6rem .8rem; min-height: 46px; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--c-primary-2); box-shadow: 0 0 0 3px rgba(39, 75, 122, .18); background: #fff; }
.input-wrap.has-suffix input { border-start-end-radius: 0; border-end-end-radius: 0; }
.suffix { display: flex; align-items: center; padding: 0 .75rem; background: var(--c-primary-soft); border: 1px solid var(--c-border); border-inline-start: 0; border-start-end-radius: var(--radius-sm); border-end-end-radius: var(--radius-sm); font-size: .85rem; color: var(--c-muted); white-space: nowrap; }
.field input[type="text"][inputmode] { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.field input[type="date"] { direction: ltr; text-align: right; }
.help { font-size: .8rem; color: var(--c-muted); margin: .3rem 0 0; line-height: 1.6; }
.field-error { font-size: .82rem; color: var(--c-err); margin: .3rem 0 0; font-weight: 500; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--c-err); background: var(--c-err-soft); }
.field-check { display: flex; flex-direction: column; }
.check { display: flex !important; align-items: center; gap: .6rem; font-weight: 500 !important; cursor: pointer; }
.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--c-primary); }
.field[hidden] { display: none; }
.advanced { margin-top: 1.25rem; border-top: 1px solid var(--c-border); padding-top: 1rem; }
.advanced summary { cursor: pointer; font-weight: 600; color: var(--c-primary-2); }
.advanced[open] summary { margin-bottom: .75rem; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.25rem; flex-wrap: wrap; }
.form-actions .btn-primary { flex: 1; min-width: 140px; }
.form-status { margin: .75rem 0 0; color: var(--c-err); font-size: .9rem; }

.results-title { font-size: 1.1rem; margin-bottom: .75rem; }
.results-empty { color: var(--c-muted); margin: 0; }
.result-main { background: linear-gradient(160deg, var(--c-primary), var(--c-primary-2)); color: #fff; border-radius: var(--radius-sm); padding: 1rem 1.1rem; margin-bottom: .9rem; }
.result-main .label { font-size: .9rem; opacity: .9; }
.result-main .value { font-size: clamp(1.6rem, 6vw, 2.1rem); font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; direction: rtl; }
.result-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; margin-bottom: .9rem; }
.result-card { background: var(--c-primary-soft); border-radius: var(--radius-sm); padding: .6rem .8rem; }
.result-card .label { font-size: .8rem; color: var(--c-muted); }
.result-card .value { font-weight: 700; color: var(--c-primary); font-variant-numeric: tabular-nums; }
.breakdown { margin: 0 0 .9rem; }
.breakdown div { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--c-border); font-size: .92rem; }
.breakdown dt { color: var(--c-muted); }
.breakdown dd { margin: 0; font-weight: 600; text-align: end; font-variant-numeric: tabular-nums; }
.result-warn { background: var(--c-warn-soft); color: #6b4100; border-radius: var(--radius-sm); padding: .6rem .8rem; font-size: .88rem; margin-bottom: .6rem; }
.result-note { font-size: .85rem; color: var(--c-muted); margin-bottom: .4rem; }
.result-table summary { cursor: pointer; font-weight: 600; color: var(--c-primary-2); margin: .6rem 0; }
.result-table .table-wrap { max-height: 420px; overflow: auto; }
.result-error { color: var(--c-err); }
.results.updated { animation: flash .5s ease; }
@keyframes flash { from { box-shadow: 0 0 0 3px rgba(242, 180, 58, .55); } to { box-shadow: var(--shadow); } }

/* Filter */
.filter-box { margin-bottom: 1rem; max-width: 520px; }
.filter-box label { font-weight: 600; display: block; margin-bottom: .3rem; }
.filter-box input { width: 100%; font: inherit; padding: .6rem .9rem; border: 1px solid var(--c-border); border-radius: var(--radius-sm); min-height: 46px; }
.filter-empty { margin-top: .5rem; color: var(--c-muted); }

/* Contact */
.contact-layout { display: grid; gap: 1.5rem; }
@media (min-width: 960px) { .contact-layout { grid-template-columns: 1fr 1fr; align-items: start; } }
.contact-form .fields, .contact-form { display: grid; gap: 1rem; }
.contact-form textarea { resize: vertical; min-height: 150px; }
.form-alert { border-radius: var(--radius-sm); padding: .8rem 1rem; font-weight: 500; }
.form-alert.ok { background: var(--c-ok-soft); color: var(--c-ok); }
.form-alert.err { background: var(--c-err-soft); color: var(--c-err); }

/* Footer */
.site-footer { background: #142640; color: #d6deea; margin-top: 3rem; padding: 2rem 0 1.25rem; font-size: .92rem; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer h2 { color: #fff; font-size: 1rem; margin-bottom: .6rem; }
.independence { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.75rem; }
.independence h2 { display: flex; align-items: center; gap: .5rem; color: var(--c-accent); }
.independence p { margin: 0; line-height: 1.9; }
.footer-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: .35rem; }
.logo-footer { color: #fff; margin-bottom: .6rem; }
.logo-footer .logo-mark { color: #fff; }
.logo-footer .logo-mark rect:first-child { fill: var(--c-primary-2); }
.logo-footer .logo-en { color: #aebbd0; }
.copyright { border-top: 1px solid rgba(255,255,255,.12); margin-top: 1.5rem; padding-top: 1rem; font-size: .82rem; color: #aebbd0; }

/* Google Auto Ads — مساحة مرنة دون حجز أماكن ثابتة */
.google-auto-placed { clear: both; margin: 1.5rem auto !important; max-width: 100%; }
ins.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print { .site-header, .site-footer, .form-actions, .advanced, .search { display: none !important; } .calc-box { display: block; } }
