:root {
  --bg: #f3eee4;
  --cream: #fbf7f0;
  --surface: #fbf7f0;
  --sunken: #e8e0d2;
  --fg: #1a1714;
  --muted: #6d655c;
  --subtle: #8a8278;
  --primary: #1b6b4a;
  --primary-fg: #f6f3ec;
  --primary-dark: #145239;
  --clay: #8f2d2a;
  --ink: #1a1714;
  --border: #d9d0c3;
  --border-strong: #c4b9a8;
  --warn: #8a5a18;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 0 rgba(26, 23, 20, 0.04), 0 12px 32px -18px rgba(26, 23, 20, 0.28);
  --font-display: "Fraunces", "Times New Roman", serif;
  --font-sans: "Outfit", "Segoe UI", system-ui, sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "Noto Naskh Arabic", "Outfit", sans-serif;
  --space: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--ink);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100dvh;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, [type="submit"] { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
h1, h2, .display {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-weight: 500;
  margin: 0;
}
p { margin: 0 0 0.6em; text-wrap: pretty; }

.shell {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  background-color: var(--ink);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'><g fill='none' stroke='%23f6f3ec' stroke-opacity='0.07' stroke-width='1'><path d='M32 6 L35 24 L32 32 L29 24 Z'/><path d='M32 58 L35 40 L32 32 L29 40 Z'/><path d='M6 32 L24 29 L32 32 L24 35 Z'/><path d='M58 32 L40 29 L32 32 L40 35 Z'/><path d='M12 12 L26 26'/><path d='M52 12 L38 26'/><path d='M12 52 L26 38'/><path d='M52 52 L38 38'/></g></svg>");
  background-size: 64px 64px;
}
.phone {
  width: 100%;
  max-width: 32rem;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 16px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.topbar h1 { font-size: 1.2rem; }
.kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.brand-ar {
  font-family: var(--font-ar);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--primary);
  display: grid;
  place-items: center;
  height: 44px;
}
.brand-ar.light { color: var(--cream); }
.icon-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  color: var(--fg);
  border-radius: var(--radius-sm);
}
.icon-btn:hover { text-decoration: none; background: var(--sunken); }
.pill {
  display: inline-flex; align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cream) 90%, transparent);
  color: var(--fg);
  font-size: 12px;
  font-weight: 500;
}
.pill.light { background: color-mix(in srgb, var(--cream) 90%, transparent); }
.pill:hover { text-decoration: none; }

.main { flex: 1; padding: 20px 16px 32px; }
.main.flush { padding: 0 0 32px; }
.page { padding: 8px 16px 8px; }
.intro { margin-bottom: 16px; }
.muted { color: var(--muted); }
.xs { font-size: 12px; }
.fine { font-size: 12px; color: var(--subtle); text-align: center; margin-top: 24px; }
.fine.center { text-align: center; }
.lede { color: var(--muted); max-width: 34ch; }
.display.xl { font-size: clamp(2rem, 6vw, 2.15rem); line-height: 1.05; }
.display.sm { font-size: 1.15rem; margin: 16px 0 8px; }
.ar-lg { font-family: var(--font-ar); font-size: 2.2rem; font-weight: 600; color: var(--primary); margin: 0; }
.ar-sm { font-family: var(--font-ar); font-size: 12px; color: var(--primary); display: block; }

.hero {
  position: relative;
  height: 44dvh;
  min-height: 260px;
  max-height: 420px;
  overflow: hidden;
  background: #1a3d32;
}
.hero img { width: 100%; height: 100%; object-fit: cover; object-position: center 62%; display: block; }
.hero-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(16,28,24,0.35), rgba(16,28,24,0.05) 38%, var(--bg));
}
.hero-top {
  position: absolute; inset: 0 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 20px 0;
  z-index: 2;
}
.hero-actions { display: flex; align-items: center; gap: 8px; }
.topbar-act { display: flex; align-items: center; gap: 8px; }
.lang-switch {
  display: inline-flex;
  border: 1px solid color-mix(in srgb, var(--cream) 35%, transparent);
  border-radius: 999px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  background: rgba(20, 30, 24, 0.28);
}
.topbar .lang-switch {
  border-color: var(--border);
  background: var(--cream);
}
.lang-switch a {
  padding: 6px 10px;
  color: var(--cream);
  text-decoration: none;
  line-height: 1;
}
.topbar .lang-switch a { color: var(--muted); }
.lang-switch a.on {
  background: var(--primary);
  color: var(--primary-fg);
}
.lang-switch a:hover { text-decoration: none; }
.home-copy { margin-top: -32px; position: relative; padding-bottom: 24px; }

