:root {
  --navy: #123a75;
  --blue: #148bca;
  --royal: #312a82;
  --ink: #102e57;
  --muted: #61748e;
  --line: #ccdcec;
  --soft: #f1f7fc;
  --white: #fff;
  --shadow: 0 20px 55px rgba(20, 59, 105, .09);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 88% 6%, rgba(20,139,202,.08), transparent 24%), var(--soft); font: 400 15px/1.55 Inter, "Segoe UI", Arial, sans-serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-header, .workspace, .notice, footer { width: min(1680px, calc(100% - 40px)); margin-inline: auto; }
.app-header { padding: 34px 0 24px; }
.brand-lockup { display: flex; align-items: center; gap: 16px; }
.brand-lockup img { width: 190px; height: 50px; object-fit: contain; object-position: left center; }
.brand-lockup span { padding: 7px 12px; border: 1px solid #a8c9e3; border-radius: 999px; color: #096da9; background: rgba(255,255,255,.72); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.header-copy { margin-top: 26px; }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.header-copy h1 { max-width: 900px; margin: 7px 0 9px; font-size: clamp(2rem, 3.2vw, 3.25rem); line-height: 1.08; letter-spacing: -.045em; }
.header-copy p { max-width: 850px; margin: 0; color: var(--muted); font-size: 16px; }

.workspace { display: grid; grid-template-columns: minmax(310px, 370px) minmax(0, 1fr); gap: 22px; align-items: start; padding: 20px 0 0; }
.editor-card, .preview-card { border: 1px solid #d6e3ee; border-radius: var(--radius); background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.editor-card { padding: 28px; }
.form-section + .form-section { margin-top: 30px; padding-top: 28px; border-top: 1px solid #dbe6ef; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.section-title span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--royal)); font-size: 10px; font-weight: 800; }
.section-title h2 { margin: 0; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { min-width: 0; }
.field.full { margin-top: 16px; }
.section-title + .field.full { margin-top: 0; }
.field label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; color: #29486e; font-size: 14px; font-weight: 750; }
.field label small { color: #8290a3; font-size: 10px; font-weight: 500; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #bcd0e3; border-radius: 10px; outline: 0; background: #fff; padding: 11px 12px; color: #102e57; font-size: 14px; transition: border-color .2s, box-shadow .2s, background .2s; }
.field input::placeholder, .field textarea::placeholder { color: #71839a; opacity: 1; }
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,139,202,.11); background: #fbfdff; }
.field input[type="file"] { padding: 8px; font-size: 12px; }
.field-note { display: block; margin-top: 7px; color: #7b8ca2; font-size: 11px; line-height: 1.45; }
.logo-preview-row { display: grid; grid-template-columns: 118px 1fr; gap: 14px; align-items: center; margin-bottom: 18px; padding: 12px; border: 1px solid #d9e7f1; border-radius: 12px; background: #f7fbfe; }
.mini-logo { height: 52px; display: grid; place-items: center; padding: 6px; border-radius: 8px; background: #fff; }
.mini-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-preview-row p { margin: 0; color: var(--muted); font-size: 11px; }
.editor-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 28px; padding-top: 20px; border-top: 1px solid #dbe6ef; color: #8290a3; font-size: 11px; }
.text-button { padding: 0; border: 0; border-bottom: 1px solid currentColor; color: var(--blue); background: transparent; font-size: 12px; font-weight: 700; }

.preview-card { position: sticky; top: 20px; padding: 24px; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.preview-toolbar > div:first-child { display: grid; gap: 4px; }
.preview-toolbar strong { color: var(--blue); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.view-switch { display: flex; padding: 3px; border: 1px solid #d7e4ef; border-radius: 10px; background: #f3f8fc; }
.view-switch button { padding: 7px 10px; border: 0; border-radius: 7px; color: #6b7d94; background: transparent; font-size: 11px; font-weight: 700; }
.view-switch button.active { color: #fff; background: var(--navy); }
.preview-stage { min-height: 620px; display: grid; place-items: center; overflow: auto; border: 1px dashed #b7cee1; border-radius: 15px; background: linear-gradient(rgba(255,255,255,.88), rgba(255,255,255,.88)), radial-gradient(circle at 20% 20%, #d8eaf6 1px, transparent 1px); background-size: auto, 18px 18px; padding: 32px 20px; }
.preview-stage.mobile { width: min(100%, 430px); margin-inline: auto; justify-content: start; }
.preview-stage.mobile .email-shell { width: 860px; zoom: .48; }
.email-shell { width: 880px; min-width: 880px; padding: 10px; background: #fff; transition: width .25s; zoom: .82; }
.email-shell img { max-width: none; }
.action-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.primary-button, .secondary-button { min-height: 44px; padding: 10px 17px; border-radius: 10px; font-size: 12px; font-weight: 800; }
.primary-button { border: 0; color: #fff; background: linear-gradient(135deg, var(--blue), var(--royal)); box-shadow: 0 10px 24px rgba(49,42,130,.18); }
.primary-button span { display: block; font-size: 13px; }
.secondary-button { border: 1px solid #b9cfe1; color: var(--navy); background: #fff; }
#status-message { flex: 1 1 200px; margin: 0; color: #307249; font-size: 12px; text-align: right; }
#status-message.error { color: #aa3434; }

.notice { display: grid; grid-template-columns: 150px 1fr; gap: 20px; margin-top: 26px; padding: 18px 22px; border-left: 3px solid var(--blue); border-radius: 8px; color: #536b88; background: #eaf5fd; font-size: 12px; }
.notice strong { color: var(--navy); }
.notice p { margin: 0; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px 0 34px; color: #71839a; font-size: 11px; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-card { position: static; }
  .preview-stage { min-height: 560px; }
}

@media (max-width: 620px) {
  .app-header, .workspace, .notice, footer { width: min(100% - 24px, 1680px); }
  .app-header { padding-top: 22px; }
  .brand-lockup { align-items: flex-start; flex-direction: column; gap: 8px; }
  .header-copy h1 { font-size: 2rem; }
  .editor-card, .preview-card { padding: 19px; border-radius: 15px; }
  .field-grid { grid-template-columns: 1fr; }
  .preview-toolbar { align-items: flex-start; flex-direction: column; }
  .preview-stage { min-height: 500px; padding: 20px 10px; }
  .email-shell { min-width: 880px; }
  .logo-preview-row, .notice { grid-template-columns: 1fr; }
  #status-message { flex-basis: 100%; text-align: left; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
