:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #5b6474;
  --line: #e3e8f0;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --ok: #157347;
  --ok-bg: #e6f6ec;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --warn: #9a5b00;
  --warn-bg: #fff4e0;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.top { background: var(--ink); color: #fff; }
.top-row { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  display: inline-grid; place-items: center; font-weight: 800;
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.brand-sub { color: #aab4c5; font-size: 13px; margin-left: 4px; }
.env {
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 4px 10px; border-radius: 999px; background: #1e293b; color: #cbd5e1;
}
.env[data-env="sandbox"] { background: #14532d; color: #bbf7d0; }
.env[data-env="live"] { background: #7f1d1d; color: #fecaca; }

.grid {
  display: grid; grid-template-columns: 1fr; gap: 20px; padding-top: 24px; padding-bottom: 24px;
}
@media (min-width: 860px) { .grid { grid-template-columns: 1fr 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.card-title { margin: 0 0 6px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
h2.card-title { font-size: 18px; }
.muted { color: var(--muted); margin: 0 0 16px; font-size: 14px; }

.fields { display: grid; gap: 12px; margin-bottom: 16px; }
.field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); }
input[type="number"], input[type="text"], input[type="email"] {
  font: inherit; font-weight: 500; width: 100%;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.with-button { display: flex; gap: 8px; align-items: stretch; }
.with-button input { flex: 1; }

button {
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  padding: 10px 14px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); white-space: nowrap;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost { background: #fff; color: var(--accent); }

.finix-form { min-height: 160px; margin-top: 8px; }
.hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.error { font-size: 14px; color: var(--bad); background: var(--bad-bg); padding: 10px 12px; border-radius: 8px; margin: 12px 0 0; }

.status {
  font-weight: 700; padding: 10px 12px; border-radius: 8px; margin: 8px 0 14px;
  background: #eef2f7; color: var(--muted);
}
.status[data-state="ok"] { background: var(--ok-bg); color: var(--ok); }
.status[data-state="bad"] { background: var(--bad-bg); color: var(--bad); }
.status[data-state="warn"] { background: var(--warn-bg); color: var(--warn); }
.status[data-state="busy"] { background: #e8efff; color: var(--accent); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 13px; word-break: break-all; }

details { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; }
summary { cursor: pointer; font-weight: 600; font-size: 14px; }
pre {
  font-family: var(--mono); font-size: 12px; line-height: 1.45; margin: 10px 0 0;
  max-height: 360px; overflow: auto; background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px;
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.actions .with-button input { width: 120px; }

.log-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 6px; }
.log { list-style: none; margin: 0; padding: 0; font-family: var(--mono); font-size: 12px; max-height: 260px; overflow: auto; }
.log li { padding: 4px 0; border-top: 1px solid var(--line); word-break: break-word; }
.log li:first-child { border-top: 0; }
.log time { color: var(--muted); margin-right: 8px; }
.log .bad { color: var(--bad); }
.log .ok { color: var(--ok); }

.foot { padding-bottom: 32px; font-size: 13px; color: var(--muted); }
.foot ul { margin: 8px 0 0; padding-left: 18px; }
.foot code { font-family: var(--mono); background: #eef2f7; padding: 1px 5px; border-radius: 4px; color: var(--ink); }
