/* LayoutLetter - Poppins + soft neumorphism
   Palette: #DB1A1A, #FFF6F6, #8CC7C4, #2C687B
*/

:root {
  --red: #DB1A1A;
  --red-dark: #B91414;
  --blush: #FFF6F6;
  --blush-strong: #FBECEC;
  --teal: #8CC7C4;
  --teal-dark: #2C687B;
  --teal-deep: #1F5261;
  --ink: #193845;
  --muted: #6D8189;
  --white: #FFFFFF;
  --surface: #FFF7F7;
  --surface-2: #F7EEEE;
  --line: rgba(44, 104, 123, 0.12);
  --shadow-dark: rgba(123, 75, 75, 0.16);
  --shadow-light: rgba(255, 255, 255, 0.98);
  --raised: 10px 10px 24px var(--shadow-dark), -10px -10px 24px var(--shadow-light);
  --raised-sm: 5px 5px 13px rgba(123, 75, 75, 0.13), -5px -5px 13px rgba(255, 255, 255, 0.96);
  --pressed: inset 5px 5px 12px rgba(123, 75, 75, 0.13), inset -5px -5px 12px rgba(255, 255, 255, 0.98);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --sidebar: 252px;
  --transition: 180ms ease;
}

/* Enhanced builder controls */
.builder-shell {
  grid-template-columns: 250px minmax(420px, 1fr) 285px;
}

.block-library {
  gap: 9px;
}

.block-tool {
  min-height: 68px;
  gap: 2px;
  padding: 8px 6px;
}

.block-tool span:first-child {
  line-height: 1;
}

.block-tool small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.45px;
  text-transform: uppercase;
}

.builder-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.compact-select {
  width: 100%;
  min-height: 38px;
  margin-bottom: 9px;
  padding: 8px 10px;
  border: 0;
  outline: none;
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--pressed);
  color: var(--ink);
  font-size: 10px;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  margin-top: 2px;
}

.palette-grid button {
  min-width: 0;
  outline: 1px solid rgba(25, 56, 69, 0.08);
}

.custom-color-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  margin-top: 10px;
}

.custom-color-row input[type="color"] {
  width: 42px;
  height: 34px;
  padding: 3px;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--raised-sm);
}

