:root {
  --bg: #eef2ff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #0b1f44;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 500px at 100% -10%, #c7d2fe 0%, transparent 60%),
    radial-gradient(900px 450px at -10% 110%, #bae6fd 0%, transparent 60%),
    var(--bg);
}

.topbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 18px 10px;
}

.brand {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #475467;
}

h1 {
  margin: 8px 0 4px;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 8px;
}

p {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.small {
  margin-top: 6px;
  font-size: 12px;
}

.status-ok {
  color: #027a48;
}

.status-warn {
  color: #b54708;
}

.status-error {
  color: #b42318;
}

.layout {
  max-width: 1200px;
  margin: 14px auto 24px;
  padding: 0 18px;
  display: grid;
  gap: 18px;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: start;
}

.welcome {
  max-width: 1200px;
  margin: 14px auto 24px;
  padding: 0 18px;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.tool-card {
  border-radius: 18px;
  padding: 28px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.12);
  position: relative;
  overflow: hidden;
}

.tool-card h2 {
  margin: 8px 0;
  font-size: 36px;
  letter-spacing: -0.02em;
}

.tool-card p {
  max-width: 760px;
  color: #334155;
  font-size: 17px;
  line-height: 1.45;
}

.tool-primary {
  background:
    radial-gradient(700px 300px at 90% 10%, rgba(147, 197, 253, 0.45), transparent 60%),
    linear-gradient(130deg, #ffffff 0%, #eff6ff 100%);
}

.tool-soon {
  background:
    radial-gradient(700px 300px at 90% 10%, rgba(191, 219, 254, 0.35), transparent 60%),
    linear-gradient(130deg, #ffffff 0%, #f8fafc 100%);
}

.tool-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #1d4ed8;
  text-transform: uppercase;
}

.tool-cta {
  margin-top: 18px;
  width: auto;
  min-width: 220px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
}

.tool-cta.ghost {
  background: #e2e8f0;
  color: #475569;
  border-color: #cbd5e1;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

label {
  display: block;
  margin: 14px 0 7px;
  font-size: 13px;
  font-weight: 600;
}

textarea,
input,
select,
button {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #d0d5dd;
  padding: 10px 12px;
  font-size: 14px;
  transition: 0.15s border-color, 0.15s box-shadow;
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea {
  resize: vertical;
  min-height: 132px;
}

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

.actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

button {
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

button:hover {
  filter: brightness(1.08);
}

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

.preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 12px;
}

#preview-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 320px;
  display: grid;
  place-items: center;
  border: 1px dashed #d0d5dd;
  border-radius: 10px;
  background:
    linear-gradient(45deg, #f8fafc 25%, #eef2ff 25%, #eef2ff 50%, #f8fafc 50%, #f8fafc 75%, #eef2ff 75%);
  background-size: 24px 24px;
  overflow: hidden;
}

#qr-canvas {
  width: min(100%, 680px);
  height: auto !important;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  border-radius: 8px;
  image-rendering: auto;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.preset-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-btn {
  width: auto;
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.chip-btn:hover {
  background: #dbeafe;
}

.dynamic-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.dynamic-fields .full {
  grid-column: 1 / -1;
}

.meta {
  font-size: 12px;
  color: #334155;
  font-weight: 700;
}

.test-results {
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  white-space: pre-wrap;
  background: #f8fafc;
}

.chip-back {
  background: #e2e8f0;
  color: #334155;
  border-color: #cbd5e1;
}

@media (max-width: 900px) {
  .tool-card h2 {
    font-size: 30px;
  }
  .tool-card p {
    font-size: 15px;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .actions {
    grid-template-columns: 1fr;
  }
  .dynamic-fields {
    grid-template-columns: 1fr;
  }
  .preview {
    position: static;
  }
}
