:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-strong: #f1f5f1;
  --text: #151816;
  --muted: #5f6b63;
  --border: #d9e0da;
  --accent: #0f766e;
  --accent-strong: #0b5f58;
  --amber: #a15c00;
  --red: #b42318;
  --shadow: 0 18px 50px rgba(22, 28, 24, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 36%),
    linear-gradient(315deg, rgba(161, 92, 0, 0.08), transparent 40%),
    var(--bg);
  color: var(--text);
  min-width: 320px;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  min-height: 42px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover:not(:disabled),
button.active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-strong);
  color: #ffffff;
}

.app-shell {
  min-height: 100vh;
  padding: 22px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 0 auto 18px;
  max-width: 1280px;
}

.brand {
  align-items: center;
  color: inherit;
  display: inline-flex;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  background:
    linear-gradient(90deg, var(--text) 0 28%, transparent 28% 42%, var(--accent) 42% 70%, transparent 70%),
    linear-gradient(0deg, transparent 0 22%, var(--amber) 22% 42%, transparent 42% 58%, var(--text) 58% 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: inset 0 0 0 6px #ffffff;
  height: 42px;
  width: 42px;
}

.brand strong {
  display: block;
  font-size: 1.24rem;
  line-height: 1;
}

.brand small {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  margin-top: 4px;
}

.primary-nav {
  align-items: center;
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.primary-nav a {
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  min-height: 36px;
  padding: 8px 10px;
  text-decoration: none;
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.22);
  color: var(--accent-strong);
}

.status-pill {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  min-height: 34px;
  padding: 0 14px;
}

.status-pill[data-level="ok"] {
  border-color: rgba(15, 118, 110, 0.35);
  color: var(--accent-strong);
}

.status-pill[data-level="error"] {
  border-color: rgba(180, 35, 24, 0.35);
  color: var(--red);
}

.tool-intro {
  align-items: end;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  margin: 0 auto 18px;
  max-width: 1280px;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.tool-intro h1,
.page-heading h1 {
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  line-height: 1.1;
  margin: 0;
  max-width: 760px;
}

.tool-intro p,
.page-heading p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.workspace {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 480px);
  margin: 0 auto;
  max-width: 1280px;
}

.controls,
.preview {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.controls {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.preview {
  align-content: start;
  display: grid;
  gap: 16px;
  padding: 18px;
}

.type-strip {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(9, minmax(76px, 1fr));
  overflow-x: auto;
  padding-bottom: 2px;
}

.type-strip button {
  min-width: 76px;
  white-space: nowrap;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field,
.checkbox-field,
.payload-box,
.option-row label {
  color: var(--muted);
  display: grid;
  gap: 7px;
  font-size: 0.88rem;
  min-width: 0;
}

.field textarea,
.payload-box textarea {
  min-height: 106px;
  resize: vertical;
}

.field:has(textarea),
.payload-box,
.field[data-field="description"],
.field[data-field="message"],
.field[data-field="body"],
.field[data-field="note"] {
  grid-column: 1 / -1;
}

.checkbox-field {
  align-items: center;
  display: flex;
  gap: 10px;
  min-height: 44px;
}

.checkbox-field input {
  height: 18px;
  order: -1;
  width: 18px;
}

.muted {
  opacity: 0.55;
}

input,
select,
textarea {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

input[type="color"] {
  padding: 4px;
}

input[type="file"] {
  padding: 8px;
}

input[type="range"] {
  accent-color: var(--accent);
  padding: 0;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.option-band {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.option-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.preview-frame {
  align-items: center;
  aspect-ratio: 1;
  background:
    linear-gradient(45deg, #eef2ee 25%, transparent 25%),
    linear-gradient(-45deg, #eef2ee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef2ee 75%),
    linear-gradient(-45deg, transparent 75%, #eef2ee 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  overflow: hidden;
  padding: 18px;
}

#qr-canvas {
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(22, 28, 24, 0.13);
  display: block;
  height: auto;
  max-height: 100%;
  max-width: 100%;
  width: 100%;
}

.action-row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.payload-box textarea {
  color: #26302a;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
}

.message-stack {
  display: grid;
  gap: 8px;
}

.message {
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.35;
  padding: 10px 12px;
}

.message.ok {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.24);
  color: var(--accent-strong);
}

.message.warning {
  background: rgba(161, 92, 0, 0.08);
  border-color: rgba(161, 92, 0, 0.24);
  color: var(--amber);
}

.message.error {
  background: rgba(180, 35, 24, 0.08);
  border-color: rgba(180, 35, 24, 0.24);
  color: var(--red);
}

.content-grid,
.content-page,
.site-footer {
  margin-left: auto;
  margin-right: auto;
  max-width: 1280px;
}

.content-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.content-grid article,
.article-stack article,
.faq-list article,
.notice-panel {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
}

.content-grid h2,
.article-stack h2,
.faq-list h2 {
  font-size: 1.05rem;
  margin: 0 0 8px;
}

.content-grid p,
.article-stack p,
.faq-list p,
.site-footer p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.content-page {
  display: grid;
  gap: 18px;
}

.page-heading {
  display: grid;
  gap: 10px;
  max-width: 860px;
}

.article-stack,
.faq-list {
  display: grid;
  gap: 12px;
  max-width: 920px;
}

.notice-panel {
  border-color: rgba(161, 92, 0, 0.35);
}

.button-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.button-link {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #ffffff;
  display: inline-flex;
  min-height: 42px;
  padding: 0 14px;
  text-decoration: none;
}

.button-link.secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--accent-strong);
}

.site-footer {
  border-top: 1px solid var(--border);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-top: 28px;
  padding: 18px 0 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent-strong);
}

@media (max-width: 980px) {
  .tool-intro,
  .workspace {
    grid-template-columns: 1fr;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .preview {
    grid-row: 1;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .primary-nav {
    justify-content: flex-start;
  }

  .type-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .form-grid,
  .option-row {
    grid-template-columns: 1fr;
  }

  .site-footer {
    flex-direction: column;
  }

  .site-footer nav {
    justify-content: flex-start;
  }
}

@media (max-width: 420px) {
  .type-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brand strong {
    font-size: 1.08rem;
  }

  .status-pill {
    font-size: 0.82rem;
    padding: 0 10px;
  }
}

/* QRIN utility layout inspired by the local reference app, customized for QR workflows. */
:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-strong: #eef7f5;
  --text: #17212b;
  --muted: #667085;
  --border: #d9e1e7;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --amber: #f97316;
  --red: #b42318;
  --focus: #2563eb;
  --shadow: 0 18px 50px rgba(23, 33, 43, 0.08);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.06), transparent 340px),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: 72px;
  background: rgba(247, 248, 251, 0.92);
  border-bottom: 1px solid rgba(217, 225, 231, 0.78);
  backdrop-filter: blur(14px);
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
select,
textarea,
input,
a {
  outline-color: var(--focus);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 88px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.app-shell {
  min-height: 100vh;
  padding: 0;
}

.topbar,
.site-footer {
  width: min(1440px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 72px;
  margin-bottom: 0;
}

.brand {
  gap: 10px;
  font-weight: 800;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 4px #ffffff;
}

.brand strong {
  font-size: 1rem;
  line-height: 1;
}

.brand small {
  display: none;
}

.primary-nav {
  justify-content: flex-end;
  gap: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.primary-nav a {
  min-height: auto;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  color: var(--accent-strong);
  background: transparent;
  border-color: transparent;
}

.trust-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  color: var(--accent-strong);
  background: var(--surface-strong);
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

.workspace {
  width: min(1440px, calc(100% - 32px));
  max-width: none;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  margin: 0 auto 28px;
}

.tool-frame,
.launch-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tool-frame {
  min-width: 0;
  padding: 18px;
}

.workspace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--amber);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.workspace-head h1,
.page-heading h1 {
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  line-height: 1.1;
}

.status-pill {
  max-width: min(520px, 48vw);
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
  font-size: 0.92rem;
}

.status-pill[data-level="ok"] {
  color: var(--accent-strong);
  border-color: rgba(15, 118, 110, 0.28);
  background: #ecfdf8;
}

.status-pill[data-level="error"] {
  color: var(--red);
  border-color: rgba(180, 35, 24, 0.32);
  background: #fff1f2;
}

.qr-tool-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 400px);
  gap: 14px;
}

.controls,
.preview {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: none;
}

.controls {
  align-content: start;
  padding: 12px;
}

.preview {
  padding: 12px;
}

.type-strip {
  grid-template-columns: repeat(7, minmax(44px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  overflow: visible;
}

.type-strip button {
  aspect-ratio: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--border);
}

.type-strip svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.type-strip button.active,
.type-strip button:hover:not(:disabled) {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.form-grid {
  gap: 12px;
}

.field,
.checkbox-field,
.payload-box,
.option-row label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

input,
select,
textarea {
  min-height: 40px;
  border-color: var(--border);
  border-radius: 8px;
}

textarea {
  font-family: var(--mono);
}

.option-band {
  margin: 0;
  background: #f9fbfc;
  border-color: var(--border);
}

.design-toolbar {
  margin-bottom: 14px;
  padding: 12px;
}

.design-toolbar .option-row {
  gap: 10px;
}

.design-toolbar input[type="file"] {
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-frame {
  padding: 14px;
  background: #f9fbfc;
  border-color: var(--border);
}

#qr-canvas {
  box-shadow: 0 10px 30px rgba(23, 33, 43, 0.1);
}

.action-row button.primary,
button.primary {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.action-row button.primary:hover:not(:disabled),
button.primary:hover:not(:disabled) {
  color: #ffffff;
  background: var(--accent-strong);
}

.action-row button:not(.primary) {
  color: var(--accent-strong);
  background: #ffffff;
  border-color: rgba(15, 118, 110, 0.35);
}

.action-row button:not(.primary):hover:not(:disabled) {
  background: var(--surface-strong);
}

.payload-box textarea {
  min-height: 116px;
  background: #fbfcfd;
}

.message {
  font-size: 0.88rem;
}

.launch-panel {
  align-self: start;
  padding: 18px;
}

.launch-panel h2 {
  margin: 0;
  font-size: 1rem;
}

.launch-panel ul {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  padding-left: 18px;
  color: #334155;
  line-height: 1.45;
}

.launch-panel li {
  padding-left: 2px;
}

.risk-note {
  margin: 0;
  padding: 12px;
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-radius: 8px;
  line-height: 1.45;
}

.content-grid {
  width: min(1440px, calc(100% - 32px));
  max-width: none;
  margin-top: 0;
}

.content-grid article,
.article-stack article,
.faq-list article,
.notice-panel {
  background: rgba(255, 255, 255, 0.76);
  box-shadow: none;
}

.site-footer {
  min-height: 56px;
  margin-bottom: 12px;
  padding-top: 0;
  align-items: center;
}

.site-footer p {
  font-size: 0.92rem;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .launch-panel {
    order: 2;
  }
}

@media (max-width: 900px) {
  .qr-tool-grid {
    grid-template-columns: 1fr;
  }

  .preview {
    grid-row: auto;
  }

  .workspace-head {
    display: grid;
  }

  .status-pill {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  .topbar,
  .site-footer,
  .workspace,
  .content-grid {
    width: min(calc(100% - 20px), 720px);
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    justify-content: center;
  }

  .primary-nav {
    justify-content: flex-end;
    gap: 10px;
  }

  .type-strip {
    grid-template-columns: repeat(7, minmax(40px, 1fr));
  }

  .tool-frame,
  .launch-panel {
    padding: 12px;
  }
}

@media (max-width: 560px) {
  .brand {
    gap: 8px;
  }

  .brand strong {
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .primary-nav {
    font-size: 0.84rem;
    gap: 8px;
  }

  .trust-chip {
    min-height: 28px;
    padding: 0 9px;
  }

  .type-strip {
    grid-template-columns: repeat(4, minmax(44px, 1fr));
  }

  .action-row,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
