:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --border: #dfe7f2;
  --text: #1a2433;
  --muted: #5b6b7d;
  --accent: #1e90ff;
  --accent-soft: #eaf4ff;
  --danger: #d14343;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 40px;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 3vw, 2.5rem);
}

.subtitle {
  color: var(--muted);
  margin: 0 0 24px;
}

.grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(26, 36, 51, 0.04);
  padding: 20px;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.2rem;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

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

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

textarea {
  resize: vertical;
  min-height: 160px;
  line-height: 1.5;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.profile-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 12px;
}

.profile-toolbar {
  margin-top: 0;
  margin-bottom: 18px;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-header-row h2 {
  margin: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

button {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  font-weight: 600;
}

button:hover {
  transform: translateY(-1px);
}

.primary {
  background: var(--accent);
  color: white;
}

.secondary {
  background: #eef3f9;
  color: var(--text);
}

.danger {
  background: #fff1f1;
  color: var(--danger);
}

.panel-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.panel-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 10px;
}

.panel-row.hidden {
  display: none;
}

.panel-row select {
  min-width: 0;
}

.qr-box {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 320px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}

canvas {
  max-width: 100%;
  display: block;
}

.status {
  min-height: 22px;
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

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

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