:root {
  color-scheme: light;
  --bg: #f3f7fb;
  --bg-strong: #e7eef5;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --ink: #17202a;
  --muted: #657284;
  --line: #d7e1ea;
  --line-strong: #b8c6d4;
  --accent: #1652f0;
  --accent-strong: #0d3db7;
  --teal: #00a885;
  --coral: #f0673f;
  --amber: #f3b61f;
  --danger: #c0392b;
  --radius: 8px;
  --shadow: 0 20px 60px rgba(21, 31, 46, 0.12);
  --shadow-soft: 0 10px 30px rgba(21, 31, 46, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(243, 247, 251, 0.1) 36rem),
    linear-gradient(135deg, rgba(0, 168, 133, 0.12), rgba(240, 103, 63, 0.09) 48%, rgba(22, 82, 240, 0.1)),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

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

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

.panel h1,
.panel h2,
.panel p,
.preview-header h2 {
  margin: 0;
}

.panel p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 430px);
  gap: 18px;
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  align-items: start;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  width: 100%;
  max-width: 1380px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

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

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

.editor-pane {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.panel,
.preview-card {
  min-width: 0;
  border: 1px solid rgba(215, 225, 234, 0.96);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.lead-panel {
  border-color: rgba(22, 82, 240, 0.22);
}

.panel-heading,
.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel h1,
.panel h2,
.preview-header h2 {
  font-size: 1.08rem;
  line-height: 1.22;
}

.seo-home {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
  width: 100%;
  max-width: 1380px;
  margin: 18px auto 0;
  padding: 18px 2px 0;
  color: var(--ink);
}

.seo-home h2,
.seo-home p {
  margin: 0;
}

.seo-home h2 {
  font-size: 1.02rem;
  line-height: 1.22;
}

.seo-home p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.seo-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  align-content: start;
}

.seo-link-grid a {
  min-width: 0;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.35;
  text-decoration: none;
}

.seo-link-grid a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.content-form {
  margin-top: 16px;
}

.content-form + .type-picker {
  margin-top: 12px;
}

.color-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #334155;
  font-size: 0.84rem;
  font-weight: 760;
}

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

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

select {
  appearance: none;
  padding-right: 42px;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23657284' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
}

.hex-color {
  font-family: "Roboto Mono", Consolas, monospace;
  text-transform: uppercase;
}

.hex-color::placeholder {
  color: #94a3b8;
  text-transform: uppercase;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 82, 240, 0.12);
}

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

.toggle-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.design-stack,
.tool-stack,
.dynamic-settings,
.section-builder,
.section-list,
.manager-list {
  display: grid;
  gap: 12px;
}

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

.style-preset {
  display: grid;
  place-items: center;
  min-height: 52px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
}

.style-preset.active,
.style-preset:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 82, 240, 0.12);
}

.advanced-box {
  display: block;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.advanced-box summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  cursor: pointer;
  color: #1f2a37;
  font-size: 0.9rem;
  font-weight: 900;
  list-style: none;
}

.advanced-box summary::-webkit-details-marker {
  display: none;
}

.advanced-box summary::after {
  content: "";
  width: 9px;
  height: 9px;
  margin-left: auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transform-origin: center;
  transition: transform 160ms ease, border-color 160ms ease;
  flex: 0 0 auto;
}

.advanced-box[open] summary {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.advanced-box[open] summary::after {
  transform: rotate(225deg);
}

.advanced-box summary:hover::after {
  border-color: var(--accent);
}

.type-picker {
  background: var(--surface-soft);
}

.nested-box {
  background: var(--surface-soft);
}

.dynamic-settings[hidden],
.advanced-box[hidden] {
  display: none;
}

.frame-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.frame-option {
  min-height: 76px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-weight: 760;
}

.frame-option.active,
.frame-option:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 82, 240, 0.12);
}

.frame-thumb {
  display: grid;
  place-items: center;
  height: 42px;
  margin-bottom: 6px;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 900;
}

.frame-option[data-frame="none"] .frame-thumb {
  border: 8px solid #111827;
  background: #ffffff;
  color: var(--ink);
}

.frame-option[data-frame="top"] .frame-thumb {
  align-items: start;
  padding-top: 6px;
}

