:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1c2330;
  --muted: #5b6472;
  --line: #d5dbe3;
  --accent: #0b4f8a;
  --accent-text: #ffffff;
  --ok-bg: #e6f4ea;
  --ok-text: #1e5b2e;
  --error-bg: #fdecec;
  --error-text: #8a1c1c;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: #1b2129;
    --text: #e6e9ee;
    --muted: #9aa3b0;
    --line: #333c48;
    --accent: #5aa2e6;
    --accent-text: #0b1520;
    --ok-bg: #173323;
    --ok-text: #a6dfb5;
    --error-bg: #3a1a1a;
    --error-text: #f2b4b4;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

header {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 0;
  font-weight: 600;
  color: var(--muted);
}

main {
  max-width: 40rem;
  margin: 1rem auto 3rem;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

@media (max-width: 40rem) {
  main { margin: 0.5rem 0 2rem; border-radius: 0; border-left: 0; border-right: 0; }
}

h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 2rem 0 0.5rem; }

.stack { display: flex; flex-direction: column; gap: 0.35rem; }
.stack label { margin-top: 0.75rem; font-weight: 600; }

input, textarea {
  font: inherit;
  color: inherit;
  background: var(--bg);
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.3rem; letter-spacing: 0.1em; text-transform: uppercase; }

button, .button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.65rem 1.2rem;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
button:disabled { opacity: 0.6; cursor: progress; }
.button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

.customer { padding: 0.75rem 1rem; border-left: 3px solid var(--accent); background: var(--bg); margin-bottom: 1rem; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 0.9rem; margin: 0.25rem 0 0; }
.req { color: var(--error-text); }

.ok, .error { padding: 0.75rem 1rem; border-radius: 6px; }
.ok { background: var(--ok-bg); color: var(--ok-text); }
.error { background: var(--error-bg); color: var(--error-text); }

.result { white-space: pre-wrap; background: var(--bg); padding: 0.75rem; border-radius: 6px; font-size: 0.9rem; }
.result.failed { background: var(--error-bg); color: var(--error-text); }

a { color: var(--accent); }

select { font: inherit; color: inherit; background: var(--bg); padding: 0.55rem 0.6rem; border: 1px solid var(--line); border-radius: 6px; }
.stack label.check { font-weight: 400; display: flex; gap: 0.5rem; align-items: baseline; margin-top: 0.5rem; }
.stack label.check input { width: auto; flex: none; }
.stack button { align-self: flex-start; }

table.stats { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.stats th, table.stats td { text-align: right; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); }
table.stats th:first-child, table.stats td:first-child { text-align: left; }
table.stats td { font-variant-numeric: tabular-nums; }
