:root {
  color-scheme: light;
  --bg: #eef0f4;
  --panel: #ffffff;
  --line: #d8dde6;
  --line-strong: #c2cad6;
  --text: #18212b;
  --muted: #617182;
  --accent: #1f5eff;
  --accent-soft: #e7efff;
  --danger: #b42318;
  --shadow: 0 20px 40px rgba(16, 24, 40, 0.08);
  --field-bg: #ffffff;
  --card-bg: #f8fafc;
  --card-active-bg: #eef4ff;
  --surface-subtle: #f4f6fa;
  --info-bg: #fff6e8;
  --info-border: #f1d3a3;
  --info-text: #7c5314;
  --radius-panel: 18px;
  --radius-control: 14px;
  --serif: "Bookman Old Style", "Book Antiqua", Georgia, serif;
  --ui: "Inter", Arial, sans-serif;
  font-family: var(--ui);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07111d;
  --panel: #0f1a2a;
  --line: #213149;
  --line-strong: #334662;
  --text: #e6eef9;
  --muted: #9db0c7;
  --accent: #7aa2ff;
  --accent-soft: #18294b;
  --danger: #ff9b94;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  --field-bg: #0b1625;
  --card-bg: #101d2f;
  --card-active-bg: #162949;
  --surface-subtle: #0b1625;
  --info-bg: #2a220f;
  --info-border: #6d5620;
  --info-text: #f4dda4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(31, 94, 255, 0.08), transparent 22rem),
    var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.page-header {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.page-header h1,
.preview-header h2,
.section-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.page-header h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.header-copy {
  margin: 8px 0 0;
  max-width: 48rem;
  color: var(--muted);
  line-height: 1.5;
}

.status-pill,
.preview-tag,
.theme-toggle {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  font-weight: 600;
}

.theme-toggle {
  cursor: pointer;
  color: var(--text);
}

.app-grid {
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow);
}

.form-panel {
  padding: 18px;
}

.preview-panel {
  padding: 18px;
  position: sticky;
  top: 14px;
  align-self: start;
}

.desktop-preview-panel {
  display: none;
}

.mobile-preview-section {
  display: grid;
  gap: 16px;
}

.form-section + .form-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}

.section-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.step-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.type-grid,
.swatch-row,
.dynamic-fields,
.address-grid {
  display: grid;
  gap: 12px;
}

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

.option-card,
.swatch-card {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--card-bg);
  cursor: pointer;
  min-height: 88px;
}

.option-card input,
.swatch-card input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.option-card:has(input:checked),
.swatch-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--card-active-bg);
  box-shadow: inset 0 0 0 1px rgba(31, 94, 255, 0.15);
}

.option-title {
  font-weight: 700;
}

.option-copy {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

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

.swatch-card {
  min-height: 96px;
  align-content: center;
  justify-items: center;
}

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.swatch.black { background: #101010; }
.swatch.white { background: #f8f8f7; }
.swatch.grey { background: #9ea3ac; }

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.92rem;
  font-weight: 600;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  padding: 14px 15px;
  background: var(--field-bg);
  color: var(--text);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field textarea {
  resize: vertical;
  min-height: 82px;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(31, 94, 255, 0.12);
}

.secondary-button,
.submit-button {
  border: 0;
  border-radius: 14px;
  min-height: 48px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0;
}

.secondary-button {
  background: var(--text);
  color: var(--panel);
}

.submit-button {
  width: 100%;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(31, 94, 255, 0.22);
}

.submit-button:hover,
.secondary-button:hover {
  filter: brightness(1.04);
}

.info-banner,
.validation-message {
  border-radius: 14px;
  padding: 12px 14px;
  line-height: 1.45;
  font-size: 0.92rem;
}

.info-banner {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
  margin-bottom: 12px;
}

.validation-message {
  min-height: 24px;
  color: var(--danger);
}

.form-footer {
  padding-top: 18px;
}

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

.plate-stage {
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.preview-plate {
  min-height: 240px;
  border-radius: 16px;
  padding: 24px 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: background 180ms ease, color 180ms ease;
}

.preview-inner {
  width: 100%;
  min-height: 180px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
}

.plate-line {
  width: 100%;
  margin: 0;
  text-align: center;
  line-height: 1.05;
  word-break: break-word;
}

.serif-line {
  font-family: var(--serif);
  text-transform: uppercase;
}

.devanagari-line {
  font-family: "Noto Sans Devanagari", sans-serif;
}

.malayalam-line {
  font-family: "Noto Sans Malayalam", sans-serif;
}

.preview-line-hidden {
  display: none;
}

.preview-plate.board-black {
  background: linear-gradient(180deg, #151515, #090909);
  color: #f5f0da;
}

.preview-plate.board-white {
  background: linear-gradient(180deg, #f8f8f5, #ecebe5);
  color: #141414;
}

.preview-plate.board-grey {
  background: linear-gradient(180deg, #adb2bb, #8b919b);
  color: #101418;
}

.preview-summary {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.preview-summary h3 {
  margin: 0 0 12px;
}

.preview-summary dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

.preview-summary dl div {
  display: grid;
  gap: 4px;
}

.preview-summary dt {
  color: var(--muted);
  font-size: 0.88rem;
}

.preview-summary dd {
  margin: 0;
  font-weight: 600;
  line-height: 1.45;
}

@media (min-width: 900px) {
  .app-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.85fr);
    align-items: start;
  }

  .page-shell {
    width: min(1260px, calc(100% - 40px));
    padding-top: 24px;
  }

  .form-panel,
  .preview-panel {
    padding: 22px;
  }

  .desktop-preview-panel {
    display: block;
  }

  .mobile-preview-section {
    display: none;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 16px, 100%);
    padding-top: 12px;
  }

  .form-panel,
  .preview-panel {
    padding: 14px;
    border-radius: 16px;
  }

  .type-grid,
  .swatch-row {
    grid-template-columns: 1fr;
  }

  .preview-plate {
    min-height: 210px;
  }
}