.role {
  display: flex; gap: 16px; align-items: stretch;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 12px 0;
  box-shadow: var(--shadow);
  color: inherit;
}
.role:hover { text-decoration: none; transform: scale(0.995); }
.role strong { display: block; font-family: var(--font-display); font-size: 1.25rem; font-weight: 500; }
.role .muted { display: block; font-size: 14px; }
.role-ic {
  width: 56px; height: 56px; flex: 0 0 56px;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  background: var(--primary); color: var(--primary-fg);
}
.role > svg { color: var(--subtle); margin-top: 16px; flex: 0 0 auto; }

.card, .card-link, .note {
  display: block;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 10px 0;
  box-shadow: var(--shadow);
  color: inherit;
}
.card-link:hover { text-decoration: none; }
.card.selected { outline: 2px solid var(--primary); }
.banner {
  display: block;
  background: var(--primary);
  color: var(--primary-fg);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 12px 0;
  box-shadow: var(--shadow);
}
.banner:hover { text-decoration: none; color: var(--primary-fg); }
.kicker.light, .banner .kicker { color: color-mix(in srgb, var(--primary-fg) 70%, transparent); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wcard {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  color: inherit;
  min-height: 260px;
}
.wcard:hover { text-decoration: none; }
.wcard-meta { padding: 10px 12px 14px; }
.wcard-name { font-weight: 500; margin: 0 0 2px; }
.photo {
  overflow: hidden;
  background: var(--sunken);
}
.photo img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.photo-pt { aspect-ratio: 3 / 4; }
.photo-sq { aspect-ratio: 1; }
.photo-fallback {
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--muted);
}
.hero-photo { border-radius: 0; max-height: 360px; }
.hero-photo img { object-position: top center; }

.chip {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 500;
  padding: 3px 8px; border-radius: 999px;
  background: var(--sunken); color: var(--muted);
}
.chip-ok { background: color-mix(in srgb, var(--primary) 14%, white); color: var(--primary-dark); }
.chip-warn { background: color-mix(in srgb, var(--warn) 16%, white); color: var(--warn); }
.chip-bad { background: color-mix(in srgb, var(--clay) 14%, white); color: var(--clay); }

.stack { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 16px; }
.stack.tight { gap: 8px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
input, select, textarea {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236d655c' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 45%, white);
  outline-offset: 1px;
  border-color: var(--primary);
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--primary-fg);
  font-weight: 500;
}
.btn:hover { text-decoration: none; background: var(--primary-dark); color: var(--primary-fg); }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; }
.btn.secondary {
  background: var(--sunken);
  color: var(--fg);
}
.btn.secondary:hover { background: var(--border); color: var(--fg); }
.text-btn {
  background: none; border: 0; color: var(--primary); padding: 8px;
  font-size: 13px; font-weight: 500;
}
.ghost-form { display: inline; }

.tabbar {
  position: sticky; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 4px 8px max(8px, env(safe-area-inset-bottom));
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px;
  font-size: 11px; font-weight: 500;
  color: var(--muted);
}
.tabbar a.on { color: var(--primary); }
.tabbar a:hover { text-decoration: none; }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px;
}
.stats.six { grid-template-columns: repeat(3, 1fr); }
.stats > div {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow);
}
.stats .display { font-variant-numeric: tabular-nums; font-size: 1.6rem; }