.paste-newsletter-zone {
  display: grid;
  min-height: 86px;
  place-items: center;
  padding: 14px;
  border: 1.5px dashed rgba(44, 104, 123, 0.34);
  outline: none;
  border-radius: 14px;
  background: rgba(140, 199, 196, 0.08);
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.paste-newsletter-zone:focus {
  border-color: var(--teal-dark);
  background: rgba(140, 199, 196, 0.15);
  box-shadow: 0 0 0 3px rgba(140, 199, 196, 0.14);
}

.builder-toolbar,
.builder-toolbar .toolbar-group {
  flex-wrap: wrap;
}

.builder-toolbar .soft-button.compact {
  white-space: nowrap;
}

.email-canvas:focus-visible {
  outline: 3px solid rgba(44, 104, 123, 0.32);
  outline-offset: 4px;
}

.rich-email-content p:first-child,
.rich-email-content h1:first-child,
.rich-email-content h2:first-child,
.rich-email-content h3:first-child {
  margin-top: 0;
}

.rich-email-content p:last-child,
.rich-email-content ul:last-child,
.rich-email-content ol:last-child,
.rich-email-content table:last-child {
  margin-bottom: 0;
}

.rich-email-content a {
  color: #2c687b;
}

.rich-email-content table {
  max-width: 100%;
}

.property-help {
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(140, 199, 196, 0.12);
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.file-property-control input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.file-property-button {
  display: grid;
  min-height: 42px;
  place-items: center;
  padding: 9px 12px;
  border: 1px dashed rgba(44, 104, 123, 0.32);
  border-radius: 12px;
  background: rgba(140, 199, 196, 0.09);
  color: var(--teal-dark);
  cursor: pointer;
}

.social-link-editor {
  display: grid;
  gap: 9px;
}

.social-link-row {
  display: grid;
  grid-template-columns: 45px 1fr;
  gap: 7px;
  padding: 9px;
  border-radius: 12px;
  background: rgba(140, 199, 196, 0.07);
}

.social-link-row input:nth-of-type(3) {
  grid-column: 1 / -1;
}

.social-link-row .danger-button {
  grid-column: 1 / -1;
  justify-self: end;
}

.template-count {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 99px;
  background: rgba(140, 199, 196, 0.16);
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 800;
}

.template-preview {
  position: relative;
  height: 330px;
  min-height: 330px;
  overflow: hidden;
  padding: 0;
}

.template-live-preview {
  position: absolute;
  top: 20px;
  left: 50%;
  width: 640px;
  min-height: 760px;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 55px rgba(72, 53, 53, 0.18);
  transform: translateX(-50%) scale(0.38);
  transform-origin: top center;
  pointer-events: none;
}

.custom-template-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  padding: 6px 9px;
  border-radius: 99px;
  background: var(--red);
  color: #ffffff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.template-card__body {
  align-items: flex-start;
  flex-direction: column;
}

.template-card__actions {
  display: flex;
  width: 100%;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.template-card__actions .primary-button {
  margin-left: auto;
}

@media (max-width: 1250px) {
  .builder-shell {
    grid-template-columns: 220px minmax(380px, 1fr);
  }
}

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

  .palette-grid {
    grid-template-columns: repeat(8, 1fr);
  }
}

@media (max-width: 620px) {
  .palette-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .template-live-preview {
    transform: translateX(-50%) scale(0.43);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--blush);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(140, 199, 196, 0.14), transparent 28%),
    radial-gradient(circle at 93% 90%, rgba(219, 26, 26, 0.06), transparent 25%),
    var(--blush);
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

button {
  color: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

svg {
  display: block;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  padding: 26px 18px 20px;
  background: rgba(255, 246, 246, 0.9);
  border-right: 1px solid rgba(44, 104, 123, 0.06);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 10px 30px;
  color: var(--teal-dark);
  font-size: 20px;
  letter-spacing: -0.6px;
  text-decoration: none;
}

.brand img {
  width: 38px;
  height: 38px;
  filter: drop-shadow(3px 4px 7px rgba(44, 104, 123, 0.16));
}

.brand strong {
  color: var(--red);
  font-weight: 800;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  text-align: left;
  transition: transform var(--transition), color var(--transition), box-shadow var(--transition), background var(--transition);
}

.nav-item:hover {
  color: var(--teal-dark);
  transform: translateX(3px);
}

.nav-item.active {
  color: var(--teal-dark);
  background: var(--surface);
  box-shadow: var(--raised-sm);
}

.nav-item.active::after {
  position: absolute;
  right: -18px;
  width: 4px;
  height: 24px;
  border-radius: 99px;
  background: var(--red);
  content: "";
}

.nav-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 10px;
  background: rgba(140, 199, 196, 0.13);
}

.nav-icon svg {
  width: 17px;
  fill: currentColor;
}

.nav-item.active .nav-icon {
  color: white;
  background: var(--teal-dark);
  box-shadow: 3px 4px 9px rgba(44, 104, 123, 0.24);
}

.sidebar-card {
  margin-top: auto;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--raised-sm);
}

