:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6b66;
  --line: #e2e2dc;
  --primary: #0f6b5c;
  --primary-ink: #ffffff;
  --primary-light: #9fd0c5;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --soft: #f1f1ec;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161817;
    --surface: #1e2120;
    --ink: #ececea;
    --muted: #9a9e9b;
    --line: #313533;
    --primary: #3fb39c;
    --primary-ink: #0d1a17;
    --primary-light: #2a5c52;
    --danger: #ff8a80;
    --danger-soft: #3a1f1d;
    --soft: #262a28;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.8;
}
.wrap { max-width: 680px; margin-inline: auto; padding: 32px 16px 48px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; opacity: 0; }
.demo { background: #fff4e0; color: #5a4200; text-align: center; padding: 6px 16px; font-size: .88rem; }

.intro h1 { font-size: 1.6rem; margin: 0 0 8px; }
.intro p { margin: 0 0 24px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }

.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; border: 0; background: none; padding: 14px 8px;
  font: inherit; font-weight: 500; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

form { padding: 20px; }
.hint { margin: 0 0 10px; color: var(--muted); font-size: .95rem; }
.field-label { display: block; font-weight: 500; margin: 12px 0 4px; }
.panel .field-label:first-of-type { margin-top: 0; }
textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; resize: vertical;
}
textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }

.link { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; margin-bottom: 10px; }
.ideas { background: var(--soft); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-size: .95rem; }
.ideas ul { margin: 0 0 6px; padding-inline-start: 18px; }
.ideas .link { margin: 0; font-size: .9rem; }

.notice { font-size: .88rem; color: var(--muted); margin: 16px 0 10px; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: .93rem; cursor: pointer; margin-bottom: 16px; }
.consent input { width: 20px; height: 20px; flex: none; margin-top: 4px; accent-color: var(--primary); }
.consent.invalid span { color: var(--danger); }
.error { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: .95rem; }

.btn {
  width: 100%; background: var(--primary); color: var(--primary-ink);
  border: 0; border-radius: 8px; padding: 12px; font: inherit; font-weight: 700; cursor: pointer;
}
.btn[disabled] { opacity: .6; cursor: progress; }

.thanks { padding: 32px 20px; text-align: center; }
.thanks p { margin: 0 0 16px; }

/* الرسم البياني */
.stats { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); font-size: .9rem; }
.stats-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; font-weight: 500; }
.bar { display: flex; height: 14px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.seg { display: block; height: 100%; width: 0; transition: width .6s ease; }
.seg.approved, .dot.approved { background: var(--primary); }
.seg.pending, .dot.pending { background: var(--primary-light); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; color: var(--muted); }
.legend b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; margin-inline-start: 4px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 6px; vertical-align: -1px; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding-top: 24px; }
  form { padding: 16px; }
}
