:root {
  color-scheme: light;
  --bg: #f4f1ec;
  --panel: #fffdf8;
  --text: #252321;
  --muted: #6d6861;
  --line: #ded6ca;
  --brand: #36424f;
  --brand-2: #b66f4a;
  --brand-3: #596f8f;
  --soft: #ece8df;
  font-family: "Tajawal", "Inter", "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
body { -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 8px; padding: 10px 14px; min-height: 42px; }
button:hover { border-color: var(--brand); }
main { width: min(1180px, calc(100% - 32px)); margin: 24px auto 48px; }
.siteFooter { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 24px; border-top: 1px solid var(--line); color: var(--muted); padding: 28px; background: #f0ebe2; }
.siteFooter strong { display: block; color: var(--brand); margin-bottom: 8px; }
.siteFooter p { margin: 0 0 6px; line-height: 1.7; }
.siteFooter small { grid-column: 1 / -1; padding-top: 16px; border-top: 1px solid var(--line); }
.footerLinks { display: grid; gap: 6px; justify-content: start; }
.footerLinks a { color: var(--brand); text-decoration: none; }
.footerLinks a:hover { text-decoration: underline; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 14px 24px; background: rgba(255, 253, 248, 0.85); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(222, 214, 202, 0.7); }
.brand { display: inline-grid; justify-items: stretch; gap: 5px; min-height: 42px; border: 0; background: transparent; padding: 2px; }
.brandName { display: flex; align-items: baseline; justify-content: center; gap: 10px; direction: rtl; line-height: 1; }
.brandName strong { color: var(--brand); font-size: 30px; font-weight: 800; line-height: .9; }
.brandName small { color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: .01em; line-height: 1; }
.brand > em { display: flex; align-items: center; gap: 6px; width: 100%; color: var(--brand-2); font-size: 7px; font-style: normal; font-weight: 800; letter-spacing: .16em; line-height: 1; text-align: center; text-transform: uppercase; white-space: nowrap; }
.brand > em::before, .brand > em::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .35; }
nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
nav button, .ghost { background: transparent; }

.hero { display: grid; grid-template-columns: 1.35fr .9fr; gap: 20px; align-items: stretch; padding: 42px; border-radius: 8px; background: linear-gradient(135deg, #fffdf8, #ebe5da 54%, #e9edf2); border: 1px solid var(--line); }
.hero h1 { margin: 0; font-size: clamp(56px, 8vw, 112px); line-height: .95; color: var(--brand); letter-spacing: 0; }
.hero p { max-width: 650px; color: var(--muted); font-size: 20px; line-height: 1.8; }
.eyebrow { color: var(--brand-2) !important; font-size: 14px !important; font-weight: 700; }
.heroPanel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-content: center; }
.privacyStrip { display: grid; gap: 10px; max-width: 720px; margin-top: 24px; padding: 16px; border: 1px solid rgba(54,66,79,.16); border-radius: 8px; background: rgba(255,253,248,.72); }
.privacyStrip strong { color: var(--brand); font-size: 18px; }
.privacyStrip span { color: var(--muted); line-height: 1.65; }
.notice { display: grid; gap: 6px; margin: 18px 0 4px; padding: 14px 16px; border: 1px solid #ead9cf; border-radius: 8px; background: #fff7ef; color: var(--muted); line-height: 1.7; }
.notice strong { color: var(--brand-2); }
.notice.compact { margin: 0; }
.formMessage { margin: 14px 0 0; padding: 12px 14px; border-radius: 8px; font-weight: 700; line-height: 1.6; }
.formMessage.error { border: 1px solid #efc7c7; background: #fff0f0; color: #8b3d3d; }
.formMessage.success { border: 1px solid #cfe6d8; background: #edf8f1; color: #2f5a43; }

.grid { display: grid; gap: 20px; margin-top: 20px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { background: var(--panel); border: 1px solid rgba(222, 214, 202, 0.8); border-radius: 12px; padding: 24px; margin-top: 20px; box-shadow: 0 20px 40px rgba(54, 66, 79, 0.05), 0 1px 3px rgba(54, 66, 79, 0.02); transition: transform 0.3s ease, box-shadow 0.3s ease; animation: fadeInUp 0.5s ease-out; }
.narrow { max-width: 760px; margin-inline: auto; }
.panel h1, .panel h2 { margin-top: 0; }
.muted { color: var(--muted); }
.srOnly { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.moneyAmount { display: inline-flex; align-items: center; gap: .22em; direction: ltr; unicode-bidi: isolate; white-space: nowrap; line-height: 1; vertical-align: -.06em; }
.moneyNumber { display: inline-block; font-variant-numeric: tabular-nums; line-height: 1; }
.currencySymbol { display: inline-block; width: .62em; height: .72em; flex: 0 0 auto; color: currentColor; overflow: visible; transform: translateY(.02em); }
.currencySymbol path { fill: currentColor; }

.stat { background: rgba(255, 253, 248, 0.82); border: 1px solid rgba(222, 214, 202, 0.7); border-radius: 12px; padding: 18px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 10px 20px rgba(54, 66, 79, 0.02); transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.stat:hover { transform: translateY(-3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 16px 28px rgba(54, 66, 79, 0.06); border-color: var(--brand-2); }
.stat > span { display: block; color: var(--muted); margin-bottom: 8px; }
.stat strong { display: block; font-size: 28px; line-height: 1.08; color: var(--brand); }
.stat strong .moneyAmount { display: inline-flex; color: inherit; }
.stat small { display: block; margin-top: 8px; color: var(--brand-2); font-weight: 700; }

.distributionPanel, .marketPanel { display: grid; align-content: start; gap: 18px; }
.rangeTrack { position: relative; height: 14px; border-radius: 999px; background: linear-gradient(90deg, #e5ded2, #b6c0cc, #d9b49d); overflow: hidden; }
.rangeTrack i { position: absolute; top: 0; bottom: 0; border-radius: inherit; background: rgba(54,66,79,.55); box-shadow: 0 0 0 999px rgba(255,255,255,.18); }
.rangeGrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.rangeGrid div, .summaryList div { display: grid; gap: 6px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fffaf2; }
.rangeGrid div > span, .summaryList div > span { color: var(--muted); font-size: 13px; }
.rangeGrid strong, .summaryList strong { color: var(--brand); overflow-wrap: anywhere; }
.rangeGrid strong .moneyAmount, .summaryList strong .moneyAmount, .summaryList small .moneyAmount { color: inherit; }
.rangeGrid small, .summaryList small { color: var(--brand-2); font-weight: 700; }
.summaryList { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.panelTitle span.high, .panelTitle span.medium, .panelTitle span.low { width: auto; min-width: 0; padding: 0 12px; border-radius: 999px; font-size: 13px; }
.panelTitle span.high { background: #2f5a43; }
.panelTitle span.medium { background: #8a5a16; }
.panelTitle span.low { background: #8b3d3d; }
.compareTool, .sharePanel { display: grid; gap: 16px; }
.compactForm { max-width: 820px; }
.compareResult { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.compareResult div { display: grid; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.compareResult div > span { color: var(--muted); }
.compareResult strong { color: var(--brand); font-size: 24px; }
.compareResult.positive div:nth-child(2) small { color: #2f5a43; font-weight: 800; }
.compareResult.negative div:nth-child(2) small { color: #8b3d3d; font-weight: 800; }
.sharePanel { grid-template-columns: 1fr auto; align-items: center; }

.chartPanel { overflow: hidden; }
.panelTitle { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panelTitle h2 { margin: 0; }
.panelTitle span { min-width: 34px; height: 34px; border-radius: 999px; display: inline-grid; place-items: center; color: #fff; background: var(--brand); font-weight: 800; }
.bars { display: grid; gap: 12px; }
.barRow { display: grid; grid-template-columns: 32px minmax(120px, 1fr) minmax(120px, 1.2fr) minmax(88px, max-content); gap: 12px; align-items: center; padding: 10px; border: 1px solid transparent; border-radius: 8px; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.barRow:hover { border-color: var(--line); background: #fffaf2; transform: translateX(-4px); }
[dir="ltr"] .barRow:hover { transform: translateX(4px); }
.barRow em { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--soft); color: var(--brand); font-style: normal; font-weight: 800; }
.barRow > span { display: grid; gap: 4px; }
.barRow small { color: var(--muted); }
.barRow div { height: 14px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.barRow i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-3), var(--brand-2)); border-radius: inherit; }
.barRow b { display: flex; justify-content: flex-start; min-width: 88px; white-space: nowrap; color: var(--brand); font-variant-numeric: tabular-nums; }
.barRow b .moneyAmount { color: inherit; }

.orgGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.miniCard { border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: grid; gap: 12px; align-content: start; }
.miniCard > span { color: var(--muted); }
.miniCard > small { color: var(--muted); line-height: 1.5; }
.orgProfileCard { cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.orgProfileCard:hover, .orgProfileCard:focus { outline: 0; border-color: var(--brand-2); box-shadow: 0 12px 28px rgba(54, 66, 79, .1); transform: translateY(-2px); }
.miniMetric { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: baseline; }
.metricLabel { color: var(--muted); font-size: 13px; }
.metricValue { justify-self: end; color: var(--brand); font-weight: 800; }
.metricValue .moneyAmount { color: inherit; }
.metricCount { grid-column: 1 / -1; justify-self: end; color: var(--brand-2); font-size: 13px; font-weight: 700; }
[dir="ltr"] .metricValue, [dir="ltr"] .metricCount { justify-self: start; }
.companyProfile { display: grid; gap: 20px; }
.companyHero { display: grid; gap: 16px; }
.companyHeroMain { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.companyHero h1 { margin: 0; color: var(--brand); font-size: clamp(34px, 5vw, 64px); line-height: 1.05; }
.companyConfidence { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.companyConfidence > span { padding: 6px 12px; border-radius: 999px; color: #fff; font-weight: 800; font-size: 13px; white-space: nowrap; }
.companyConfidence > span.high { background: #2f5a43; }
.companyConfidence > span.medium { background: #8a5a16; }
.companyConfidence > span.low { background: #8b3d3d; }
.companyWebsite { justify-self: start; color: var(--brand); font-weight: 800; text-decoration: none; overflow-wrap: anywhere; }
.companyWebsite:hover { text-decoration: underline; }
.companyStats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.compactEntityStats { grid-template-columns: repeat(2, minmax(140px, 1fr)); min-width: min(360px, 100%); }
.authGrid { align-items: start; }
.profileSummary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.profileMetric { display: grid; gap: 6px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.profileMetric span { color: var(--muted); }
.profileMetric strong { color: var(--brand); font-size: 24px; overflow-wrap: anywhere; line-height: 1.35; }
.profileMetric small { color: var(--brand-2); font-weight: 700; }
.emailText { font-size: 18px !important; direction: ltr; text-align: start; }
.saveFlash { margin: 16px 0; padding: 12px 14px; border: 1px solid #cfe6d8; border-radius: 8px; background: #edf8f1; color: #2f5a43; font-weight: 800; }
.profileContributions { margin-top: 28px; display: grid; gap: 12px; }
.contributionRow { grid-template-columns: 1.2fr 1.2fr 1fr auto auto; }
.contributionEdit { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.contributionEdit h3 { margin: 0; }
.recommendPanel { display: grid; gap: 12px; margin: 18px 0; }

.form { display: grid; gap: 16px; margin-top: 18px; }
.compactForm { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); gap: 10px; }
.consentCheck { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fffaf2; color: var(--text); line-height: 1.7; }
.consentCheck input { width: 18px; height: 18px; margin-top: 4px; }
.consentCheck a, .footerLinks button { color: var(--brand-2); font-weight: 800; text-decoration: underline; }
.consentCheck small { display: inline; color: var(--muted); }
.footerLinks button { width: fit-content; padding: 0; border: 0; background: transparent; font: inherit; cursor: pointer; }
.policyPage { max-width: 920px; margin-inline: auto; }
.policyPage h1 { margin-bottom: 8px; }
.policyIntro { margin: 20px 0; padding: 16px; border-inline-start: 4px solid var(--brand-2); background: var(--soft); color: var(--brand); font-weight: 700; line-height: 1.8; }
.policySections { display: grid; gap: 0; }
.policySections section { padding: 20px 0; border-top: 1px solid var(--line); }
.policySections h2 { margin: 0 0 8px; color: var(--brand); font-size: 20px; }
.policySections p { margin: 0; color: var(--muted); line-height: 1.9; }
.policyContact { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
label { display: grid; gap: 7px; color: var(--muted); }
label small { color: var(--brand-2); line-height: 1.5; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; color: var(--text); }
.combo { position: relative; }
.comboInput { padding-inline-end: 12px; }
[dir="rtl"] .comboInput { padding-inline-start: 12px; padding-inline-end: 12px; }
.comboMenu { position: absolute; z-index: 20; inset-inline: 0; top: calc(100% + 6px); display: none; max-height: 280px; overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 18px 44px rgba(54, 66, 79, .16); }
.combo.open .comboMenu { display: grid; gap: 4px; }
.comboMenu button { width: 100%; min-height: 38px; padding: 9px 10px; text-align: start; border: 0; background: transparent; border-radius: 6px; }
.comboMenu button:hover, .comboMenu button:focus { outline: 0; background: #f3eee5; }
textarea { resize: vertical; min-height: 110px; }
input:focus, select:focus, textarea:focus { outline: 3px solid #e5d8ce; border-color: var(--brand-2); }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; padding: 16px; }
.benefitGroups { display: grid; gap: 12px; }
.benefitGroups fieldset { background: #fffaf2; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.check input { width: auto; }
.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.progressSteps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.progressSteps span { padding: 10px; border-radius: 8px; background: var(--soft); color: var(--brand); text-align: center; font-weight: 800; }
.formStep { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fffaf2; }
.formStep h2, .formStep p { margin: 0; }
.formStep p { color: var(--muted); line-height: 1.7; }
.inlineRequest { justify-self: start; }

.sectionHead { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sectionHead input { max-width: 360px; }
.tabs { display: flex; gap: 8px; overflow: auto; padding-bottom: 12px; margin-bottom: 12px; }
.tabs .active { background: var(--brand); color: #fff; border-color: var(--brand); }
.adminToolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.adminToolbar input { max-width: 420px; }
.inlineForm { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; }
.fileBtn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; color: var(--text); background: #fff; }
.table { display: grid; gap: 8px; }
.dataRow { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr auto auto auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.dataRow > span { color: var(--muted); overflow-wrap: anywhere; }
.compactRow { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.editRow { grid-template-columns: 1fr 1fr auto auto; }
.requestRow { display: grid; grid-template-columns: 1.2fr repeat(4, minmax(120px, 1fr)); gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.historyRow { background: #fbf8f1; }
.requestRow div { display: grid; gap: 5px; align-content: start; }
.requestRow div > span { color: var(--muted); font-size: 13px; }
.warningText { color: #8a5a16 !important; font-weight: 800; }
.requestRow p { grid-column: 1 / -1; margin: 0; color: var(--muted); line-height: 1.7; }
.actions { grid-column: 1 / -1; display: flex !important; grid-auto-flow: column; grid-template-columns: none !important; justify-content: end; align-items: center; }
.status { display: inline-flex; align-items: center; width: max-content; padding: 6px 10px; border-radius: 999px; font-weight: 800; }
.status.pending { color: #8a5a16; background: #fff2d8; }
.status.approved { color: #2f5a43; background: #dff1e8; }
.status.rejected { color: #8b3d3d; background: #f9dddd; }
.footerAdmin section { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.footerAdmin h2 { margin: 0; }
.footerLinkRow { display: grid; grid-template-columns: 1fr 1fr 1.4fr auto; gap: 10px; margin-bottom: 10px; }
.qualityGrid { display: grid; gap: 16px; }

@media (max-width: 820px) {
  main { width: min(100% - 24px, 1180px); margin-top: 14px; }
  .topbar { align-items: stretch; flex-direction: column; padding: 12px; gap: 10px; }
  .siteFooter, .footerLinkRow { grid-template-columns: 1fr; }
  .siteFooter small { grid-column: auto; }
  nav { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  nav button { white-space: nowrap; flex: 0 0 auto; }
  .ghost { width: 100%; }
  .hero, .heroPanel, .two, .split, .inlineForm, .profileSummary, .companyStats, .compareResult, .sharePanel { grid-template-columns: 1fr; }
  .hero { padding: 26px; }
  .companyHeroMain { flex-direction: column; }
  .rangeGrid, .summaryList, .progressSteps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .barRow, .dataRow, .requestRow { grid-template-columns: 1fr; }
  .requestRow p, .actions { grid-column: auto; }
  .actions { justify-content: stretch; flex-wrap: wrap; }
  .actions button { flex: 1 1 120px; }
  .sectionHead, .adminToolbar { align-items: stretch; flex-direction: column; }
  .sectionHead input { max-width: none; }
  .adminToolbar input { max-width: none; }
}

@media (max-width: 560px) {
  main { width: min(100% - 16px, 1180px); }
  .hero { padding: 20px; }
  .hero h1 { font-size: 52px; }
  .hero p { font-size: 17px; line-height: 1.7; }
  .panel { padding: 16px; }
  .stat strong { font-size: 24px; }
  .rangeGrid, .summaryList, .progressSteps { grid-template-columns: 1fr; }
  .barRow { gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .barRow:hover { background: transparent; border-color: transparent; border-bottom-color: var(--line); }
  .barRow div { width: 100%; }
  fieldset { grid-template-columns: 1fr; }
}

/* Confidence Gauge styles */
.confidenceGauge {
  width: 48px;
  height: 48px;
  margin-inline-start: 12px;
}
.gaugeBg {
  stroke: var(--soft);
}
.gaugeFill {
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Distribution SVG Curve */
.distributionSvg {
  display: block;
  margin: 16px 0 8px;
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.5);
  border: 1px solid var(--line);
}

/* Percentile Display */
.percentileDisplay {
  text-align: center;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(54, 66, 79, 0.05), rgba(182, 111, 74, 0.05));
  border: 1px solid var(--line);
  margin-top: 14px;
  animation: fadeInUp 0.4s ease-out;
}
.percentileDisplay h3 {
  margin: 0 0 6px;
  font-size: 20px;
  color: var(--brand);
}
.percentileDisplay p {
  margin: 0;
  color: var(--muted);
}
.percentileBar {
  height: 8px;
  background: var(--soft);
  border-radius: 99px;
  margin-top: 12px;
  overflow: hidden;
}
.percentileBarInner {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-3), var(--brand-2));
  border-radius: inherit;
  width: var(--percentile-width, 0%);
  animation: growPercentile 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes growPercentile {
  from { width: 0%; }
  to { width: var(--percentile-width, 0%); }
}