.sidebar-card__eyebrow,
.eyebrow {
  color: var(--red);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.sidebar-card strong {
  display: block;
  margin-top: 6px;
  color: var(--teal-dark);
  font-size: 14px;
}

.sidebar-card p {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 11px;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.sidebar-footer {
  display: grid;
  grid-template-columns: 36px 1fr 32px;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 8px 4px 0;
}

.sidebar-footer .avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: var(--teal-deep);
  box-shadow: var(--raised-sm);
  font-size: 11px;
  font-weight: 800;
}

.sidebar-footer strong,
.sidebar-footer span {
  display: block;
}

.sidebar-footer strong {
  color: var(--teal-dark);
  font-size: 11px;
}

.sidebar-footer span {
  color: var(--muted);
  font-size: 9px;
}

.main-column {
  min-height: 100vh;
  margin-left: var(--sidebar);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(20px, 4vw, 48px);
  background: rgba(255, 246, 246, 0.78);
  border-bottom: 1px solid rgba(44, 104, 123, 0.06);
  backdrop-filter: blur(18px);
}

.topbar-title h1 {
  margin: 2px 0 0;
  color: var(--teal-dark);
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.15;
  letter-spacing: -1px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button,
.soft-button,
.primary-button,
.danger-button,
.segment,
.control-button {
  border: 0;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--raised-sm);
  color: var(--teal-dark);
}

.icon-button svg {
  width: 19px;
  fill: currentColor;
}

.icon-button:hover,
.soft-button:hover,
.control-button:hover {
  transform: translateY(-2px);
}

.icon-button:active,
.soft-button:active,
.control-button:active {
  box-shadow: var(--pressed);
  transform: translateY(0);
}

.icon-button.small {
  width: 28px;
  height: 28px;
  background: transparent;
  box-shadow: none;
  font-size: 11px;
}

.mobile-menu {
  display: none;
}

.primary-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 14px;
  background: var(--red);
  box-shadow: 6px 7px 14px rgba(219, 26, 26, 0.19), -5px -5px 12px rgba(255, 255, 255, 0.94);
  color: white;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--red-dark);
  transform: translateY(-2px);
}

.primary-button:active {
  box-shadow: inset 4px 4px 9px rgba(112, 0, 0, 0.23), inset -3px -3px 8px rgba(255, 122, 122, 0.25);
  transform: translateY(0);
}

.primary-button .plus {
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}

.soft-button,
.control-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--raised-sm);
  color: var(--teal-dark);
  font-weight: 700;
}

.soft-button.compact {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
}

.danger-button {
  padding: 9px 14px;
  border-radius: 12px;
  background: rgba(219, 26, 26, 0.08);
  color: var(--red);
  font-weight: 700;
}

.view-host {
  width: min(1600px, 100%);
  min-height: calc(100vh - 88px);
  margin: 0 auto;
  padding: clamp(22px, 3.2vw, 42px) clamp(20px, 4vw, 48px) 50px;
}

.page-enter {
  animation: pageIn 280ms ease both;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  min-height: 260px;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 80% 20%, rgba(140, 199, 196, 0.25), transparent 26%),
    linear-gradient(140deg, #fffafa 0%, #fff4f4 58%, #f5ebeb 100%);
  box-shadow: var(--raised);
}

.hero-card::before,
.hero-card::after {
  position: absolute;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.hero-card::before {
  top: -74px;
  right: 17%;
  width: 180px;
  height: 180px;
  border: 35px solid rgba(140, 199, 196, 0.12);
}

.hero-card::after {
  right: -40px;
  bottom: -80px;
  width: 210px;
  height: 210px;
  background: rgba(219, 26, 26, 0.045);
}

.hero-copy {
  position: relative;
  z-index: 2;
  padding: clamp(30px, 5vw, 62px);
}

.hero-copy h2 {
  max-width: 700px;
  margin: 10px 0 12px;
  color: var(--teal-dark);
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.04;
  letter-spacing: -2.2px;
}

.hero-copy h2 span {
  color: var(--red);
}

.hero-copy p {
  max-width: 620px;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-visual {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 260px;
  place-items: center;
  padding: 30px;
}

.newsletter-mini {
  position: relative;
  width: min(260px, 82%);
  padding: 18px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 16px 18px 35px rgba(77, 60, 60, 0.16), -12px -12px 25px rgba(255, 255, 255, 0.9);
  transform: rotate(4deg);
}

.newsletter-mini::before {
  position: absolute;
  top: -12px;
  left: -12px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 8px 9px 16px rgba(219, 26, 26, 0.2);
  content: "✦";
  color: white;
  display: grid;
  place-items: center;
}

.mini-logo,
.mini-line,
.mini-button,
.mini-image {
  border-radius: 99px;
}

.mini-logo {
  width: 70px;
  height: 10px;
  background: var(--teal-dark);
}

.mini-image {
  height: 92px;
  margin: 14px 0;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--teal), var(--teal-dark));
}