.split { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.split-card { display: grid; grid-template-columns: 96px 1fr; padding: 0; overflow: hidden; }
.split-card > div { padding: 14px; }

.people, .list, .paylist, .cards, .checks { list-style: none; margin: 0; padding: 0; }
.people li a, .list li {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  margin: 8px 0;
  box-shadow: var(--shadow);
  color: inherit;
}
.people li a:hover { text-decoration: none; }
.people .photo { width: 56px; flex: 0 0 56px; border-radius: var(--radius-sm); }
.people span, .list li span { min-width: 0; flex: 1; }
.people small, .list small { display: block; color: var(--muted); font-size: 12px; }
.paylist { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.paylist li {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.paylist li:last-child { border-bottom: 0; }
.checks li { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; }
.checks .box {
  width: 18px; height: 18px; flex: 0 0 18px; margin-top: 2px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  display: grid; place-items: center;
}
.checks li.on .box { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.check { flex-direction: row; align-items: center; gap: 8px; color: var(--fg); font-weight: 400; }
.check input { width: auto; min-height: 0; }
.days { display: flex; flex-wrap: wrap; gap: 8px; }
.days .check { background: var(--sunken); padding: 8px 10px; border-radius: 999px; }

.empty {
  border: 1px dashed var(--border-strong);
  background: var(--cream);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
}
.flash {
  margin: 8px 16px 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.flash-ok { background: color-mix(in srgb, var(--primary) 14%, white); color: var(--primary-dark); }
.flash-err { background: color-mix(in srgb, var(--clay) 14%, white); color: var(--clay); }
.demo {
  margin-top: 28px;
  background: var(--cream);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 13px;
}
.demo ul { margin: 8px 0 0; padding-left: 16px; color: var(--muted); }
.seg {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--sunken);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}
.seg a {
  text-align: center; padding: 10px;
  border-radius: 999px; color: var(--muted); font-weight: 500;
}
.seg a.on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.seg a:hover { text-decoration: none; }
.pay { font-family: var(--font-display); font-size: 1.2rem; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

html[dir="rtl"] body,
html[dir="rtl"] .phone { font-family: var(--font-ar), var(--font-sans); }
html[dir="rtl"] h1,
html[dir="rtl"] .display,
html[dir="rtl"] .role strong { font-family: var(--font-ar); letter-spacing: 0; }
html[dir="rtl"] .kicker { letter-spacing: 0.06em; }
html[dir="rtl"] .icon-btn svg,
html[dir="rtl"] .role > svg { transform: scaleX(-1); }
html[dir="rtl"] .demo ul { padding-left: 0; padding-right: 16px; }
html[dir="rtl"] .lede { max-width: none; }
html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select { text-align: right; }
html[dir="rtl"] .checks { padding-right: 0; }
html[dir="rtl"] .tabbar a span { font-family: var(--font-ar); }
html[dir="rtl"] .pill,
html[dir="rtl"] .btn,
html[dir="rtl"] .text-btn,
html[dir="rtl"] .chip { font-family: var(--font-ar); }
html[dir="rtl"] .fine { font-family: var(--font-ar); }
html[dir="rtl"] .wcard-meta,
html[dir="rtl"] .people small { font-family: var(--font-ar); }
html[dir="rtl"] .lang-switch a[lang="ar"] { font-family: var(--font-ar); }

.btn.danger {
  background: var(--clay);
  color: #fbf7f0;
}
.btn.danger:hover { background: #6f201e; color: #fbf7f0; }
.danger-card {
  border: 1px solid color-mix(in srgb, var(--clay) 28%, var(--border));
  background: color-mix(in srgb, var(--clay) 6%, var(--surface));
}
.stars {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.star {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font-size: 13px;
}
.star:has(input:checked) {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}
.star input { width: auto; min-height: 0; margin: 0; }
.mail-item p { white-space: pre-wrap; }
html[dir="rtl"] .star { font-family: var(--font-ar); }
html[dir="rtl"] .danger-card h2 { font-family: var(--font-ar); }

.qr-home {
  display: flex;
  gap: 16px;
  align-items: center;
}
.qr-home .qr-img {
  width: 120px;
  height: 120px;
  flex: 0 0 120px;
  border-radius: 12px;
  background: #fff;
  padding: 6px;
}
.qr-home .btn { margin-top: 8px; }
.qr-stage {
  text-align: center;
}
.qr-stage .qr-img.lg {
  width: min(280px, 72vw);
  height: auto;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: #fff;
  padding: 12px;
}
.qr-stage .mono {
  font-family: ui-monospace, "IBM Plex Mono", monospace;
  direction: ltr;
  word-break: break-all;
}
.steps {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--fg);
}
.steps li { margin: 8px 0; }
.step-card h2 { margin-bottom: 4px; }
[data-install][hidden],
.install-ready[hidden] { display: none !important; }
html.pwa-installed .install-steps,
html.pwa-installed [data-install],
html.pwa-installed .qr-stage { display: none; }
html.pwa-installed .install-ready { display: block !important; }
html[dir="rtl"] .steps { padding-left: 0; padding-right: 20px; }
html[dir="rtl"] .qr-home .display,
html[dir="rtl"] .qr-stage .display,
html[dir="rtl"] .step-card h2 { font-family: var(--font-ar); }

.zip-dl {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--primary);
  color: var(--primary-fg);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 0 0 16px;
  box-shadow: var(--shadow);
  text-decoration: none;
}
.zip-dl:hover { text-decoration: none; background: var(--primary-dark); color: var(--primary-fg); }
.zip-dl strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: inherit;
}
.zip-dl .muted { display: block; font-size: 14px; color: color-mix(in srgb, var(--primary-fg) 78%, transparent); }
.zip-dl .role-ic { background: var(--primary-dark); color: var(--primary-fg); }
.zip-pill { font-weight: 600; }
html[dir="rtl"] .zip-dl,
html[dir="rtl"] .zip-dl strong { font-family: var(--font-ar); letter-spacing: 0; }


