:root {
  --ink: #18201d;
  --muted: #6e7773;
  --line: #e2e7e4;
  --soft-line: #edf0ee;
  --paper: #ffffff;
  --canvas: #f4f6f4;
  --accent: #23758b;
  --accent-dark: #155f72;
  --accent-soft: #e8f3f6;
  --button: #f36b2a;
  --button-dark: #d9521d;
  --button-soft: #fff0e8;
  --green: #23758b;
  --shadow: 0 18px 50px rgba(21, 95, 114, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
.upload-button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.upload-button:focus-within {
  outline: 3px solid rgba(35, 117, 139, 0.22);
  outline-offset: 2px;
}

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

.heading-actions,
.preview-actions {
  display: flex;
  align-items: center;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  color: #4e5a55;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  transition: 160ms ease;
}

.icon-button:hover {
  color: var(--ink);
  border-color: #cbd3cf;
  transform: translateY(-1px);
}

.icon-button svg,
.button svg,
.view-toggle svg,
.toast svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.main-content {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px clamp(24px, 4vw, 64px) 30px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font: 800 clamp(27px, 3vw, 34px)/1.08 "Manrope", sans-serif;
  letter-spacing: -1.5px;
}

.page-heading > div > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.heading-actions {
  gap: 18px;
}

.saved-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #68726d;
  font-size: 12px;
  font-weight: 600;
}

.saved-dot {
  width: 7px;
  height: 7px;
  background: #53a684;
  border-radius: 50%;
}

.button {
  min-height: 38px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 160ms ease;
}

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

.button-primary {
  color: #fff;
  background: var(--button);
  box-shadow: 0 8px 18px rgba(217, 82, 29, 0.22);
}

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

.button-secondary {
  color: var(--button-dark);
  background: #fff;
  border: 1px solid rgba(243, 107, 42, 0.34);
}

.button-secondary:hover {
  border-color: var(--button);
  background: var(--button-soft);
}

.button-small {
  min-height: 36px;
  padding: 0 13px;
  font-size: 12px;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(540px, 1.02fr) minmax(470px, 0.98fr);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.editor-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.editor-header {
  min-height: 54px;
  padding: 14px 28px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.editor-header .eyebrow {
  margin-bottom: 4px;
}

.editor-header h2 {
  margin: 0;
  font: 700 18px/1.2 "Manrope", sans-serif;
  letter-spacing: -0.4px;
}

.tabs {
  height: 68px;
  padding: 0 32px;
  display: flex;
  align-items: flex-end;
  gap: 30px;
  border-bottom: 1px solid var(--line);
}

.tab {
  height: 68px;
  padding: 3px 0 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #7b8580;
  background: none;
  border: 0;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.tab::after {
  content: "";
  height: 2px;
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  background: transparent;
  border-radius: 2px 2px 0 0;
}

.tab.is-active {
  color: var(--ink);
}

.tab.is-active::after {
  background: var(--accent);
}

.count-badge {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 20px;
  font-size: 10px;
}

.is-hidden {
  display: none !important;
}

.tab-content {
  display: none;
  padding: 18px 28px 22px;
}

.tab-content.is-active {
  display: block;
  animation: panelIn 180ms ease;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.panel-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}

.panel-intro h2,
.preview-heading h2 {
  margin-bottom: 0;
  font: 700 17px/1.2 "Manrope", sans-serif;
  letter-spacing: -0.5px;
}

.panel-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.people-strip {
  margin-bottom: 14px;
  padding: 5px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  background: #f4f6f4;
  border-radius: 11px;
  max-height: 96px;
  overflow-y: auto;
}

.person-card {
  min-width: 0;
  min-height: 28px;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  color: #6b7570;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.person-card:hover {
  background: rgba(255, 255, 255, 0.6);
}

.person-card.is-active {
  color: var(--ink);
  background: #fff;
  border-color: #e5e9e7;
  box-shadow: 0 3px 8px rgba(28, 45, 38, 0.05);
}

.person-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-section-heading {
  margin-bottom: 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.form-section-heading h3 {
  margin: 0;
  font: 700 13px/1.3 "Manrope", sans-serif;
}

.form-section-heading span {
  color: #939b97;
  font-size: 10px;
}

.image-heading-actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.form-section-spaced {
  margin-top: 18px;
}

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

.form-grid-single {
  grid-template-columns: 1fr;
}

.field {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: #59635f;
  font-size: 11px;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #dce2df;
  border-radius: 9px;
  font-size: 12px;
  outline: none;
  transition: 150ms ease;
}

.field input:hover,
.field select:hover {
  border-color: #cbd4cf;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 117, 139, 0.12);
}

.color-input-wrap {
  display: grid;
  grid-template-columns: 43px 1fr;
  gap: 8px;
}

.color-input-wrap input[type="color"] {
  padding: 5px;
  cursor: pointer;
}

.photo-control {
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 15px;
  background: #fafbfa;
  border: 1px dashed #d8dfdb;
  border-radius: 12px;
}

.image-slot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.image-slot {
  min-width: 0;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  background: #fafbfa;
  border: 1px solid #e3e8e5;
  border-radius: 10px;
}

.image-slot-preview {
  width: 44px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background: var(--slot-color, #26634f);
  border-radius: 8px;
  text-align: center;
  font: 800 8px/1.1 "Manrope", sans-serif;
  text-transform: uppercase;
}

.image-slot-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.event-slot-main {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.image-slot .photo-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.image-slot .field {
  gap: 5px;
}

.image-slot .field input,
.image-slot .field select {
  height: 32px;
}

.photo-preview {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--green);
  border-radius: 50%;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.photo-copy > strong {
  font-size: 11px;
}

.photo-copy > span {
  color: #8a938f;
  font-size: 9px;
}

.photo-actions {
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.upload-button input {
  width: 1px;
  height: 1px;
  position: absolute;
  opacity: 0;
}

.text-button {
  padding: 4px 0;
  color: var(--button-dark);
  background: transparent;
  border: 0;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.logo-preview {
  min-width: 145px;
  height: 58px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  overflow: hidden;
  font: 700 13px "Manrope", sans-serif;
}

.logo-preview strong {
  font: 900 12px/1 "Manrope", sans-serif;
  letter-spacing: -0.5px;
}

.logo-preview > img {
  max-width: 115px;
  max-height: 42px;
  object-fit: contain;
}

.preview-panel {
  min-width: 0;
  padding: 20px 26px 20px;
  display: flex;
  flex-direction: column;
  background: #f8f9f8;
}

.preview-heading {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preview-heading .eyebrow {
  margin-bottom: 4px;
}

.view-toggle {
  padding: 3px;
  display: flex;
  gap: 2px;
  background: #eaeeeb;
  border-radius: 9px;
}

.view-toggle button {
  width: 32px;
  height: 29px;
  display: grid;
  place-items: center;
  color: #87908c;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.view-toggle button.is-active {
  color: #44504b;
  background: #fff;
  box-shadow: 0 2px 5px rgba(27, 43, 36, 0.08);
}

.view-toggle svg {
  width: 15px;
  height: 15px;
}

.email-stage {
  min-height: 350px;
  margin: 14px 0;
  padding: clamp(16px, 3vw, 28px);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.75), transparent 34%),
    #e9eeeb;
  border-radius: 15px;
  transition: 180ms ease;
}

.email-stage.is-dark {
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.07), transparent 34%),
    #2c3531;
}

.email-card {
  width: 100%;
  max-width: 520px;
  min-height: 245px;
  background: #fff;
  border: 1px solid rgba(33, 48, 42, 0.08);
  border-radius: 10px;
  box-shadow: 0 22px 40px rgba(31, 45, 39, 0.14);
  overflow: hidden;
}

.email-chrome {
  height: 34px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: #fafbfa;
  border-bottom: 1px solid #eef0ef;
}

.email-chrome span {
  width: 6px;
  height: 6px;
  background: #d6dcd9;
  border-radius: 50%;
}

.email-body {
  padding: 24px 28px;
  overflow-x: auto;
}

.email-body > p {
  margin: 0 0 16px;
  color: #6b726f;
  font-family: Arial, sans-serif;
  font-size: 12px;
}

#signaturePreview {
  zoom: 0.9;
}

.preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.preview-footer > div:first-child {
  display: grid;
  gap: 2px;
}

.preview-footer strong {
  font-size: 11px;
}

.preview-footer span {
  color: #818a86;
  font-size: 9px;
}

.preview-actions {
  gap: 8px;
}

.preview-actions .button {
  min-height: 40px;
}

.toast {
  min-width: 190px;
  padding: 13px 18px;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  background: #1e2b26;
  border-radius: 11px;
  box-shadow: 0 14px 28px rgba(20, 32, 27, 0.22);
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast svg {
  width: 17px;
  color: #7ee0b8;
}

.icon-button,
.button,
.workspace,
.tab::after,
.count-badge,
.people-strip,
.person-card,
.field input,
.field select,
.photo-control,
.image-slot,
.image-slot-preview,
.photo-preview,
.logo-preview,
.view-toggle,
.view-toggle button,
.email-stage,
.email-card,
.toast {
  border-radius: 0;
}

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

  .editor-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .preview-panel {
    min-height: 660px;
  }
}

@media (min-width: 1121px) and (max-height: 820px) {
  .main-content {
    padding-top: 18px;
    padding-bottom: 22px;
  }

  .page-heading {
    margin-bottom: 14px;
  }

  .page-heading > div > p:last-child,
  .preview-footer > div:first-child span {
    display: none;
  }

  .email-stage {
    min-height: 310px;
  }

  .people-strip {
    max-height: 84px;
  }

  .form-section-spaced {
    margin-top: 14px;
  }
}

@media (max-width: 700px) {
  .main-content {
    padding: 30px 14px 36px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .heading-actions .saved-state {
    display: none;
  }

  .heading-actions .button {
    width: 42px;
    padding: 0;
    font-size: 0;
  }

  .workspace {
    border-radius: 14px;
  }

  .tabs,
  .editor-header {
    padding: 0 20px;
    gap: 24px;
  }

  .editor-header {
    min-height: 76px;
    padding-top: 18px;
    padding-bottom: 16px;
  }

  .tab-content,
  .preview-panel {
    padding-right: 20px;
    padding-left: 20px;
  }

  .panel-intro {
    align-items: center;
  }

  .people-strip {
    grid-template-columns: 1fr;
  }

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

  .image-slot-grid {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    min-height: 600px;
  }

  .email-stage {
    min-height: 400px;
    padding: 16px;
  }

  .email-body {
    padding: 28px 20px;
    overflow-x: auto;
  }

  .preview-footer {
    align-items: flex-end;
  }

  .preview-footer > div:first-child span {
    display: none;
  }
}

@media (max-width: 440px) {
  .page-heading > div > p:last-child,
  .preview-footer > div:first-child {
    display: none;
  }

  h1 {
    font-size: 29px;
  }

  .panel-intro .button {
    width: 36px;
    padding: 0;
    font-size: 0;
  }

  .email-body {
    padding-right: 14px;
    padding-left: 14px;
    overflow: hidden;
  }

  #signaturePreview {
    width: 250%;
    margin-bottom: -34px;
    zoom: 1;
    transform: scale(0.4);
    transform-origin: top left;
  }

  .preview-footer {
    justify-content: flex-end;
  }
}

.icon-button,
.button,
.workspace,
.tab::after,
.count-badge,
.people-strip,
.person-card,
.field input,
.field select,
.photo-control,
.image-slot,
.image-slot-preview,
.photo-preview,
.logo-preview,
.view-toggle,
.view-toggle button,
.email-stage,
.email-card,
.toast,
.saved-dot,
.email-chrome span {
  border-radius: 0;
}