.mini-line {
  width: 100%;
  height: 8px;
  margin-top: 9px;
  background: #eee1e1;
}

.mini-line.short {
  width: 65%;
}

.mini-button {
  width: 92px;
  height: 28px;
  margin-top: 15px;
  background: var(--red);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.stat-card,
.panel {
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--raised-sm);
}

.stat-card {
  display: flex;
  min-height: 128px;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.stat-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border-radius: 15px;
  background: rgba(140, 199, 196, 0.18);
  color: var(--teal-dark);
  box-shadow: var(--pressed);
  font-size: 20px;
}

.stat-copy span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.stat-copy strong {
  display: block;
  margin-top: 3px;
  color: var(--teal-dark);
  font-size: 25px;
  letter-spacing: -1px;
}

.stat-trend {
  margin-top: 3px;
  color: #4E9F78;
  font-size: 10px;
  font-weight: 700;
}

.stat-trend.neutral {
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  gap: 22px;
  margin-top: 24px;
}

.panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  color: var(--teal-dark);
  font-size: 17px;
  letter-spacing: -0.4px;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.data-table th,
.data-table td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.data-table td {
  color: var(--ink);
  font-size: 12px;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: rgba(140, 199, 196, 0.055);
}

.status-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 9px;
  border-radius: 99px;
  background: rgba(140, 199, 196, 0.16);
  color: var(--teal-dark);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.status-pill.draft {
  background: rgba(219, 26, 26, 0.07);
  color: var(--red);
}

.status-pill.scheduled {
  background: rgba(140, 199, 196, 0.2);
  color: var(--teal-deep);
}

.quick-list {
  display: grid;
  gap: 13px;
}

.quick-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--pressed);
}

.quick-number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: rgba(140, 199, 196, 0.14);
  color: var(--teal-dark);
  font-weight: 800;
}

.quick-item strong,
.quick-item span {
  display: block;
}

.quick-item strong {
  color: var(--teal-dark);
  font-size: 12px;
}

.quick-item span {
  color: var(--muted);
  font-size: 10px;
}

.quick-item button {
  border: 0;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-weight: 800;
}

/* Builder */
.builder-shell {
  display: grid;
  grid-template-columns: 220px minmax(390px, 1fr) 255px;
  gap: 20px;
  min-height: calc(100vh - 166px);
}

.builder-panel,
.canvas-shell {
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--raised-sm);
}

.builder-panel {
  min-width: 0;
  padding: 18px;
}

.builder-panel h3 {
  margin: 0;
  color: var(--teal-dark);
  font-size: 14px;
}

.builder-panel .panel-note {
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 10px;
}

.block-library {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.block-tool {
  display: grid;
  min-height: 78px;
  place-items: center;
  gap: 6px;
  padding: 10px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--raised-sm);
  color: var(--teal-dark);
  cursor: grab;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  transition: transform var(--transition), box-shadow var(--transition);
}

.block-tool:hover {
  transform: translateY(-3px);
}

.block-tool:active {
  cursor: grabbing;
  box-shadow: var(--pressed);
}

.block-tool span:first-child {
  font-size: 20px;
}

.canvas-shell {
  min-width: 0;
  overflow: hidden;
}

.builder-toolbar {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: var(--pressed);
}

