/* ============================================================================
   Zatca API — Application stylesheet (v2)
   Light, modern, professional. Saudi green brand. Bilingual (RTL + LTR).
   ============================================================================ */

:root {
  --bg:           #ffffff;
  --bg-soft:      #f8fafc;
  --bg-mute:      #f1f5f9;
  --border:       #e5e7eb;
  --border-soft:  #f1f5f9;
  --text:         #0f172a;
  --text-2:       #475569;
  --text-3:       #94a3b8;
  --ink:          #0b1220;

  --brand:        #10b981;
  --brand-600:    #059669;
  --brand-700:    #047857;
  --brand-50:     #ecfdf5;
  --brand-100:    #d1fae5;

  --danger:       #ef4444;
  --danger-50:    #fef2f2;
  --warn:         #f59e0b;
  --warn-50:      #fffbeb;
  --info:         #0ea5e9;
  --info-50:      #f0f9ff;

  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    18px;
  --radius-xl:    24px;

  --shadow-xs:    0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm:    0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md:    0 4px 6px -1px rgba(15, 23, 42, .07), 0 2px 4px -2px rgba(15, 23, 42, .04);
  --shadow-lg:    0 10px 25px -3px rgba(15, 23, 42, .08), 0 4px 6px -4px rgba(15, 23, 42, .06);
  --shadow-glow:  0 14px 40px -12px rgba(16, 185, 129, .25);

  --font-sans:    "Inter", "IBM Plex Sans Arabic", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  --container:    1200px;
}

/* RTL: Arabic prefers IBM Plex Sans Arabic, but we still keep Inter for code/UI numbers */
[dir="rtl"] { font-family: "IBM Plex Sans Arabic", "Tajawal", "Cairo", var(--font-sans); }

* , *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

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

img, svg { max-width: 100%; display: block; }
a { color: var(--brand-700); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--brand-600); }

h1, h2, h3, h4 { color: var(--ink); margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: clamp(34px, 5vw, 56px); }
h2 { font-size: clamp(26px, 3.4vw, 38px); }
h3 { font-size: 20px; }

/* ----------------------------------------------------------------------------
   Layout
   ---------------------------------------------------------------------------- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .container { padding: 0 18px; } }

section { padding: 80px 0; }
@media (max-width: 700px) { section { padding: 56px 0; } }

.section-head { text-align: center; max-width: 720px; margin: 0 auto 48px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 999px;
  background: var(--brand-50); color: var(--brand-700);
  border: 1px solid var(--brand-100);
  margin-bottom: 18px;
}
.section-head h2 { margin: 0 0 12px; }
.section-head p { color: var(--text-2); font-size: 17px; margin: 0; }

/* ----------------------------------------------------------------------------
   Top navigation (marketing)
   ---------------------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; gap: 28px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-700) 100%);
  display: grid; place-items: center;
  color: #fff; font-size: 15px; font-weight: 800;
  box-shadow: var(--shadow-sm);
}
.nav-links {
  display: flex; gap: 4px; align-items: center;
  margin-inline-start: 12px;
}
.nav-link {
  font-size: 14px; font-weight: 500;
  color: var(--text-2);
  padding: 8px 14px; border-radius: var(--radius-sm);
  transition: all .15s ease;
}
.nav-link:hover { color: var(--ink); background: var(--bg-mute); }
.nav-link.active { color: var(--ink); }
.nav-spacer { flex: 1; }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.lang-toggle {
  font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px;
  background: var(--bg-mute); color: var(--text);
  transition: background .15s ease;
}
.lang-toggle:hover { background: var(--border); color: var(--ink); }

.nav-toggle {
  display: none;
  background: transparent; border: 1px solid var(--border);
  width: 36px; height: 36px; border-radius: 8px;
  align-items: center; justify-content: center;
  color: var(--text); cursor: pointer;
}
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none; position: absolute;
    top: 100%; inset-inline: 16px;
    background: #fff; border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); border-radius: var(--radius);
    padding: 12px; flex-direction: column; gap: 4px;
    margin: 6px 0 0;
  }
  .nav-links.open { display: flex; }
}

/* ----------------------------------------------------------------------------
   Buttons
   ---------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  font: inherit; font-weight: 600; font-size: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--bg-mute); color: var(--text);
  cursor: pointer; transition: all .15s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--border); color: var(--ink); }
.btn-primary {
  background: var(--brand); color: #fff;
  box-shadow: 0 1px 2px rgba(16, 185, 129, .35), 0 0 0 1px rgba(16, 185, 129, .15) inset;
}
.btn-primary:hover { background: var(--brand-600); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--bg-mute); }
.btn-outline {
  background: transparent; color: var(--ink);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--text-3); background: var(--bg-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-warn { background: var(--warn); color: #422006; }
.btn-warn:hover { background: #d97706; color: #fff; }
.btn-accent { background: var(--brand); color: #fff; }
.btn-accent:hover { background: var(--brand-600); color: #fff; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ----------------------------------------------------------------------------
   Hero
   ---------------------------------------------------------------------------- */
