:root {
  --ink: #1c1917;
  --muted: #57534e;
  --paper: #f6f4f1;
  --card: #ffffff;
  --line: #e7e5e4;
  --ember: #c2410c;
  --ember-dark: #9a3412;
  --ember-soft: #fff7ed;
  --shadow: 0 12px 32px rgba(28, 25, 23, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Kufi Arabic", "Noto Sans Arabic", Tahoma, sans-serif;
  line-height: 1.7;
}

a { color: var(--ember-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

img { display: block; }

.site-header,
.site-footer,
.page {
  width: min(72rem, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand span { font-size: 1.15rem; }

.nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav form { margin: 0; }

.page { flex: 1; padding-bottom: 3rem; }

.site-footer {
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

h1, h2 { line-height: 1.35; margin: 0 0 0.6rem; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.15rem; }
.panel h2 { margin-top: 0; }

.muted { color: var(--muted); }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 38rem; }

.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
}

.notice {
  background: var(--ember-soft);
  border: 1px solid #fed7aa;
  border-radius: 14px;
  padding: 1rem 1.1rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.auth-panel { width: min(28rem, 100%); margin: 2.5rem auto; }

label {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.9rem;
  font-size: 0.92rem;
}

input, button {
  font: inherit;
  color: var(--ink);
}

input {
  width: 100%;
  background: #fff;
  border: 1px solid #d6d3d1;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}

input:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.button-primary, button[type="submit"] {
  background: var(--ember);
  color: #fff;
}

.button-primary:hover, button[type="submit"]:hover { background: var(--ember-dark); }

.button-secondary {
  background: transparent;
  color: var(--ink);
  border-color: #d6d3d1;
}

.button-quiet {
  background: transparent;
  color: var(--ink);
  border-color: #d6d3d1;
}

.nav .button-quiet, .row-actions button, .inline button {
  margin: 0;
  padding: 0.35rem 0.7rem;
  background: #fff;
  color: var(--ink);
  border: 1px solid #d6d3d1;
}

.nav .button-quiet:hover, .row-actions button:hover, .inline button:hover {
  border-color: var(--ember);
  color: var(--ember-dark);
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 2rem;
  align-items: center;
  padding: 2.5rem 0 1rem;
}

.hero-mark {
  justify-self: end;
  width: min(16rem, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, #fff 0 28%, transparent 29%),
    linear-gradient(160deg, #fff7ed, #ffedd5);
  border: 1px solid #fed7aa;
  border-radius: 28px;
}

.hero-mark img { width: 7.5rem; height: 7.5rem; }

.kicker {
  color: var(--ember-dark);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.4rem; }

.steps, .stats {
  display: grid;
  gap: 0.9rem;
}

.steps { grid-template-columns: repeat(4, 1fr); margin-top: 1.5rem; }
.stats { grid-template-columns: repeat(3, 1fr); margin-top: 1rem; }
.stats-4 { grid-template-columns: repeat(4, 1fr); }

.step, .stat { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.05rem; }
.step-no { display: block; color: var(--ember); font-weight: 700; letter-spacing: 0.04em; }
.stat strong, .stat-value { display: block; font-size: 1.7rem; line-height: 1.2; }
.stat span, .step p { color: var(--muted); margin: 0.2rem 0 0; }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin: 0.5rem 0 1.2rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  font-size: 0.82rem;
  background: #f5f5f4;
  color: var(--muted);
  white-space: nowrap;
}

.pill-pending, .pill-queued, .pill-requested { background: #ffedd5; color: #9a3412; }
.pill-active, .pill-completed, .pill-paid, .pill-success { background: #ecfdf3; color: #166534; }
.pill-claimed { background: #e0f2fe; color: #075985; }
.pill-rejected, .pill-failed, .pill-error { background: #fee2e2; color: #991b1b; }
.pill-disabled { background: #f5f5f4; color: #57534e; }

.secret {
  font-family: ui-monospace, "DejaVu Sans Mono", monospace;
  direction: ltr;
  text-align: left;
  word-break: break-all;
  user-select: all;
  background: var(--ink);
  color: #fff7ed;
  border-radius: 12px;
  padding: 0.95rem 1rem;
  margin: 0.6rem 0 0;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 40rem; }
th, td {
  text-align: right;
  padding: 0.7rem 0.45rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }

.row-actions, .inline { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.inline { display: inline-flex; }

.form-grid {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.7fr 0.45fr auto;
  gap: 0.75rem;
  align-items: end;
}

.form-grid label { margin-top: 0; }
.form-grid button { margin-bottom: 0.05rem; }

.token-form { display: flex; gap: 0.75rem; align-items: end; }
.token-form label { flex: 1; margin-top: 0; }

.overview { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }

.money { color: var(--ember-dark); }
.rate-line { margin: 0.8rem 0 0; }
.subhead { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.rate-form, .payout-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; }
.rate-form label, .payout-form label { margin-top: 0; min-width: 10rem; flex: 1; }

.bar {
  display: block;
  height: 0.4rem;
  margin-top: 0.35rem;
  background: #ffedd5;
  border-radius: 999px;
  overflow: hidden;
  min-width: 5.5rem;
}
.bar > i { display: block; height: 100%; background: var(--ember); }

.page > .panel, .page > .split { margin-top: 1rem; }
.page > .stats + .panel, .page > .notice + .panel { margin-top: 1rem; }

@media (max-width: 900px) {
  .hero, .steps, .overview, .form-grid, .stats-4, .split { grid-template-columns: 1fr; }
  .hero-mark { justify-self: start; width: 9rem; }
  .hero-mark img { width: 4.5rem; height: 4.5rem; }
  .stats { grid-template-columns: 1fr; }
  .token-form { flex-direction: column; align-items: stretch; }
  .page-head { flex-direction: column; }
}