.segment {
  min-height: 32px;
  padding: 6px 11px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.segment.active {
  background: var(--surface);
  box-shadow: var(--raised-sm);
  color: var(--teal-dark);
}

.canvas-stage {
  display: flex;
  min-height: calc(100vh - 228px);
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 32px 20px 54px;
  background:
    linear-gradient(rgba(44, 104, 123, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(44, 104, 123, 0.035) 1px, transparent 1px),
    #f8efef;
  background-size: 24px 24px;
}

.email-canvas {
  width: min(640px, 100%);
  min-height: 740px;
  overflow: hidden;
  border-radius: 6px;
  background: white;
  box-shadow: 0 18px 45px rgba(85, 57, 57, 0.16);
  transition: width 220ms ease;
}

.email-canvas.mobile {
  width: 375px;
}

.canvas-empty {
  display: grid;
  min-height: 700px;
  place-items: center;
  padding: 30px;
  text-align: center;
}

.canvas-empty__inner {
  max-width: 280px;
  color: var(--muted);
}

.canvas-empty__inner strong {
  display: block;
  margin-bottom: 7px;
  color: var(--teal-dark);
  font-size: 15px;
}

.email-block {
  position: relative;
  outline: 2px solid transparent;
  cursor: pointer;
  transition: outline-color var(--transition), filter var(--transition);
}

.email-block:hover {
  outline-color: rgba(140, 199, 196, 0.6);
}

.email-block.selected {
  z-index: 2;
  outline-color: var(--teal-dark);
}

.email-block.selected::before {
  position: absolute;
  top: -11px;
  left: 10px;
  z-index: 5;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--teal-dark);
  content: attr(data-block-label);
  color: white;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.block-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  display: none;
  gap: 5px;
}

.email-block.selected .block-actions {
  display: flex;
}

.block-action {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--teal-dark);
  color: white;
  cursor: pointer;
  font-size: 11px;
}

.block-action.delete {
  background: var(--red);
}

.email-content {
  pointer-events: none;
}

.drop-indicator {
  height: 5px;
  background: var(--red);
}

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

.properties-form label,
.send-form label,
.audience-form label {
  display: grid;
  gap: 7px;
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 700;
}

.properties-form input,
.properties-form textarea,
.properties-form select,
.send-form input,
.audience-form input,
.audience-form textarea,
.audience-form select,
.search-input {
  width: 100%;
  border: 1px solid transparent;
  outline: none;
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--pressed);
  color: var(--ink);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.properties-form input,
.properties-form select,
.send-form input,
.audience-form input,
.audience-form select,
.search-input {
  min-height: 42px;
  padding: 10px 12px;
}

.properties-form textarea,
.audience-form textarea {
  min-height: 100px;
  resize: vertical;
  padding: 12px;
}

.properties-form input:focus,
.properties-form textarea:focus,
.properties-form select:focus,
.send-form input:focus,
.audience-form input:focus,
.audience-form textarea:focus,
.search-input:focus {
  border-color: rgba(44, 104, 123, 0.25);
  box-shadow: inset 4px 4px 10px rgba(123, 75, 75, 0.1), inset -4px -4px 10px white, 0 0 0 3px rgba(140, 199, 196, 0.12);
}

.color-row {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 9px;
}

.color-row input[type="color"] {
  min-height: 42px;
  padding: 4px;
}

.property-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.builder-save-state {
  color: var(--muted);
  font-size: 10px;
}

/* Templates */
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 0;
  color: var(--teal-dark);
  font-size: clamp(25px, 3vw, 38px);
  letter-spacing: -1.3px;
}

.section-heading p {
  max-width: 650px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.template-card {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--raised-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.template-card:hover {
  transform: translateY(-6px);
  box-shadow: 10px 12px 26px rgba(123, 75, 75, 0.17), -9px -9px 22px rgba(255, 255, 255, 0.98);
}

.template-preview {
  min-height: 260px;
  padding: 24px;
  background: #f8eeee;
}

.template-paper {
  width: 100%;
  min-height: 212px;
  overflow: hidden;
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 28px rgba(72, 53, 53, 0.13);
}

.tp-hero {
  height: 95px;
  background: linear-gradient(135deg, var(--teal-dark), var(--teal));
}

.tp-hero.red {
  background: linear-gradient(135deg, var(--red), #ef6f6f);
}

.tp-hero.light {
  background: linear-gradient(135deg, #fff7f7, #eadede);
}

.tp-body {
  padding: 14px;
}

.tp-line {
  height: 7px;
  margin-bottom: 7px;
  border-radius: 99px;
  background: #eadede;
}

.tp-line.head {
  width: 70%;
  height: 11px;
  background: var(--teal-dark);
}

.tp-line.short {
  width: 62%;
}

.tp-button {
  width: 70px;
  height: 21px;
  margin-top: 12px;
  border-radius: 99px;
  background: var(--red);
}

.template-card__body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
}

.template-card h3 {
  margin: 0;
  color: var(--teal-dark);
  font-size: 14px;
}

.template-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

/* Audience */
.audience-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.4fr);
  gap: 22px;
}

.import-stack {
  display: grid;
  gap: 20px;
}

.import-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--raised-sm);
}