.hero {
  position: relative;
  padding: 96px 0 64px;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(16, 185, 129, .12) 0%, transparent 60%),
    radial-gradient(40% 40% at 80% 30%, rgba(6, 182, 212, .08) 0%, transparent 60%);
  z-index: -1;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right,  rgba(15, 23, 42, .04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, .04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(60% 60% at 50% 30%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(60% 60% at 50% 30%, #000 30%, transparent 80%);
  z-index: -1; opacity: .6;
}
.hero h1 { max-width: 900px; margin: 18px auto 0; }
.hero h1 .accent {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-700) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.hero .lede {
  max-width: 680px; margin: 22px auto 0;
  color: var(--text-2); font-size: 18px; line-height: 1.6;
}
.hero-cta {
  margin-top: 32px;
  display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center;
}
.hero-note {
  margin-top: 16px;
  color: var(--text-3); font-size: 13px;
}

/* ----------------------------------------------------------------------------
   Trust bar
   ---------------------------------------------------------------------------- */
.trust {
  padding: 56px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-soft);
}
.trust-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
}
.trust-item { text-align: center; }
.trust-num {
  font-size: 32px; font-weight: 800; color: var(--ink);
  letter-spacing: -0.03em; line-height: 1;
}
.trust-label {
  margin-top: 8px;
  color: var(--text-2); font-size: 13px;
  letter-spacing: 0.02em;
}
@media (max-width: 700px) {
  .trust-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ----------------------------------------------------------------------------
   Feature grid
   ---------------------------------------------------------------------------- */
.features-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 900px) { .features-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .features-grid { grid-template-columns: 1fr; } }

.feature {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.feature:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-100);
}
.feature-icon {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--brand-50); color: var(--brand-700);
  margin-bottom: 16px;
}
.feature-icon svg { width: 22px; height: 22px; }
.feature h3 { margin: 0 0 8px; font-size: 17px; }
.feature p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.6; }

/* ----------------------------------------------------------------------------
   How it works (timeline)
   ---------------------------------------------------------------------------- */
.steps {
  background: var(--bg-soft);
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.steps-grid {
  display: grid; gap: 32px;
  grid-template-columns: repeat(3, 1fr);
  position: relative;
}
.steps-grid::before {
  content: "";
  position: absolute;
  top: 32px; left: 16%; right: 16%;
  height: 2px;
  background: repeating-linear-gradient(to right, var(--border) 0 6px, transparent 6px 12px);
  z-index: 0;
}
[dir="rtl"] .steps-grid::before { background: repeating-linear-gradient(to left, var(--border) 0 6px, transparent 6px 12px); }
@media (max-width: 800px) {
  .steps-grid { grid-template-columns: 1fr; }
  .steps-grid::before { display: none; }
}
.step { position: relative; text-align: center; padding: 0 8px; z-index: 1; }
.step-num {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand);
  color: var(--brand-700);
  display: grid; place-items: center;
  font-size: 22px; font-weight: 800;
  box-shadow: var(--shadow-glow);
}
.step h3 { margin: 0 0 8px; font-size: 18px; }
.step p { margin: 0; color: var(--text-2); font-size: 14px; }

