:root {
  --bg: #f3f6f4;
  --ink: #10231c;
  --muted: #5b6d66;
  --card: #ffffff;
  --line: #e2e9e5;
  --brand: #0b3d2e;
  --accent: #1fa463;
  --accent-ink: #ffffff;
  --danger: #c0392b;
  --warn: #b7791f;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16, 35, 28, .06), 0 12px 32px rgba(16, 35, 28, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(1200px 500px at 100% -10%, #d9efe3 0%, transparent 60%),
    radial-gradient(900px 400px at -10% 110%, #e6efe9 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
}

.shell { max-width: 460px; margin: 0 auto; padding: 28px 18px 40px; }

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.logo {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
  background: var(--brand); color: #7ff0b3;
}
h1 { font-size: 1.25rem; margin: 0; font-weight: 700; }
h2 { font-size: 1.15rem; margin: 0 0 6px; font-weight: 700; }
.sub, .muted { color: var(--muted); margin: 0; font-size: .95rem; }

.steps { list-style: none; padding: 0; margin: 0 0 16px; display: flex; gap: 8px; }
.steps li {
  flex: 1; display: flex; align-items: center; gap: 8px; justify-content: center;
  font-size: .85rem; color: var(--muted);
  padding: 8px 6px; border-radius: 999px; background: rgba(255,255,255,.6); border: 1px solid var(--line);
}
.steps li span {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: .75rem; background: var(--line); color: var(--muted); font-weight: 600;
}
.steps li.active { color: var(--ink); border-color: var(--accent); background: #fff; }
.steps li.active span, .steps li.done span { background: var(--accent); color: #fff; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; animation: rise .25s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

form { display: grid; gap: 10px; margin-top: 16px; }
label { font-size: .88rem; font-weight: 600; }
input {
  font: inherit; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: #fbfcfb; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31,164,99,.15); }

.btn {
  font: inherit; font-weight: 600; border: 0; cursor: pointer; border-radius: 12px;
  padding: 12px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .05s, filter .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: #eef4f0; color: var(--brand); }
.btn.danger { background: #fbeceb; color: var(--danger); width: 100%; margin-top: 18px; }
.btn.link { background: none; color: var(--muted); width: 100%; margin-top: 10px; font-weight: 500; }
.btn.small { padding: 8px 14px; font-size: .9rem; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.5); border-top-color: #fff; animation: spin .8s linear infinite;
}
.spinner.dark { border-color: #cfe0d7; border-top-color: var(--accent); width: 28px; height: 28px; }
@keyframes spin { to { transform: rotate(360deg); } }

.perks { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.perks li { position: relative; padding-inline-start: 26px; font-size: .92rem; color: var(--muted); }
.perks li::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 7px; width: 14px; height: 8px;
  border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg);
}

.tabs { display: flex; gap: 6px; padding: 4px; background: #eef4f0; border-radius: 12px; margin-bottom: 16px; }
.tab {
  flex: 1; font: inherit; font-size: .92rem; border: 0; background: transparent; color: var(--muted);
  padding: 9px; border-radius: 9px; cursor: pointer; font-weight: 600;
}
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.qr-frame {
  width: 100%; max-width: 300px; aspect-ratio: 1; margin: 0 auto; border-radius: 16px;
  border: 1px dashed #cfe0d7; background: #fff; display: grid; place-items: center; overflow: hidden; padding: 10px;
}
.qr-frame img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.qr-placeholder { display: grid; place-items: center; gap: 10px; color: var(--muted); text-align: center; }
.qr-placeholder p { margin: 0; font-size: .9rem; }
.refresh-note { text-align: center; font-size: .8rem; color: var(--muted); margin: 10px 0 4px; }

.howto { margin: 14px 0 0; padding-inline-start: 22px; display: grid; gap: 4px; font-size: .93rem; }

.pair-code { margin-top: 18px; text-align: center; }
.code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 1.9rem; letter-spacing: .25em;
  font-weight: 700; background: #f2f8f4; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0;
}

.success { text-align: center; }
.check { width: 72px; height: 72px; margin: 4px auto 12px; }
.check svg { width: 100%; height: 100%; }
.check circle { fill: #e5f6ec; stroke: var(--accent); stroke-width: 2; }
.check path { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .5s .15s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.info { margin: 18px 0 0; display: grid; gap: 0; text-align: start; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.info div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; }
.info div + div { border-top: 1px solid var(--line); }
.info dt { color: var(--muted); font-size: .9rem; }
.info dd { margin: 0; font-weight: 600; }
.pill { background: #e5f6ec; color: #137a47; padding: 2px 10px; border-radius: 999px; font-size: .85rem; }

.warn h2 { color: var(--warn); }
.warn .btn { margin-top: 14px; width: 100%; }

.toast {
  position: fixed; inset-inline: 16px; bottom: 18px; margin: 0 auto; max-width: 420px;
  background: var(--brand); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: .92rem;
  box-shadow: var(--shadow); text-align: center;
}
.foot { text-align: center; color: #9aaba4; font-size: .8rem; margin-top: 22px; }

[hidden] { display: none !important; }
