:root {
  --paper: #F6F1E7; --card: #FFFDF8; --ink: #1D2B27; --muted: #5F6B66; --line: #E3DAC8; --line-2: #EFE8D8;
  --green: #1F6F5C; --green-d: #174F42; --green-l: #E3F0EA;
  --amber: #A5600B; --amber-l: #FBEFD9; --red: #A33A2B; --red-l: #F8E4DF;
  --font-body: Inter, "Tajawal", "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: Fraunces, "Tajawal", "Noto Naskh Arabic", Georgia, serif;
  --r: 12px;
}
html[lang="ar"] { --font-body: Tajawal, "Noto Sans Arabic", Inter, system-ui, sans-serif; --font-head: Tajawal, "Noto Sans Arabic", serif; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--font-body); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 1.25rem 1.1rem 3rem; outline: none; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5rem; font-weight: 600; letter-spacing: -.01em; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 { font-weight: 700; letter-spacing: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 .6rem; } a { color: var(--green-d); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .strong { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: .5rem; top: -4rem; background: var(--ink); color: #fff; padding: .5rem .8rem; border-radius: 8px; z-index: 10; }
.skip:focus { top: .5rem; }
:focus-visible { outline: 3px solid #3B9C84; outline-offset: 2px; border-radius: 6px; }

/* top bar */
.top { border-bottom: 1px solid var(--line); background: rgba(246,241,231,.9); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px); }
.top-in { max-width: 1040px; margin: 0 auto; padding: .6rem 1.1rem; display: flex; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--green); color: #F6F1E7; display: grid; place-items: center; font-weight: 700; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.35rem; }
.brand-alt { color: var(--muted); font-size: .9rem; }
.tagline { margin-inline-start: auto; color: var(--muted); font-size: .92rem; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.2rem 1rem 2rem; border-top: 1px solid var(--line); }
@media (max-width: 720px) { .tagline, .brand-alt { display: none; } .top-in { justify-content: space-between; } }

/* buttons, forms */
.btn { font: inherit; font-weight: 600; background: var(--card); color: var(--ink); border: 1.5px solid var(--line); border-radius: 10px; padding: .6rem 1rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; transition: transform .12s, background .12s, border-color .12s; }
.btn:hover { border-color: var(--green); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: var(--green-d); border-color: var(--green-d); }
.btn-lg { padding: .8rem 1.5rem; font-size: 1.05rem; }
.btn-small { min-height: 36px; padding: .3rem .8rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.linklike { background: none; border: 0; padding: .3rem 0; font: inherit; color: var(--green-d); text-decoration: underline; cursor: pointer; }
.linklike.danger { color: var(--red); }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; } .actions.end { justify-content: flex-end; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; } .between { justify-content: space-between; }
.field { margin-bottom: 1rem; border: 0; padding: 0; min-width: 0; }
.field label, .field legend { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; padding: 0; }
input[type=text], input[type=date], input:not([type]), input[inputmode], textarea, input[name=currency] { width: 100%; font: inherit; padding: .65rem .75rem; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); min-height: 44px; }
input:focus, textarea:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px rgba(31,111,92,.2); }
input[aria-invalid=true] { border-color: var(--red); }
.hint { font-size: .85rem; color: var(--muted); min-height: 1.2em; margin-top: .25rem; }
.err { color: var(--red); font-weight: 600; display: block; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; } @media (max-width: 520px) { .two { grid-template-columns: 1fr; } }
.narrow { max-width: 260px; }
.radio { display: inline-flex; align-items: center; gap: .4rem; margin-inline-end: 1rem; font-weight: 500 !important; }
input[type=range] { width: 100%; accent-color: var(--green); height: 32px; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: .8rem; align-items: start; } .inline-form .btn { margin-top: 1.55rem; }
@media (max-width: 620px) { .inline-form { grid-template-columns: 1fr; } .inline-form .btn { margin-top: 0; } }

