:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #637083;
  --line: #d9dee5;
  --paper: #ffffff;
  --canvas: #f4f6f8;
  --accent: #0b6b53;
  --accent-hover: #075640;
  --danger: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

.topbar {
  min-height: 64px;
  padding: 0 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); font-weight: 750; text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border: 6px solid var(--accent); box-shadow: inset 0 0 0 2px var(--paper); }
.quota-label { font-size: 0.82rem; color: var(--muted); }

main { display: grid; place-items: center; padding: 48px 20px; }
.workspace { width: min(920px, 100%); }
.intro { max-width: 680px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 0.75rem; font-weight: 800; }
h1 { margin: 0; max-width: 660px; font-size: clamp(2.15rem, 5vw, 4rem); line-height: 1.04; letter-spacing: 0; }
.intro > p:last-child { margin: 18px 0 0; color: var(--muted); font-size: 1.08rem; }

.generator { padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: 0 16px 45px rgba(24, 32, 42, 0.08); }
label { display: block; margin-bottom: 9px; font-size: 0.88rem; font-weight: 700; }
.field-help { margin: -2px 0 10px; color: var(--muted); font-size: 0.86rem; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input { min-width: 0; height: 48px; padding: 0 14px; border: 1px solid #aeb7c2; border-radius: 6px; color: var(--ink); background: #fff; font: inherit; }
input:focus { outline: 3px solid rgba(11, 107, 83, 0.18); border-color: var(--accent); }
input[aria-invalid="true"] { border-color: var(--danger); }
button, .download { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; padding: 0 20px; border: 0; border-radius: 6px; color: #fff; background: var(--accent); font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
button:hover, .download:hover { background: var(--accent-hover); }
button:focus-visible, .download:focus-visible { outline: 3px solid rgba(11, 107, 83, 0.24); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: 0.65; }
[hidden] { display: none !important; }
.message { min-height: 22px; margin: 8px 0 0; color: var(--danger); font-size: 0.86rem; }

.result { margin-top: 22px; padding-top: 22px; display: grid; grid-template-columns: 180px 1fr; gap: 24px; border-top: 1px solid var(--line); }
.qr-frame { width: 180px; aspect-ratio: 1; padding: 8px; border: 1px solid var(--line); background: #fff; }
.qr-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.result.is-placeholder .qr-frame { background: #f8fafb; }
.result-actions { align-self: center; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.result-actions strong, .result-actions span { display: block; }
.result-actions span { margin-top: 5px; color: var(--muted); font-size: 0.86rem; }
footer { padding: 20px; text-align: center; color: var(--muted); font-size: 0.8rem; }

@media (max-width: 620px) {
  .topbar { padding: 0 20px; }
  .quota-label { max-width: 130px; text-align: right; }
  main { place-items: start center; padding-top: 34px; }
  .generator { padding: 20px; }
  .input-row { grid-template-columns: 1fr; }
  .result { grid-template-columns: 1fr; }
  .qr-frame { width: min(100%, 280px); margin: 0 auto; }
  .result-actions { align-items: stretch; flex-direction: column; }
  .download { width: 100%; }
}