.frame-option[data-frame="bottom"] .frame-thumb {
  align-items: end;
  padding-bottom: 6px;
}

.frame-option[data-frame="ticket"] .frame-thumb {
  border-radius: 4px;
  outline: 2px dashed rgba(255, 255, 255, 0.65);
  outline-offset: -7px;
}

.logo-tools,
.button-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.logo-size-control {
  min-width: 180px;
}

.file-drop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 136px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.file-drop input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.primary-button,
.ghost-button {
  min-width: 0;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-weight: 820;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(22, 82, 240, 0.2);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button:hover,
.file-drop:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 18px rgba(21, 31, 46, 0.08);
}

.primary-button:hover,
.ghost-button:hover,
.file-drop:hover {
  transform: translateY(-1px);
}

.preview-pane {
  position: sticky;
  top: 18px;
}

.preview-card {
  padding: 18px;
}

.free-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(0, 168, 133, 0.12);
  color: #047857;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.canvas-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, #dce5ee 25%, transparent 25%),
    linear-gradient(-45deg, #dce5ee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dce5ee 75%),
    linear-gradient(-45deg, transparent 75%, #dce5ee 75%);
  background-color: #ffffff;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

#qrCanvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 6px;
}

.status-panel {
  display: grid;
  gap: 2px;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.status-panel[hidden] {
  display: none;
}

.status-panel strong {
  font-size: 0.9rem;
}

.status-panel span {
  color: var(--muted);
  font-size: 0.82rem;
}

.status-panel.error {
  border-color: rgba(192, 57, 43, 0.45);
  background: rgba(192, 57, 43, 0.08);
}

.download-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.primary-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.bulk-input {
  width: 100%;
  min-height: 130px;
  font-family: "Roboto Mono", Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
}

.dynamic-panel {
  display: grid;
  gap: 12px;
}

.dynamic-panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.publish-mode-control {
  min-width: 240px;
  flex: 1 1 280px;
}

.dynamic-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.82rem;
}

.dynamic-note.ready {
  border-color: rgba(0, 168, 133, 0.38);
  background: rgba(0, 168, 133, 0.08);
  color: #047857;
}

.dynamic-note.error {
  border-color: rgba(192, 57, 43, 0.42);
  background: rgba(192, 57, 43, 0.08);
  color: var(--danger);
}

.bulk-layout {
  display: grid;
  gap: 12px;
  align-items: start;
}

.bulk-builder {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bulk-input-label {
  display: grid;
  gap: 8px;
}

.bulk-input {
  min-height: 190px;
}

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

.bulk-summary div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.bulk-summary strong {
  font-size: 0.9rem;
}

.bulk-summary span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
}

.bulk-actions {
  margin: 12px 0;
}

.bulk-prefix {
  max-width: 340px;
}

.manager-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.manager-row.active {
  border-color: var(--accent);
  background: rgba(22, 82, 240, 0.06);
}

.manager-row strong,
.section-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-row span,
.section-row span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.manager-row code {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.manager-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.manager-actions button {
  min-height: 34px;
  padding: 0 10px;
}

.selected-code-tools {
  margin-top: 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.stat-grid div {
  display: grid;
  gap: 2px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.stat-grid strong {
  font-size: 1.08rem;
  line-height: 1.15;
}

.stat-grid span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.section-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.section-row.dragging {
  opacity: 0.55;
}

.section-handle {
  display: grid;
  place-items: center;
  width: 28px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 900;
  cursor: grab;
}

@media (max-width: 1180px) {
  .workspace {
    max-width: 960px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .preview-pane {
    position: static;
  }

  .preview-card {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }

  .preview-header {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  .status-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .style-presets {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .frame-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .panel,
  .preview-card {
    padding: 14px;
  }

  .preview-card,
  .form-grid.two-columns,
  .color-grid,
  .stat-grid,
  .bulk-layout,
  .bulk-summary,
  .primary-actions,
  .seo-home,
  .seo-link-grid {
    grid-template-columns: 1fr;
  }

  .style-presets,
  .frame-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dynamic-panel-heading,
  .manager-row,
  .section-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button-grid > button,
  .logo-tools > button,
  .logo-tools > label {
    flex: 1 1 100%;
  }
}