/* layout */
.page-head { margin-bottom: 1rem; } .page-head .lead { color: var(--muted); max-width: 60ch; }
.back { display: inline-block; margin-bottom: .6rem; color: var(--muted); text-decoration: none; font-size: .92rem; }
html[dir=rtl] .back { }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.15rem 1.2rem; margin-bottom: 1rem; box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.split { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.hero { padding: 2.5rem 0 1rem; max-width: 680px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); }
.eyebrow { color: var(--green); font-weight: 600; letter-spacing: .04em; }
.lead { font-size: 1.1rem; }
.notice { background: var(--amber-l); border: 1px solid #EBCB93; color: #5B3A07; border-radius: 10px; padding: .7rem .9rem; margin-bottom: 1rem; }
.data-tools { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-top: 1.5rem; font-size: .9rem; }

/* promise cards */
.promise-card { display: block; text-decoration: none; color: inherit; transition: border-color .12s, transform .12s; }
.promise-card:hover { border-color: var(--green); transform: translateY(-1px); }
.promise-card h2 { margin: 0; }
.bar { height: 10px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin: .8rem 0 .5rem; }
.bar span { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.tag { font-size: .75rem; font-weight: 600; background: var(--line-2); color: var(--muted); padding: .15rem .55rem; border-radius: 99px; }
.tag-ok { background: var(--green-l); color: var(--green-d); }
.chip { display: inline-block; font-size: .8rem; font-weight: 600; padding: .15rem .6rem; border-radius: 99px; }
.chip-ok { background: var(--green-l); color: var(--green-d); } .chip-late { background: var(--red-l); color: var(--red); }
.chip-due { background: var(--amber-l); color: var(--amber); } .chip-mute { background: var(--line-2); color: var(--muted); }

/* plans */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-bottom: 1rem; }
@media (max-width: 720px) { .plans { grid-template-columns: 1fr; } }
.plan { font: inherit; text-align: start; color: inherit; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); padding: 1rem; display: flex; flex-direction: column; gap: .35rem; cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
.plan:hover:not(:disabled) { border-color: var(--green); transform: translateY(-1px); }
.plan.is-selected { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,111,92,.18); background: #fff; }
.plan:disabled { opacity: .55; cursor: not-allowed; }
.plan-head { display: flex; justify-content: space-between; align-items: center; gap: .4rem; }
.plan-name { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; }
.plan-amt { font-size: 1.35rem; font-weight: 700; color: var(--green-d); }
.plan-sub { color: var(--muted); font-size: .85rem; }
.spark { width: 100%; height: 44px; margin: .3rem 0; }
.cushion { display: block; height: 8px; border-radius: 99px; background: repeating-linear-gradient(45deg, var(--line-2), var(--line-2) 4px, #fff 4px, #fff 8px); border: 1px solid var(--line); overflow: hidden; }
.cushion i { display: block; height: 100%; background: var(--green); }
.plan-surv { font-size: .88rem; font-weight: 600; color: var(--green-d); }
.plan-surv.warn { color: var(--red); }
.waiting { text-align: center; padding: 2.5rem 1rem; }
.deadline { border-inline-start: 5px solid var(--green); } .deadline.warn { border-inline-start-color: var(--amber); background: #FFFAF0; }

/* promise page */
.head { display: flex; gap: 1.2rem; align-items: center; }
.head-main { flex: 1; min-width: 0; } .head h1 { margin: 0; }
.head p { margin: .15rem 0; }
.stat-big { font-size: 1.15rem; font-weight: 700; } .ok-text { color: var(--green-d); font-weight: 700; } .warn-text { color: var(--amber); font-weight: 600; }
.ring-text { font: 700 1.4rem var(--font-head); fill: var(--ink); }
@media (max-width: 520px) { .head { flex-direction: column; align-items: flex-start; } }
.tabs { display: flex; gap: .3rem; border-bottom: 2px solid var(--line); margin: 1.2rem 0 1rem; }
.tab { padding: .65rem 1.1rem; text-decoration: none; color: var(--muted); font-weight: 600; border-radius: 10px 10px 0 0; margin-bottom: -2px; border-bottom: 3px solid transparent; }
.tab:hover { color: var(--ink); } .tab.is-active { color: var(--green-d); border-bottom-color: var(--green); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: .5rem .6rem; text-align: start; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; }
.row-paid td { color: var(--muted); } .row-behind { background: var(--red-l); } .row-due { background: var(--amber-l); }
.chart { width: 100%; height: auto; max-height: 260px; } .axis { font: 12px var(--font-body); fill: var(--muted); }
.verdict { padding: .7rem .9rem; border-radius: 10px; margin: .6rem 0 0; font-weight: 500; }
.verdict.ok { background: var(--green-l); color: var(--green-d); } .verdict.bad { background: var(--red-l); color: var(--red); }
.stress-label { display: block; font-weight: 700; font-size: 1.05rem; margin-bottom: .2rem; }
.behind { border-color: #EBCB93; background: #FFFAF0; }
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-top: .8rem; } @media (max-width: 820px) { .options { grid-template-columns: 1fr; } }
.option { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .9rem; display: flex; flex-direction: column; gap: .3rem; }
.option .btn { margin-top: auto; align-self: flex-start; }
.list { list-style: none; margin: 0; padding: 0; } .list li { display: flex; gap: 1rem; align-items: baseline; padding: .5rem 0; border-bottom: 1px solid var(--line-2); } .list li .num:first-child { min-width: 7.5rem; color: var(--muted); }

/* letter */
.letter { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 2.2rem 2.4rem; max-width: 760px; margin: 0 auto 1rem; box-shadow: 0 8px 30px rgba(60,40,0,.08); font-family: var(--font-head); font-size: 1.02rem; line-height: 1.7; }
html[lang="en"] .letter[lang="ar"], .letter[lang="ar"] { font-family: Tajawal, "Noto Sans Arabic", serif; }
.letter[lang="en"] { font-family: Fraunces, Georgia, serif; }
.letter h2 { font-size: 1.5rem; border-bottom: 2px solid var(--green); padding-bottom: .4rem; }
.letter-meta { color: var(--muted); font-size: .9rem; text-align: end; } .letter-to { color: var(--muted); }
.letter h3 { margin-top: 1.4rem; font-size: 1rem; }
.letter-table { font-size: .92rem; max-width: 420px; } .letter-table th, .letter-table td { padding: .3rem .5rem; }
.sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 2.2rem; } .sig span { display: block; border-bottom: 1px solid var(--ink); height: 2rem; } .sig small { color: var(--muted); }
.letter-foot { margin-top: 1.5rem; color: var(--muted); font-size: .8rem; text-align: center; }
@media (max-width: 560px) { .letter { padding: 1.3rem 1.1rem; } .sigs { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  body { background: #fff; display: block; } .top, .foot, .tabs, .head, .page-head, .no-print, .data-tools, .tabpanel > .card, #skip { display: none !important; }
  main { max-width: none; padding: 0; } .letter { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .letter-table th, .letter-table td { border-bottom: 1px solid #ccc; }
}

.two .field label { min-height: 2.7em; display: flex; align-items: flex-end; }
@media (max-width: 520px) { .two .field label { min-height: 0; } }
.how { max-width: 680px; margin-top: 2rem; } .how ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.how li { display: flex; gap: .9rem; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; }
.how li p { margin: 0; } .how-n { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; }
@media (max-width: 520px) { .hint { min-height: 0; } }