.import-card h3 {
  margin: 0;
  color: var(--teal-dark);
  font-size: 15px;
}

.import-card p {
  margin: 5px 0 16px;
  color: var(--muted);
  font-size: 10px;
}

.audience-form {
  display: grid;
  gap: 12px;
}

.drop-zone {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 24px;
  border: 2px dashed rgba(44, 104, 123, 0.18);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--pressed);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--teal-dark);
  background: #fffafa;
  transform: translateY(-2px);
}

.drop-zone input {
  display: none;
}

.drop-zone-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 17px;
  background: rgba(140, 199, 196, 0.18);
  color: var(--teal-dark);
  box-shadow: var(--raised-sm);
  font-size: 23px;
}

.drop-zone strong {
  color: var(--teal-dark);
}

.drop-zone span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.import-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
  margin-bottom: 16px;
}

.summary-chip {
  padding: 13px;
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--pressed);
}

.summary-chip span,
.summary-chip strong {
  display: block;
}

.summary-chip span {
  color: var(--muted);
  font-size: 9px;
}

.summary-chip strong {
  margin-top: 2px;
  color: var(--teal-dark);
  font-size: 18px;
}

.audience-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.audience-toolbar .search-input {
  max-width: 280px;
}

.email-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.contact-dot {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border-radius: 50%;
  background: rgba(140, 199, 196, 0.18);
  color: var(--teal-dark);
  font-size: 9px;
  font-weight: 800;
}

/* Campaigns */
.campaign-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.campaign-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--raised-sm);
}

.campaign-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.campaign-card h3 {
  margin: 8px 0 4px;
  color: var(--teal-dark);
  font-size: 16px;
}

.campaign-card p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

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

.campaign-stats div {
  padding: 10px;
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--pressed);
}

.campaign-stats span,
.campaign-stats strong {
  display: block;
}

.campaign-stats span {
  color: var(--muted);
  font-size: 8px;
}

.campaign-stats strong {
  color: var(--teal-dark);
  font-size: 15px;
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  padding: 30px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 18px;
  background: rgba(140, 199, 196, 0.15);
  color: var(--red);
  box-shadow: var(--raised-sm);
  font-size: 22px;
}

.empty-state h3 {
  margin: 0;
  color: var(--teal-dark);
}

.empty-state p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

/* Modals and notifications */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 49, 59, 0.44);
  backdrop-filter: blur(8px);
  transition: opacity var(--transition);
}