/* ----------------------------------------------------------------------------
   Code sample
   ---------------------------------------------------------------------------- */
.code-block {
  max-width: 900px; margin: 0 auto;
  background: var(--ink);
  color: #cbd5e1;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid #1e293b;
}
.code-tabs {
  display: flex; gap: 4px;
  padding: 10px 12px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  align-items: center;
}
.code-dots { display: inline-flex; gap: 6px; margin-inline-end: 12px; }
.code-dots span { width: 11px; height: 11px; border-radius: 50%; background: #334155; }
.code-tab {
  padding: 5px 12px; border-radius: 6px;
  font-family: var(--font-mono); font-size: 12px;
  color: #94a3b8;
  background: transparent; border: 0; cursor: pointer;
  transition: all .15s ease;
}
.code-tab.active { background: var(--brand); color: #fff; }
.code-tab:not(.active):hover { color: #e2e8f0; background: #1e293b; }
.code-body {
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.7;
  padding: 24px;
  overflow: auto;
  direction: ltr; text-align: left;
}
.code-body .k { color: #c4b5fd; }   /* keyword */
.code-body .s { color: #86efac; }   /* string */
.code-body .n { color: #fcd34d; }   /* number */
.code-body .c { color: #64748b; font-style: italic; } /* comment */
.code-body .v { color: #93c5fd; }   /* variable */
.code-body .f { color: #fda4af; }   /* function */
.code-block + p.code-foot { text-align: center; color: var(--text-3); font-size: 13px; margin-top: 16px; }

/* ----------------------------------------------------------------------------
   Pricing
   ---------------------------------------------------------------------------- */
.plans {
  display: grid; gap: 24px;
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
}
@media (max-width: 900px) { .plans { grid-template-columns: 1fr; max-width: 480px; margin: 0 auto; } }

.plan {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  display: flex; flex-direction: column;
  position: relative;
  transition: all .2s ease;
}
.plan:hover { box-shadow: var(--shadow-md); }
.plan.is-featured {
  border-color: var(--brand);
  box-shadow: var(--shadow-glow);
  transform: translateY(-4px);
}
.plan-badge {
  position: absolute; top: -12px; inset-inline-start: 28px;
  background: var(--brand); color: #fff;
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
}
.plan h3 { font-size: 18px; margin: 0 0 6px; }
.plan .plan-desc { color: var(--text-2); font-size: 14px; min-height: 42px; margin: 0 0 20px; }
.plan-price {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 24px;
}
.plan-price .num { font-size: 44px; font-weight: 800; color: var(--ink); letter-spacing: -0.03em; line-height: 1; }
.plan-price .unit { color: var(--text-3); font-size: 13px; }
.plan-features { list-style: none; padding: 0; margin: 0 0 28px; flex: 1; }
.plan-features li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0;
  color: var(--text);
  font-size: 14px;
}
.plan-features li::before {
  content: "✓";
  color: var(--brand-700); font-weight: 700; font-size: 13px;
  width: 18px; height: 18px;
  background: var(--brand-50);
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0; margin-top: 2px;
}

/* Comparison table */
.compare-table {
  width: 100%; border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.compare-table th, .compare-table td {
  padding: 14px 18px;
  text-align: start;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
}
.compare-table th { background: var(--bg-soft); color: var(--text-2); font-weight: 600; }
.compare-table td.col-feature { font-weight: 500; color: var(--ink); }
.compare-table tr:last-child td { border-bottom: 0; }

/* ----------------------------------------------------------------------------
   FAQ accordion
   ---------------------------------------------------------------------------- */
.faq-section { max-width: 820px; margin: 0 auto; }
.faq-section + .faq-section { margin-top: 48px; }
.faq-section-title {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--brand-700);
  margin: 0 0 16px;
}
.faq {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.faq details {
  border-bottom: 1px solid var(--border-soft);
}
.faq details:last-child { border-bottom: 0; }
.faq summary {
  list-style: none;
  display: flex; align-items: center; gap: 16px;
  padding: 20px 24px;
  cursor: pointer;
  font-weight: 600; color: var(--ink);
  font-size: 15px;
  transition: background .15s ease;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  margin-inline-start: auto;
  font-size: 22px; font-weight: 400; line-height: 1;
  color: var(--text-3);
  transition: transform .2s ease;
}
.faq details[open] summary::after { content: "−"; color: var(--brand-700); }
.faq summary:hover { background: var(--bg-soft); }
.faq-body {
  padding: 0 24px 22px;
  color: var(--text-2); font-size: 14.5px; line-height: 1.7;
}

/* ----------------------------------------------------------------------------
   Contact
   ---------------------------------------------------------------------------- */
.contact-grid {
  display: grid; gap: 48px;
  grid-template-columns: 1fr 1.2fr;
  align-items: start;
}
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-info-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 18px 20px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
}
.contact-info-card + .contact-info-card { margin-top: 14px; }
.contact-info-icon {
  width: 38px; height: 38px;
  background: var(--brand-50); color: var(--brand-700);
  display: grid; place-items: center;
  border-radius: 10px; flex-shrink: 0;
}
.contact-info-icon svg { width: 18px; height: 18px; }
.contact-info-label { font-size: 12px; color: var(--text-3); margin: 0; }
.contact-info-value { color: var(--ink); font-weight: 500; margin: 2px 0 0; font-size: 14.5px; }

/* ----------------------------------------------------------------------------
   CTA band
   ---------------------------------------------------------------------------- */
.cta-band {
  background: linear-gradient(135deg, #064e3b 0%, var(--brand-700) 50%, var(--brand) 100%);
  color: #ffffff;
  border-radius: var(--radius-xl);
  padding: 64px 40px;
  text-align: center;
  margin: 80px auto;
  max-width: 1100px;
  position: relative; overflow: hidden;
}
.cta-band::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, .12) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, .08) 0%, transparent 50%);
}
.cta-band h2 { color: #ffffff; margin: 0 0 12px; position: relative; }
.cta-band p { color: rgba(255, 255, 255, .85); font-size: 17px; margin: 0 auto 28px; max-width: 540px; position: relative; }
.cta-band .btn { position: relative; }
.cta-band .btn-primary { background: #fff; color: var(--brand-700); }
.cta-band .btn-primary:hover { background: #f9fafb; color: var(--brand-700); }

/* ----------------------------------------------------------------------------
   Footer
   ---------------------------------------------------------------------------- */
.foot {
  background: var(--bg-soft);
  border-top: 1px solid var(--border-soft);
  padding: 64px 0 32px;
  margin-top: 0;
}
.foot-grid {
  display: grid; gap: 40px;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border-soft);
}
@media (max-width: 800px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .foot-grid { grid-template-columns: 1fr; gap: 28px; } }
.foot-brand { font-weight: 700; color: var(--ink); margin: 12px 0 8px; }
.foot-tagline { color: var(--text-2); font-size: 14px; max-width: 320px; }
.foot-col h4 {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-2);
  margin: 0 0 14px;
}
.foot-col a {
  display: block;
  font-size: 14px; color: var(--text);
  padding: 5px 0;
  transition: color .15s ease;
}
.foot-col a:hover { color: var(--brand-700); }
.foot-bottom {
  padding-top: 28px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px;
  color: var(--text-3); font-size: 13px;
}

/* ----------------------------------------------------------------------------
   Generic forms / inputs
   ---------------------------------------------------------------------------- */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.full { grid-template-columns: 1fr; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; color: var(--text-2); font-weight: 500; }

.captcha-row { display: flex; align-items: center; gap: 8px; }
.captcha-img {
  height: 50px; width: 160px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  user-select: none;
}
.captcha-reload {
  padding: 0 10px;
  font-size: 18px; line-height: 1;
  height: 50px;
}
.input, .select, textarea.input {
  width: 100%;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  font: inherit; font-size: 14.5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder, textarea.input::placeholder { color: var(--text-3); }
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .15);
}
textarea.input { min-height: 130px; resize: vertical; }
.help { color: var(--text-3); font-size: 12.5px; }

/* ----------------------------------------------------------------------------
   Pills / badges
   ---------------------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--bg-mute); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-2);
  font-family: var(--font-mono);
}
.pill.success { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.pill.warn    { background: var(--warn-50); border-color: #fde68a; color: #92400e; }
.pill.danger  { background: var(--danger-50); border-color: #fecaca; color: #991b1b; }
.pill.info    { background: var(--info-50); border-color: #bae6fd; color: #075985; }

/* ----------------------------------------------------------------------------
   Alerts
   ---------------------------------------------------------------------------- */
.alert {
  border: 1px solid var(--border); background: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  display: flex; gap: 12px; align-items: flex-start;
}
.alert + .alert { margin-top: 10px; }
.alert.success { border-color: var(--brand-100); background: var(--brand-50); color: #064e3b; }
.alert.warn    { border-color: #fde68a; background: var(--warn-50); color: #92400e; }
.alert.danger  { border-color: #fecaca; background: var(--danger-50); color: #991b1b; }
.alert.info    { border-color: #bae6fd; background: var(--info-50); color: #075985; }

/* ----------------------------------------------------------------------------
   Auth card
   ---------------------------------------------------------------------------- */
.auth-wrap {
  min-height: calc(100vh - 72px - 64px);
  display: grid; place-items: center;
  padding: 60px 20px;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(16, 185, 129, .08) 0%, transparent 60%),
    var(--bg);
}
.auth-card {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.auth-card p.sub { color: var(--text-2); margin: 6px 0 24px; }
.auth-card .help { text-align: center; margin-top: 16px; }
.auth-card a { font-weight: 600; }

/* ----------------------------------------------------------------------------
   Generic cards/panels (for dashboard reuse if needed)
   ---------------------------------------------------------------------------- */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 22px;
}
.card + .card { margin-top: 18px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  margin: -22px -22px 18px; padding: 16px 22px;
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600; font-size: 15px; color: var(--ink);
}
.card-actions { margin-inline-start: auto; }
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); }

/* Tables (generic) */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
  vertical-align: middle;
}
.table thead th {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); font-weight: 600;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.table tbody tr:hover { background: var(--bg-soft); }
.table-wrap {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}

/* Code / kv */
pre.code {
  background: var(--bg-mute);
  border: 1px solid var(--border-soft);
  color: var(--ink);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  overflow: auto;
  font-family: var(--font-mono); font-size: 13px;
  direction: ltr; text-align: left;
}
.kv-row { display: grid; grid-template-columns: 220px 1fr; padding: 10px 14px; border-top: 1px solid var(--border-soft); gap: 12px; }
.kv-row:first-child { border-top: none; }
.kv-row .k { color: var(--text-2); font-size: 13px; }
.kv-row .v { font-family: var(--font-mono); word-break: break-all; font-size: 13px; }

/* Grid helpers */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ============================================================================
   Dashboard scope — keeps the dashboard area visually distinct (still light,
   but with a calmer surface). The actual layouts/dashboard.php wraps content
   in `.app-dash` so these styles apply only there.
   ============================================================================ */
.app-dash {
  background: var(--bg-soft);
  min-height: 100vh;
}
.app-dash .shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  padding: 24px;
  max-width: var(--container);
  margin: 0 auto;
}
@media (max-width: 900px) { .app-dash .shell { grid-template-columns: 1fr; } }
.app-dash .sidebar {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  position: sticky; top: 80px;
  align-self: start;
}
.app-dash .sidebar h4 {
  font-size: 11px; color: var(--text-3); text-transform: uppercase;
  letter-spacing: .1em; margin: 12px 12px 6px; font-weight: 700;
}
.app-dash .navlink {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text); font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  transition: background .15s ease;
}
.app-dash .navlink:hover { background: var(--bg-soft); color: var(--ink); }
.app-dash .navlink.active {
  background: var(--brand-50);
  color: var(--brand-700);
}
.app-dash .navlink .ic { width: 18px; opacity: .9; }
.app-dash .main { min-width: 0; }
.app-dash .page-head {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px;
  margin-bottom: 22px;
}
.app-dash .page-title { font-size: 24px; font-weight: 700; margin: 0; color: var(--ink); }
.app-dash .page-subtitle { color: var(--text-2); margin: 4px 0 0; font-size: 14px; }

/* Stats row */
.stat {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px;
}
.stat .label { color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat .value { font-size: 28px; font-weight: 800; color: var(--ink); margin-top: 6px; letter-spacing: -0.02em; }
.stat.success .value { color: var(--brand-700); }
.stat.warn .value { color: #b45309; }
.stat.danger .value { color: #b91c1c; }
.stat.info .value { color: #0369a1; }

/* ============================================================================
   Modal (centered overlay with backdrop)
   ============================================================================ */
.modal {
  position: fixed; inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  background: rgba(11, 18, 32, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  overflow-y: auto;
  padding: 40px 16px;
}
.modal[hidden]       { display: none !important; }
.modal.is-open       { display: flex !important; }
.modal-dialog {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 920px;
  width: 100%;
  box-shadow: 0 25px 60px -12px rgba(0,0,0,.4);
  overflow: hidden;
  margin: auto 0;
  animation: modalIn .22s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head .modal-close {
  margin-inline-start: auto;
  background: transparent; border: 0; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
  color: var(--text-2); font-size: 20px; line-height: 1;
  display: grid; place-items: center;
  transition: background .15s ease;
}
.modal-head .modal-close:hover { background: var(--bg-mute); color: var(--ink); }
.modal-body { padding: 0; }
body.modal-open { overflow: hidden; }

/* ============================================================================
   Establishment hub header (shared across all establishment-scoped pages)
   ============================================================================ */
.est-hub-header {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 0;
  margin-bottom: 22px;
  box-shadow: var(--shadow-xs);
}
.est-hub-head {
  display: flex; align-items: center; gap: 16px;
  padding-bottom: 18px;
  flex-wrap: wrap;
}
.est-tabs {
  display: flex; gap: 4px;
  overflow-x: auto;
  border-top: 1px solid var(--border-soft);
  padding: 8px 0 0;
  margin: 0 -22px;
  padding-inline: 22px;
}
.est-tabs::-webkit-scrollbar { height: 4px; }
.est-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.est-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  font-size: 14px; font-weight: 500;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all .15s ease;
  text-decoration: none;
  margin-bottom: -1px;
}
.est-tab:hover { color: var(--ink); }
.est-tab.is-active {
  color: var(--brand-700);
  border-bottom-color: var(--brand);
  font-weight: 600;
}
.est-tab-ic { font-size: 15px; opacity: .85; }

/* ============================================================================
   Establishment switcher (dashboard topbar)
   ============================================================================ */
.est-switcher { position: relative; margin-inline-start: 12px; }
.est-switcher-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  background: var(--bg-mute); border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer; color: var(--text);
  font: inherit; font-weight: 500;
  transition: all .15s ease;
}
[dir="rtl"] .est-switcher-btn { padding: 6px 6px 6px 12px; }
.est-switcher-btn:hover { background: #fff; border-color: var(--text-3); }
.est-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-700) 100%);
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.est-name { font-size: 14px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.est-switcher-menu {
  position: absolute; top: calc(100% + 6px); inset-inline-start: 0;
  min-width: 280px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: none;
  z-index: 60;
}
.est-switcher.is-open .est-switcher-menu { display: block; }
.est-menu-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3); padding: 8px 12px 6px;
  font-weight: 600;
}
.est-menu-form { margin: 0; }
.est-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 12px;
  background: transparent; border: 0;
  border-radius: var(--radius-sm);
  color: var(--text); font: inherit; font-size: 14px;
  cursor: pointer; text-align: start;
}
.est-menu-item:hover { background: var(--bg-soft); }
.est-menu-item.current { background: var(--brand-50); }
.est-menu-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.est-menu-check { color: var(--brand-700); font-weight: 700; }
.est-menu-divider { height: 1px; background: var(--border-soft); margin: 6px 0; }
.est-menu-action {
  display: block; padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--brand-700) !important; font-weight: 500;
  font-size: 13.5px;
}
.est-menu-action:hover { background: var(--bg-soft); }

/* ============================================================================
   Page-level documentation tabs (Documentation / PHP / C# / JavaScript / ...)
   ============================================================================ */
.doc-tabs { margin-bottom: 18px; }
.doc-tabnav {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  margin-bottom: 18px;
}
.doc-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  font: inherit; font-size: 14px; font-weight: 600;
  background: transparent; border: 0;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: color .15s ease, border-color .15s ease;
}
.doc-tab:hover { color: var(--ink); }
.doc-tab.is-active {
  color: var(--brand-700);
  border-bottom-color: var(--brand);
}
.doc-tab-ic { font-size: 16px; line-height: 1; opacity: .85; }

/* ============================================================================
   Onboarding wizard (multi-step form)
   ============================================================================ */
.wizard {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 900px) {
  .wizard { grid-template-columns: 1fr; gap: 16px; padding: 18px; }
}

/* Sidebar stepper */
.wizard-nav { display: flex; flex-direction: column; gap: 4px; padding-inline-end: 16px; border-inline-end: 1px solid var(--border-soft); }
@media (max-width: 900px) { .wizard-nav { flex-direction: row; overflow-x: auto; border: 0; padding: 0; gap: 6px; } }

.wizard-step {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 8px;
  position: relative;
  cursor: default;
}
.wizard-step:not(:last-child)::after {
  content: ""; position: absolute;
  inset-inline-start: 26px; top: 44px; bottom: -4px;
  width: 2px;
  background: var(--border);
}
@media (max-width: 900px) { .wizard-step:not(:last-child)::after { display: none; } }
.wizard-step.is-active .step-bubble,
.wizard-step.is-done   .step-bubble {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.wizard-step.is-done .step-bubble::after { content: "✓"; }
.wizard-step.is-done .step-bubble .num { display: none; }
.wizard-step.is-active .wizard-step-title { color: var(--ink); }
.step-bubble {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%;
  background: #fff; border: 2px solid var(--border);
  display: grid; place-items: center;
  color: var(--text-2); font-weight: 700; font-size: 14px;
  transition: all .2s ease;
}
.wizard-step-info { min-width: 0; }
.wizard-step-title { font-weight: 600; color: var(--text-2); font-size: 14px; line-height: 1.4; }
.wizard-step-desc  { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }

/* Step content panels */
.wizard-body { min-width: 0; padding: 8px 4px; }
.wizard-panel { display: none; }
.wizard-panel.is-active { display: block; animation: fadeSlide .2s ease; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.wizard-panel h3 {
  font-size: 20px; margin: 0 0 6px;
}
.wizard-panel .sub { color: var(--text-2); margin: 0 0 20px; font-size: 14px; }

/* Choice cards (radios) */
.choice-list { display: flex; flex-direction: column; gap: 12px; }
.choice {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: #fff;
  transition: all .15s ease;
}
.choice:hover { border-color: var(--brand-100); background: var(--brand-50); }
.choice input { accent-color: var(--brand); width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }
.choice .choice-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--brand-50); color: var(--brand-700);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.choice-icon svg { width: 20px; height: 20px; }
.choice-info { min-width: 0; }
.choice-title { font-weight: 600; color: var(--ink); font-size: 15px; }
.choice-desc { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.choice:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-50);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .12);
}

/* Wizard footer */
.wizard-actions {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
}
.wizard-actions .left  { display: flex; gap: 8px; }
.wizard-actions .right { display: flex; gap: 8px; }

/* Result panel */
.wizard-result {
  text-align: center;
  padding: 32px 16px;
}
.wizard-result .result-icon {
  width: 72px; height: 72px; margin: 0 auto 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 36px;
}
.wizard-result.success .result-icon { background: var(--brand-50); color: var(--brand-700); }
.wizard-result.error   .result-icon { background: var(--danger-50); color: #b91c1c; }
.wizard-result h3 { font-size: 24px; margin: 0 0 8px; }
.wizard-result p  { color: var(--text-2); margin: 0 auto 20px; max-width: 480px; }
.wizard-result .result-details {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: start;
  font-family: var(--font-mono); font-size: 12.5px;
  color: var(--text-2);
  max-width: 540px; margin: 0 auto 20px;
  white-space: pre-wrap; word-break: break-all;
}

/* Horizontal progress bar (during AJAX onboarding) */
.wizard-bar {
  position: relative;
  max-width: 480px;
  margin: 24px auto 8px;
  height: 28px;
  border-radius: 999px;
  background: var(--bg-mute);
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.wizard-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-700) 100%);
  transition: width .4s ease;
  border-radius: 999px;
}
.wizard-bar-fill.error {
  background: linear-gradient(90deg, #fca5a5 0%, #ef4444 100%);
}
.wizard-bar-percent {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.04em;
  /* Layer above the fill, with a subtle outline so it stays readable
     both on the empty grey track and on the green filled portion.   */
  text-shadow: 0 0 2px rgba(255,255,255,.85);
  pointer-events: none;
}

/* Progress log (during processing) */
.wizard-progress { max-width: 480px; margin: 0 auto; padding: 24px 0; }
.wizard-progress-step {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0;
  color: var(--text-2);
  font-size: 14px;
}
.wizard-progress-step .ind {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-mute);
  display: grid; place-items: center;
  font-size: 12px;
  color: var(--text-3);
  flex-shrink: 0;
}
.wizard-progress-step.running .ind {
  background: var(--brand-50); color: var(--brand-700);
  animation: pulse 1.4s ease infinite;
}
.wizard-progress-step.done .ind {
  background: var(--brand); color: #fff;
}
.wizard-progress-step.done .ind::before { content: "✓"; }
.wizard-progress-step.running .ind::before { content: "…"; }
.wizard-progress-step.error .ind { background: var(--danger-50); color: #b91c1c; }
.wizard-progress-step.error .ind::before { content: "!"; }
.wizard-progress-step.done  { color: var(--ink); }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}

/* Connected status banner */
.connected-banner {
  display: flex; align-items: center; gap: 18px;
  padding: 20px 24px;
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: var(--radius);
}
.connected-banner .check {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-size: 22px; flex-shrink: 0;
}
.connected-banner .info { min-width: 0; flex: 1; }
.connected-banner .info h3 { margin: 0 0 4px; font-size: 17px; }
.connected-banner .info p  { margin: 0; color: var(--text-2); font-size: 14px; }
.connected-banner .actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 700px) {
  .connected-banner { flex-direction: column; align-items: flex-start; }
}

/* ============================================================================
   Helpers
   ============================================================================ */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 40px; }
.text-center { text-align: center; }
