body {
  background:
    radial-gradient(circle at 72% 4%, rgba(124,58,237,.12), transparent 30%),
    radial-gradient(circle at 10% 0%, rgba(37,99,235,.08), transparent 26%),
    #f7f9fd;
  color:#07152f;
}
.app-shell { display:flex; min-height:100vh; }
.sidebar {
  width:260px;
  background:linear-gradient(180deg,#07142b 0%,#10172a 58%,#0b1220 100%);
  color:#fff;
  padding:24px 16px;
  flex-shrink:0;
  position:sticky;
  top:0;
  height:100vh;
  box-shadow:18px 0 45px rgba(15,23,42,.12);
}
.brand {
  font-weight:900;
  font-size:21px;
  margin-bottom:24px;
  display:flex;
  align-items:center;
  gap:10px;
  letter-spacing:0;
}
.brand::before {
  content:"";
  width:34px;
  height:34px;
  border-radius:10px;
  background:conic-gradient(from 120deg,var(--brand-color, #2563eb),#e84da1,#ff7043,var(--brand-color, #2563eb));
  box-shadow:0 10px 25px rgba(124,58,237,.32);
}
.sidebar nav { display:flex; flex-direction:column; gap:4px; }
.sidebar a {
  display:flex;
  align-items:center;
  color:#d7e2f4;
  text-decoration:none;
  padding:12px 13px;
  border-radius:10px;
  margin-bottom:0;
  font-weight:700;
  font-size:15px;
  border:1px solid transparent;
}
.sidebar a:hover {
  background:rgba(255,255,255,.08);
  color:#fff;
  border-color:rgba(255,255,255,.08);
}
.sidebar a.active {
  background:linear-gradient(135deg,var(--brand-color, #2563eb),#7c3aed);
  color:#fff;
  box-shadow:0 14px 30px rgba(37,99,235,.28);
}
.app-main { flex:1; padding:28px; min-width:0; }
.topbar {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:24px;
  background:rgba(255,255,255,.78);
  border:1px solid rgba(226,232,240,.85);
  border-radius:18px;
  padding:20px 22px;
  box-shadow:0 16px 42px rgba(15,23,42,.06);
  backdrop-filter:blur(14px);
}
.topbar h1 { margin:0; font-size:30px; font-weight:900; letter-spacing:0; color:#07152f; }
.topbar .text-muted { color:#64748b !important; font-weight:600; }
.smart-setup-card {
  background:#fff;
  border:1px solid #dbe5f3;
  border-radius:14px;
  box-shadow:0 12px 32px rgba(15,23,42,.06);
  margin:-10px 0 18px;
  overflow:hidden;
}
.smart-setup-summary {
  align-items:center;
  background:linear-gradient(90deg,#fff,#f8fbff);
  border:0;
  color:#122039;
  display:grid;
  gap:12px;
  grid-template-columns:auto minmax(0,1fr) auto auto;
  padding:12px 14px;
  text-align:left;
  width:100%;
}
.smart-setup-icon {
  align-items:center;
  background:#eef4ff;
  border-radius:10px;
  color:var(--brand-color, #2563eb);
  display:flex;
  height:38px;
  justify-content:center;
  width:38px;
}
.smart-setup-copy strong,
.smart-setup-step strong {
  display:block;
  font-size:14px;
  font-weight:900;
}
.smart-setup-copy small,
.smart-setup-step small {
  color:#64748b;
  display:block;
  font-size:12px;
  font-weight:700;
}
.smart-setup-chevron {
  color:#64748b;
  transition:transform .18s ease;
}
.smart-setup-card.is-open .smart-setup-chevron {
  transform:rotate(180deg);
}
.smart-setup-panel {
  border-top:1px solid #edf2f7;
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
}
.smart-setup-step {
  align-items:flex-start;
  border-right:1px solid #edf2f7;
  color:#122039;
  display:flex;
  gap:9px;
  min-height:78px;
  padding:13px;
  text-decoration:none;
}
.smart-setup-step:last-child { border-right:0; }
.smart-setup-step:hover { background:#f8fbff; }
.smart-setup-step.is-done { background:#f3fbf6; }
.smart-setup-dot {
  align-items:center;
  background:#fff;
  border:1px solid #dbe5f3;
  border-radius:999px;
  color:#94a3b8;
  display:flex;
  flex:0 0 auto;
  height:24px;
  justify-content:center;
  margin-top:1px;
  width:24px;
}
.smart-setup-step.is-done .smart-setup-dot {
  background:#dcfce7;
  border-color:#bbf7d0;
  color:#15803d;
}
.card {
  border:1px solid rgba(226,232,240,.9);
  border-radius:18px;
  box-shadow:0 18px 45px rgba(15,23,42,.07);
  background:rgba(255,255,255,.9);
}
.card h2,.card h3 { color:#07152f; font-weight:900; }
.table { margin-bottom:0; }
.table td,.table th { vertical-align:middle; padding:16px 12px; }
.table th {
  color:#07152f;
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.04em;
  border-bottom:1px solid #e6eaf2;
}
.table td { border-color:#edf1f7; color:#0f172a; }
.table tbody tr:hover { background:#f8fbff; }
textarea.code-editor { font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; min-height:360px; }
.email-builder {
  border:1px solid #dfe6f1;
  border-radius:14px;
  background:#f8fbff;
  overflow:hidden;
}
.email-builder-toolbar {
  align-items:center;
  background:#fff;
  border-bottom:1px solid #e6eaf2;
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  justify-content:space-between;
  padding:12px;
}
.email-builder-formatbar {
  align-items:center;
  background:#f8fafc;
  border-bottom:1px solid #e6eaf2;
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  padding:8px 12px;
}
.email-builder-formatbar button,
.email-builder-formatbar select {
  align-items:center;
  background:#fff;
  border:1px solid #dfe6f1;
  border-radius:8px;
  color:#0f172a;
  display:inline-flex;
  font-size:13px;
  font-weight:900;
  height:34px;
  justify-content:center;
  min-width:36px;
  padding:0 10px;
}
.email-builder-formatbar button:hover {
  background:#eef6ff;
  border-color:#bfd7ff;
}
.email-builder-formatbar select {
  font-weight:700;
  min-width:130px;
}
.email-builder-layout {
  display:grid;
  grid-template-columns:200px minmax(360px, 1fr) 240px;
  min-height:520px;
}
.email-builder-panel {
  background:#fff;
  border-right:1px solid #e6eaf2;
  padding:14px;
}
.email-builder-panel:last-child {
  border-left:1px solid #e6eaf2;
  border-right:0;
}
.email-builder-panel-title {
  color:#64748b;
  font-size:12px;
  font-weight:900;
  letter-spacing:.04em;
  margin-bottom:10px;
  text-transform:uppercase;
}
.email-builder-blocks {
  display:grid;
  gap:8px;
}
.email-builder-block {
  align-items:center;
  background:#f8fafc;
  border:1px solid #e2e8f0;
  border-radius:9px;
  color:#0f172a;
  cursor:grab;
  display:flex;
  font-weight:800;
  gap:8px;
  padding:10px;
  text-align:left;
  width:100%;
}
.email-builder-block:hover {
  background:#eef6ff;
  border-color:#bfd7ff;
}
.email-builder-stage {
  background:#eef3f9;
  padding:18px;
  overflow:auto;
}
.email-builder-canvas {
  background:#fff;
  border:1px solid #dfe6f1;
  box-shadow:0 18px 45px rgba(15,23,42,.08);
  margin:0 auto;
  max-width:680px;
  min-width:340px;
  min-height:460px;
  padding:22px;
}
.email-builder-empty {
  align-items:center;
  border:2px dashed #cbd5e1;
  border-radius:12px;
  color:#64748b;
  display:flex;
  font-weight:800;
  justify-content:center;
  min-height:180px;
  text-align:center;
}
.email-builder-item {
  border:1px solid transparent;
  border-radius:10px;
  margin-bottom:10px;
  position:relative;
}
.email-builder-item:hover,
.email-builder-item.is-selected {
  border-color:var(--brand-color, #2563eb);
  box-shadow:0 0 0 3px rgba(37,99,235,.08);
}
.email-builder-itembar {
  align-items:center;
  background:var(--brand-color, #2563eb);
  border-radius:8px 8px 0 0;
  color:#fff;
  display:none;
  font-size:12px;
  font-weight:900;
  justify-content:space-between;
  padding:5px 8px;
}
.email-builder-item:hover .email-builder-itembar,
.email-builder-item.is-selected .email-builder-itembar {
  display:flex;
}
.email-builder-itembar button {
  background:rgba(255,255,255,.14);
  border:0;
  border-radius:6px;
  color:#fff;
  font-weight:900;
  height:24px;
  min-width:24px;
}
.email-builder-content {
  padding:8px;
}
.email-builder-content [contenteditable="true"] {
  outline:2px solid transparent;
  outline-offset:3px;
}
.email-builder-content [contenteditable="true"]:focus {
  outline-color:rgba(37,99,235,.25);
}
.email-builder-properties {
  display:grid;
  gap:12px;
}
.email-builder-properties .form-label {
  font-size:12px;
  font-weight:900;
  margin-bottom:5px;
}
.email-builder-preview {
  background:#fff;
  border:1px solid #dfe6f1;
  border-radius:12px;
  height:420px;
  width:100%;
}
.email-builder-source {
  min-height:240px;
}
.stat { font-size:34px; font-weight:900; color:#07152f; }
.btn {
  border-radius:9px;
  font-weight:800;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
}
.btn-primary {
  --bs-btn-bg:var(--brand-color, #2563eb);
  --bs-btn-border-color:var(--brand-color, #2563eb);
  --bs-btn-hover-bg:#1d4ed8;
  --bs-btn-hover-border-color:#1d4ed8;
  box-shadow:0 10px 22px rgba(37,99,235,.18);
}
.btn-success { box-shadow:0 10px 22px rgba(22,163,74,.14); }
.form-control,.form-select {
  border-color:#dfe6f1;
  border-radius:10px;
  padding:.62rem .78rem;
}
.form-control:focus,.form-select:focus {
  border-color:var(--brand-color, #2563eb);
  box-shadow:0 0 0 .22rem rgba(37,99,235,.12);
}
.badge {
  border-radius:999px;
  padding:.45em .68em;
  font-weight:900;
}
.alert {
  border-radius:12px;
  border-width:1px;
  box-shadow:0 10px 24px rgba(15,23,42,.04);
}
.progress-bar { background-color:var(--brand-color, #2563eb); }
.template-browser {
  align-items:start;
  display:grid;
  grid-template-columns:220px 220px minmax(260px, 1fr);
  gap:14px;
}
.template-new-button {
  min-height:50px;
  width:100%;
}
.template-jump-select {
  background-color:#fff;
  border:1px solid #dfe6f1;
  border-radius:10px;
  color:#0f172a;
  font-weight:800;
  min-height:50px;
  min-width:0;
  padding:.62rem 2.25rem .62rem .78rem;
}
.template-jump-menu {
  min-width:0;
  position:relative;
  width:100%;
  z-index:20;
}
.template-jump-menu summary {
  align-items:center;
  background:#fff;
  border:1px solid #dfe6f1;
  border-radius:10px;
  color:#0f172a;
  cursor:pointer;
  display:flex;
  font-weight:900;
  gap:10px;
  justify-content:space-between;
  line-height:1.2;
  list-style:none;
  min-height:50px;
  min-width:0;
  overflow:hidden;
  padding:.62rem .78rem;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.template-jump-menu summary::-webkit-details-marker {
  display:none;
}
.template-jump-menu summary::after {
  border-bottom:2px solid currentColor;
  border-right:2px solid currentColor;
  content:"";
  flex:0 0 8px;
  height:8px;
  margin-right:2px;
  transform:rotate(45deg);
  width:8px;
}
.template-jump-menu[open] summary {
  border-color:var(--brand-color, #2563eb);
  box-shadow:0 0 0 .22rem rgba(37,99,235,.12);
}
.template-jump-menu-list {
  background:#fff;
  border:1px solid #dfe6f1;
  border-radius:10px;
  box-shadow:0 18px 45px rgba(15,23,42,.16);
  left:0;
  margin-top:6px;
  max-height:240px;
  overflow:auto;
  padding:6px;
  position:absolute;
  right:0;
}
.template-jump-menu-list a,
.template-jump-empty {
  border-radius:8px;
  color:#0f172a;
  display:block;
  min-width:0;
  padding:8px 10px;
  text-decoration:none;
}
.template-jump-menu-list a:hover,
.template-jump-menu-list a.is-active {
  background:#eef6ff;
  color:var(--brand-color, #2563eb);
}
.template-jump-menu-list strong,
.template-jump-menu-list span {
  display:block;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
}
.template-jump-menu-list strong {
  font-size:13px;
  white-space:nowrap;
}
.template-jump-menu-list span {
  color:#64748b;
  font-size:12px;
  line-height:1.25;
  margin-top:2px;
  white-space:nowrap;
}
.template-jump-empty {
  color:#64748b;
  font-weight:800;
}
.template-list {
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(230px, 1fr));
  gap:10px;
  min-width:0;
}
.template-browser .template-list {
  display:none;
}
.template-list-item,
.template-list-empty {
  background:#fff;
  border:1px solid #dfe6f1;
  border-radius:9px;
  color:#0f172a;
  display:block;
  min-width:0;
  padding:12px 14px;
  text-decoration:none;
}
.template-list-item:hover {
  border-color:var(--brand-color, #2563eb);
  box-shadow:0 10px 24px rgba(37,99,235,.1);
}
.template-list-item.active {
  background:linear-gradient(135deg,var(--brand-color, #2563eb),#7c3aed);
  border-color:transparent;
  color:#fff;
}
.template-list-item strong,
.template-list-item small {
  display:block;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
}
.template-list-item strong {
  white-space:nowrap;
}
.template-list-item small {
  color:#64748b;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  line-height:1.45;
  margin-top:3px;
  white-space:normal;
}
.template-list-item.active small {
  color:rgba(255,255,255,.82);
}
.template-list-empty {
  align-items:center;
  color:#64748b;
  display:flex;
  font-weight:800;
}
@media (max-width: 1400px) {
  .email-builder-layout {
    grid-template-columns:190px minmax(380px, 1fr);
  }
  .email-builder-panel:last-child {
    border-left:0;
    border-right:0;
    border-top:1px solid #e6eaf2;
    grid-column:1 / -1;
  }
  .email-builder-properties {
    grid-template-columns:repeat(3, minmax(160px, 1fr));
  }
}
@media (max-width: 1100px) {
  .smart-setup-panel {
    grid-template-columns:1fr 1fr;
  }
}
@media (max-width: 900px) {
  .email-builder-layout { grid-template-columns:1fr; }
  .email-builder-panel,
  .email-builder-panel:last-child {
    border:0;
    border-bottom:1px solid #e6eaf2;
    grid-column:auto;
  }
  .email-builder-properties {
    grid-template-columns:1fr;
  }
  .email-builder-canvas {
    min-width:0;
  }
}
@media (max-width: 800px) {
  .app-shell { display:block; }
  .sidebar { width:100%; height:auto; position:relative; }
  .sidebar nav { display:grid; grid-template-columns:repeat(2,1fr); }
  .app-main { padding:16px; }
  .topbar { display:block; padding:16px; }
  .topbar h1 { font-size:24px; }
  .smart-setup-summary {
    grid-template-columns:auto minmax(0,1fr) auto;
  }
  .smart-setup-summary .btn {
    grid-column:2 / 4;
    justify-content:center;
  }
  .smart-setup-panel {
    grid-template-columns:1fr;
  }
  .smart-setup-step {
    border-bottom:1px solid #edf2f7;
    border-right:0;
  }
  .template-browser {
    grid-template-columns:1fr;
  }
  .template-new-button {
    margin-bottom:10px;
    min-height:auto;
    width:100%;
  }
  .template-list-item,
  .template-list-empty {
    width:100%;
  }
}