.modal-backdrop.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.modal {
  width: min(950px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: var(--radius-xl);
  background: var(--blush);
  box-shadow: 22px 24px 60px rgba(20, 49, 59, 0.25), -12px -12px 35px rgba(255, 255, 255, 0.32);
}

.send-modal {
  width: min(670px, 100%);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 3px 0 0;
  color: var(--teal-dark);
  font-size: 20px;
}

.preview-stage {
  display: grid;
  min-height: 600px;
  place-items: start center;
  overflow: auto;
  padding: 35px;
  background: #eee5e5;
}

.preview-frame {
  width: 640px;
  overflow: hidden;
  background: white;
  box-shadow: 0 18px 40px rgba(55, 40, 40, 0.2);
  transition: width 220ms ease;
}

.preview-frame.mobile {
  width: 375px;
}

.send-form {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.send-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.send-summary div {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--pressed);
}

.send-summary span,
.send-summary strong {
  display: block;
}

.send-summary span {
  color: var(--muted);
  font-size: 9px;
}

.send-summary strong {
  color: var(--teal-dark);
  font-size: 19px;
}

.consent-row {
  display: grid !important;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 10px !important;
  padding: 14px;
  border-radius: 15px;
  background: rgba(140, 199, 196, 0.1);
  color: var(--ink) !important;
  font-weight: 500 !important;
}

.consent-row input {
  width: 18px;
  height: 18px;
  min-height: auto;
  margin: 0;
  accent-color: var(--red);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.fine-print {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: grid;
  width: min(360px, calc(100vw - 40px));
  gap: 10px;
}

.toast {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 16px;
  background: var(--blush);
  box-shadow: 9px 10px 25px rgba(56, 42, 42, 0.2), -7px -7px 18px rgba(255, 255, 255, 0.93);
  animation: toastIn 220ms ease both;
}

.toast-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: rgba(140, 199, 196, 0.18);
  color: var(--teal-dark);
  font-weight: 800;
}

.toast.error .toast-icon {
  background: rgba(219, 26, 26, 0.1);
  color: var(--red);
}

.toast strong,
.toast span {
  display: block;
}

.toast strong {
  color: var(--teal-dark);
  font-size: 11px;
}

.toast span {
  color: var(--muted);
  font-size: 9px;
}

.toast button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Responsive */
@media (max-width: 1250px) {
  .builder-shell {
    grid-template-columns: 190px minmax(360px, 1fr);
  }

  .builder-panel.properties-panel {
    grid-column: 1 / -1;
  }

  .properties-panel .properties-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .properties-panel .property-empty {
    min-height: 100px;
  }
}

@media (max-width: 1080px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .dashboard-grid,
  .audience-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  :root {
    --sidebar: 270px;
  }

  .sidebar {
    transform: translateX(-110%);
    transition: transform 220ms ease;
    box-shadow: 18px 0 40px rgba(44, 104, 123, 0.18);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-column {
    margin-left: 0;
  }

  .mobile-menu {
    display: grid;
  }

  .topbar {
    min-height: 78px;
  }

  .view-host {
    min-height: calc(100vh - 78px);
  }

  .builder-shell {
    grid-template-columns: 1fr;
  }

  .builder-panel.elements-panel {
    order: 2;
  }

  .canvas-shell {
    order: 1;
  }

  .builder-panel.properties-panel {
    order: 3;
  }

  .block-library {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .canvas-stage {
    min-height: 650px;
  }

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

  .hero-card {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    min-height: 220px;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: center;
    padding: 14px 16px;
  }

  .topbar-title .eyebrow {
    display: none;
  }

  .topbar-title h1 {
    font-size: 20px;
  }

  .topbar-actions .icon-button {
    display: none;
  }

  .primary-button {
    min-height: 40px;
    padding: 9px 13px;
    font-size: 11px;
  }

  .hero-copy {
    padding: 30px 24px;
  }

  .hero-copy h2 {
    font-size: 34px;
    letter-spacing: -1.5px;
  }

  .stats-grid,
  .template-grid,
  .campaign-grid,
  .import-summary {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: 100px;
  }

  .section-heading,
  .audience-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .audience-toolbar .search-input {
    max-width: none;
  }

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

  .builder-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-group {
    justify-content: space-between;
  }

  .properties-panel .properties-form,
  .form-grid,
  .send-summary {
    grid-template-columns: 1fr;
  }

  .modal-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .preview-stage {
    padding: 18px 8px;
  }

  .preview-frame.desktop {
    width: 640px;
    transform-origin: top center;
  }
}

/* Final enhanced-builder sizing overrides */
.builder-shell {
  grid-template-columns: 250px minmax(420px, 1fr) 285px;
}

.block-library {
  gap: 9px;
}

.block-tool {
  min-height: 68px;
  gap: 2px;
  padding: 8px 6px;
}

.template-preview {
  position: relative;
  height: 330px;
  min-height: 330px;
  overflow: hidden;
  padding: 0;
}

.template-card__body {
  align-items: flex-start;
  flex-direction: column;
}

@media (max-width: 1250px) {
  .builder-shell {
    grid-template-columns: 220px minmax(380px, 1fr);
  }
}

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

.compact-modal {
  width: min(460px, calc(100% - 28px));
}
