:root {
  color-scheme: dark;
  --bg: #080a0f;
  --card: #121720;
  --elevated: #171d27;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f6f8;
  --muted: #9aa3b2;
  --gold: #f5b82e;
  --ink: #0b0d12;
  --ok: #16c784;
  --danger: #ea3943;
  --info: #3b82f6;
  --warn: #f0b90b;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Vazirmatn, Tahoma, sans-serif;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(245, 184, 46, 0.16), transparent 55%),
    var(--bg);
  color: var(--text);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.wrap { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 64px; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 22px; }
.mark { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800; color: var(--ink);
  background: linear-gradient(180deg, #ffd166, var(--gold));
}
h1 { margin: 0; font-size: 1.45rem; }
.lede { margin: 6px 0 0; color: var(--muted); line-height: 1.7; }
.grid { display: grid; grid-template-columns: 360px 1fr; gap: 18px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.card h2 { margin: 0 0 6px; font-size: 1.05rem; }
.hint { margin: 0 0 16px; color: var(--muted); line-height: 1.7; font-size: 0.92rem; }
label { display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 6px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 8px; }
input, select {
  width: 100%;
  background: #10151d;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
input:focus, select:focus { border-color: var(--gold); }
.order-id { letter-spacing: 0.02em; direction: ltr; text-align: left; }
.btn {
  border: 0; border-radius: 12px; padding: 11px 14px; font-weight: 800;
  background: var(--gold); color: var(--ink);
}
.btn.secondary, .btn.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--line-strong);
}
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn.block { width: 100%; margin-top: 4px; }
.flags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.flag {
  border-radius: 999px; padding: 5px 10px; font-size: 0.78rem; font-weight: 700;
  background: var(--elevated); border: 1px solid var(--line);
}
.flag.ok { color: var(--ok); }
.flag.warn { color: var(--warn); }
.webhook {
  direction: ltr; text-align: left; background: #080a0f; border-radius: 12px;
  padding: 10px 12px; border: 1px solid rgba(245, 184, 46, 0.25);
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  margin-bottom: 14px;
}
.webhook span { overflow-wrap: anywhere; font-size: 0.82rem; }
.returns { margin: -6px 0 14px; color: var(--muted); font-size: 0.82rem; line-height: 1.8; }
.returns b { color: var(--text); font-weight: 700; }
.result-lines { margin: 8px 0 0; display: grid; gap: 4px; }
.result-lines div { display: flex; justify-content: space-between; gap: 12px; }
.result-lines span { color: var(--muted); }
.banner {
  border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; line-height: 1.7;
  border: 1px solid var(--line);
  background: var(--elevated);
}
.banner.good { border-color: rgba(22, 199, 132, 0.35); }
.banner.bad { border-color: rgba(234, 57, 67, 0.35); }
.list { display: flex; flex-direction: column; gap: 10px; }
.order {
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--elevated);
}
.order header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.order-no { direction: ltr; font-weight: 800; }
.meta { color: var(--muted); font-size: 0.86rem; margin-top: 6px; line-height: 1.7; }
.pill {
  border-radius: 999px; padding: 3px 8px; font-size: 0.75rem; font-weight: 800; white-space: nowrap;
  background: rgba(59, 130, 246, 0.15); color: #93c5fd;
}
.pill.delivered { background: rgba(22, 199, 132, 0.15); color: var(--ok); }
.pill.closed, .pill.error { background: rgba(234, 57, 67, 0.15); color: #fda4af; }
.pill.review, .pill.refunded { background: rgba(240, 185, 11, 0.15); color: var(--warn); }
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.actions a, .actions button { text-decoration: none; }
.empty { color: var(--muted); padding: 18px 0; }
.log { margin-top: 16px; }
.log li { color: var(--muted); font-size: 0.82rem; line-height: 1.7; direction: ltr; text-align: left; }
.error { color: #fda4af; min-height: 1.2em; font-size: 0.86rem; }

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: flex-start; }
}
